Restored counting homes total from AdressdB in Preordercampaign/Index
This commit is contained in:
@@ -113,8 +113,10 @@
|
||||
<td>
|
||||
<a href="<?=self::getUrl("Preorder", "Index", ["filter" => ["preordercampaign_id" => $camp->id]])?>">
|
||||
<?=$camp->active_preorder_count?>
|
||||
<?php if($camp->homes_total): ?>
|
||||
<?php if($camp->homes_total): // manual value ?>
|
||||
/ <?=$camp->homes_total?> (<?=(round(($camp->active_preorder_count / $camp->homes_total) * 100, 2))?> %)
|
||||
<?php elseif($camp->total_homes): // automatic value from AdressDB ?>
|
||||
/ <?=$camp->total_homes?> (<?=(round(($camp->active_preorder_count / $camp->total_homes) * 100, 2))?> %)
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@@ -95,7 +95,7 @@ class ADBWohneinheitModel {
|
||||
) as tbl
|
||||
";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
|
||||
@@ -82,10 +82,15 @@ class Preordercampaign extends mfBaseModel {
|
||||
|
||||
if($name == "total_homes") {
|
||||
$total = 0;
|
||||
|
||||
$netzgebiet_ids = null;
|
||||
foreach($this->getProperty("salesclusters") as $scluster) {
|
||||
$netzgebiet_id = $scluster->salescluster_id;
|
||||
$total += ADBWohneinheitModel::count(['netzgebiet_id' => $netzgebiet_id]);
|
||||
$netzgebiet_ids[] = $scluster->id;
|
||||
}
|
||||
if(count($netzgebiet_ids)) {
|
||||
$total = ADBWohneinheitModel::count(['netzgebiet_id' => $netzgebiet_ids]);
|
||||
}
|
||||
|
||||
$this->total_homes = $total;
|
||||
return $total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user