From aecec270dc1254bb6a92bf9fbe2e5fbf3d402809 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Wed, 24 Sep 2025 18:51:40 +0530 Subject: [PATCH 1/5] CHANGE_UI_Issues - VADIVEL J 2025-09-24 --- app/Controllers/ThzController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index eb2708d3..457ec66a 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -145,6 +145,11 @@ class ThzController extends BaseController $data = $this->request->getGet(); + if ($returnType === 'web' && in_array(get_role_id(), [3, 4])) { + $data['assign_to'] = $data['assign_to'] ?? get_session_userid(); + } + + $tickets = $this->fetchTicketsBasedOnrole($data); From 4abee8faec71f56021e8c06f75170dd8997595a9 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Thu, 25 Sep 2025 15:09:41 +0530 Subject: [PATCH 2/5] CHANGE_UI_Issues - VADIVEL J 2025-09-25 --- app/Config/Autoload.php | 4 +- app/Controllers/ThzController.php | 216 +++++++++--------------------- app/Helpers/ExceptionHelper.php | 35 +++++ 3 files changed, 100 insertions(+), 155 deletions(-) create mode 100644 app/Helpers/ExceptionHelper.php diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index a1a4356c..525acb3c 100755 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -100,5 +100,7 @@ class Autoload extends AutoloadConfig * @var string[] * @phpstan-var list */ - public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload', 'excel_import_export', 'file', 'drive','ExcelSanitizeHelper', 'api_helper']; + public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload', + 'excel_import_export', 'file', 'drive','ExcelSanitizeHelper', 'api_helper','ExceptionHelper' +]; } diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php index 457ec66a..0f8125b3 100644 --- a/app/Controllers/ThzController.php +++ b/app/Controllers/ThzController.php @@ -69,30 +69,7 @@ class ThzController extends BaseController $old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray(); $result = $this->updateTicket($data); - if ($old && isset($data['status'])) { - - if ($old['status'] != $data['status']) { - $history = [ - 'thz_id' => $data['thz_id'], - 'field_name' => 'status', - 'display_name' => 'Status', - 'old_value' => $old['status'], - 'new_value' => $data['status'], - 'is_active' => 1 - ]; - - if (!empty(get_session_userid())) { - $history['created_by'] = get_session_userid(); - } - - $hist_id = $this->thzHistoryModel->insert($history); - $references = $old['status'] . " - " . $data['status'] . " - " . $hist_id; - } else { - $references = $old['status'] . " - " . $data['status']; - } - } else { - $references = "No Details"; - } + $references = ($old && isset($data['status'])) ? $this->handleTicketHistory($old, $data) : "No Details" ; $updateID = $data['thz_id']; } else { @@ -115,22 +92,10 @@ class ThzController extends BaseController 'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!', 'ref' => $references ])->setStatusCode($result ? 200 : 400); + + } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } @@ -161,7 +126,7 @@ class ThzController extends BaseController } } else { $data['ticket_data'] = $tickets; - $data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['3', '4'])->findAll(); + $data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['3', '4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu , 2-"manager l2 " - ivangalum assign pannalam // 3,4 remain person varannum. $data['client_list'] = $this->clientModel->getCreatedByUserName(); @@ -176,21 +141,7 @@ class ThzController extends BaseController 'data' => $tickets, ])->setStatusCode(200); } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } @@ -209,35 +160,19 @@ class ThzController extends BaseController throw new \RuntimeException('No tickets found', 404); } - if ($data['notes_type'] == "External") { - $emailNotificationResult = $this->ticketConversationSaveNotification($data); - } else { - $emailNotificationResult = false; - } - - + $emailNotificationResult = ($data['notes_type'] === "External") + ? $this->ticketConversationSaveNotification($data) + : false; return $this->response->setJSON([ 'status' => $result ? 'success' : 'error', 'message' => $result ? "Ticket Notes created successfully" : "Unable to create ticket notes. Please try again.", 'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed Or No Need..!!' ])->setStatusCode($result ? 200 : 400); + + } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } @@ -270,21 +205,7 @@ class ThzController extends BaseController return $this->response->setJSON(['status' => 'success', 'data' => $result])->setStatusCode(200); } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } @@ -300,7 +221,7 @@ class ThzController extends BaseController if ($thz_id) { $result['master'] = $this->thzMasterModel - ->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') + ->select('thz_master.*, user_profiles.first_name as assignee_name') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left') ->where('thz_master.thz_id', $thz_id) ->findAll(); @@ -309,7 +230,7 @@ class ThzController extends BaseController $notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType); $result['notes'] = !empty($notes) ? $notes : []; } else { - $this->myLogger->logme('error', 'No tickets found for ticket id ' . json_encode($thz_id)); + $this->myLogger->logme('error', 'No tickets found for ticket id ' . json_encode($thz_id)); throw new \RuntimeException('No tickets found', 400); } } else { @@ -321,21 +242,7 @@ class ThzController extends BaseController try { return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200); } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } else { @@ -347,7 +254,7 @@ class ThzController extends BaseController : ''; $result['related_tickets'] = $this->thzMasterModel - ->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name') + ->select('thz_master.*, user_profiles.first_name as assignee_name') ->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left') ->where('thz_master.assign_to', $assign_to) ->where('thz_master.mobile', $mobile) @@ -373,7 +280,7 @@ class ThzController extends BaseController if ($method === 'get') { $types = $this->thzTypeModel->select('id,name,is_active')->where('is_active', 1)->findAll(); if (empty($types)) { - $this->myLogger->logme('error', 'No ticket types found '); + $this->myLogger->logme('error', 'No ticket types found '); return $this->response->setJSON(['status' => 'error', 'message' => 'No ticket types found'])->setStatusCode(404); } return $this->response->setJSON(['status' => 'success', 'data' => $types])->setStatusCode(200); @@ -402,21 +309,7 @@ class ThzController extends BaseController } return $this->response->setJSON(['status' => 'error', 'message' => 'Invalid request method'])->setStatusCode(405); } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } @@ -426,7 +319,7 @@ class ThzController extends BaseController $data = $this->request->getGet(); $thz_id = $data['thz_id']; // $details = $this->thzHistoryModal->whereIn('thz_id', $thz_id)->where('is_active', 1)->get()->getResultArray(); - $details = $this->thzHistoryModel->select('thz_history.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as created_name') + $details = $this->thzHistoryModel->select('thz_history.*, user_profiles.first_name as created_name') ->join('user_profiles', 'user_profiles.id = thz_history.created_by', 'left') ->where('thz_history.thz_id', $thz_id)->where('thz_history.is_active', 1) ->orderBy('thz_history.created_at', 'desc') @@ -435,28 +328,14 @@ class ThzController extends BaseController if (empty($details)) { - $this->myLogger->logme('error', 'No history details found for ticket id ' . json_encode($thz_id) ); + $this->myLogger->logme('error', 'No history details found for ticket id ' . json_encode($thz_id)); throw new \RuntimeException('No History found', 404); } return $this->response->setJSON(['status' => 'success', 'data' => $details])->setStatusCode(200); } catch (\Throwable $e) { - $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; - - $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException - || $e instanceof \mysqli_sql_exception - || $e instanceof \PDOException; - - $context = ['title' => get_class($e), 'type' => get_class($e), 'code' => $code, 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]; - - $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); - - return $this->response->setJSON([ - 'status' => 'error', - 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), - 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() - ])->setStatusCode($code); + return handle_exception($e, $this->myLogger, $this->response); } } @@ -634,23 +513,23 @@ class ThzController extends BaseController $cc = getenv('G_ticketing_system_cc'); - $this->myLogger->logme('error', "env for cc G_ticketing_system_cc ".$cc); + $this->myLogger->logme('error', "env for cc G_ticketing_system_cc " . $cc); - $template = empty($assignee_email) - ? 'ticket_save_create_user_unassigned' + $template = empty($assignee_email) + ? 'ticket_save_create_user_unassigned' : 'ticket_save_create_user_assigned'; if (!empty($assignee_email)) { $data['assignee_email'] = $assignee_email; } - $this->sendEmail($template, $data, $user_email, $ticketId); + $this->sendEmail($template, $data, $user_email, $ticketId); // send to account manager and if it is more than one email also no problem we send to all account managers if (!empty($account_manager_email)) { - $this->myLogger->logme('error', "mail sent for account manager ". json_encode($account_manager_email)); + $this->myLogger->logme('error', "mail sent for account manager " . json_encode($account_manager_email)); $this->sendEmail($template, $data, $account_manager_email, $ticketId, $cc); - }else{ + } else { $this->myLogger->logme('error', "mail not sent for account manager "); } @@ -684,19 +563,19 @@ class ThzController extends BaseController } - private function sendEmail($templateName, $data, $to_email, $ticketId , $cc = "", $bcc = "") + private function sendEmail($templateName, $data, $to_email, $ticketId, $cc = "", $bcc = "") { $mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? []; if (empty($mailTemplate)) { - $this->myLogger->logme('error','No Mail Template Found To send email in ticketing system'); + $this->myLogger->logme('error', 'No Mail Template Found To send email in ticketing system'); return; } - if( empty($cc)){ + if (empty($cc)) { $this->myLogger->logme('error', 'empty cc attached for template name : ' . json_encode($templateName)); - }else{ + } else { $this->myLogger->logme('error', "cc attached for template name : " . json_encode($templateName)); } @@ -724,7 +603,6 @@ class ThzController extends BaseController $res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $to_mail, 'cc' => $cc_string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]); $this->myLogger->logme('error', 'Mail Response : ' . json_encode($res)); - } @@ -744,4 +622,34 @@ class ThzController extends BaseController $data['policy_terms'] = $policy_terms; return view('view_policy_terms', $data); } + + + private function handleTicketHistory(array $old, array $data): string + { + if ($old['status'] != $data['status']) { + $history = [ + 'thz_id' => $data['thz_id'], + 'field_name' => 'status', + 'display_name' => 'Status', + 'old_value' => $old['status'], + 'new_value' => $data['status'], + 'is_active' => 1 + ]; + + if (!empty(get_session_userid())) { + $history['created_by'] = get_session_userid(); + } + + $hist_id = $this->thzHistoryModel->insert($history); + + return $old['status'] . " - " . $data['status'] . " - " . $hist_id; + } + + return $old['status'] . " - " . $data['status']; + } + + + + + } diff --git a/app/Helpers/ExceptionHelper.php b/app/Helpers/ExceptionHelper.php new file mode 100644 index 00000000..c3211950 --- /dev/null +++ b/app/Helpers/ExceptionHelper.php @@ -0,0 +1,35 @@ +getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = [ + 'title' => get_class($e), + 'type' => get_class($e), + 'code' => $code, + 'message' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine() + ]; + + if ($logger) { + $logger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + } else { + log_message('error', "Exception: {$context['message']} in {$context['file']} on line {$context['line']}"); + } + + return $response->setJSON([ + 'status' => 'error', + 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine() + ])->setStatusCode($code); + } +} + From 3f19dea5307bb1a6b2a583df3b6142da50381a4c Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 25 Sep 2025 17:01:01 +0530 Subject: [PATCH 3/5] FIX_Dropdown converted in updward --- app/Views/UserList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Views/UserList.php b/app/Views/UserList.php index 544b544b..001fa6a7 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -920,7 +920,8 @@ table.dataTable tbody td { enableFiltering: false, enableCaseInsensitiveFiltering: false, includeSelectAllOption : false, - buttonWidth:'100%' + buttonWidth:'100%', + dropUp: true }); $('.close').click(function(){ From 439156863e51fc853e0e13e8770c34ae5be24a17 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 26 Sep 2025 14:46:35 +0530 Subject: [PATCH 4/5] CHANGE_POLICY_NO_DUB : RV --- app/Views/client_policy.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 90a5a4bf..24b3b6b2 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -129,7 +129,7 @@
- +
@@ -1832,33 +1832,35 @@ } - $('#policy_no').change(function(){ + //check dublicate policy number + function checkPolicyNo() { - var policy_no = $(this).val(); - console.log(policy_no +'-'+policy_no.length); + var policy_no = $('#policy_no').val(); + console.log(policy_no + '-' + policy_no.length); policy_no = policy_no.trim(); - console.log(policy_no +'-'+policy_no.length); - + console.log(policy_no + '-' + policy_no.length); $.ajax({ - url: ''+policy_no, + url: '' + policy_no, type: "GET", dataType: 'json', success: function (res) { + console.log(res); + if (res.status == true) { - console.log(res) - if(res.status == true){ toastr.warning(res.message, 'warning'); $('#policy_no').val(''); + + }else{ + } }, error: function (xhr, status, error) { console.error(xhr.responseText); console.error(status, error); - } + } }); - - }) + } $(document).ready(function () { // Check if the URL contains a hash From d28f5c1140ce36fd6ab75f92385313bd88bff854 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 26 Sep 2025 14:50:10 +0530 Subject: [PATCH 5/5] CHANGE_POLICY_NO_DUB : RV --- app/Views/client_policy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 24b3b6b2..541a6a98 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -129,7 +129,7 @@
- +