Fixed saving ConstructionConsentOwner in History

This commit is contained in:
Frank Schubert
2025-10-10 14:37:51 +02:00
parent ae0c4c16b8
commit 6cd61a2750
2 changed files with 8 additions and 6 deletions

View File

@@ -43,7 +43,7 @@ class ConstructionConsentOwner extends mfBaseModel {
foreach($changed as $field) { foreach($changed as $field) {
$this->log->debug(__METHOD__ . ": $field changed from '" . $this->_old_data->$field . "' to '" . $this->data->$field . "'"); $this->log->debug(__METHOD__ . ": $field changed from '" . $this->_old_data->$field . "' to '" . $this->data->$field . "'");
$history = ConstructionConsentHistory::create([ $history = ConstructionConsentHistory::create([
"constructionconsent_id" => $this->id, "constructionconsent_id" => $this->constructionconsent_id,
"key" => "owner-".$this->id."-$field", "key" => "owner-".$this->id."-$field",
"old_value" => $this->_old_data->$field, "old_value" => $this->_old_data->$field,
"new_value" => $this->data->$field "new_value" => $this->data->$field

View File

@@ -122,11 +122,13 @@ class ConstructionConsentOwnerController extends mfBaseController
if(!$item->save()) { if(!$item->save()) {
$this->layout()->setFlash("Beim Speichern ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.", "error"); $this->layout()->setFlash("Beim Speichern ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.", "error");
} else { } else {
if($mode == "add") {
$journal = ConstructionConsentJournal::create([ $journal = ConstructionConsentJournal::create([
"constructionconsent_id" => $cc->id, "constructionconsent_id" => $cc->id,
"text" => "Eigentümer " . ($item->company ? $item->company : $item->firstname . " " . $item->lastname) . " wurde hinzugefügt" "text" => "Eigentümer " . ($item->company ? $item->company : $item->firstname . " " . $item->lastname) . " wurde hinzugefügt"
]); ]);
$journal->save(); $journal->save();
}
$this->layout()->setFlash("Besitzer wurde erfolgreich gespeichert.", "success"); $this->layout()->setFlash("Besitzer wurde erfolgreich gespeichert.", "success");
} }