Added Order Form and File
This commit is contained in:
@@ -3,55 +3,61 @@
|
||||
class Order extends mfBaseModel {
|
||||
private $owner;
|
||||
private $billingaddress;
|
||||
private $products;
|
||||
private $files;
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
|
||||
public function getNewPos() {
|
||||
if(!$this->id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$p = end($this->getProperty("products"));
|
||||
return ++$p->pos;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($name == "owner") {
|
||||
if($this->id) {
|
||||
$this->owner = new Address($this->owner_id);
|
||||
return $this->owner;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->owner = new Address($this->owner_id);
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
if($name == "contact") {
|
||||
if($this->id) {
|
||||
$this->contact = new Address($this->contact_id);
|
||||
return $this->contact;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->contact = new Address($this->contact_id);
|
||||
return $this->contact;
|
||||
}
|
||||
|
||||
if($name == "billingaddress") {
|
||||
if($this->id) {
|
||||
$this->billingaddress = new Address($this->billingaddress_id);
|
||||
return $this->billingaddress;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->billingaddress = new Address($this->billingaddress_id);
|
||||
return $this->billingaddress;
|
||||
}
|
||||
|
||||
if($name == "products") {
|
||||
$this->products = OrderProductModel::search(["order_id" => $this->id]);
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
if($name == "files") {
|
||||
$this->files = OrderFileModel::search(['order_id' => $this->id]);
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
if($this->id) {
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
if($this->id) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
|
||||
Reference in New Issue
Block a user