From d0bcb9a3691033e6c69141778d1784014648fc62 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 28 Sep 2023 11:44:50 +0200 Subject: [PATCH] Fixed bug which prevented Preorder::afterSave() from running --- application/Preorder/Preorder.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/Preorder/Preorder.php b/application/Preorder/Preorder.php index 7163fe41c..e635feeba 100644 --- a/application/Preorder/Preorder.php +++ b/application/Preorder/Preorder.php @@ -20,7 +20,8 @@ class Preorder extends mfBaseModel { } public function afterSave() { - if(!$this->in_after_save) return true; + // prevent potential infinite loop + if($this->in_after_save) return true; $this->in_after_save = true; // update preorder OAID if it's different from the unit OAID // but only if the unit OAID is of the same origin as the campaign @@ -34,6 +35,7 @@ class Preorder extends mfBaseModel { public function setOrCreateOaid($oaid_attributes = false) { $campaign = new Preordercampaign($this->preordercampaign_id); + //var_dump($campaign);exit; if(!$campaign->id) { return false; } @@ -53,6 +55,7 @@ class Preorder extends mfBaseModel { } } elseif($campaign->oaid_origin == "ofaa") { $current_oaid = OpenAccessIdModel::getFirstOaid($this->oaid); + //var_dump($current_oaid);exit; if(!$current_oaid) { $this->log->error("OAID of Preorder ".$this->id." not found in OpenAccessIds"); // assume it's from a different origin