@@ -95,6 +95,7 @@ if ($mode === 'legacy-cycles') {
|
||||
}
|
||||
|
||||
if ($mode === 'prepare') {
|
||||
$urgent = ($argv[3] ?? '') === 'urgent';
|
||||
if (! $db->getSchemaBuilder()->hasTable('budget_requisition_cycles')) {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_27_000001_add_requisition_cycles.php')->up();
|
||||
}
|
||||
@@ -107,16 +108,17 @@ if ($mode === 'prepare') {
|
||||
Budget::query()->create(['tenant_id' => $owner->tenant_id, 'cost_center_id' => $f['r']->cost_center_id, 'year' => now()->year, 'kind' => 'operating',
|
||||
'amount_minor' => 100000, 'includes_tax' => true, 'reason' => 'Synthetic concurrent cycle budget', 'created_by' => $admin->id, 'approved_by' => $finance->id]);
|
||||
app(RequisitionExpiry::class)->savePolicy($admin, ['operation_key' => (string) Str::uuid(), 'version' => 0, 'enabled' => true,
|
||||
'levels' => [['role' => 'department_head', 'expire_minutes' => 30, 'reminder_minutes' => null, 'escalation_minutes' => null, 'profile_ids' => []]],
|
||||
'levels' => [['role' => 'department_head', 'expire_minutes' => 30, 'reminder_minutes' => null, 'escalation_minutes' => null, 'profile_ids' => [],
|
||||
...($urgent ? ['urgent_expire_minutes' => 5, 'urgent_reminder_minutes' => null, 'urgent_escalation_minutes' => null] : [])]],
|
||||
'reason' => 'Explicit synthetic concurrent expiry policy']);
|
||||
auth()->guard()->setUser($owner);
|
||||
$workflow = app(RequisitionWorkflow::class);
|
||||
$request = $workflow->save($owner, ['operation_key' => (string) Str::uuid(), 'cost_center_id' => $f['r']->cost_center_id, 'priority' => 'normal',
|
||||
$request = $workflow->save($owner, ['operation_key' => (string) Str::uuid(), 'cost_center_id' => $f['r']->cost_center_id, 'priority' => $urgent ? 'urgent' : 'normal',
|
||||
'needed_by' => today()->addWeek()->toDateString(), 'justification' => 'Synthetic simultaneous expiry and decision',
|
||||
'items' => [['description' => 'Synthetic item', 'category' => 'Material', 'purchase_type' => 'consumable', 'quantity' => '1.000', 'unit' => 'un', 'unit_price' => '100.00', 'tax_rate' => '0.00']]]);
|
||||
$workflow->submit($owner, $request, (string) Str::uuid(), $request->process_version);
|
||||
$request->refresh();
|
||||
Carbon::setTestNow(now()->addMinutes(31));
|
||||
Carbon::setTestNow(now()->addMinutes($urgent ? 6 : 31));
|
||||
echo json_encode(['tenant' => $owner->tenant_id, 'owner' => $owner->id, 'head' => $head->id, 'request' => $request->id,
|
||||
'version' => $request->process_version, 'clock' => now()->toIso8601String(),
|
||||
'basis' => app(RequisitionExpiry::class)->deadline($request)['basis_hash'], 'operation' => (string) Str::uuid()], JSON_THROW_ON_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user