From a0459a3fbb833a7e65da3ccb18040eafe5821ecb Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 10:03:01 +0530 Subject: [PATCH] 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 {