CHANGE_ in agree api : GWM
This commit is contained in:
parent
272b073582
commit
9fb2bc75b9
@ -223,6 +223,10 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = $this->request->getJSON();
|
$data = $this->request->getJSON();
|
||||||
|
|
||||||
|
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
||||||
|
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
||||||
|
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
|
||||||
$Count = 0;
|
$Count = 0;
|
||||||
@ -505,6 +509,10 @@ class EmployeeRestController extends AdminController
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$requestData = $this->request->getJSON();
|
$requestData = $this->request->getJSON();
|
||||||
|
|
||||||
|
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id);
|
||||||
|
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
||||||
|
|
||||||
foreach ($requestData as $key => $value)
|
foreach ($requestData as $key => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1996,6 +2004,7 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$postData = json_decode($this->request->getBody(), true);
|
$postData = json_decode($this->request->getBody(), true);
|
||||||
|
$this->myLogger->logme("error", $this->request->getBody());
|
||||||
$client_policy_id = $postData['client_policy_id'];
|
$client_policy_id = $postData['client_policy_id'];
|
||||||
sort($client_policy_id);
|
sort($client_policy_id);
|
||||||
|
|
||||||
@ -2003,7 +2012,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$client_id = $postData['client_id'];
|
$client_id = $postData['client_id'];
|
||||||
|
|
||||||
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
|
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
|
||||||
|
$employeeIds = array_column($empData, 'id');
|
||||||
//for mail common parameter
|
//for mail common parameter
|
||||||
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
||||||
|
|
||||||
@ -2015,39 +2024,56 @@ class EmployeeRestController extends AdminController
|
|||||||
$policy = $this->clientPolicyModel->where('id',$value)->where('open_for_enrollment',1)->find();
|
$policy = $this->clientPolicyModel->where('id',$value)->where('open_for_enrollment',1)->find();
|
||||||
if($policy)
|
if($policy)
|
||||||
{
|
{
|
||||||
foreach ($empData as $empDataKey => $empDataValue)
|
$this->myLogger->logme("error", 'client policy id = '.$value.' is open for enrollment');
|
||||||
|
|
||||||
|
$empPolicyData = $this->employeePolicyModel->where('client_policy_id', $value )
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->whereIn($employeeIds)
|
||||||
|
->findAll();
|
||||||
|
if(count($empPolicyData))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$empIdsFromPolicyData = array_column($empPolicyData, 'employee_id');
|
||||||
|
//update emp polict table
|
||||||
$this->employeePolicyModel->where('client_policy_id', $value )
|
$this->employeePolicyModel->where('client_policy_id', $value )
|
||||||
->where('is_active', 1 )
|
->where('is_active', 1 )
|
||||||
->where('employee_id', $empDataValue['id'] )
|
->whereIn('employee_id', $empIdsFromPolicyData )
|
||||||
->where('status', 'draft' )
|
->groupStart()
|
||||||
|
->where('status', 'draft')
|
||||||
|
->orWhere('status', 'enrolled')
|
||||||
|
->groupEnd()
|
||||||
->set(array('status'=>'enrolled'))
|
->set(array('status'=>'enrolled'))
|
||||||
->update();
|
->update();
|
||||||
|
//update Employee table
|
||||||
|
$this->employeeModel->where('emp_code', $emp_code)
|
||||||
|
->where('id', $empIdsFromPolicyData)
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->groupStart()
|
||||||
|
->where('emp_status', 'draft')
|
||||||
|
->orWhere('emp_status', 'enrolled')
|
||||||
|
->groupEnd()
|
||||||
|
->set(['emp_status' => 'enrolled'])
|
||||||
|
->update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
|
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
|
||||||
if(count($find) > 0){
|
if(count($find) > 0){
|
||||||
$array_list[] = $find;
|
$array_list[] = $find;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}else { $this->myLogger->logme("error", 'client policy id = '.$value.' is not open for enrollment');}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//update Employee table
|
|
||||||
$this->employeeModel->where('emp_code', $emp_code)->where('client_id', $client_id)->where('is_active', 1)
|
|
||||||
->groupStart()
|
|
||||||
->where('emp_status', 'draft')
|
|
||||||
->orWhere('emp_status', 'enrolled')
|
|
||||||
->groupEnd()
|
|
||||||
->set(['emp_status' => 'enrolled'])
|
|
||||||
->update();
|
|
||||||
|
|
||||||
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
|
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
|
||||||
|
|
||||||
|
|
||||||
if (isset($notification) && $notification['enabled'] == 1) {
|
if (isset($notification) && $notification['enabled'] == 1 && count($array_list)) {
|
||||||
$params ['array_list'] = $array_list;
|
$params ['array_list'] = $array_list;
|
||||||
$params ['client_policy_id'] = $client_policy_id;
|
$params ['client_policy_id'] = $client_policy_id;
|
||||||
$params ['emp_code'] = $emp_code;
|
$params ['emp_code'] = $emp_code;
|
||||||
@ -2328,7 +2354,8 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))->findAll();
|
$clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))
|
||||||
|
->where('open_for_enrollment',1)->findAll();
|
||||||
|
|
||||||
if(count($clientPolicy))
|
if(count($clientPolicy))
|
||||||
{
|
{
|
||||||
@ -2990,6 +3017,19 @@ class EmployeeRestController extends AdminController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function findThePolicyIsOpenForEnrollment($plicy_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$policy = $this->clientPolicyModel->where('id',$plicy_id)->where('open_for_enrollment',1)->find();
|
||||||
|
|
||||||
|
if($policy)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user