From 5f0390887a95a77f26b76127085f69e4372da50b Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Thu, 30 Jan 2025 14:54:53 +0530 Subject: [PATCH] FIX_CLAIM_MODULE_OVERALL_WORKFLOW_SRI --- app/Controllers/TicketController.php | 35 +++++++++++++++++++++------- app/Views/ticket_form_gmc.php | 2 +- app/Views/ticket_mail_template.php | 2 +- app/Views/ticket_reply.php | 6 ++--- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 72b53ea3..92c19dc7 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -504,7 +504,7 @@ class TicketController extends BaseController $ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id); if (!$ticket_data) { - $this->myLogger->logme('ERROR', "No ticket data found for Ticket ID: $ticket_id"); + $this->myLogger->logme('error', "No ticket data found for Ticket ID: $ticket_id"); return null; } @@ -514,7 +514,7 @@ class TicketController extends BaseController $template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id); if (!$template_data) { - $this->myLogger->logme('ERROR', "No email template found for Claim Status ID: " . $ticket_data['claim_status_id']); + $this->myLogger->logme('error', "No email template found for Claim Status ID: " . $ticket_data['claim_status_id']); return null; } @@ -526,12 +526,12 @@ class TicketController extends BaseController // Validate Essential Fields if (empty($ticket_data['emp_mail'])) { - $this->myLogger->logme('ERROR', "Employee email is missing for Ticket ID: $ticket_id"); + $this->myLogger->logme('error', "Employee email is missing for Ticket ID: $ticket_id"); return null; } if (empty($subject) || empty($message)) { - $this->myLogger->logme('ERROR', "Generated email content is empty for Ticket ID: $ticket_id"); + $this->myLogger->logme('error', "Generated email content is empty for Ticket ID: $ticket_id"); return null; } @@ -548,7 +548,7 @@ class TicketController extends BaseController return $mailData; } catch (\Exception $e) { - $this->myLogger->logme('ERROR', "Exception in constructMailContent: " . $e->getMessage()); + $this->myLogger->logme('error', "Exception in constructMailContent: " . $e->getMessage()); return null; } } @@ -592,10 +592,24 @@ class TicketController extends BaseController $acm_mails = $this->ticketMasterModel->getTicketDataByTicketID($mail_data['ticket_id']); if (!$acm_mails) { - $this->myLogger->logme('ERROR', "No ACM mails found for Ticket ID: " . $mail_data['ticket_id']); + $this->myLogger->logme('error', "No ACM mails found for Ticket ID: " . $mail_data['ticket_id']); + $this->myLogger->logme('error', "Reply mail not send"); return false; } + $ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($mail_data['ticket_id']); + + if (!$ticket_data) { + $this->myLogger->logme('error', "No ticket data found for Ticket ID : " .$mail_data['ticket_id']); + $this->myLogger->logme('error', "Reply mail not send"); + return null; + } + + if(!empty($mail_data)){ + $mail_data['mail_content'] = $this->replacePlaceholders($mail_data['mail_content'], $ticket_data); + $mail_data['mail_subject'] = $this->replacePlaceholders($mail_data['mail_subject'], $ticket_data); + } + $this->myLogger->logme('error', "Fetched ACM emails"); $emailData = [ @@ -616,11 +630,15 @@ class TicketController extends BaseController public function sendAutoMailTrigger($ticket_id) { $auto_mail_enable = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id); - + // print_rr($auto_mail_enable); $mail_responce = []; - if ($auto_mail_enable['is_auto_mail'] == 1) { + if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) { $mail_content = $this->constructMailContent($ticket_id); $mail_responce = $this->sendTrigger($mail_content); + }elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0 ){ + $this->myLogger->logme('error','Auto Mail Not Sent, Reason: Automail Not Enabled'); + }else{ + $this->myLogger->logme('error','Auto Mail Not Sent, Reason: Mail Template Not Created'); } return $mail_responce; @@ -748,6 +766,7 @@ class TicketController extends BaseController $new_new_value = isset($row['new_value']) ? $row['new_value'] : '-'; $row['old_value'] = $new_old_value; $row['new_value'] = $new_new_value; + } } diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index af966114..d24e22c7 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -176,7 +176,7 @@ if (isset($claim_type) && count($claim_type)) { foreach ($claim_type as $key => $value) { $selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : ''; - echo ""; + echo ""; } } ?> diff --git a/app/Views/ticket_mail_template.php b/app/Views/ticket_mail_template.php index f50859ab..e36b2718 100644 --- a/app/Views/ticket_mail_template.php +++ b/app/Views/ticket_mail_template.php @@ -194,7 +194,7 @@ table.dataTable tbody td { member_mobile - diff --git a/app/Views/ticket_reply.php b/app/Views/ticket_reply.php index 5bb94ef9..c3faa0b4 100644 --- a/app/Views/ticket_reply.php +++ b/app/Views/ticket_reply.php @@ -11,7 +11,7 @@ -
+
@@ -23,10 +23,10 @@