From ba2ac3f4b987c70230c65f6508f42fa96653845d Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 1 Nov 2025 12:43:13 +0530 Subject: [PATCH 1/3] CHANGE_CLAIM_FILE_UPLOAD_GET_DOC_NAME --- app/Controllers/EmployeeRestController.php | 6 ++++-- app/Helpers/utility_helper.php | 13 ++++++++----- app/Models/ClaimFilesModel.php | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 83015c20..9b3a3b53 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3471,6 +3471,7 @@ class EmployeeRestController extends AdminController $received_data = $this->request->getPost(); $this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? [])); $get_file_data = $this->request->getFiles('claim_docs'); + $get_docs_name = $this->request->getPost('claim_doc_names') ?? []; // print_r($get_file_data); die; $employee_id = $received_data['emp_id']; $client_policy_id = $received_data['client_policy_id']; @@ -3479,7 +3480,7 @@ class EmployeeRestController extends AdminController $file_data = []; if(isset($get_file_data) && !empty($get_file_data)){ $file_path = WRITEPATH . 'uploads/claim_files/'; - $file_data = multi_file_Upload($get_file_data, $file_path); + $file_data = multi_file_Upload($get_file_data, $file_path, $get_docs_name); } @@ -3629,7 +3630,8 @@ class EmployeeRestController extends AdminController $data = [ 'ticket_id' => $ticket_id, - 'doc_name' => $value['file_name'], + 'doc_name' => $value['doc_name'], + 'file_name' => $value['file_name'], 'url' => $value['file_path'], 'file_type' => 2, 'ticket_message_id' => $ticket_message_id, diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index 034de8ce..e42801b3 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -112,8 +112,9 @@ if (!function_exists('file_Upload_for_lead')) { // } // } +// function for only using in the Flutter Claim File Upload if (!function_exists('multi_file_Upload')) { - function multi_file_Upload($fileToUpload, $filepath) + function multi_file_Upload($fileToUpload, $filepath, $docs_name = []) { $uploadedFiles = []; @@ -123,13 +124,15 @@ if (!function_exists('multi_file_Upload')) { foreach ($files as $file) { // If file is itself an array (multiple under same input name) if (is_array($file)) { - foreach ($file as $f) { + foreach ($file as $index => $f) { if ($f !== null && $f->isValid() && !$f->hasMoved()) { - $fileName = $f->getRandomName(); // safer unique name - $f->move($filepath, $fileName); + $fileRandomName = $f->getRandomName(); // safer unique name + $f->move($filepath, $fileRandomName); + $fileName = $f->getName(); $uploadedFiles[] = [ 'file_name' => $fileName, - 'file_path' => $filepath . $fileName + 'doc_name' => $docs_name[$index] ?? $fileName, + 'file_path' => $filepath . $fileRandomName ]; } } diff --git a/app/Models/ClaimFilesModel.php b/app/Models/ClaimFilesModel.php index 8e22ae01..2d747e3d 100644 --- a/app/Models/ClaimFilesModel.php +++ b/app/Models/ClaimFilesModel.php @@ -19,7 +19,8 @@ class ClaimFilesModel extends Model 'updated_by', 'created_at', 'updated_at', - 'is_active' + 'is_active', + 'file_name', ]; // Callbacks From 44403126160132a15f992786c642b16dad441397 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 1 Nov 2025 15:08:34 +0530 Subject: [PATCH 2/3] CHANGE_CLAIM_FILE_UPLOAD --- app/Controllers/EmployeeRestController.php | 8 ++++++++ app/Controllers/TicketController.php | 6 +++++- app/Helpers/utility_helper.php | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 9b3a3b53..3e44328e 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3472,6 +3472,14 @@ class EmployeeRestController extends AdminController $this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? [])); $get_file_data = $this->request->getFiles('claim_docs'); $get_docs_name = $this->request->getPost('claim_doc_names') ?? []; + + if (is_string($get_docs_name)) { + $decoded = json_decode($get_docs_name, true); + $get_docs_name = json_last_error() === JSON_ERROR_NONE ? $decoded : []; + } elseif (!is_array($get_docs_name)) { + $get_docs_name = []; + } + // print_r($get_file_data); die; $employee_id = $received_data['emp_id']; $client_policy_id = $received_data['client_policy_id']; diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index eb7e894b..f6a924c2 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -1281,8 +1281,12 @@ class TicketController extends BaseController // $actionType = $this->request->getGet(); $claimFiles = new ClaimFilesModel(); $file_data = $claimFiles->where('id', $claim_file_id)->first(); - $fileName = $file_data['doc_name']; + // $fileName = $file_data['doc_name']; + $url = $file_data['url']; + $parts = explode('/', $url); + $fileName = end($parts); + $filePath = WRITEPATH . '/uploads/claim_files/' . $fileName; try { diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index e42801b3..8f976243 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -127,8 +127,8 @@ if (!function_exists('multi_file_Upload')) { foreach ($file as $index => $f) { if ($f !== null && $f->isValid() && !$f->hasMoved()) { $fileRandomName = $f->getRandomName(); // safer unique name - $f->move($filepath, $fileRandomName); $fileName = $f->getName(); + $f->move($filepath, $fileRandomName); $uploadedFiles[] = [ 'file_name' => $fileName, 'doc_name' => $docs_name[$index] ?? $fileName, From a5ee2c8d2bc15aba0bc3bc4ac834fdbf68625a53 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 1 Nov 2025 18:01:50 +0530 Subject: [PATCH 3/3] FIX_BDS_REPORT_CSV_ADD_BUSINESS_TYPE --- app/Views/report_bds.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index 5a1786f4..198d203a 100644 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -81,7 +81,7 @@ table.dataTable tbody td { S. No User Month - + Business Type Client Type Insured Name Policy/
Endorsement @@ -125,7 +125,7 @@ table.dataTable tbody td { ?>" class="mdi mdi-pencil" > - + @@ -279,9 +279,22 @@ $(document).ready(function() { text: ' CSV ', title: 'Policy-Tranction-BDS-List', exportOptions: { - columns: ':visible', // or specify exact columns [0,1,2,...] + columns: function (idx, data, node) { + return true; // ✅ include all columns (even hidden) + }, format: { body: function (data, row, column, node) { + + data = data.replace(/ /g, '').replace(/\s+/g, ' ').trim(); + + // If it's the first column (index 0), remove link and special chars + if (column === 0 || column === 20 || column === 11 ) { + // Remove all tags and their contents + data = data.replace(/]*>(.*?)<\/a>/gi, ''); + // Also remove other HTML tags and   + data = $('
').html(data).text().replace(/\u00a0/g, ' ').trim(); + } + // Force K and L columns to string if (column === 10 || column === 11) { // Option 1: prepend single quote