diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 43b0fafc..b0e59d7a 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -784,10 +784,10 @@ class ClientController extends AdminController ], 'cd_ac_no' => [ - 'rules' => 'required|is_natural_no_zero', + 'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_\\-]+$/]', 'errors' => [ 'required' => 'Account number is required', - 'is_natural_no_zero' => 'must be a positive integer', + 'regex_match' => 'Account number can only contain letters, numbers, slashes (/), underscores (_), and hyphens (-)', ] ], diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 5f8bd879..815d00fd 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -607,7 +607,7 @@ class EmployeeRestController extends AdminController { try { - $empData = $this->employeePolicyModel->getEmployeePolicy(client_id: $this->request->getGet('client_id'), policy_id: $this->request->getGet('client_policy_id'), status: 0, branch_id: $this->request->getGet('client_branch_id')); + $empData = $this->employeePolicyModel->getEmployeePolicy(client_id: $this->request->getGet('client_id'), policy_id: $this->request->getGet('client_policy_id'), status: 0, branch_id: $this->request->getGet('client_branch_id'), staus_type: 'inactive'); if ($empData) { return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200); diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 6b9b17f1..aac0cc45 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -222,7 +222,7 @@ class EmployeePolicyModel extends Model // return $res; // } // remarks do not remove - public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "") + public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "", $staus_type = '') { // dd($status); $ecard_download_link = " @@ -356,8 +356,13 @@ class EmployeePolicyModel extends Model // Always check these conditions $result ->where('employee_polices.is_active', 1) - ->where('emp.is_active', 1) - ->where('employee_polices.status !=', 'inactive'); + ->where('emp.is_active', 1); + + if($staus_type == 'inactive'){ + $result->whereIn('employee_polices.status', ['active', 'inactive']); + }else{ + $result->where('employee_polices.status !=', 'inactive'); + } $res = $result->findAll();