Added Preorder cancel request UI changes

This commit is contained in:
Frank Schubert
2025-09-17 12:15:52 +02:00
parent f6edba49a0
commit bad591e80d
4 changed files with 188 additions and 13 deletions

View File

@@ -1090,6 +1090,12 @@ class PreorderController extends mfBaseController {
case "saveStatusJournal":
$return = $this->saveStatusJournalApi();
break;
case "approveCancelRequest":
$return = $this->approveCancelRequest();
break;
case "denyCancelRequest":
$return = $this->denyCancelRequest();
break;
default:
$return = false;
}
@@ -1108,6 +1114,49 @@ class PreorderController extends mfBaseController {
}
}
protected function approveCancelRequest() {
return true; // disabled
$preorder_id = $this->request->pid;
$preorder = new Preorder($preorder_id);
if(!$preorder->id) {
$this->log->debug(__METHOD__.": Preorder $preorder_id not found");
return false;
}
if(!$preorder->cancel_request) {
$this->log->debug(__METHOD__.": Preorder $preorder_id has no cancel request");
return false;
}
}
protected function denyCancelRequest() {
return true; // disabled
$preorder_id = $this->request->pid;
$preorder = new Preorder($preorder_id);
if(!$preorder->id) {
$this->log->debug(__METHOD__.": Preorder $preorder_id not found");
return false;
}
if(!$preorder->cancel_request) {
$this->log->debug(__METHOD__.": Preorder $preorder_id has no cancel request");
return false;
}
// empty all cancel request fields
$preorder->cancel_request = null;
$preorder->cancel_request_by = null;
$preorder->cancel_request_status_code = null;
$preorder->cancel_request_execution_date = null;
$preorder->save();
return ["message" => "Cancel request removed"];
}
protected function saveStatusJournalApi() {
$preorder_id = $this->request->preorder_id;
$text = $this->request->text;