diff --git a/Layout/default/Order/Index.php b/Layout/default/Order/Index.php
index 81b947cbe..608e15f27 100644
--- a/Layout/default/Order/Index.php
+++ b/Layout/default/Order/Index.php
@@ -46,8 +46,11 @@
=$order->owner->zip?> =$order->owner->city?>
- =$order->termination->building->street?>=($order->termination->name) ? " ".$order->termination->name : ""?>
- =$order->termination->building->zip?> =$order->termination->building->city?>
+ terminations) && count($order->terminations)): ?>
+
+ =$order->terminations[0]->building->street?>=($order->terminations[0]->name) ? " ".$order->terminations[0]->name : ""?>
+ =$order->terminations[0]->building->zip?> =$order->terminations[0]->building->city?>
+
|
=date("d.m.Y", $order->order_date)?> |
=date("d.m.Y", $order->edit)?> |
diff --git a/application/Order/Order.php b/application/Order/Order.php
index e4b1c1385..a2bce9fc0 100644
--- a/application/Order/Order.php
+++ b/application/Order/Order.php
@@ -4,6 +4,7 @@ class Order extends mfBaseModel {
private $owner;
private $billingaddress;
private $products;
+ private $terminations;
private $files;
private $creator;
private $editor;
@@ -23,6 +24,28 @@ class Order extends mfBaseModel {
return ++$p->pos;
}
+ public function getTerminations() {
+ if(!$this->id) {
+ return false;
+ }
+
+ $products = $this->getProperty("products");
+
+ if(!is_array($products) || !count($products)) {
+ return false;
+ }
+
+ $terminations = [];
+
+ foreach($products as $product) {
+ if($product->termination_id) {
+ $terminations[] = $product->termination;
+ }
+ }
+ //var_dump($this->terminations);exit;
+ return $terminations;
+ }
+
public function getProperty($name) {
if($this->$name == null) {
@@ -50,6 +73,11 @@ class Order extends mfBaseModel {
return $this->products;
}
+ if($name == "terminations") {
+ $this->terminations = $this->getTerminations();
+ return $this->terminations;
+ }
+
if($name == "files") {
$this->files = OrderFileModel::search(['order_id' => $this->id]);
return $this->files;
diff --git a/application/OrderProduct/OrderProduct.php b/application/OrderProduct/OrderProduct.php
index f998c0261..0e9522c9f 100644
--- a/application/OrderProduct/OrderProduct.php
+++ b/application/OrderProduct/OrderProduct.php
@@ -3,6 +3,7 @@
class OrderProduct extends mfBaseModel {
private $order;
private $product;
+ private $termination;
private $editor;
private $creator;