From 1c5ea0d91d8a29b71c17c85830b8ab6221261689 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Fri, 22 Nov 2024 14:23:52 +0100 Subject: [PATCH] Counting EFH/MPH from Hausnummer now in Prordercampaign/Index --- application/ADBHausnummer/ADBHausnummer.php | 16 ++++++++++++++++ .../Preordercampaign/Preordercampaign.php | 8 +++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/application/ADBHausnummer/ADBHausnummer.php b/application/ADBHausnummer/ADBHausnummer.php index 3b7ce20c6..8a441367f 100644 --- a/application/ADBHausnummer/ADBHausnummer.php +++ b/application/ADBHausnummer/ADBHausnummer.php @@ -44,6 +44,22 @@ class ADBHausnummer extends mfBaseModel { } + public function getBuildingType() { + $rimo_type = strtolower($this->rimo_type); + + if(array_key_exists($this->rimo_type, TT_ADB_GDA_TYPES)) { + return TT_ADB_GDA_TYPES[$this->rimo_type]; + } + + $gdaeigenschaft = strtolower($this->gdaeigenschaft); + if(array_key_exists($gdaeigenschaft, TT_ADB_GDA_TYPES)) { + return TT_ADB_GDA_TYPES[$gdaeigenschaft]; + } + + return "sd"; + + } + public function setNewStatusCode($new_status_code) { if(!$new_status_code) return false; diff --git a/application/Preordercampaign/Preordercampaign.php b/application/Preordercampaign/Preordercampaign.php index 99627ec2c..4ec503171 100644 --- a/application/Preordercampaign/Preordercampaign.php +++ b/application/Preordercampaign/Preordercampaign.php @@ -174,15 +174,13 @@ class Preordercampaign extends mfBaseModel { $count_sd = 0; $count_md = 0; foreach($this->getProperty("active_preorders") as $preorder) { - //echo "/c:".$preorder->connection_count."/"; - if($preorder->connection_type == "single-dwelling") { + $bt = $preorder->adb_hausnummer->getBuildingType(); + if($bt == "sd") { $count_sd += $preorder->connection_count ? (int)$preorder->connection_count : 1; - } elseif ($preorder->connection_type == "multi-dwelling") { + } elseif ($bt == "md") { $count_md += $preorder->connection_count ? (int)$preorder->connection_count : 1; } $count += (int)$preorder->connection_count; - - //echo "/s:$count/"; } $this->active_preorder_count = $count; $this->active_preorder_count_sd = $count_sd;