fix tests

This commit is contained in:
root
2026-06-11 11:46:12 -04:00
parent c91fa2ce4d
commit 5ead80fdc7
1489 changed files with 11349 additions and 10305 deletions
@@ -14,13 +14,12 @@ class PurchaseOrderReceiveService
{
public function __construct(
private InventoryMovementService $inventoryMovementService
) {
}
) {}
public function receive(int $poId, array $received, string $issuedBy): array
{
$po = PurchaseOrder::query()->find($poId);
if (!$po || in_array($po->status, [PurchaseOrder::STATUS_CANCELED, PurchaseOrder::STATUS_RECEIVED], true)) {
if (! $po || in_array($po->status, [PurchaseOrder::STATUS_CANCELED, PurchaseOrder::STATUS_RECEIVED], true)) {
throw new RuntimeException('PO not receivable.');
}
@@ -43,8 +42,9 @@ class PurchaseOrderReceiveService
->where('id', $itemId)
->first();
if (!$poItem) {
if (! $poItem) {
$completed = false;
continue;
}
@@ -67,7 +67,7 @@ class PurchaseOrderReceiveService
'supply_id' => $supply->id,
'type' => 'in',
'quantity' => $toReceive,
'ref' => 'PO ' . ($po->po_number ?? $po->id),
'ref' => 'PO '.($po->po_number ?? $po->id),
'issued_to' => 'Inventory',
'issued_by' => $issuedBy,
'notes' => 'Received against PO',
@@ -83,7 +83,7 @@ class PurchaseOrderReceiveService
qtyChange: $toReceive,
type: 'in',
reason: 'Purchase order received',
note: 'PO ' . ($po->po_number ?? $po->id),
note: 'PO '.($po->po_number ?? $po->id),
performedBy: $performedBy
);
}