Fixed adding same homes every time import runs
This commit is contained in:
@@ -122,8 +122,8 @@ foreach($netowners as $apiOwner) {
|
||||
|
||||
$addressErrors = [];
|
||||
|
||||
if($cluster_rimo_id != "SDIRolloutRegion_97586867201_1711003389") {
|
||||
// stiftingtal
|
||||
if($cluster_rimo_id != "SDISalesCluster_29189625089_1679036889") {
|
||||
// lieboch
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -222,8 +222,10 @@ foreach($netowners as $apiOwner) {
|
||||
|
||||
$last_unit_num = 0;
|
||||
$existing_units = [];
|
||||
$existing_units_extref = [];
|
||||
foreach(\ADBWohneinheitModel::search(["hausnummer_id" => $hausnummer->id]) as $unit) {
|
||||
$existing_units[$unit->extref] = $unit;
|
||||
$existing_units[] = $unit;
|
||||
$existing_units_extref[$unit->extref] = $unit;
|
||||
if($last_unit_num < $unit->num) {
|
||||
$last_unit_num++;
|
||||
}
|
||||
@@ -259,8 +261,8 @@ foreach($netowners as $apiOwner) {
|
||||
|
||||
//echo "$home_rimo_id\n";continue;
|
||||
|
||||
if(array_key_exists($home_rimo_id, $existing_units)) {
|
||||
$unit = $existing_units[$home_rimo_id];
|
||||
if(array_key_exists($home_rimo_id, $existing_units_extref)) {
|
||||
$unit = $existing_units_extref[$home_rimo_id];
|
||||
} else {
|
||||
// find free home without rimo_id
|
||||
$unit = \ADBWohneinheitModel::getFirst(["hausnummer_id" => $hausnummer->id, "extref" => null]);
|
||||
|
||||
Reference in New Issue
Block a user