new OAID type "other" / added adrcd to preorderreporting api

This commit is contained in:
Frank Schubert
2025-02-10 16:11:12 +01:00
parent fd9367bd8d
commit 5a1c07882b
9 changed files with 230 additions and 87 deletions
+34 -1
View File
@@ -37,6 +37,12 @@ class Preorder extends mfBaseModel {
}
}
public function beforeSave() {
if(!isset($this->data->status_id)) {
$this->data->status_id = 1;
}
}
public function afterSave() {
// reset auto magic properties
$this->status = null;
@@ -111,6 +117,9 @@ class Preorder extends mfBaseModel {
}
}
$campaign = $this->getProperty("campaign");
if($campaign->oaid_origin == "other") return true;
if($this->adb_wohneinheit_id && is_array($this->getProperty("adb_wohneinheit")->rimo_workorders)) {
foreach($this->getProperty("adb_wohneinheit")->rimo_workorders as $workorder) {
Rimoapi::updateWorkorder($workorder->rimo_id, $update);
@@ -425,7 +434,7 @@ class Preorder extends mfBaseModel {
$new_status = new Preorderstatus($this->status_id);
if(!$new_status->id) {
$this->log->warning(__METHOD__ . ": Preorder has invalid status!");
$this->log->warning(__METHOD__ . ": Preorder has invalid status! ".print_r($this, true));
return true;
}
@@ -583,6 +592,23 @@ class Preorder extends mfBaseModel {
return true;
}
/*if($campaign->oaid_origin == "other") {
// oaid in wohneinheit übernehmen, falls in Preorder schon vorhanden
if($this->oaid)
// oaid aus wohneinheit übernehmen, falls vorhanden
$this->log->debug(__METHOD__.": Kampagne unterstützt keine OAIDs");
return true;
}*/
if($campaign->oaid_origin == "other") {
if($wohneinheit->oaid != $this->oaid) {
$this->oaid = $wohneinheit->oaid;
}
return true;
}
if($this->oaid) {
// If current OAID is from correct Origin then do nothing
if($campaign->oaid_origin == "thetool") {
@@ -755,6 +781,13 @@ class Preorder extends mfBaseModel {
return false;
}
$campaign = new Preordercampaign($this->preordercampaign_id);
if($campaign->oaid_origin == "other") {
$this->log->debug(__METHOD__.": Kampagne unterstützt keine OAIDs");
return false;
}
if(!$this->oaid) {
$this->setOrCreateOaid();
if(!$this->oaid) {