AddressDB Status change UI

This commit is contained in:
Frank Schubert
2024-12-06 13:35:55 +01:00
parent 40e9aaf505
commit 3a7b356b30
7 changed files with 593 additions and 10 deletions
@@ -35,6 +35,8 @@ class ADBHausnummer extends mfBaseModel {
$this->getGpsCoords();
}
$this->logChanges();
// Statuschange from Rimo statuschange for all units
foreach(ADBWohneinheitModel::search(["hausnummer_id" => $this->id]) as $wohneinheit) {
@@ -42,6 +44,34 @@ class ADBHausnummer extends mfBaseModel {
}
}
public function resetSaveNesting() {
mfValuecache::singleton()->delete("adbhausnummer-save-nesting-level-" . $this->id);
}
private function logChanges() {
$changes = $this->getChangedFields();
if(!count($changes)) return true;
$logstr = "";
foreach($changes as $key) {
if($key == "status_id") {
$old_status = new ADBStatus($this->_old_data->status_id);
$new_status = new ADBStatus($this->data->status_id);
$logstr .= "| '$key' => FROM '".$this->_old_data->$key."' TO '".$this->data->$key."' [".$old_status->code." => ".$new_status->code."]";
} else {
$logstr .= "| '$key' => FROM '".$this->_old_data->$key."' TO '".$this->data->$key."'";
}
}
$me = new User();
$me->loadMe();
$this->log->info(__CLASS__." Changes: User ".$me->username." $logstr");
return true;
}
public function getBuildingType() {