Fixed bug which prevented Preorder::afterSave() from running
This commit is contained in:
@@ -20,7 +20,8 @@ class Preorder extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function afterSave() {
|
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;
|
$this->in_after_save = true;
|
||||||
// update preorder OAID if it's different from the unit OAID
|
// 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
|
// 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) {
|
public function setOrCreateOaid($oaid_attributes = false) {
|
||||||
$campaign = new Preordercampaign($this->preordercampaign_id);
|
$campaign = new Preordercampaign($this->preordercampaign_id);
|
||||||
|
//var_dump($campaign);exit;
|
||||||
if(!$campaign->id) {
|
if(!$campaign->id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -53,6 +55,7 @@ class Preorder extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
} elseif($campaign->oaid_origin == "ofaa") {
|
} elseif($campaign->oaid_origin == "ofaa") {
|
||||||
$current_oaid = OpenAccessIdModel::getFirstOaid($this->oaid);
|
$current_oaid = OpenAccessIdModel::getFirstOaid($this->oaid);
|
||||||
|
//var_dump($current_oaid);exit;
|
||||||
if(!$current_oaid) {
|
if(!$current_oaid) {
|
||||||
$this->log->error("OAID of Preorder ".$this->id." not found in OpenAccessIds");
|
$this->log->error("OAID of Preorder ".$this->id." not found in OpenAccessIds");
|
||||||
// assume it's from a different origin
|
// assume it's from a different origin
|
||||||
|
|||||||
Reference in New Issue
Block a user