@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user