Counting EFH/MPH from Hausnummer now in Prordercampaign/Index

This commit is contained in:
Frank Schubert
2024-11-22 14:23:52 +01:00
parent c28a322210
commit 1c5ea0d91d
2 changed files with 19 additions and 5 deletions

View File

@@ -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;

View File

@@ -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;