diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index ffe3486d..1785d543 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1691,6 +1691,10 @@ class EmployeeRestController extends AdminController if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy { + + if($this->request->getGet('client_id') == 8) // This changes only for client "sterling" + { + $selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si') ->join('employee_polices', 'employees.id = employee_polices.employee_id') ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id AND client_policy.policy_type_id = 2') @@ -1709,6 +1713,9 @@ class EmployeeRestController extends AdminController // To reindex the array to have a proper 0 index $responce['SlabRates'] = array_values($filteredSlabRates); + } + + // Map family floaters that already exist in the employee table $familyFloates = $policy_terms->family_floaters; // remove parent and parent-in-law from familyFloaters @@ -1828,8 +1835,12 @@ class EmployeeRestController extends AdminController $whereArray = []; foreach ( $decodedArray->family_floaters as $key => $value) { if($value != 0){ - if($key == 'parents'){ $text = 'parent'; }else if($key == 'childrens'){ $text = 'child'; }else if($key == 'parents-in-law'){$text = 'parent_in_law';}else{ $text = $key; } - array_push($whereArray,$text); + if($key == 'parents'){ $text = ["parent"]; } + else if($key == 'childrens'){ $text = ["child"]; } + else if($key == 'parents-in-law'){ $text = ["parent_in_law"];} + else if($key ==='either-parents-pil') { $text = ["parent", "parent_in_law"];} + else{ $text = $key; } + $whereArray = array_merge($whereArray, $text); } } @@ -1878,8 +1889,12 @@ class EmployeeRestController extends AdminController $whereArray = []; foreach ( $decodedArray->family_floaters as $key => $value) { if($value != 0){ - if($key == 'parents'){ $text = 'parent'; }else if($key == 'childrens'){ $text = 'child'; }else if($key == 'parents-in-law'){$text = 'parent_in_law';}else{ $text = $key; } - array_push($whereArray,$text); + if($key == 'parents'){ $text = ["parent"]; } + else if($key == 'childrens'){ $text = ["child"]; } + else if($key == 'parents-in-law'){ $text = ["parent_in_law"];} + else if($key ==='either-parents-pil') { $text = ["parent", "parent_in_law"];} + else{ $text = $key; } + $whereArray = array_merge($whereArray, $text); } } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 4d646997..f663a40b 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -128,8 +128,9 @@ class RestAuthenticationController extends AdminController { $employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->first(); }else{ - $mobile_number = $this->request->getJSON()->mobile_number; - $email_id = $this->request->getJSON()->email_id; + + $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + $email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null; $employeeData = $this->employeeModel->where('relationship', 'self'); @@ -257,11 +258,20 @@ class RestAuthenticationController extends AdminController public function saveMpin() { try { - $mobile_number = $this->request->getJSON()->mobile_number; + + $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + $email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null; + + if (isset($mobile_number)) { + $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); + } else { + $employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->first(); + } + $mpin = $this->request->getJSON()->mpin; - $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); + if ($employeeData) { $id= $employeeData["id"]; @@ -288,12 +298,20 @@ class RestAuthenticationController extends AdminController public function updateMpin() { try { - $mobile_number = $this->request->getJSON()->mobile_number; + + $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + $email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null; $old_mpin = $this->request->getJSON()->old_mpin; $mpin = $this->request->getJSON()->new_mpin; - - $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('mpin', $old_mpin)->where('relationship', 'self')->first(); + if (isset($mobile_number)) + { + $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('mpin', $old_mpin)->where('relationship', 'self')->first(); + }else{ + $employeeData = $this->employeeModel->where('email', $email_id)->where('mpin', $old_mpin)->where('relationship', 'self')->first(); + } + + if ($employeeData) { $id= $employeeData["id"]; @@ -320,10 +338,17 @@ class RestAuthenticationController extends AdminController public function verifyMpin() { try { - $mobile_number = $this->request->getJSON()->mobile_number; + + $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + $email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null; $mpin = $this->request->getJSON()->mpin; - $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); + if (isset($mobile_number)) + { + $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); + }else{ + $employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->first(); + } if ($employeeData && $mpin == $employeeData["mpin"]) { $auth = HttpRequestHelper::getRequestInfo(); @@ -355,10 +380,19 @@ class RestAuthenticationController extends AdminController public function checkMpin() { try { - $mobile_number = $this->request->getJSON()->mobile_number; + $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + $email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null; + $mpin = $this->request->getJSON()->mpin; + + if (isset($mobile_number)) + { + $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); + }else{ + $employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->first(); + } - $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); + if ($employeeData && $employeeData["mpin"] != null) {