Contract WIP & Contractqueue WIP 2024-04-18
This commit is contained in:
@@ -50,6 +50,9 @@ class Contract extends mfBaseModel {
|
||||
case "link":
|
||||
$this->linkTo[] = $link;
|
||||
break;
|
||||
case "credit":
|
||||
$this->linkFrom[] = $link;
|
||||
break;
|
||||
case "upgrade":
|
||||
$this->upgradeTo[] = $link;
|
||||
break;
|
||||
@@ -73,6 +76,9 @@ class Contract extends mfBaseModel {
|
||||
case "link":
|
||||
$this->linkFrom[] = $link;
|
||||
break;
|
||||
case "credit":
|
||||
$this->linkTo[] = $link;
|
||||
break;
|
||||
case "upgrade":
|
||||
$this->upgradeFrom[] = $link;
|
||||
break;
|
||||
@@ -126,7 +132,40 @@ class Contract extends mfBaseModel {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function addFilesFromOrder() {
|
||||
if(!$this->orderproduct_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$op = $this->getProperty("orderproduct");
|
||||
$order = $op->order;
|
||||
if(!$order || !$order->id) return true;
|
||||
|
||||
foreach($order->files as $file) {
|
||||
$cfile = ContractFileModel::create([
|
||||
"contract_id" => $this->id,
|
||||
"file_id" => $file->file_id,
|
||||
"name" => $file->name,
|
||||
"description" => $file->description,
|
||||
"create_by" => $file->create_by,
|
||||
"edit_by" => $file->edit_by
|
||||
]);
|
||||
$cfile->save();
|
||||
|
||||
$journal = ContractjournalModel::create([
|
||||
"contract_id" => $this->id,
|
||||
"type" => "file",
|
||||
"value" => $cfile->id,
|
||||
"text" => (array_key_exists($cfile->name, TT_ORDER_FILE_TYPES)) ? TT_ORDER_FILE_TYPES[$cfile->name] : $cfile->name
|
||||
]);
|
||||
$journal->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
@@ -227,7 +266,7 @@ class Contract extends mfBaseModel {
|
||||
}
|
||||
|
||||
if($name == "links") {
|
||||
$this->links = ContractLinkModel::includesContractId($this->id, ["type" => $link]);
|
||||
$this->links = ContractLinkModel::includesContractId($this->id, ["type" => "link"]);
|
||||
//var_dump($this->links);exit;
|
||||
return $this->links;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user