Added termination address in order list
This commit is contained in:
@@ -46,8 +46,11 @@
|
||||
<?=$order->owner->zip?> <?=$order->owner->city?>
|
||||
</td>
|
||||
<td>
|
||||
<?=$order->termination->building->street?><?=($order->termination->name) ? " ".$order->termination->name : ""?><br />
|
||||
<?=$order->termination->building->zip?> <?=$order->termination->building->city?>
|
||||
<?php if(is_array($order->terminations) && count($order->terminations)): ?>
|
||||
|
||||
<?=$order->terminations[0]->building->street?><?=($order->terminations[0]->name) ? " ".$order->terminations[0]->name : ""?><br />
|
||||
<?=$order->terminations[0]->building->zip?> <?=$order->terminations[0]->building->city?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-monospace"><?=date("d.m.Y", $order->order_date)?></td>
|
||||
<td class="text-monospace"><?=date("d.m.Y", $order->edit)?></td>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class OrderProduct extends mfBaseModel {
|
||||
private $order;
|
||||
private $product;
|
||||
private $termination;
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user