commit de compras
This commit is contained in:
@@ -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));
|
||||
Reference in New Issue
Block a user