Added temporary script to create Contracts from Orders
This commit is contained in:
@@ -111,6 +111,22 @@ class Contract extends mfBaseModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function generateMatchcode() {
|
||||
$owner_address = $this->getProperty("owner")->street.", ".$this->getProperty("owner")->zip." ".$this->getProperty("owner")->city;
|
||||
|
||||
if($this->termination_id) {
|
||||
$termination = new Termination($this->termination_id);
|
||||
$termination_address = $termination->building->street.", ".$termination->building->zip." ".$termination->building->city;
|
||||
return $termination_address;
|
||||
}
|
||||
|
||||
if(stripos($this->getProperty("product")->name, "dsl") != false) {
|
||||
return $owner_address;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
@@ -136,12 +152,6 @@ class Contract extends mfBaseModel {
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if($name == "product") {
|
||||
$this->product = mfValuecache::singleton()->get("mfObjectmodel-Product-".$this->product_id);
|
||||
if($this->product === null) {
|
||||
@@ -164,6 +174,14 @@ class Contract extends mfBaseModel {
|
||||
return $this->orderproduct;
|
||||
}
|
||||
|
||||
|
||||
if(!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*if($name == "contractConfigGroups") {
|
||||
$product = $this->getProperty("product");
|
||||
$this->contractConfigGroups = ContractconfigGroupModel::search(['producttech_id' => $product->producttech_id]);
|
||||
@@ -265,7 +283,6 @@ class Contract extends mfBaseModel {
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
|
||||
Reference in New Issue
Block a user