Changed to rimo impot
This commit is contained in:
@@ -88,6 +88,15 @@ class ADBHausnummerModel {
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
|
||||
// search in cache
|
||||
$item = mfValuecache::singleton()->get("mfObjectmodel-adb_hausnummer-".$data->id);
|
||||
if($item && $item->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-adb_hausnummer-".$data->id, $item);
|
||||
return $item;
|
||||
}
|
||||
// if not in cache, load regularly
|
||||
|
||||
$item = new ADBHausnummer($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
@@ -220,7 +229,15 @@ class ADBHausnummerModel {
|
||||
}
|
||||
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new ADBHausnummer($data);
|
||||
$item = mfValuecache::singleton()->get("mfObjectmodel-adb_hausnummer-".$data->id);
|
||||
if($item && $item->id) {
|
||||
$items[] = $item;
|
||||
} else {
|
||||
$item = new ADBHausnummer($data);
|
||||
mfValuecache::singleton()->set("mfObjectmodel-adb_hausnummer-".$data->id, $item);
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
@@ -70,6 +70,15 @@ class ADBWohneinheitModel {
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
|
||||
// search in cache
|
||||
$item = mfValuecache::singleton()->get("mfObjectmodel-adb_wohneinheit-".$data->id);
|
||||
if($item && $item->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-adb_wohneinheit-".$data->id, $item);
|
||||
return $item;
|
||||
}
|
||||
// if not in cache, load regularly
|
||||
|
||||
$item = new ADBWohneinheit($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
@@ -140,7 +149,14 @@ class ADBWohneinheitModel {
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new ADBWohneinheit($data);
|
||||
$item = mfValuecache::singleton()->get("mfObjectmodel-adb_wohneinheit-".$data->id);
|
||||
if($item && $item->id) {
|
||||
$items[] = $item;
|
||||
} else {
|
||||
$item = new ADBWohneinheit($data);
|
||||
mfValuecache::singleton()->set("mfObjectmodel-adb_wohneinheit-".$data->id, $item);
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
@@ -78,65 +78,6 @@ class AddressDB {
|
||||
LEFT JOIN `".FRONKDB_DBNAME."`.`Address` as tbl_address on (tbl_address.`id` = tbl_preorder.partner_id)
|
||||
";
|
||||
|
||||
/*public static $wohneinheit_query = "select `Netzgebiet`.`id` AS `netzgebiet_id`,
|
||||
`Netzgebiet`.`name` AS `netzgebiet`,
|
||||
`Netzgebiet`.`extref` AS `netzgebiet_extref`,
|
||||
`Gemeinde`.`id` AS `gemeinde_id`,
|
||||
`Gemeinde`.`kennziffer` AS `gemeinde_kennziffer`,
|
||||
`Gemeinde`.`code` AS `gemeinde_code`,
|
||||
`Gemeinde`.`name` AS `gemeinde`,
|
||||
`Ortschaft`.`id` AS `ortschaft_id`,
|
||||
`Ortschaft`.`kennziffer` AS `ortschaft_kennziffer`,
|
||||
`Ortschaft`.`name` AS `ortschaft`,
|
||||
`Plz`.`plz` AS `plz`,
|
||||
`Strasse`.`id` AS `strasse_id`,
|
||||
`Strasse`.`kennziffer` AS `strasse_kennziffer`,
|
||||
`Strasse`.`name` AS `strasse`,
|
||||
`Hausnummer`.`id` AS `hausnummer_id`,
|
||||
`Hausnummer`.`oaid` AS `oaid`,
|
||||
`Hausnummer`.`adrcd` AS `adrcd`,
|
||||
`Hausnummer`.`subcd` AS `subcd`,
|
||||
`Hausnummer`.`oaid` AS `hausnummer_oaid`,
|
||||
`Hausnummer`.`hausnummer` AS `hausnummer`,
|
||||
`Hausnummer`.`stiege` AS `hausnummer_stiege`,
|
||||
`Hausnummer`.`extref` AS `hausnummer_extref`,
|
||||
`Hausnummer`.`unit_count` AS `unit_count`,
|
||||
`Hausnummer`.`meridian` AS `meridian`,
|
||||
`Hausnummer`.`rw` AS `rw`,
|
||||
`Hausnummer`.`hw` AS `hw`,
|
||||
`Hausnummer`.`gps_lat` AS `gps_lat`,
|
||||
`Hausnummer`.`gps_long` AS `gps_long`,
|
||||
`Hausnummer`.`grund_nr` AS `grund_nr`,
|
||||
`Hausnummer`.`rollout` AS `rollout`,
|
||||
`Hausnummer`.`rollout_info` AS `rollout_info`,
|
||||
`Hausnummer`.`freigabe` AS `freigabe`,
|
||||
`Hausnummer`.`visibility` AS `visibility`,
|
||||
`Hausnummer`.`rimo_id` AS `hausnummer_rimo_id`,
|
||||
`Hausnummer`.`rimo_fcp_name` AS `rimo_fcp_name`,
|
||||
`Wohneinheit`.`id` AS `wohneinheit_id`,
|
||||
`Wohneinheit`.`oaid` AS `wohneinheit_oaid`,
|
||||
`Wohneinheit`.`extref` AS `wohneinheit_extref`,
|
||||
`Wohneinheit`.`num` AS `num`,
|
||||
`Wohneinheit`.`block` AS `block`,
|
||||
`Wohneinheit`.`stiege` AS `stiege`,
|
||||
`Wohneinheit`.`stock` AS `stock`,
|
||||
`Wohneinheit`.`tuer` AS `tuer`,
|
||||
`Wohneinheit`.`bezeichner` AS `bezeichner`,
|
||||
`Wohneinheit`.`zusatz` AS `zusatz`,
|
||||
`Wohneinheit`.`nutzung` AS `nutzung`,
|
||||
tbl_preorder.type AS `order_type`,
|
||||
tbl_address.id AS `partner_id`,
|
||||
tbl_address.company AS `partner_company`
|
||||
from `Hausnummer`
|
||||
left join `Netzgebiet` on (`Hausnummer`.`netzgebiet_id` = `Netzgebiet`.`id`)
|
||||
left join `Plz` on (`Plz`.`id` = `Hausnummer`.`plz_id`)
|
||||
left join `Strasse` on (`Strasse`.`id` = `Hausnummer`.`strasse_id`)
|
||||
left join `Ortschaft` on (`Ortschaft`.`id` = `Hausnummer`.`ortschaft_id`)
|
||||
left join `Gemeinde` on (`Gemeinde`.`id` = `Strasse`.`gemeinde_id`)
|
||||
left join `Wohneinheit` on (`Wohneinheit`.`hausnummer_id` = `Hausnummer`.`id`)
|
||||
left join `".FRONKDB_DBNAME."`.`Preorder` as tbl_preorder on (tbl_preorder.`adb_wohneinheit_id` = `Wohneinheit`.`id` AND (tbl_preorder.`deleted` = 0 OR tbl_preorder.`deleted` IS NULL))
|
||||
left join `".FRONKDB_DBNAME."`.`Address` as tbl_address on (tbl_address.`id` = tbl_preorder.partner_id)
|
||||
";*/
|
||||
|
||||
public function __construct() {
|
||||
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
@@ -231,7 +172,7 @@ class AddressDB {
|
||||
$log->debug(__METHOD__ . ": new Preorder Status flag: " . $matrix["pf"]);
|
||||
}
|
||||
|
||||
$preorder = PreorderModel::getFirstActive(["adb_wohneinheit_id" => $wohneinheit->id]);
|
||||
//$preorder = PreorderModel::getFirstActive(["adb_wohneinheit_id" => $wohneinheit->id]);
|
||||
|
||||
if($preorder) {
|
||||
$preorder->resetSaveNesting();
|
||||
@@ -247,7 +188,6 @@ class AddressDB {
|
||||
$log->debug(__METHOD__.": Setting Preorder Status to ".$preorderstatus);
|
||||
$preorder->setNewStatusCode($preorderstatus);
|
||||
$preorder->save();
|
||||
$preorder = PreorderModel::getFirstActive(["adb_wohneinheit_id" => $wohneinheit->id]);
|
||||
$preorder->resetSaveNesting();
|
||||
}
|
||||
if($preorderstatus_flag) {
|
||||
@@ -281,7 +221,7 @@ class AddressDB {
|
||||
|
||||
}
|
||||
|
||||
$wohneinheit = new ADBWohneinheit($wohneinheit->id);
|
||||
//$wohneinheit = new ADBWohneinheit($wohneinheit->id);
|
||||
|
||||
$wohneinheit_status = $matrix["w"];
|
||||
if($wohneinheit_status) {
|
||||
|
||||
@@ -665,9 +665,7 @@ class Preorder extends mfBaseModel {
|
||||
|
||||
foreach(ADBStatusflagModel::getAll() as $hflag) {
|
||||
$val = $hausnummer->statusflags[$hflag->id]->value->value;
|
||||
/*if($hflag->code == 141) {
|
||||
var_dump($hausnummer->statusflags[$hflag->id],$hausnummer->statusflags[$hflag->id]->value);exit;
|
||||
}*/
|
||||
if(!$val) continue; // only set flags from 0 to 1
|
||||
|
||||
$pflag = PreorderStatusflagModel::getFirst(["preorder_id" => $this->id, "code" => $hflag->code]);
|
||||
if(!$pflag) {
|
||||
@@ -676,9 +674,6 @@ class Preorder extends mfBaseModel {
|
||||
}
|
||||
$pflag->preorder_id = $this->id;
|
||||
|
||||
if($hflag->code == 141) {
|
||||
var_dump($pflag, $pflag->value, $val);
|
||||
}
|
||||
if($pflag->value->value != $val) {
|
||||
$pflag->value->value = $val;
|
||||
$pflag->value->save();
|
||||
|
||||
@@ -276,6 +276,7 @@ class PreorderModel
|
||||
// if not in cache, load regularly
|
||||
$item = new Preorder($data);
|
||||
if ($item->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-preorder-".$data->id, $item);
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
@@ -570,7 +571,9 @@ class PreorderModel
|
||||
if($item) {
|
||||
$items[] = $item;
|
||||
} else {
|
||||
$items[] = new Preorder($data);
|
||||
$item = new Preorder($data);
|
||||
mfValuecache::singleton()->set("mfObjectmodel-preorder-".$data->id, $item);
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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