From 21731baf7d1d4d759d2dd30ef850f3c4b8ee96f8 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Thu, 30 Jan 2025 11:40:05 +0530 Subject: [PATCH 1/2] FIX_CLAIM_TYPE_IN_TICKET_HISTORY_SRI --- app/Controllers/TicketController.php | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index d202d2ab..1c9dc253 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -648,9 +648,9 @@ class TicketController extends BaseController -- Insured Employee ID Change old_insured_emp.name as old_insured_id_name, - new_insured_emp.name as new_insured_id_name + new_insured_emp.name as new_insured_id_name, - + ticket_master.ticket_type_id FROM ticket_history th @@ -664,6 +664,7 @@ class TicketController extends BaseController ON th.field_name = 'claim_status_id' AND th.old_value = old_status.id AND old_status.is_active = 1 + LEFT JOIN ticket_claim_status new_status ON th.field_name = 'claim_status_id' AND th.new_value = new_status.id @@ -684,6 +685,10 @@ class TicketController extends BaseController ON th.field_name = 'insured_emp_id' AND th.new_value = new_insured_emp.id + LEFT JOIN ticket_master as ticket_master + on th.field_name = 'claim_type' + AND th.ticket_id = ticket_master.id + WHERE @@ -714,32 +719,34 @@ class TicketController extends BaseController $row['new_value'] = $new_new_value; } elseif ($row['field_name'] == 'priority') { $new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-'; - $new_new_value = $priorityType[$row['new_value']]; + $new_new_value = isset($priorityType[$row['new_value']]) ? $priorityType[$row['new_value']] : '-'; $row['old_value'] = $new_old_value; $row['new_value'] = $new_new_value; } elseif ($row['field_name'] == 'relationship') { $new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-'; - $new_new_value = $relationshipType[$row['new_value']]; + $new_new_value = isset($relationshipType[$row['new_value']]) ? $relationshipType[$row['new_value']] : '-'; $row['old_value'] = $new_old_value; $row['new_value'] = $new_new_value; } elseif ($row['field_name'] == 'mode_of_intimation') { $new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-"; - $new_new_value = $modeOFIntimate[$row['new_value']]; + $new_new_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-"; + $row['old_value'] = $new_old_value; + $row['new_value'] = $new_new_value; + } elseif ($row['field_name'] == 'claim_type') { + $new_old_value = isset($claim_type[$row['ticket_type_id']][$row['old_value']]) ? $claim_type[$row['ticket_type_id']][$row['old_value']] : '-'; + $new_new_value = isset($claim_type[$row['ticket_type_id']][$row['new_value']])?$claim_type[$row['ticket_type_id']][$row['new_value']]:'-'; $row['old_value'] = $new_old_value; $row['new_value'] = $new_new_value; } elseif ($row['field_name'] == 'claim_type') { $new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-'; - $new_new_value = $claim_type[$row['new_value']]; - $row['old_value'] = $new_old_value; - $row['new_value'] = $new_new_value; - } elseif ($row['field_name'] == 'claim_type') { - $new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-'; - $new_new_value = $claim_type[$row['new_value']]; + $new_new_value = isset($claim_type[$row['new_value']]) ? $claim_type[$row['new_value']] : '-'; $row['old_value'] = $new_old_value; $row['new_value'] = $new_new_value; } else { $new_old_value = isset($row['old_value']) ? $row['old_value'] : '-'; + $new_new_value = isset($row['new_value']) ? $row['new_value'] : '-'; $row['old_value'] = $new_old_value; + $row['new_value'] = $new_new_value; } } From 5f0390887a95a77f26b76127085f69e4372da50b Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Thu, 30 Jan 2025 14:54:53 +0530 Subject: [PATCH 2/2] 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 @@