enabled deleting orders
This commit is contained in:
@@ -247,7 +247,11 @@ class OrderController extends mfBaseController {
|
||||
if(is_numeric($r->billingaddress_id)) {
|
||||
$order_data['billingaddress_id'] = $r->billingaddress_id;
|
||||
}
|
||||
$order_data['billing_type'] = $r->billing_type;
|
||||
if($r->billing_type == "sepa") {
|
||||
$order_data['billing_type'] = "sepa";
|
||||
} else {
|
||||
$order_data['billing_type'] = "invoice";
|
||||
}
|
||||
$order_data['bank_account_bank'] = $r->bank_account_bank;
|
||||
$order_data['bank_account_owner'] = $r->bank_account_owner;
|
||||
$order_data['bank_account_iban'] = $r->bank_account_iban;
|
||||
@@ -411,5 +415,25 @@ class OrderController extends mfBaseController {
|
||||
|
||||
}
|
||||
|
||||
public function deleteAction() {
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$id = $this->request->id;
|
||||
|
||||
$order = new Order($id);
|
||||
if(!$order->id || $order->id != $id) {
|
||||
$this->layout()->setFlash("Bestellung nicht gefunden.", "error");
|
||||
$this->redirect("Order");
|
||||
}
|
||||
|
||||
$order->deletePositions();
|
||||
|
||||
// check if Product is unused
|
||||
$order->delete();
|
||||
$this->redirect("Order");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user