enhanced preorder filter; fixed fixing wrong oaid origin

This commit is contained in:
Frank Schubert
2023-09-15 10:36:20 +02:00
parent 9fdf910858
commit d8ab02ba7d
12 changed files with 60 additions and 603 deletions
+19 -10
View File
@@ -42,17 +42,26 @@ class Preorder extends mfBaseModel {
if($this->oaid) {
// If current OAID is from correct Origin then do nothing
$current_oaid = OpenAccessIdModel::getFirstOaid($this->oaid);
if(!$current_oaid) {
return true; // this is a thetool oaid, so do nothing
}
if($campaign->oaid_origin == $current_oaid->origin) {
// also check if wohneinheit has no oaid and set it
if(!$wohneinheit->oaid) {
$wohneinheit->oaid = $current_oaid->oaid;
$wohneinheit->save();
if($campaign->oaid_origin == "thetool") {
$current_oaid = OpenAccessIdModel::getFirstOaid($this->oaid);
if($current_oaid) {
$this->log->warning("OAID of Preorder ".$this->id." should be thetool, but is OFAA");
}
} elseif($campaign->oaid_origin == "ofaa") {
$current_oaid = OpenAccessIdModel::getFirstOaid($this->oaid);
if(!$current_oaid) {
$this->log->error("OAID of Preorder ".$this->id." not found in OpenAccessIds");
// assume it's from a different origin
} else {
if($campaign->oaid_origin == $current_oaid->origin) {
// also check if wohneinheit has no oaid and set it
if(!$wohneinheit->oaid) {
$wohneinheit->oaid = $current_oaid->oaid;
$wohneinheit->save();
}
return true;
}
}
return true;
}
}