enabled deleting orders

This commit is contained in:
Frank Schubert
2021-08-09 17:01:40 +02:00
parent 38d13c3326
commit 7302470771
3 changed files with 35 additions and 2 deletions

View File

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