Tracking Status from Sendcloud fixes

This commit is contained in:
Andreas Palm 2024-07-21 21:53:25 +02:00
parent e3488040ec
commit 1985a69cfa
2 changed files with 3 additions and 2 deletions

View File

@ -138,6 +138,7 @@ class SendCloudApi
case 'shipment-on-route': case 'shipment-on-route':
case 'driver-on-route': case 'driver-on-route':
$highest = ShipmentStatus::EnRoute; $highest = ShipmentStatus::EnRoute;
break;
case 'delivered': return ShipmentStatus::Delivered; case 'delivered': return ShipmentStatus::Delivered;
} }
} }

View File

@ -27,7 +27,7 @@ $shipments = $db->fetchGroup($shipments_sql);
foreach ($shipments as $module => $vps) { foreach ($shipments as $module => $vps) {
list($moduleId, $moduleName) = explode(';', $module,2); list($moduleId, $moduleName) = explode(';', $module,2);
$module = $app->erp->LoadVersandModul($moduleName, $moduleName); $module = $app->erp->LoadVersandModul($moduleName, intval($moduleId));
foreach ($vps as $vp) { foreach ($vps as $vp) {
$status = match ($module->GetShipmentStatus($vp['tracking'])) { $status = match ($module->GetShipmentStatus($vp['tracking'])) {
@ -38,6 +38,6 @@ foreach ($shipments as $module => $vps) {
}; };
if ($status === null || $status === $vp['status']) continue; if ($status === null || $status === $vp['status']) continue;
$db->perform('UPDATE versandpakete SET status = :status WHERE id = :id', $db->perform('UPDATE versandpakete SET status = :status WHERE id = :id',
[':status' => $status, ':id' => $vp['id']]); ['status' => $status, 'id' => $vp['id']]);
} }
} }