Contractqueue: commit to Contract finished
This commit is contained in:
@@ -16,6 +16,7 @@ class Contract extends mfBaseModel {
|
||||
private $isCancelled;
|
||||
private $journals;
|
||||
private $links;
|
||||
private $linksWithCredit;
|
||||
private $linkFrom;
|
||||
private $linkTo;
|
||||
private $upgradeFrom;
|
||||
@@ -116,6 +117,24 @@ class Contract extends mfBaseModel {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isFinished() {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$now = date('U');
|
||||
|
||||
if($this->finish_date && $this->finish_date <= $now) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->cancel_date && $this->cancel_date <= $now) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function generateMatchcode() {
|
||||
$owner_address = $this->getProperty("owner")->street.", ".$this->getProperty("owner")->zip." ".$this->getProperty("owner")->city;
|
||||
@@ -270,7 +289,13 @@ class Contract extends mfBaseModel {
|
||||
//var_dump($this->links);exit;
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
|
||||
if($name == "linksWithCredit") {
|
||||
$this->linksWithCredit = ContractLinkModel::includesContractId($this->id, ["type" => ["link", "credit"]]);
|
||||
//var_dump($this->links);exit;
|
||||
return $this->linksWithCredit;
|
||||
}
|
||||
|
||||
if(in_array($name, ['linkFrom','linkTo','upgradeFrom','upgradeTo','downgradeFrom','downgradeTo','productchangeFrom','productchangeTo','relocationFrom','relocationTo'])) {
|
||||
if($this->$name === null) {
|
||||
$this->getLinks();
|
||||
|
||||
Reference in New Issue
Block a user