Started Contract Index
This commit is contained in:
@@ -4,6 +4,7 @@ class Order extends mfBaseModel {
|
||||
private $owner;
|
||||
private $billingaddress;
|
||||
private $products;
|
||||
private $contracts;
|
||||
private $terminations;
|
||||
private $journals;
|
||||
private $files;
|
||||
@@ -195,6 +196,16 @@ class Order extends mfBaseModel {
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
if($name == "contracts") {
|
||||
foreach($this->getProperty("products") as $product) {
|
||||
//var_dump($product);
|
||||
if($product->contract && $product->contract->id) {
|
||||
$this->contracts[] = $product->contract;
|
||||
}
|
||||
}
|
||||
return $this->contracts;
|
||||
}
|
||||
|
||||
if($name == "terminations") {
|
||||
$this->terminations = $this->getTerminations();
|
||||
return $this->terminations;
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user