M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 12:05:53 +01:00
parent 9368dd2f10
commit e776eb0211
7 changed files with 25 additions and 26 deletions
@@ -260,7 +260,7 @@ class CloseShipment extends Controller
// ->get();
// PFC : Check that Picked / Packed are all Equal
foreach ($iCM688M2SL as $key => $ICM688M2SLR) {
foreach ($iCM688M2SL as $ICM688M2SLR) {
$a5PICKED = isset($ICM688M2SLR->A5PICKED) ? $ICM688M2SLR->A5PICKED : 0;
$a5RSVQTY = isset($ICM688M2SLR->A5RSVQTY) ? $ICM688M2SLR->A5RSVQTY : 0;
$a5ShortShipQty = (int) $a5RSVQTY - (int) $a5PICKED;
@@ -295,7 +295,7 @@ class CloseShipment extends Controller
->orderBy('AYINTBOX')
->get();
foreach ($iCM695M1JOINTMP as $ICM695M1JOINR) {
foreach ($iCM695M1JOINTMP as $key => $ICM695M1JOINR) {
$a4SHIPVIA = isset($ICM695M1JOINR->A4SHIPVIA) ? trim(str_replace('&', '_', $ICM695M1JOINR->A4SHIPVIA)) : '';
$sHIPTYPE = trim($ICM695M1JOINR->A4SHIPTYPE);
@@ -128,7 +128,11 @@ class UserPickingStats5 extends Controller
try {
$response = Http::withBasicAuth((string) $request->header('php-auth-user'), (string) $request->header('php-auth-pw'))
->get($url, ['dates' => $date, 'user' => $request->user, 'format' => 'json']);
$data = $response->successful() ? (json_decode($response->body(), true) ?: []) : [];
$data = [];
if ($response->successful()) {
$decoded = json_decode($response->body(), true);
$data = is_array($decoded) ? $decoded : [];
}
} catch (\Throwable $e) {
Log::warning('M3 picking statistics unavailable', ['date' => $date, 'exception' => $e->getMessage()]);
$data = [];