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

View File

@@ -90,6 +90,25 @@ class ConstructionConsentController extends mfBaseController {
return $new_filter;
}
protected function viewAction() : void {
$this->layout()->setTemplate("ConstructionConsent/View");
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$item = new ConstructionConsent($id);
if(!$item || !$item->id) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$this->layout()->set("item", $item);
}
protected function addAction() : void {
$this->layout()->setTemplate("ConstructionConsent/Form");
}
@@ -131,16 +150,16 @@ class ConstructionConsentController extends mfBaseController {
$data["constructionconsentproject_id"] = $r->constructionconsentproject_id;
$data["object_type"] = $r->object_type;
$data["name"] = $r->name;
$data["adb_street_id"] = $r->adb_street_id;
$data["adb_strasse_id"] = $r->adb_strasse_id;
$data["ez"] = $r->ez;
$data["kg"] = $r->kg;
$data["gst"] = $r->gst;
$data["gstnr"] = $r->gstnr;
$data["usage_length"] = $r->usage_length;
$data["usage_pipe_on_plot"] = $r->usage_pipe_on_plot;
$data["usage_pipe_in_building"] = $r->usage_pipe_in_building;
$data["usage_manhole"] = $r->usage_manhole;
$data["usage_owner"] = $r->usage_owner;
$data["usage_length"] = $r->usage_length ?: null;
$data["usage_pipe_on_plot"] = $r->usage_pipe_on_plot ? 1 : 0;
$data["usage_pipe_in_building"] = $r->usage_pipe_in_building ? 1 : 0;
$data["usage_manhole"] = $r->usage_manhole ? 1 : 0;
$data["usage_owner"] = $r->usage_owner ? 1 : 0;
if($mode == "add") {
$item = ConstructionConsent::create($data);
@@ -258,7 +277,6 @@ class ConstructionConsentController extends mfBaseController {
$adb = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
$res = $adb->query($sql);
$this->log->debug("done");
if(!$adb->num_rows($res)) {
header("Content-Type: application/json");