From 9d3eb5e8b9b79b4c28a9f0643b79943e6a3fe870 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Fri, 12 Apr 2019 18:28:30 +0800 Subject: [PATCH] large changes --- .../Modules/Orders/Services/ListsOrderHistory.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Classes/Modules/Orders/Services/ListsOrderHistory.php b/app/Classes/Modules/Orders/Services/ListsOrderHistory.php index c3401f5..53ec1e8 100644 --- a/app/Classes/Modules/Orders/Services/ListsOrderHistory.php +++ b/app/Classes/Modules/Orders/Services/ListsOrderHistory.php @@ -47,8 +47,12 @@ class ListsOrderHistory $shippingSchedules = $shippingArrangment->shippingSchedule()->get(); foreach ($shippingSchedules as $schedule){ if($schedule->status === "2"){ - $customeIssue = CustomIssues::where('schedule_id', $schedule->id)->firstOrFail(); - $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]); + $customeIssue = CustomIssues::where('schedule_id', $schedule->id)->first(); + if($customeIssue){ + $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]); + } else { + $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']); + } } else { $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Your Order has been scheduled for shipping ']); } @@ -76,7 +80,11 @@ class ListsOrderHistory foreach ($shippingSchedules as $schedule){ if($schedule->status === "2"){ $customeIssue = CustomIssues::where('schedule_id', $schedule->id)->firstOrFail(); - $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]); + if($customeIssue){ + $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]); + } else { + $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']); + } } else { $history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Your Order has been scheduled for shipping ']); }