Files
SGF/scripts/sgf-cash-rule-policy.php
2026-11-11 09:00:17 +02:00

3 lines
807 B
PHP

<?php
$book='regression';require __DIR__.'/sgf-single-bootstrap.php';$native->transaction(function()use($native,$f){foreach(['cash.receipt_classified','cash.expense_confirmed'] as $kind){$row=$native->table('gl_rules')->where($f['scope'])->where('rule_key',$kind)->orderByDesc('version')->firstOrFail();if($row->policy==='QA-CASH-JOURNAL-v1')continue;if($native->table('gl_journals')->where('snapshot->source->effect_type',$kind)->exists())throw new LogicException('Cannot change posted fixture rule');$v=(array)$row;unset($v['id']);$v['version']++;$v['policy']='QA-CASH-JOURNAL-v1';$v['reason']='Completar a regra QA antes da primeira prova, sem alterar versões antigas.';$native->table('gl_rules')->insert($v);}});echo json_encode(['passed'=>true,'regression_only'=>true,'journals_changed'=>0]).PHP_EOL;