From a0459a3fbb833a7e65da3ccb18040eafe5821ecb Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 10:03:01 +0530 Subject: [PATCH 1/5] FIX_OPD_NOT_SHOWING_QUERY_ISSUE --- app/Controllers/EmployeeRestController.php | 12 ++++++++++-- app/Models/UserModel.php | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index ee2e072..4ec1f2b 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -4567,10 +4567,17 @@ class EmployeeRestController extends AdminController ( SELECT id FROM client_policy - WHERE policy_type_id in (4, 72) + WHERE policy_type_id = 4 AND base_policy = gmc_client_policy_id LIMIT 1 - ) AS gmc_topup_policy_id + ) AS gmc_topup_policy_id, + + ( + SELECT id FROM client_policy + WHERE policy_type_id = 72 + AND base_policy = gmc_client_policy_id + LIMIT 1 + ) AS opd_topup_policy_id ") ->join('employee_polices', 'employees.id = employee_polices.employee_id') ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id') @@ -4607,6 +4614,7 @@ class EmployeeRestController extends AdminController $policyIds[] = $data['gmc_topup_policy_id']; $policyIds[] = $data['gmc_parent_policy_id']; + $policyIds[] = $data['opd_topup_policy_id'] ?? null; $policyIds[] = $getParentTopUp['gmc_parent_topup_policy_id'] ?? null; return $policyIds; diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index 49b8440..0541cbf 100755 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -77,7 +77,7 @@ class UserModel extends Model public function getUserByEmail($email){ - $userData = $this->where('email', $email)->get(); + $userData = $this->where('email', $email)->where('is_active', 1)->get(); if ($userData->getNumRows() > 0) { return $userData->getRow(); } else { @@ -87,7 +87,7 @@ class UserModel extends Model public function getUserById($id){ - $userData = $this->where('id', $id)->get(); + $userData = $this->where('id', $id)->where('is_active', 1)->get(); if ($userData->getNumRows() > 0) { return $userData->getRow(); } else { From 90660bf4f7e07fbe0595d783b6f7bfcceb66fc86 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 18:13:15 +0530 Subject: [PATCH 2/5] FIX_REMOVE_API --- app/Controllers/EmployeeRestController.php | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 4ec1f2b..9312886 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3308,10 +3308,26 @@ class EmployeeRestController extends AdminController { try { - $clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id')) - ->where('open_for_enrollment',1)->findAll(); + $clientPolicy = $this->clientPolicyModel + ->where('id', $this->request->getGet('client_policy_id')) + ->findAll(); + + if (!count($clientPolicy ?? [])) { + return $this->respond([ + 'status' => 'failed', + 'code' => 404, + 'message' => 'Client policy not found', + 'data' => [] + ], 200); + } + + if(in_array($clientPolicy['policy_type_id'], [3,4,5,72])){ + $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($clientPolicy['base_policy'], $this->request->getGet('emp_code')); + }else{ + $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($this->request->getGet('client_policy_id'), $this->request->getGet('emp_code')); + } - if(count($clientPolicy)) + if($openForEnrollment) { @@ -3371,7 +3387,7 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200); }else{ - return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200); + return $this->respond(['status' => 'failed', 'message' => 'Enrollment closed for this policy','code' => 404,'data' => [] ], 200); } From b84be593a540f43c62e61363be07c7086a8afeb9 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 18:34:41 +0530 Subject: [PATCH 3/5] FIX_FILTER_ISSUE --- app/Controllers/EmployeeRestController.php | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 9312886..3b7fc88 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3308,21 +3308,14 @@ class EmployeeRestController extends AdminController { try { - $clientPolicy = $this->clientPolicyModel - ->where('id', $this->request->getGet('client_policy_id')) - ->findAll(); + $clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))->findAll(); - if (!count($clientPolicy ?? [])) { - return $this->respond([ - 'status' => 'failed', - 'code' => 404, - 'message' => 'Client policy not found', - 'data' => [] - ], 200); + if(count($clientPolicy ?? []) == 0){ + return $this->respond(['status' => 'failed','code' => 404, 'message' => 'Client policy not found', 'data' => [] ], 200); } - if(in_array($clientPolicy['policy_type_id'], [3,4,5,72])){ - $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($clientPolicy['base_policy'], $this->request->getGet('emp_code')); + if(in_array($clientPolicy[0]['policy_type_id'], [3,4,5,72])){ + $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($clientPolicy[0]['base_policy'], $this->request->getGet('emp_code')); }else{ $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($this->request->getGet('client_policy_id'), $this->request->getGet('emp_code')); } @@ -3339,6 +3332,11 @@ class EmployeeRestController extends AdminController $empData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) ->where('is_addon_value', 0 ) ->findAll(); + }else if($clientPolicy[0]['policy_type_id'] == 72)//OPD + { + $empData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) + ->where('is_addon_value', 0) + ->findAll(); }else if($clientPolicy[0]['policy_type_id'] == 5)//GMC-Parent-Topup { $empData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) @@ -3392,7 +3390,7 @@ class EmployeeRestController extends AdminController } catch (\Exception $e) { - return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 200); } } From 8bc75801f71e65acd04562a7dc4a9c57058b75d5 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 18:52:06 +0530 Subject: [PATCH 4/5] FIX_STATUS_UPDATE --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 3b7fc88..f2ffb3a 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3350,7 +3350,7 @@ class EmployeeRestController extends AdminController $this->employeePolicyModel->where('client_policy_id',$this->request->getGet('client_policy_id') ) ->where('employee_id', $value['id'] ) - ->set(array('is_active'=> 0 )) + ->set(array('is_active'=> 0 , 'status' => 'truncated' )) ->update(); } From 8e578a0acdcacced8dcd03407bbbd3fe0ba3fa8f Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 18:52:30 +0530 Subject: [PATCH 5/5] FIX_STATUS_ISSUE --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index f2ffb3a..2245a06 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3350,7 +3350,7 @@ class EmployeeRestController extends AdminController $this->employeePolicyModel->where('client_policy_id',$this->request->getGet('client_policy_id') ) ->where('employee_id', $value['id'] ) - ->set(array('is_active'=> 0 , 'status' => 'truncated' )) + ->set(array('is_active'=> 0 , 'status' => 'truncated')) ->update(); }