Erfasse Shopify-Bestellungen trotz Fehlbestand
This commit is contained in:
1 parent
ba23c58dea
commit
ed8927b37d
7 files changed
+266
-31
No files matched your search
@@ -197,8 +197,6 @@ function project_shopify_order(PDO $pdo, string $orderGid, callable $orderLoader
|
||||
if ($resolvedLines === []) {
|
||||
throw new RuntimeException('Shopify-Bestellung enthaelt keine Positionen');
|
||||
}
|
||||
shopify_projection_stock_check($pdo, $resolvedLines);
|
||||
|
||||
if ($dryRun) {
|
||||
$customer = is_array($order['customer'] ?? null) ? $order['customer'] : [];
|
||||
shopify_projection_customer($pdo, $customer, true);
|
||||
@@ -208,6 +206,7 @@ function project_shopify_order(PDO $pdo, string $orderGid, callable $orderLoader
|
||||
'sales_order_id' => null,
|
||||
'line_count' => count($resolvedLines),
|
||||
'allocation_count' => 0,
|
||||
'virtual_allocation_count' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -256,6 +255,7 @@ function project_shopify_order(PDO $pdo, string $orderGid, callable $orderLoader
|
||||
$locations = get_default_location_ids($pdo);
|
||||
$lineNo = 0;
|
||||
$allocationCount = 0;
|
||||
$virtualAllocationCount = 0;
|
||||
foreach ($resolvedLines as $resolvedLine) {
|
||||
$lineNo++;
|
||||
$line = $resolvedLine['line'];
|
||||
@@ -289,6 +289,7 @@ function project_shopify_order(PDO $pdo, string $orderGid, callable $orderLoader
|
||||
$lineId = (int) $lineStmt->fetchColumn();
|
||||
$allocation = allocate_line_inventory($pdo, $orderId, $lineId, $lineNo, $qty, (int) $resolvedLine['sellable_item_id'], $locations, 'shopify-order');
|
||||
$allocationCount += (int) ($allocation['allocationCount'] ?? 0);
|
||||
$virtualAllocationCount += (int) ($allocation['virtualAllocationCount'] ?? 0);
|
||||
}
|
||||
|
||||
shopify_projection_address($pdo, $partyId, (array) ($order['billingAddress'] ?? []), 'billing', false);
|
||||
@@ -307,5 +308,6 @@ function project_shopify_order(PDO $pdo, string $orderGid, callable $orderLoader
|
||||
'sales_order_id' => $orderId,
|
||||
'line_count' => count($resolvedLines),
|
||||
'allocation_count' => $allocationCount,
|
||||
'virtual_allocation_count' => $virtualAllocationCount,
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user