diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 2ab0eab0..46a82f2e 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -5494,14 +5494,13 @@ class EmployeeRestController extends AdminController $pt_files_data = $ptFilesModel->where('is_active', 1)->where('id', $pt_file_id)->first(); if(empty($pt_files_data)){ - $data['message'] = 'The Physical File Not Found in server'; - return view('errors/404', $data); } + return $this->respond(['status' => false, 'code' => 404, 'message' => 'The Physical File Not Found in server'], 200); + } $filePath = $uploadFilePath . '/' . $pt_files_data['file_name']; if (!file_exists($filePath)) { - $data['message'] = 'The Physical File Not Found in server'; - return view('errors/404', $data); + return $this->respond(['status' => false, 'code' => 404, 'message' => 'The Physical File Not Found in server'], 200); } // Force file download @@ -5517,6 +5516,16 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => false, 'code' => 404, 'message' => 'client_policy_id or employee_policy_ids is required'], 200); } + if(empty($received_data['hr_id'])){ + return $this->respond(['status' => false, 'code' => 404, 'message' => 'hr_id is required'], 200); + } + + $employee_data = $this->employeePolicyModel->getEmployeeDataWithPolicyUsingClientPolicyIdOrEmployeePolicyIds($received_data); + + if(empty($employee_data)){ + return $this->respond(['status' => false, 'code' => 404, 'message' => 'No employee data found for the policy'], 200); + } + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Bulk E-card download process started. Link share your mail'], 200);