Changed to contractqueue and contract

This commit is contained in:
Frank Schubert
2024-08-01 20:45:44 +02:00
parent 489d081d35
commit 840c5b6f2a
9 changed files with 282 additions and 38 deletions

View File

@@ -32,6 +32,7 @@ class Contract extends mfBaseModel {
private $vatgroup;
private $vatrate;
private $voicenumbers;
private $files;
private $finisher;
private $canceler;
private $creator;
@@ -305,8 +306,28 @@ class Contract extends mfBaseModel {
]);
$journal->save();
}
}
public function addJournalFromOrder() {
if(!$this->orderproduct_id) {
return true;
}
$order = $this->getProperty("orderproduct")->order;
if(!$order || !$order->id) {
return true;
}
foreach($order->journals as $order_journal) {
$journal = ContractjournalModel::create([
'contract_id' => $this->id,
'type' => "text",
'value' => "",
'text' => $order_journal->text
]);
$journal->save();
}
return true;
}
public function getVoicenumbers() {
@@ -589,6 +610,14 @@ class Contract extends mfBaseModel {
}
return $this->$name;
}
if($name == "files") {
$files = ContractFileModel::search(["contract_id" => $this->id]);
if($files) {
$this->files = $files;
return $this->files;
}
return [];
}
if($name == "finisher") {
$this->finisher = mfValuecache::singleton()->get("Worker-id-" . $this->finish_date_by);