OrderActionsForm::docancel PHP Method

docancel() public method

Take the order that this was to be change on, and set the status that was requested from the form request data.
public docancel ( array $data, Form $form )
$data array The form request data submitted
$form Form The {@link Form} this was submitted on
    public function docancel($data, $form)
    {
        if (self::config()->allow_cancelling && $this->order->canCancel()) {
            $this->order->Status = 'MemberCancelled';
            $this->order->write();
            if (self::config()->email_notification) {
                OrderEmailNotifier::create($this->order)->sendCancelNotification();
            }
            $this->controller->sessionMessage(_t("OrderForm.OrderCancelled", "Order sucessfully cancelled"), 'warning');
            if (Member::currentUser() && ($link = $this->order->Link())) {
                $this->controller->redirect($link);
            } else {
                $this->controller->redirectBack();
            }
        }
    }