Fixed counting homes in Rimo Import
This commit is contained in:
@@ -307,10 +307,13 @@ foreach ($clusters as $cluster_data) {
|
||||
}
|
||||
}
|
||||
|
||||
$plannedTU = $building->plannedTU;
|
||||
$to_create_count = $building->plannedTU - count($existing_units);
|
||||
$rimo_home_count = 0;
|
||||
if (property_exists($building->homes, "item") && is_array($building->homes->item) && count($building->homes->item)) {
|
||||
$rimo_home_count = count($building->homes->item);
|
||||
}
|
||||
$to_create_count = $rimo_home_count - count($existing_units);
|
||||
|
||||
if ($plannedTU && $to_create_count > 0) {
|
||||
if ($rimo_home_count && $to_create_count > 0) {
|
||||
for ($i = 0; $i < $to_create_count; $i++) {
|
||||
$unit = \ADBWohneinheitModel::create([
|
||||
"hausnummer_id" => $hausnummer->id,
|
||||
@@ -375,12 +378,12 @@ foreach ($clusters as $cluster_data) {
|
||||
}
|
||||
}
|
||||
|
||||
$unit = new \ADBWohneinheit($unit->id);
|
||||
//$unit = new \ADBWohneinheit($unit->id);
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
}
|
||||
|
||||
$unit = new \ADBWohneinheit($unit->id);
|
||||
//$unit = new \ADBWohneinheit($unit->id);
|
||||
if($unit->rimo_deleted) {
|
||||
$unit->rimo_deleted = 0;
|
||||
$unit->save(["no_updates" => 1]);
|
||||
@@ -391,7 +394,7 @@ foreach ($clusters as $cluster_data) {
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new extref on unit\n" . print_r($home, true));
|
||||
}
|
||||
$unit = new \ADBWohneinheit($unit->id);
|
||||
//$unit = new \ADBWohneinheit($unit->id);
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user