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); } }