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
+4
View File
@@ -0,0 +1,4 @@
<?php
use App\Models\{PurchaseAward,User};
use App\Services\PurchaseWorkflow;
if(!($s['invoices']??false)||is_file($s['root'].'/invoice-negative-prepared.json'))throw new LogicException('Fresh invoice negative fixture required');$f=json_decode(file_get_contents($s['root'].'/native-fixture.json'),true);$award=PurchaseAward::withoutGlobalScopes()->findOrFail($f['foreign_award']);$user=User::findOrFail($award->created_by);auth()->setUser($user);$order=app(PurchaseWorkflow::class)->issue($user,$award);$f['foreign_order']=$order->id;$f['foreign_order_line']=$order->items()->firstOrFail()->id;file_put_contents($s['root'].'/native-fixture.json',json_encode($f,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));file_put_contents($s['root'].'/invoice-negative-prepared.json',json_encode(['passed'=>true,'foreign_order_prepared'=>true,'main_book_changed'=>false],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));