From 95f22ec8e6fbe12899afdab635e9e4144f47dc94 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 12 Dec 2025 13:02:34 +0530 Subject: [PATCH] FIX_GMC_PARANTS_E_CARD_MAIL_ISSUE --- app/Controllers/EmpDataServiceController.php | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 8fa5f4bb..179aa7b3 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -5022,7 +5022,7 @@ class EmpDataServiceController extends BaseController $processedCount++; // Send batch emails or handle single email - if ($count == 20 || $processedCount == count($ids)) { + if ($count == 20 || $processedCount == count($emp_details)) { if (!empty($wholeData)) { if ($single_mail == 1) { $this->myLogger->logme('error', 'sendMailForDownloadingECard - Sending single mail'); @@ -5035,7 +5035,12 @@ class EmpDataServiceController extends BaseController $wholeData = []; $count = 0; } + }else{ + $this->myLogger->logme('error', 'sendMailForDownloadingECard - Whole mail data is empty'); } + }else{ + $idscount = count($ids); + $this->myLogger->logme('error', "sendMailForDownloadingECard - processedCount not equal to ids count, processedCount : {$processedCount} and ids count : {$idscount}"); } } @@ -5048,9 +5053,19 @@ class EmpDataServiceController extends BaseController return ['status' => false , 'message' => 'Employee Data not found']; } - } catch (\Exception $e) { - $this->myLogger->logme('error', 'sendMailForDownloadingECard - Exception occurred: {message}', ['message' => $e->getMessage()]); - return ['status' => false , 'message' => 'Exception occurred' . $e->getMessage()]; + } catch (\Exception $th) { + $errorData = [ + 'message' => $th->getMessage(), + 'file' => $th->getFile(), + 'line' => $th->getLine(), + 'code' => $th->getCode(), + 'trace' => $th->getTraceAsString(), + 'trace_array' => $th->getTrace(), // full array version (optional) + 'function' => $th->getTrace()[0]['function'] ?? null, + 'class' => $th->getTrace()[0]['class'] ?? null, + ]; + $this->myLogger->logme('error', 'sendMailForDownloadingECard - Exception occurred: {message}', ['message' => $th->getMessage()]); + return ['status' => false , 'message' => 'Exception occurred' . $th->getMessage(), 'error_data' => $errorData]; } }