Restored counting homes total from AdressdB in Preordercampaign/Index
This commit is contained in:
@@ -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