Started Contract Index

This commit is contained in:
Frank Schubert
2022-05-24 17:23:14 +02:00
parent 814261f023
commit b0fe713d0d
8 changed files with 202 additions and 29 deletions

View File

@@ -366,6 +366,18 @@ class OrderController extends mfBaseController {
$this->layout()->setFlash("Bestellung nicht gefunden", "error");
$this->redirect("Order");
}
// refuse to save if there is a contract already
if($order->finish_date && is_array($order->contracts) && count($order->contracts)) {
$this->layout()->setFlash("Bestellung kann nicht mehr bearbeitet werden, da sie bereits abgeschlossen und in Verrechnung ist.", "error");
$this->redirect("Order", "edit", ['id' => $order->id]);
}
/*foreach($order->products as $p) {
if($p->contract && $p->contract->id) {
$this->layout()->setFlash("Bestellung kann nicht mehr bearbeitet werden, da sie bereits abgeschlossen und in Verrechnung ist.", "error");
$this->redirect("Order", "edit", ['id' => $order->id]);
}
}*/
} else {
$id = false;
$mode = "add";
@@ -827,7 +839,7 @@ class OrderController extends mfBaseController {
$of['order_id'] = $new_id;
$of['file_id'] = $file_id;
$of['name'] = $file->name;
$of['description'] = $file->description;
$of['description'] = $r->file_description;
$orderfile = OrderFileModel::create($of);
if(!$orderfile->save()) {