Merge branch 'fronkdev' into 'master'

Fixed saving ConstructionConsentOwner in History

See merge request fronk/thetool!1835
This commit is contained in:
Frank Schubert
2025-10-10 12:38:17 +00:00
2 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -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");
}