Added termination address in order list
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user