WIP 2025-01-09 ConstructionConsent

This commit is contained in:
Frank Schubert
2025-01-10 12:35:25 +01:00
parent aa0b36715b
commit 5f752da41f
8 changed files with 403 additions and 21 deletions
@@ -1,14 +1,25 @@
<?php
class ConstructionConsent extends mfBaseModel {
private $project;
private $termnination;
private $adb_hausnummer;
private $adb_strasse;
private $owners;
private $creator;
private $editor;
public function getProperty($name) {
if($this->$name == null) {
if($name == "project") {
$project = new ConstructionConsentProject($this->id);
if($project->id) {
$this->project = $project;
}
return $this->project;
}
if($name == "adb_hausnummer") {
if(!$this->adb_hausnummer_id) return null;
$hausnummer = new ADBHausnummer($this->adb_hausnummer_id);
@@ -27,6 +38,38 @@ class ConstructionConsent extends mfBaseModel {
return $this->adb_strasse;
}
if($name == "owners") {
if(!$this->id) return null;
$owners = ConstructionConsentOwner::search(["constructionconsent_id" => $this->id]);
if(count($owners)) {
$this->owners = $owners;
}
return $this->owners;
}
if($name == "creator") {
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($this->creator === null) {
$this->creator = new User($this->create_by);
if($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
}
}
return $this->creator;
}
if($name == "editor") {
$this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
if($this->editor === null) {
$this->editor = new User($this->edit_by);
if($this->editor->id) {
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
}
}
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
@@ -55,8 +98,9 @@ class ConstructionConsent extends mfBaseModel {
$model = new ConstructionConsent();
$table_fields = [
"termination_id","adb_wohneinheit_id","object_type","ez","owner_name","owner_street","owner_zip","owner_city",
"owner_country","status","result","create_by","edit_by","create","edit"
"constructionconsentproject_id", "termination_id","adb_hausnummer_id", "adb_strasse_id", "object_type", "name", "ez", "kg", "gst", "gstnr",
"usage_length", "usage_pipe_on_plot", "usage_pipe_in_building", "usage_manhole", "usage_owner",
"status", "result", "result_text", "note", "create_by","edit_by","create","edit"
];
foreach($data as $field => $value) {