@@ -29,6 +29,18 @@ class PurchaseOrder extends Model
|
||||
return ['snapshot' => 'array', 'issued_at' => 'datetime'];
|
||||
}
|
||||
|
||||
/** Older synthetic documents may predate the complete frozen document structure. */
|
||||
public function hasCompleteDocumentSnapshot(): bool
|
||||
{
|
||||
foreach (['company', 'department', 'cost_center', 'requisition', 'issuer', 'requester', 'supplier', 'quotation', 'award', 'approval_rules', 'decision_matrix', 'final_approvals'] as $key) {
|
||||
if (! is_array($this->snapshot[$key] ?? null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return HasMany<PurchaseOrderItem, $this> */
|
||||
public function items(): HasMany
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user