diff --git a/application/ConstructionConsentOwner/ConstructionConsentOwner.php b/application/ConstructionConsentOwner/ConstructionConsentOwner.php index ba47ba443..fe99d8e35 100644 --- a/application/ConstructionConsentOwner/ConstructionConsentOwner.php +++ b/application/ConstructionConsentOwner/ConstructionConsentOwner.php @@ -43,7 +43,7 @@ class ConstructionConsentOwner extends mfBaseModel { foreach($changed as $field) { $this->log->debug(__METHOD__ . ": $field changed from '" . $this->_old_data->$field . "' to '" . $this->data->$field . "'"); $history = ConstructionConsentHistory::create([ - "constructionconsent_id" => $this->id, + "constructionconsent_id" => $this->constructionconsent_id, "key" => "owner-".$this->id."-$field", "old_value" => $this->_old_data->$field, "new_value" => $this->data->$field diff --git a/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php b/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php index e8a59c51c..c6401b6dd 100644 --- a/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php +++ b/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php @@ -122,11 +122,13 @@ class ConstructionConsentOwnerController extends mfBaseController if(!$item->save()) { $this->layout()->setFlash("Beim Speichern ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.", "error"); } else { - $journal = ConstructionConsentJournal::create([ - "constructionconsent_id" => $cc->id, - "text" => "Eigentümer " . ($item->company ? $item->company : $item->firstname . " " . $item->lastname) . " wurde hinzugefügt" - ]); - $journal->save(); + if($mode == "add") { + $journal = ConstructionConsentJournal::create([ + "constructionconsent_id" => $cc->id, + "text" => "Eigentümer " . ($item->company ? $item->company : $item->firstname . " " . $item->lastname) . " wurde hinzugefügt" + ]); + $journal->save(); + } $this->layout()->setFlash("Besitzer wurde erfolgreich gespeichert.", "success"); }