Fixed not setting flag 141 in rimo-import
This commit is contained in:
@@ -11,6 +11,8 @@ class ADBHausnummer extends mfBaseModel {
|
||||
private $freigaben = [];
|
||||
private $wohneinheiten = [];
|
||||
|
||||
|
||||
|
||||
protected function init() {
|
||||
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$this->table = "Hausnummer";
|
||||
@@ -19,7 +21,10 @@ class ADBHausnummer extends mfBaseModel {
|
||||
|
||||
public function afterSave($_params = []) {
|
||||
if(array_key_exists("no_aftersave", $_params) && $_params["no_aftersave"]) return true;
|
||||
|
||||
|
||||
$this->log->debug("[".$this->_ruid."] "."-----------------------------------------");
|
||||
$this->log->debug("[".$this->_ruid."] ".__METHOD__.": hausnummer_id: ".$this->id);
|
||||
|
||||
// prevent potential infinite loop
|
||||
$nesting_level = mfValuecache::singleton()->get("adbhausnummer-save-nesting-level-".$this->id);
|
||||
if(!$nesting_level) {
|
||||
@@ -30,6 +35,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$this->id, $nesting_level);
|
||||
|
||||
if($nesting_level > 1) {
|
||||
$this->log->debug("[".$this->_ruid."] ".__METHOD__.": Preventing potential infinite loop");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,6 +51,9 @@ class ADBHausnummer extends mfBaseModel {
|
||||
AddressDB::handleRimoStatusUpdate($wohneinheit->id);
|
||||
}
|
||||
|
||||
// reload self from database
|
||||
$this->fetch($this->id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,7 +90,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->log->info(__CLASS__." Changes: User ".$me->username." $logstr");
|
||||
$this->log->info("[".$this->_ruid."] ".__CLASS__." Changes: User ".$me->username." $logstr");
|
||||
|
||||
return true;
|
||||
|
||||
@@ -106,7 +115,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
public function setNewStatusCode($new_status_code) {
|
||||
if(!$new_status_code) return false;
|
||||
|
||||
$this->log->debug(__METHOD__.": Want new Hausnummer (".$this->id.") Status ".$new_status_code);
|
||||
$this->log->debug("[".$this->_ruid."] ".__METHOD__.": Want new Hausnummer (".$this->id.") Status ".$new_status_code);
|
||||
|
||||
$new_status = ADBStatusModel::getFirst(["code" => $new_status_code]);
|
||||
|
||||
@@ -115,7 +124,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
$flag = ADBStatusflagModel::getFirst(["code" => $new_status_code]);
|
||||
if(!$flag) return false;
|
||||
|
||||
$this->log->debug(__METHOD__.": Statuscode $new_status_code is Flag");
|
||||
$this->log->debug("[".$this->_ruid."] ".__METHOD__.": Statuscode $new_status_code is Flag");
|
||||
$flag_value = ADBHausnummerStatusflagValueModel::getFirst(["flag_id" => $flag->id, "hausnummer_id" => $this->id]);
|
||||
if(!$flag_value) {
|
||||
$flag_value = ADBHausnummerStatusflagValueModel::create([
|
||||
@@ -130,7 +139,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
|
||||
$old_status = $this->getProperty("status");
|
||||
if($old_status->code < $new_status->code) {
|
||||
$this->log->debug(__METHOD__.": Setting Hausnummer (".$this->id.") Status from ".$old_status->code." to ".$new_status->code);
|
||||
$this->log->debug("[".$this->_ruid."] ".__METHOD__.": Setting Hausnummer (".$this->id.") Status from ".$old_status->code." to ".$new_status->code);
|
||||
$this->status_id = $new_status->id;
|
||||
}
|
||||
|
||||
@@ -145,7 +154,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
'street' => $this->getProperty("strasse")->name
|
||||
];
|
||||
if(!$search['country'] || !$search['city'] || !$search['zip'] || !$search['street']) {
|
||||
$this->log->warning(__METHOD__.": Unable to retrieve GPS Coordinates. Search key missing (hausnummer_id: ".$this->id.")");
|
||||
$this->log->warning("[".$this->_ruid."] ".__METHOD__.": Unable to retrieve GPS Coordinates. Search key missing (hausnummer_id: ".$this->id.")");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -191,7 +200,7 @@ class ADBHausnummer extends mfBaseModel {
|
||||
}
|
||||
|
||||
if(ADBHausnummerModel::search(['oaid' => $code])) {
|
||||
$this->log->warn(__FILE__."::getNewObjectCode: New Code already in use. Trying again for a maximum of $try times.");
|
||||
$this->log->warn("[".$this->_ruid."] ".__FILE__."::getNewObjectCode: New Code already in use. Trying again for a maximum of $try times.");
|
||||
} else {
|
||||
// code is unique
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user