commit de compras

This commit is contained in:
2026-11-04 09:37:20 +02:00
parent fcf31e8d48
commit 0b05a1192c
741 changed files with 114127 additions and 116 deletions
+9
View File
@@ -0,0 +1,9 @@
<?php
use Illuminate\Support\Facades\DB;
$s=json_decode(file_get_contents(getenv('RECEIPT_COMPOSITION_STATE')),true);if(!($s['integrated']??false)||is_file($s['root'].'/integrated-baseline.json'))throw new LogicException('Fresh integrated composition required');
require $s['app'].'/vendor/autoload.php';$app=require $s['app'].'/bootstrap/app.php';$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();App\Modules\Purchasing\BudgetAdapter::guard();
$n=json_decode(file_get_contents($s['root'].'/native-fixture.json'),true);config(['database.connections.integrated_setup'=>$s['nativeConnection']]);$db=DB::connection('integrated_setup');$counts=[];
foreach(['requisitions','quotations','purchase_awards','purchase_orders','goods_receipts','invoices','budget_consumptions','pa_proposals','pa_obligations','external_payments']as$t){$counts[$t]=$db->table($t)->where('tenant_id',$n['tenant'])->count();if($counts[$t]!==0)throw new LogicException('Integrated main book must start empty: '.$t);}
if((int)$db->table('budget_entries')->where('tenant_id',$n['tenant'])->sum('reserved_minor')!==0||(int)$db->table('budget_entries')->where('tenant_id',$n['tenant'])->sum('committed_minor')!==0)throw new LogicException('No main reservation or commitment before request');
foreach(['request','supplier','sourcing','order','geography','invoice','obligation']as$mode)if(!is_file($s['root'].'/'.$mode.'-baseline.json'))throw new LogicException('Composition missing '.$mode);
file_put_contents($s['root'].'/integrated-baseline.json',json_encode(['passed'=>true,'main_counts'=>$counts,'native_reserved_minor'=>0,'native_committed_minor'=>0,'prepared_suppliers'=>3,'geography_rows'=>DB::table('geo_territories')->count(),'automatic_localisations'=>DB::table('geo_locations')->count(),'new_permission_names'=>[],'same_native_book'=>true,'previous_fixtures_upgraded'=>false,'visual_review'=>false],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));