diff --git a/Layout/default/ConstructionConsent/Form.php b/Layout/default/ConstructionConsent/Form.php index 93c7b43ce..df597d02e 100644 --- a/Layout/default/ConstructionConsent/Form.php +++ b/Layout/default/ConstructionConsent/Form.php @@ -331,10 +331,16 @@ if(!$("#plan_adb_hausnummer_id").val()) return; var building_id = $('#plan_adb_hausnummer_id').val(); + var type = $("#object_type").val(); // get plan image preview try { - var response = await fetch(' "getRimoPlanPreview"])?>&building_id=' + building_id); + var response; + if(type == "building" ) { + response = await fetch(' "getRimoPlanPreview"])?>&building_id=' + building_id + '&include_home_trench=1'); + } else { + response = await fetch(' "getRimoPlanPreview"])?>&building_id=' + building_id); + } if (!response.ok) { return false; } diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php index 70882420b..4d71d4e3b 100644 --- a/application/ConstructionConsent/ConstructionConsent.php +++ b/application/ConstructionConsent/ConstructionConsent.php @@ -411,8 +411,8 @@ class ConstructionConsent extends mfBaseModel { END AS status_light FROM ConstructionConsent LEFT JOIN ConstructionConsentOwner cwo ON ConstructionConsent.id = cwo.constructionconsent_id - LEFT JOIN addressdb.view_hausnummer vh ON ConstructionConsent.adb_hausnummer_id = vh.hausnummer_id - LEFT JOIN addressdb.Strasse vs ON ConstructionConsent.adb_strasse_id = vs.id + LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer vh ON ConstructionConsent.adb_hausnummer_id = vh.hausnummer_id + LEFT JOIN `".ADDRESSDB_DBNAME."`.Strasse vs ON ConstructionConsent.adb_strasse_id = vs.id WHERE $where GROUP BY ConstructionConsent.id $having diff --git a/application/ConstructionConsent/ConstructionConsentController.php b/application/ConstructionConsent/ConstructionConsentController.php index e416c3c19..1411cab87 100644 --- a/application/ConstructionConsent/ConstructionConsentController.php +++ b/application/ConstructionConsent/ConstructionConsentController.php @@ -766,6 +766,7 @@ class ConstructionConsentController extends mfBaseController { private function getRimoPlanPreviewApi() { $adb_hausnummer_id = $this->request->building_id; + $include_home_trench = $this->request->include_home_trench ? true : false; $hausnummer = new ADBHausnummer($adb_hausnummer_id); if(!$hausnummer->id) { @@ -849,7 +850,18 @@ class ConstructionConsentController extends mfBaseController { ]; if($hausnummer->trenches) { - $trenches = json_decode($hausnummer->trenches); + $trenches = []; + if($include_home_trench && $hausnummer->home_trench) { + $trenches = [json_decode($hausnummer->home_trench)]; + } + + $street_trenches = json_decode($hausnummer->trenches); + foreach($street_trenches as $t) { + if(is_array($t) && count($t)) { + $trenches[] = $t; + } + } + $this->log->debug(print_r($trenches, true)); $params["paths"] = [ "line_width" => 5,