Preorder admin Update OAID From Unit always updates oaid object
This commit is contained in:
@@ -52,10 +52,12 @@ class OpenAccessId extends mfBaseModel {
|
||||
|
||||
// XXX for now only support ADB Addresses
|
||||
if(!$this->adb_wohneinheit_id) {
|
||||
$this->log->warning(__METHOD__.": No ADB Wohneinheit ID ".$this->oaid);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!$this->id) {
|
||||
$this->log->warning(__METHOD__.": No ID ".$this->oaid);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,6 +67,7 @@ class OpenAccessId extends mfBaseModel {
|
||||
|
||||
$wohneinheit = new ADBWohneinheit($this->adb_wohneinheit_id);
|
||||
if(!$wohneinheit->id || !$wohneinheit->extref) {
|
||||
$this->log->warning(__METHOD__.": No Wohneinheit ID or Wohneinheit Extref ".$this->oaid);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,7 +92,7 @@ class OpenAccessId extends mfBaseModel {
|
||||
|
||||
if($fetch_ftu) {
|
||||
$resp_data = $rimo->getFtuData($wohneinheit->extref);
|
||||
|
||||
|
||||
if(!is_array($resp_data->ftus->item) || !count($resp_data->ftus->item)) {
|
||||
$this->log->warning(__METHOD__.": Homes ftus object has no items ".$this->oaid);
|
||||
return false;
|
||||
|
||||
@@ -889,7 +889,7 @@ class PreordercampaignController extends mfBaseController {
|
||||
$missing_oaid = 0;
|
||||
|
||||
foreach(PreorderModel::searchActive(["preordercampaign_id" => $id, "connection_count" => 1]) as $preorder) {
|
||||
|
||||
|
||||
if($preorder->type == "interest") {
|
||||
$this->log->debug(__METHOD__.": Ignoring Preorder ".$preorder->id.": is interest");
|
||||
continue;
|
||||
@@ -999,23 +999,24 @@ class PreordercampaignController extends mfBaseController {
|
||||
$oaid_ftu = $oaid->getExportData("rimo");
|
||||
//var_dump($oaid_ftu);
|
||||
if($oaid_ftu->ftu_id) {
|
||||
$rimo->unassignOaid($oaid_ftu->ftu_id);
|
||||
$rimo->assignOaid($unit_ftu_data["id"]);
|
||||
|
||||
$oaid->updateExportData("rimo", "ftu_id", $unit_ftu_data["id"]);
|
||||
$oaid->updateExportData("rimo", "ftu_name", $unit_ftu_data["name"]);
|
||||
$oaid->updateExportData("rimo", "ftu_assigned_date", date("U"));
|
||||
$oaid->address = $wohneinheit->hausnummer->getAddress();
|
||||
$oaid->unit_string = (string)$wohneinheit;
|
||||
|
||||
$oaid->adb_wohneinheit_id = $wohneinheit->id;
|
||||
$oaid->assigned = date("U");
|
||||
$oaid->exported_to = "rimo";
|
||||
$oaid->exported = date('U');
|
||||
|
||||
//var_dump($oaid);exit;
|
||||
$oaid->save();
|
||||
$rimo->unassignOaid($oaid_ftu->ftu_id);
|
||||
$rimo->assignOaid($unit_ftu_data["id"]);
|
||||
|
||||
$oaid->updateExportData("rimo", "ftu_id", $unit_ftu_data["id"]);
|
||||
$oaid->updateExportData("rimo", "ftu_name", $unit_ftu_data["name"]);
|
||||
$oaid->updateExportData("rimo", "ftu_assigned_date", date("U"));
|
||||
}
|
||||
$oaid->address = $wohneinheit->hausnummer->getAddress();
|
||||
$oaid->unit_string = (string)$wohneinheit;
|
||||
|
||||
$oaid->adb_wohneinheit_id = $wohneinheit->id;
|
||||
$oaid->assigned = date("U");
|
||||
$oaid->exported_to = "rimo";
|
||||
$oaid->exported = date('U');
|
||||
|
||||
//var_dump($oaid);exit;
|
||||
$oaid->save();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user