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