@@ -24,6 +24,38 @@ if (DB::getDriverName() !== 'pgsql' || DB::connection()->getDatabaseName() !== $
|
||||
throw new LogicException('Review verification database mismatch.');
|
||||
}
|
||||
$request = DB::table('requisitions')->where('id', $proof['synthetic_fixture']['draft'])->first();
|
||||
if (in_array('--saved-searches', $argv, true)) {
|
||||
$owner = DB::table('users')->where('email', $proof['synthetic_fixture']['users']['owner'])->sole();
|
||||
$saved = DB::table('procurement_saved_searches')->sole();
|
||||
if ($saved->tenant_id !== $owner->tenant_id || $saved->user_id !== $owner->id || (int) $saved->version !== 4
|
||||
|| $saved->name !== 'Meus pedidos revistos QA' || $saved->term !== 'REQ' || $saved->archived_at !== null
|
||||
|| $request->status !== 'draft' || (int) $request->process_version !== 2
|
||||
|| DB::table('audit_logs')->where('requisition_id', $request->id)->where('action', 'requisition.updated')->exists()
|
||||
|| DB::table('budget_entries')->where('requisition_id', $request->id)->exists()
|
||||
|| DB::table('budget_distributions')->where('requisition_id', $request->id)->exists()
|
||||
|| DB::table('invoices')->exists()) {
|
||||
throw new RuntimeException('Saved criteria must preserve owner, four native versions and absence of draft or financial operations.');
|
||||
}
|
||||
echo json_encode(['native_private_search_cycle' => true, 'one_preference' => true, 'version' => 4, 'criterion_preserved' => true,
|
||||
'active_after_restore' => true, 'no_draft_update_reservation_or_invoice' => true], JSON_THROW_ON_ERROR).PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
if (in_array('--category', $argv, true)) {
|
||||
$line = DB::table('requisition_items')->where('requisition_id', $request->id)->sole();
|
||||
$context = json_decode($line->category_context, true, 32, JSON_THROW_ON_ERROR);
|
||||
if ($request->status !== 'draft' || (int) $request->process_version !== 3
|
||||
|| $context !== ['version' => 1, 'category' => 'office_equipment', 'reason' => 'Artigo sintético de escritório ainda sem entrada no catálogo.']
|
||||
|| $line->category !== 'Material' || $line->purchase_type !== 'consumable' || (int) $request->total_minor !== 10000
|
||||
|| DB::table('budget_entries')->where('requisition_id', $request->id)->exists()
|
||||
|| DB::table('budget_distributions')->where('requisition_id', $request->id)->exists()
|
||||
|| DB::table('audit_logs')->where('requisition_id', $request->id)->where('action', 'requisition.updated')->count() !== 1
|
||||
|| DB::table('invoices')->exists()) {
|
||||
throw new RuntimeException('Native classification save must preserve the original category, type, totals and absence of business effects.');
|
||||
}
|
||||
echo json_encode(['native_category_saved' => true, 'explicit_reason_preserved' => true, 'original_descriptors_and_totals_preserved' => true,
|
||||
'draft_version' => 3, 'one_update_audit' => true, 'no_reservation_or_invoice' => true], JSON_THROW_ON_ERROR).PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
$plan = json_decode($request->budget_distribution_preparation, true, 32, JSON_THROW_ON_ERROR);
|
||||
if ((int) $request->process_version !== 3 || $request->status !== 'draft' || count($plan['allocations']) !== 2
|
||||
|| array_column($plan['allocations'], 'subtotal_minor') !== [5000, 5000] || array_column($plan['allocations'], 'total_minor') !== [5000, 5000]
|
||||
|
||||
Reference in New Issue
Block a user