Added Preorder cancel request UI changes
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user