Changed to rimo impot
This commit is contained in:
@@ -564,7 +564,7 @@ class AddressHelper
|
||||
if ($new_strasse) {
|
||||
$this->logFindAddressError("[II] Updating Strasse from " . $hausnummer->strasse->name . " to " . $new_strasse->name . " ($addr_dbg_str)");
|
||||
$hausnummer->strasse_id = $new_strasse->id;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
@@ -576,7 +576,7 @@ class AddressHelper
|
||||
if ($hausnummer_name != $hausnummer->hausnummer) {
|
||||
$this->logFindAddressError("[II] Updating Hausnummer from " . $hausnummer->hausnummer . " to " . $hausnummer_name . " ($addr_dbg_str)");
|
||||
$hausnummer->hausnummer = $hausnummer_name;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ class AddressHelper
|
||||
if ($new_plz) {
|
||||
$this->logFindAddressError("[II] Updating PLZ from " . $hausnummer->plz->plz . " to " . $new_plz->plz . " ($addr_dbg_str)");
|
||||
$hausnummer->plz_id = $new_plz->id;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ class AddressHelper
|
||||
|
||||
if ($hausnummer->extref != $name) {
|
||||
$hausnummer->extref = $name;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
@@ -607,14 +607,14 @@ class AddressHelper
|
||||
if ($lat && $long) {
|
||||
$hausnummer->gps_lat = (float)$lat;
|
||||
$hausnummer->gps_long = (float)$long;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($hausnummer->rimo_id != $rimo_id) {
|
||||
$hausnummer->rimo_id = $rimo_id;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
@@ -629,14 +629,15 @@ class AddressHelper
|
||||
}*/
|
||||
if($update_freigabe && $hausnummer->freigabe != $this->netzgebiet->freigabe) {
|
||||
$hausnummer->freigabe = $this->netzgebiet->freigabe;
|
||||
if(!$hausnummer->save()) {
|
||||
if(!$hausnummer->save(["no_aftersave" => true])) {
|
||||
$this->logFindAddressError("[EE] Error saving Hausnummer ($addr_dbg_str)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$hausnummer->oaid && $this->netzgebiet->unit_create_oaid) {
|
||||
$hausnummer->getNewOAID();
|
||||
$hausnummer->oaid = $hausnummer->getNewOAID();
|
||||
$hausnummer->save(["no_aftersave" => true]);
|
||||
}
|
||||
|
||||
|
||||
@@ -684,6 +685,10 @@ class AddressHelper
|
||||
//echo "Hausnummer per Suche gefunden\n";
|
||||
$data = $this->db->fetch_object($res);
|
||||
//echo "found by strasse/hausnummer/gemeinde\n";
|
||||
$hausnummer = new ADBHausnummer($data->hausnummer_id);
|
||||
if($hausnummer->id) {
|
||||
\mfValuecache::singleton()->set("mfObjectmodel-adb_hausnummer-".$data->id, $hausnummer);
|
||||
}
|
||||
return new ADBHausnummer($data->hausnummer_id);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -291,12 +291,14 @@ foreach ($clusters as $cluster_data) {
|
||||
continue;
|
||||
}
|
||||
$hausnummer_found_count++;
|
||||
|
||||
$hausnummer_id = $hausnummer->id;
|
||||
|
||||
$hausnummer_changed = false;
|
||||
/*
|
||||
* Set Building Status based on Operational-/Executionstate
|
||||
*/
|
||||
|
||||
|
||||
if(is_object($building->executionState) && property_exists($building->executionState, "userLabel")) {
|
||||
$b_executionstate_id = $building->executionState->name;
|
||||
$b_executionstate_label = $building->executionState->userLabel;
|
||||
@@ -306,24 +308,17 @@ foreach ($clusters as $cluster_data) {
|
||||
if($b_executionstate_label != $hausnummer->rimo_ex_state) {
|
||||
$hausnummer->rimo_ex_state = $b_executionstate_label;
|
||||
$hausnummer->save();
|
||||
//echo "saved executionstate\n";
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$hausnummer_changed = true;
|
||||
}
|
||||
if($b_operationalstate_label != $hausnummer->rimo_op_state) {
|
||||
$hausnummer->rimo_op_state = $b_operationalstate_label;
|
||||
$hausnummer->save();
|
||||
//echo "saved operationalstate\n";
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$hausnummer_changed = true;
|
||||
}
|
||||
|
||||
if($b_executionstate_id == "99" && $hausnummer->visibility != "private") {
|
||||
echo "== Setting visibility to private because execution state $b_executionstate_id ($b_executionstate_label) [".$hausnummer->id."]\n";
|
||||
$hausnummer->visibility = "private";
|
||||
$hausnummer->save();
|
||||
$hausnummer->resetSaveNesting();
|
||||
//$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$hausnummer_changed = true;
|
||||
}
|
||||
|
||||
if($b_operationalstate_id == "99" && $b_executionstate_id == "1") {
|
||||
@@ -331,25 +326,29 @@ foreach ($clusters as $cluster_data) {
|
||||
if($hausnummer->rollout_info != "unscheduled" || $hausnummer->rollout != null) {
|
||||
$hausnummer->rollout = null;
|
||||
$hausnummer->rollout_info = "unscheduled";
|
||||
$hausnummer->save();
|
||||
$hausnummer->resetSaveNesting();
|
||||
$hausnummer_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
|
||||
// update Preorders
|
||||
foreach(\PreorderModel::searchActive(["adb_hausnummer_id" => $hausnummer_id]) as $preorder) {
|
||||
|
||||
/* should be done already in hausnummer->afterSave()
|
||||
*
|
||||
foreach(\PreorderModel::searchActive(["adb_hausnummer_id" => $hausnummer_id]) as $preorder) {
|
||||
$preorder->syncStatusFlagsFromAdb();
|
||||
$preorder->resetSaveNesting();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if(is_object($building->buildingType) && property_exists($building->buildingType, "userLabel") && $building->buildingType->userLabel) {
|
||||
$hausnummer->rimo_type = strtolower($building->buildingType->userLabel);
|
||||
$hausnummer_changed = true;
|
||||
}
|
||||
|
||||
if($hausnummer_changed) {
|
||||
$hausnummer->save();
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$hausnummer->resetSaveNesting();
|
||||
}
|
||||
|
||||
|
||||
@@ -385,6 +384,7 @@ foreach ($clusters as $cluster_data) {
|
||||
die("Error saving new unit OAID\n" . print_r($unit, true));
|
||||
}
|
||||
}
|
||||
\mfValuecache::singleton()->set("mfObjectmodel-adb_wohneinheit-".$unit->id, $unit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,12 +400,14 @@ foreach ($clusters as $cluster_data) {
|
||||
foreach ($building->homes->item as $home) {
|
||||
if(!$home->id) continue;
|
||||
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
//$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
//print_r($home);exit;
|
||||
$homes_count++;
|
||||
$home_rimo_id = $home->id;
|
||||
$home_name = $home->name;
|
||||
|
||||
$unit_changed = false;
|
||||
|
||||
$rimo_home_list[] = $home_rimo_id;
|
||||
|
||||
//echo "$home_rimo_id\n";continue;
|
||||
@@ -434,26 +436,31 @@ foreach ($clusters as $cluster_data) {
|
||||
die("Error saving new unit OAID\n" . print_r($unit, true));
|
||||
}
|
||||
}
|
||||
\mfValuecache::singleton()->set("mfObjectmodel-adb_wohneinheit-".$unit->id, $unit);
|
||||
|
||||
//$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);
|
||||
$hausnummer->resetSaveNesting();
|
||||
$unit->resetSaveNesting();
|
||||
//\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);
|
||||
if($unit->rimo_deleted) {
|
||||
$unit->rimo_deleted = 0;
|
||||
$unit->save(["no_updates" => 1]);
|
||||
$unit_changed = true;
|
||||
//$unit->save(["no_updates" => 1]);
|
||||
}
|
||||
|
||||
if ($unit->extref != $home_rimo_id) {
|
||||
$unit->extref = $home_rimo_id;
|
||||
if (!$unit->save()) {
|
||||
$unit_changed = true;
|
||||
/*if (!$unit->save()) {
|
||||
die("Error saving new extref on unit\n" . print_r($home, true));
|
||||
}
|
||||
}*/
|
||||
//$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);
|
||||
/*$hausnummer->resetSaveNesting();
|
||||
$unit->resetSaveNesting();*/
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -462,19 +469,11 @@ foreach ($clusters as $cluster_data) {
|
||||
|
||||
if($home->executionState->userLabel != $unit->rimo_ex_state) {
|
||||
$unit->rimo_ex_state = $home->executionState->userLabel;
|
||||
$unit->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_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_changed = true;
|
||||
}
|
||||
if($home->operationalState->userLabel != $unit->rimo_op_state) {
|
||||
$unit->rimo_op_state = $home->operationalState->userLabel;
|
||||
$unit->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_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_changed = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -501,9 +500,7 @@ foreach ($clusters as $cluster_data) {
|
||||
|
||||
$unit_extdata->rimo->ftu = $ftu_data;
|
||||
$unit->external_data = json_encode($unit_extdata);
|
||||
if (!$unit->save()) {
|
||||
die("!!! Error saving unit extdata\n" . print_r($unit));
|
||||
}
|
||||
$unit_changed = true;
|
||||
|
||||
// check OAID
|
||||
if (property_exists($home->ftus->item[0], "oaidObject") && is_object($home->ftus->item[0]->oaidObject) && $home->ftus->item[0]->oaidObject->name) {
|
||||
@@ -516,7 +513,7 @@ foreach ($clusters as $cluster_data) {
|
||||
if($preorder_only_oaid) {
|
||||
// if campaign oaid handling "other" just import OAID and nothing else
|
||||
$unit->oaid = $rimo_oaid;
|
||||
$unit->save();
|
||||
$unit_changed = true;
|
||||
} else {
|
||||
echo "!!! Home hat fremde OAID: $rimo_oaid (Home " . $unit->id . "\n";
|
||||
}
|
||||
@@ -550,7 +547,6 @@ foreach ($clusters as $cluster_data) {
|
||||
$oaid->export_data = json_encode($exp_data);
|
||||
|
||||
$oaid->save();
|
||||
$unit->save();
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -619,25 +615,30 @@ foreach ($clusters as $cluster_data) {
|
||||
|
||||
if ($sdicluster) {
|
||||
$unit->patch_cluster = $sdicluster;
|
||||
$unit->save();
|
||||
$unit_changed = true;
|
||||
}
|
||||
if ($shelf) {
|
||||
$unit->patch_shelf = $shelf;
|
||||
$unit->save();
|
||||
$unit_changed = true;
|
||||
}
|
||||
if ($patchpanel) {
|
||||
$unit->patch_module = $patchpanel;
|
||||
$unit->save();
|
||||
$unit_changed = true;
|
||||
}
|
||||
if ($port) {
|
||||
$unit->patch_port = $port;
|
||||
$unit->save();
|
||||
$unit_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($unit_changed) {
|
||||
$unit->save();
|
||||
$unit->resetSaveNesting();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -685,8 +686,8 @@ foreach ($clusters as $cluster_data) {
|
||||
}
|
||||
if ($hausnummer->home_trench != $home_trench) {
|
||||
$hausnummer->home_trench = json_encode($home_trench);
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$hausnummer_changed = true;
|
||||
//$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -702,8 +703,8 @@ foreach ($clusters as $cluster_data) {
|
||||
if ($hausnummer->borderpoint_lat != $lat || $hausnummer->borderpoint_long != $long) {
|
||||
$hausnummer->borderpoint_lat = $lat;
|
||||
$hausnummer->borderpoint_long = $long;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$hausnummer_changed = true;
|
||||
//$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,11 +724,16 @@ foreach ($clusters as $cluster_data) {
|
||||
if (count($trenches)) {
|
||||
//var_dump($trenches);exit;
|
||||
$hausnummer->trenches = json_encode($trenches);
|
||||
$hausnummer->save();
|
||||
$hausnummer_changed = true;
|
||||
//$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($hausnummer_changed) {
|
||||
$hausnummer->save();
|
||||
$hausnummer->resetSaveNesting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1048,6 +1054,7 @@ function deleteHomesIfEligible(Array $rimo_home_list, Object $hausnummer) {
|
||||
echo "[DD] Deleting Hausnummer ".$adb_unit->hausnummer_id." Wohneinheit ".$adb_unit->id." (extref ".$adb_unit->extref.")\n";
|
||||
$return_strings[] = "[DD] Deleting Hausnummer ".$adb_unit->hausnummer_id." Wohneinheit ".$adb_unit->id." (extref ".$adb_unit->extref.")";
|
||||
|
||||
\mfValuecache::singleton()->delete("mfObjectmodel-adb_wohneinheit-".$adb_unit->id);
|
||||
$adb_unit->delete();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user