From 03a53bbbd291240b987d1d0ccf911e346dc6befd Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Sun, 18 Aug 2024 22:38:59 +0200 Subject: [PATCH] Enabled Statusflags in Preorder Api --- application/Api/v1/PreorderApicontroller.php | 6 +++--- application/Preorder/Preorder.php | 6 +++--- application/Preorder/PreorderController.php | 4 ++-- .../PreorderStatusflagValue/PreorderStatusflagValue.php | 1 + application/Preorderstatus/Preorderstatus.php | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/application/Api/v1/PreorderApicontroller.php b/application/Api/v1/PreorderApicontroller.php index cc27d4160..afa0f4aa0 100644 --- a/application/Api/v1/PreorderApicontroller.php +++ b/application/Api/v1/PreorderApicontroller.php @@ -1038,13 +1038,13 @@ class PreorderApicontroller extends mfBaseApicontroller { $return['orderDate'] = date("Y-m-d",$preorder->order_date); } $return['status'] = $preorder->status->getApiArray(); - /*foreach($preorder->statusflags as $sflag) { + foreach($preorder->statusflags as $sflag) { $return['status']['flags'][$sflag->code] = [ - "code" => $sflag->code, + "code" => (int)$sflag->code, "text" => $sflag->name, "value" => ($sflag->value->value == 1) ]; - }*/ + } if($addon_data) { $return["additionalData"] = $addon_data; } diff --git a/application/Preorder/Preorder.php b/application/Preorder/Preorder.php index 35175b231..d11160a09 100644 --- a/application/Preorder/Preorder.php +++ b/application/Preorder/Preorder.php @@ -603,13 +603,13 @@ class Preorder extends mfBaseModel { $campaign = $this->getProperty("campaign"); $status = $this->getProperty("status")->getApiArray(); - /*foreach($this->getProperty("statusflags") as $sflag) { + foreach($this->getProperty("statusflags") as $sflag) { $status["flags"][$sflag->code] = [ - "code" => $sflag->code, + "code" => (int)$sflag->code, "text" => $sflag->name, "value" => ($sflag->value->value == 1) ]; - }*/ + } $a = []; diff --git a/application/Preorder/PreorderController.php b/application/Preorder/PreorderController.php index ba397ae6b..9e5249f9a 100644 --- a/application/Preorder/PreorderController.php +++ b/application/Preorder/PreorderController.php @@ -915,7 +915,7 @@ class PreorderController extends mfBaseController { $return = $this->savePatchpositionApi(); break; case "setStatusFlag": - $return = $this->setStatusFlagAction(); + $return = $this->setStatusFlagApi(); break; default: $return = false; @@ -930,7 +930,7 @@ class PreorderController extends mfBaseController { $this->returnJson($data); } - private function setStatusFlagAction() { + private function setStatusFlagApi() { $preorder_id = $this->request->preorder_id; $flag_id = $this->request->flag_id; $value = $this->request->value; diff --git a/application/PreorderStatusflagValue/PreorderStatusflagValue.php b/application/PreorderStatusflagValue/PreorderStatusflagValue.php index 31c93ccf7..a1a11b7ef 100644 --- a/application/PreorderStatusflagValue/PreorderStatusflagValue.php +++ b/application/PreorderStatusflagValue/PreorderStatusflagValue.php @@ -11,6 +11,7 @@ class PreorderStatusflagValue extends mfBaseModel { "old_value" => property_exists($this->_old_data, "value") ? $this->_old_data->value : null, "new_value" => $this->data->value ]); + $history->save(); $this->getProperty("preorder")->afterSave(); } diff --git a/application/Preorderstatus/Preorderstatus.php b/application/Preorderstatus/Preorderstatus.php index 8237f962d..0a257287e 100644 --- a/application/Preorderstatus/Preorderstatus.php +++ b/application/Preorderstatus/Preorderstatus.php @@ -10,7 +10,7 @@ class Preorderstatus extends mfBaseModel { $a = []; $a['code'] = (int)$this->code; $a['text'] = $this->name; - //$a['flags'] = []; + $a['flags'] = []; return $a; }