CHANGE_UI_Issues - VADIVEL J 2025-09-22

This commit is contained in:
vadivelJ96 2025-09-22 18:10:44 +05:30
parent 909ded80b4
commit 20f1a442a4

View File

@ -106,6 +106,8 @@ class ThzController extends BaseController
$emailNotificationResult = $this->ticketSaveNotification($data, $insertOrUpdate = $text, $id);
log_message('error', 'emailNotificationResult: ' . json_encode($emailNotificationResult));
return $this->response->setJSON([
'status' => $result ? 'success' : 'error',
'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again.",
@ -151,6 +153,7 @@ class ThzController extends BaseController
if ($returnType === 'api') {
if (empty($tickets)) {
// return $this->response->setJSON([ 'status' => 'error','message' => 'No tickets found'])->setStatusCode(404);
log_message('error', 'empty tickets in ticket list: ' . json_encode($tickets));
throw new \RuntimeException('No tickets found', 400);
}
} else {
@ -198,7 +201,7 @@ class ThzController extends BaseController
$result = $this->thzMasterNotesModel->insert($data);
if (empty($result)) {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(404);
log_message('error', 'Ticket conversation insert failed..!!: ' . json_encode($result));
throw new \RuntimeException('No tickets found', 404);
}
@ -246,6 +249,7 @@ class ThzController extends BaseController
$details = $this->thzMasterModel->ticketAutoFetchDetails($client_id, $mobile);
if (empty($details)) {
log_message('error', 'empty AutoFetchDetails for client_id : ' . json_encode($client_id));
throw new \RuntimeException('No Data found', 400);
}
@ -301,7 +305,7 @@ class ThzController extends BaseController
$notes = $this->thzMasterNotesModel->ticketConversationList($thz_id, $returnType);
$result['notes'] = !empty($notes) ? $notes : [];
} else {
// return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']))->setStatusCode(400);
log_message('error', 'No tickets found for ticket id ' . json_encode($thz_id));
throw new \RuntimeException('No tickets found', 400);
}
} else {
@ -365,6 +369,7 @@ class ThzController extends BaseController
if ($method === 'get') {
$types = $this->thzTypeModel->select('id,name,is_active')->where('is_active', 1)->findAll();
if (empty($types)) {
log_message('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);
@ -426,7 +431,7 @@ class ThzController extends BaseController
if (empty($details)) {
// return $this->response->setJSON([ 'status' => 'error','message' => 'No History found'])->setStatusCode(404);
log_message('error', 'No history details found for ticket id ' . json_encode($thz_id) );
throw new \RuntimeException('No History found', 404);
}
@ -625,6 +630,8 @@ class ThzController extends BaseController
$cc = getenv('G_ticketing_system_cc');
log_message('error', "env for cc G_ticketing_system_cc ".$cc);
$template = empty($assignee_email)
? 'ticket_save_create_user_unassigned'
: 'ticket_save_create_user_assigned';
@ -633,7 +640,7 @@ class ThzController extends BaseController
$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)) {
@ -676,10 +683,14 @@ class ThzController extends BaseController
$mailTemplate = $this->ticketMailTemplateModel->where('template_name', $templateName)->findAll()[0] ?? [];
if (empty($mailTemplate)) {
log_message('error','No Template Found');
log_message('error','No Mail Template Found To send email in ticketing system');
return;
}
if( empty($cc)){
log_message('error', 'empty cc attached for template name : ' . json_encode($templateName));
}
$mailTemplate['subject'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['subject']);
$mailTemplate['mail_content'] = str_replace('%subject%', $data['subject'] ?? '', $mailTemplate['mail_content']);