From c05eeb195a2abeffc8c328dfa0fe74889a880642 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 11 Nov 2025 17:16:46 +0530 Subject: [PATCH 1/4] FIX_CHANGE_PASS_HASH_ISSUE --- app/Controllers/RestAuthenticationController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index e12a157..69d9e5e 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -1570,8 +1570,7 @@ class RestAuthenticationController extends AdminController if (isset($employeeData['employee_id']) && password_verify($old_password, $employeeData['password'])) { // Hash new password - // $newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT); - $newHashedPassword = $new_password; + $newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT); // Update password and clear OTP $updated = $this->employeeModel->update($employeeData['employee_id'], [ From 61a2a67e0b3864720314090e606da1e45704b189 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 12 Nov 2025 10:13:36 +0530 Subject: [PATCH 2/4] FIX_HR_CLIENT_DETAILS_ISSUE --- app/Controllers/EmployeeRestController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index d9a4d7b..f8bf125 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1782,7 +1782,7 @@ class EmployeeRestController extends AdminController $post_branch_id = $this->request->getGet('post_branch_id'); - if ($pre_client_id != null) { + if (!empty($pre_client_id)) { $client = $this->clientModel->where('id', $pre_client_id)->first(); @@ -1810,16 +1810,14 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); } - } elseif ($post_client_id != null) { + } elseif (!empty($post_client_id)) { - $restAuthController = new RestAuthenticationController; $queryParams = [ 'client_id' => $post_client_id, 'client_branch_id' => $post_branch_id ]; - return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails'); } else { From d38e253fbc938b6b2482c5730c53c036c1939605 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 13 Nov 2025 16:28:34 +0530 Subject: [PATCH 3/4] FIX_HR_SMPL_DOWNLOAD_LINK --- app/Config/Routes.php | 2 ++ app/Controllers/EmployeeRestController.php | 30 +++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index fb8e437..6912a8e 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -462,6 +462,8 @@ $routes->post("employeeRest/changePassword", "RestAuthenticationController::chan $routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword"); $routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp"); $routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword"); +$routes->get("employeeRest/downloadSampleExcel/(:any)", "EmployeeController::downloadSampleExcelFile/$1"); + // $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index f8bf125..fb01044 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -800,9 +800,17 @@ class EmployeeRestController extends AdminController $empServiceController = new EmployeeServiceController(); $result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]); if(isset($result['error_summary']) && count($result['error_summary'])) - { - $result = $empServiceController->getExcelErrorData($file_id); - return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "file upload failed with errors",'data' => $result], 200); + { + if(isset($result['error_type'])){ + $result = $empServiceController->getExcelErrorData($file_id); + return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "file upload failed with errors",'data' => $result], 200); + }else { + $message = "file upload failed with errors"; + if(isset($result['error_data'])){ + $message = $result['error_data']; + } + return $this->respond(['status' => 'failed', 'code' => 404, 'message' => $message,'data' => $result], 200); + } } @@ -1094,9 +1102,19 @@ class EmployeeRestController extends AdminController }else{ return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404); } - } catch (\Exception $e) { - $this->myLogger->logme("error", ($e->getMessage().' --- '.$e->getLine() . '----' . $e->getTraceAsString())); - return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } catch (\Throwable $th) { + $this->myLogger->logme("error", ($th->getMessage().' --- '.$th->getLine() . '----' . $th->getTraceAsString())); + $errorData = [ + 'message' => $th->getMessage(), + 'file' => $th->getFile(), + 'line' => $th->getLine(), + 'code' => $th->getCode(), + 'trace' => $th->getTraceAsString(), + 'trace_array' => $th->getTrace(), // full array version (optional) + 'function' => $th->getTrace()[0]['function'] ?? null, + 'class' => $th->getTrace()[0]['class'] ?? null, + ]; + return $this->respond(['status' => 'failed','code' => 500,'data' => $th->getMessage(), 'error_data' => $errorData], 500); } From 96c825197bf2d7c9d6f6cc4b67789013df2991b2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 13 Nov 2025 18:14:19 +0530 Subject: [PATCH 4/4] FEAT_HR_SAMPL_FILE_DOWNLOAD --- app/Config/Routes.php | 2 +- app/Controllers/EmployeeController.php | 41 ++++++++++++++++------ app/Controllers/EmployeeRestController.php | 13 +++++++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6912a8e..d5cc961 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -462,7 +462,7 @@ $routes->post("employeeRest/changePassword", "RestAuthenticationController::chan $routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword"); $routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp"); $routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword"); -$routes->get("employeeRest/downloadSampleExcel/(:any)", "EmployeeController::downloadSampleExcelFile/$1"); +$routes->get("employeeRest/downloadSampleExcel", "EmployeeRestController::downloadSampleExcel"); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 564fc92..dcb7ec7 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -412,27 +412,48 @@ class EmployeeController extends AdminController * @return redirect back with an error message if the file is not found, otherwise sends the file to the user for download. */ - public function downloadSampleExcelFile($actionType = null) + public function downloadSampleExcelFile($actionType = null, $return_type = 0) { // $actionType = $this->request->getGet(); $filePath = ''; + // Path to your file if ($actionType == 'inception') { - $filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_inception.xls') + : ROOTPATH . 'public/sample_excel/sample_inception.xls'; } else if ($actionType == 'correction') { - $filePath = ROOTPATH . 'public/sample_excel/sample_correction .xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_correction.xls') + : ROOTPATH . 'public/sample_excel/sample_correction.xls'; } else if ($actionType == 'si_enhancement') { - $filePath = ROOTPATH . 'public/sample_excel/sample_si_enhancement.xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_si_enhancement.xls') + : ROOTPATH . 'public/sample_excel/sample_si_enhancement.xls'; } else if ($actionType == 'dependent_addtion') { - $filePath = ROOTPATH . 'public/sample_excel/sample_dependent_addition.xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_dependent_addition.xls') + : ROOTPATH . 'public/sample_excel/sample_dependent_addition.xls'; } else if ($actionType == 'addition') { - $filePath = ROOTPATH . 'public/sample_excel/sample_addition.xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_addition.xls') + : ROOTPATH . 'public/sample_excel/sample_addition.xls'; } else if ($actionType == 'deletion') { - $filePath = ROOTPATH . 'public/sample_excel/sample_deletion.xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_deletion.xls') + : ROOTPATH . 'public/sample_excel/sample_deletion.xls'; } else if ($actionType == 'enrollment') { - $filePath = ROOTPATH . 'public/sample_excel/enrollment.xlsx'; - }else if ($actionType == 'missed_inception') { - $filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls'; + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/enrollment.xlsx') + : ROOTPATH . 'public/sample_excel/enrollment.xlsx'; + } else if ($actionType == 'missed_inception') { + $filePath = ($return_type == 1) + ? base_url('public/sample_excel/sample_inception.xls') + : ROOTPATH . 'public/sample_excel/sample_inception.xls'; + } + + if($return_type == 1){ + return $filePath; } // Check if the file exists diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index fb01044..0cd0fdd 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3522,6 +3522,8 @@ class EmployeeRestController extends AdminController } + + //-------------------------------------------------------------------------------------------- public function hrFileUpload() { @@ -3658,6 +3660,17 @@ class EmployeeRestController extends AdminController } } + public function downloadSampleExcel() + { + $employeeController = new EmployeeController(); + $file_path = $employeeController->downloadSampleExcelFile('enrollment', 1); + if(empty($file_path)){ + return $this->respond(['status' => "success", 'code' => 404, 'data' => "", "message" => "Sample file not avilable"], 200); + }else{ + return $this->respond(['status' => "success", 'code' => 200, 'data' => $file_path], 200); + } + + } } \ No newline at end of file