commit melhorias compras3
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-22 10:56:58 +02:00
parent 4fac443dda
commit efd97e265b
130 changed files with 8917 additions and 363 deletions
+5 -2
View File
@@ -112,9 +112,10 @@ class PurchaseWorkflow
});
}
public function issue(User $user, PurchaseAward $award): PurchaseOrder
/** @param list<array<string,mixed>> $agreementBindings */
public function issue(User $user, PurchaseAward $award, array $agreementBindings = []): PurchaseOrder
{
return DB::transaction(function () use ($user, $award) {
return DB::transaction(function () use ($user, $award, $agreementBindings) {
$this->guard->lockCompany($user);
$user = app(CurrentActor::class)->lock($user, [PurchasingRole::Procurement]);
abort_if(app(OrganizationAccess::class)->maintenanceOnly($user), 403);
@@ -125,6 +126,7 @@ class PurchaseWorkflow
$existing = PurchaseOrder::query()->where('requisition_id', $requisition->id)->first();
if ($existing) {
app(OrderCancellationWorkflow::class)->assertOperational($existing);
app(AgreementOrderLimits::class)->assertReplay($existing, $agreementBindings);
return $existing;
}
@@ -163,6 +165,7 @@ class PurchaseWorkflow
}
}
$snapshot = [
...app(AgreementOrderLimits::class)->freeze($user, $quote, $requisition, $lines, $agreementBindings),
...($quote->exchange_basis === null ? [] : ['exchange_basis' => $quote->exchange_basis, 'reference_amounts' => app(QuotationExchange::class)->amounts($quote)]),
...($catalogueSources === [] ? [] : ['catalogue_sources' => $catalogueSources]),
'development_only' => true, 'budget_checked' => false,