Contractqueue: commit to Contract finished

This commit is contained in:
Frank Schubert
2024-04-18 22:58:37 +02:00
parent b9f270fb10
commit e388c6e066
12 changed files with 932 additions and 721 deletions
+26 -1
View File
@@ -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();