commit compras 2711
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-27 13:49:31 +02:00
parent dc73540558
commit e709d900d1
81 changed files with 5352 additions and 107 deletions
@@ -225,6 +225,14 @@ class OrderCancellationWorkflow
abort_unless($distribution !== null, 503, 'Preserve a origem do compromisso.');
$source['version'] = DB::table('budget_order_bindings')->where('tenant_id', $actor->tenant_id)->where('distribution_id', $distribution->id)->count();
$source['plan_hash'] = json_decode($distribution->snapshot, true, 64, JSON_THROW_ON_ERROR)['plan_hash'];
foreach ($source['allocations'] as &$row) {
$current = DB::table('budget_order_allocations')->where('tenant_id', $actor->tenant_id)->where('distribution_id', $distribution->id)
->where('order_key', $order->getAttribute('order_key'))->where('allocation_key', $row['allocation_key'])->whereIn('kind', ['commit', 'amend']);
foreach (['subtotal_minor', 'total_minor'] as $field) {
$row[$field] = (int) (clone $current)->sum($field);
}
}
unset($row);
}
unset($source);
$adapter = app(CommonBudget::class);