From 45d52ed655f398daf2a1e76f23341e25410b7610 Mon Sep 17 00:00:00 2001 From: Tb Fajri Date: Sun, 10 Sep 2023 07:19:50 +0700 Subject: [PATCH] update fix --- .../Controllers/Api/LivechatController.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Modules/Internal/Http/Controllers/Api/LivechatController.php b/Modules/Internal/Http/Controllers/Api/LivechatController.php index c8074d8e..6c78e9fb 100644 --- a/Modules/Internal/Http/Controllers/Api/LivechatController.php +++ b/Modules/Internal/Http/Controllers/Api/LivechatController.php @@ -118,7 +118,25 @@ class LivechatController extends Controller $status = $liveChat->sStatus; $nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent $paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A'; - $fullNameDoctor = $liveChat->doctor->user != null ? $liveChat->doctor->user->detail->sTitlePrefix . ' ' . $liveChat->doctor->user->full_name . ' ' . $liveChat->doctor->user->detail->sTitleSuffix : '-' ; + $fullNameDoctor = '-'; + if ($liveChat->doctor->user !== null) { + $fullNameDoctor = ''; + + if ($liveChat->doctor->user->detail !== null) { + if ($liveChat->doctor->user->detail->sTitlePrefix !== null) { + $fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . ' '; + } + + if ($liveChat->doctor->user->full_name !== null) { + $fullNameDoctor .= $liveChat->doctor->user->full_name . ' '; + } + + if ($liveChat->doctor->user->detail->sTitleSuffix !== null) { + $fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix; + } + } + } + $recordType = 'P'; if ($nIDUser){ $recordType = 'D';