Enabled Statusflags in Preorder Api

This commit is contained in:
Frank Schubert
2024-08-18 22:38:59 +02:00
parent 7531d700c0
commit 03a53bbbd2
5 changed files with 10 additions and 9 deletions

View File

@@ -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;
}

View File

@@ -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 = [];

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -10,7 +10,7 @@ class Preorderstatus extends mfBaseModel {
$a = [];
$a['code'] = (int)$this->code;
$a['text'] = $this->name;
//$a['flags'] = [];
$a['flags'] = [];
return $a;
}