FIX_ENROLMENT_IS_ADD_ON_KEY&DOC_FORMAT&SELF_NOT_AVAIL_ISSUE&GET_VERIFIED_USER_API
This commit is contained in:
parent
83c933837c
commit
04526853fd
@ -1036,7 +1036,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms) && ($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0)) // 3 is GMC parents dep addon)
|
||||
if((($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) && ($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
if(!$res['is_self_found'])
|
||||
@ -1049,7 +1049,7 @@ class EmployeeServiceController extends AdminController
|
||||
//check self avaialbe either same policy DB level(i.e.) gMC parents
|
||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
|
||||
{
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: trim($emp_id),client_id: $file['client_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ],relationship:['self']);
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: trim($emp_id),client_id: $file['client_id'],emp_status: ['active','draft','enrolled'],policy_status:['active','draft','enrolled'],client_branch_id:[ $file['client_branch_id'] ],relationship:['self']);
|
||||
// dd($self_details);
|
||||
if(!count($self_details))
|
||||
{
|
||||
@ -1928,297 +1928,200 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
}
|
||||
|
||||
public function employeesEnrollmentInsert($params)
|
||||
{
|
||||
|
||||
public function employeesEnrollmentInsert($params)
|
||||
{
|
||||
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
// dd($file);
|
||||
$return = [];
|
||||
if (!isset($file)) {
|
||||
//file not found in DB
|
||||
return array('status' => false, 'msg' => 'file not found in DB');
|
||||
}
|
||||
$file_name_with_path = WRITEPATH . "/uploads/excel/" . $file['file_name'];
|
||||
|
||||
//check physical file
|
||||
if (!file_exists($file_name_with_path)) {
|
||||
//file not found update status and reason
|
||||
$message = "Physical file not found";
|
||||
// echo $message;
|
||||
$this->myLogger->logme('error', ($message . ' for file id ' . $file_id));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
|
||||
return array('error_summary' => [5], 'error_data' => $message);
|
||||
}
|
||||
|
||||
//get excel data
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$result = ['error_type' => 2, 'error_summary' => [], 'error_data' => []];
|
||||
$columns_to_check = $this->enrollment_excel_columns;
|
||||
$keys = array_keys($columns_to_check);
|
||||
$allowedHighestColumn = end($columns_to_check);
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||
// print_r($keys);die();
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'], client_branch_id: $file['client_branch_id']);
|
||||
//remove header
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
$emp_emails = [];
|
||||
|
||||
//check is welcome notification enabled
|
||||
$notification = $this->notificationModel->where('client_id', $file['client_id'])->where('template_name', 'member_welcome_mail')->first();
|
||||
// dd($notification);
|
||||
$client_details = $this->clientModel->where('id', $file['client_id'])->first();
|
||||
|
||||
// dd($excel_data);
|
||||
$emp_emails = []; // Initialize an empty array to store employee email.
|
||||
|
||||
foreach ($excel_data as $key => $row) {
|
||||
$is_row_empty = check_row_is_empty_or_null($row);
|
||||
if (!$is_row_empty) {
|
||||
$value = [];
|
||||
$policy_data = [];
|
||||
$temp_unit = '';
|
||||
if (empty($row[12])) {
|
||||
$temp_unit = $existing_units[0];
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
// dd($file);
|
||||
$return = [];
|
||||
if(!isset($file))
|
||||
{
|
||||
//file not found in DB
|
||||
return array('status' => false, 'msg' => 'file not found in DB');
|
||||
}
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
//check physical file
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
//file not found update status and reason
|
||||
$message = "Physical file not found";
|
||||
// echo $message;
|
||||
$this->myLogger->logme('error',($message . ' for file id ' . $file_id));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'failed','reason' => json_encode(['error_summary' => array_count_values([5]),'error_data' => $message])])->update();
|
||||
return array('error_summary' => [5], 'error_data' => $message);
|
||||
}
|
||||
|
||||
$value['emp_code'] = $row[1];
|
||||
$value['name'] = $row[2];
|
||||
$value['doj'] = (!empty($row[3]) ? convert_string_to_date($row[3], 'Y-m-d') : null);
|
||||
$value['gender'] = $row[4];
|
||||
$value['relationship'] = ucfirst(trim($row[5]));
|
||||
$value['dob'] = convert_string_to_date($row[6], 'Y-m-d');
|
||||
$value['email_corporate'] = $row[7];
|
||||
$value['mobile'] = $row[8];
|
||||
$value['band'] = $row[10];
|
||||
$value['basic_pay'] = $row[11];
|
||||
$value['unit'] = $temp_unit;
|
||||
$value['family_floater_key'] = null;
|
||||
$value['client_id'] = $file['client_id'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$value['file_id'] = $file_id;
|
||||
//get excel data
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ];
|
||||
$columns_to_check = $this->enrollment_excel_columns;
|
||||
$keys = array_keys($columns_to_check);
|
||||
$allowedHighestColumn = end($columns_to_check);
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||
// print_r($keys);die();
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
//remove header
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
$emp_emails = [];
|
||||
|
||||
//check is welcome notification enabled
|
||||
$notification = $this->notificationModel->where('client_id',$file['client_id'])->where('template_name','member_welcome_mail')->first();
|
||||
// dd($notification);
|
||||
$client_details = $this->clientModel->where('id', $file['client_id'])->first();
|
||||
$policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first();
|
||||
|
||||
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
||||
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'father') {
|
||||
$relation = 'parent';
|
||||
} else if (strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter') {
|
||||
$relation = 'child';
|
||||
} else if (strtolower(trim($value['relationship'])) === 'father in law' || strtolower(trim($value['relationship'])) === 'mother in law') {
|
||||
$relation = 'parent_in_law';
|
||||
} else if (strtolower(trim($value['relationship'])) === 'spouse') {
|
||||
$relation = 'spouse';
|
||||
} else {
|
||||
$relation = 'self';
|
||||
}
|
||||
$value['family_floater_key'] = $relation;
|
||||
// dd($policy_details);
|
||||
|
||||
$policy_data['basic_cover_si'] = $row[9];
|
||||
$policy_data['date_coverage'] = $row[13];
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
foreach ($excel_data as $key => $row)
|
||||
{
|
||||
$is_row_empty = check_row_is_empty_or_null($row);
|
||||
if(!$is_row_empty)
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmployee($value, $file['client_branch_id']);
|
||||
unset($value['temp']);
|
||||
//save employee table
|
||||
// dd($employee['id']);
|
||||
if ($employee !== null) {
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee['id'];
|
||||
$value['emp_status'] = 'draft';
|
||||
|
||||
$log_message = 'Enrollment Update Employee - ' . $employee['name'] . '(' . $employee['emp_code'] . ') with PK ' . $employee['id'];
|
||||
} else {
|
||||
$value['emp_status'] = 'draft';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$log_message = 'Enrollment Insert Employee- ' . $value['name'] . '(' . $value['emp_code'] . ') with PK ';
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
if (isset($value['id'])) {
|
||||
$emp_id = $value['id'];
|
||||
} else {
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
$log_message .= $emp_id;
|
||||
}
|
||||
|
||||
// $emp_id = $this->employeeModel->getInsertID();
|
||||
// if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
// else{ $emp_id = $employee['id']; }
|
||||
|
||||
$this->myLogger->logme('error', $log_message);
|
||||
|
||||
//save policy table
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id, 'client_policy_id' => $file['policy_id']]);
|
||||
if (count($employee_policy)) {
|
||||
$policy_data['updated_by'] = $file['created_by'];
|
||||
$policy_data['id'] = $employee_policy[0]['id'];
|
||||
$policy_data['status'] = 'draft';
|
||||
|
||||
$log_message = 'Update Employee Policy for ' . $value['name'] . '(' . $value['emp_code'] . ') with PK- ' . $employee_policy[0]['id'] . ' client policy ID ' . $employee_policy[0]['client_policy_id'] . ' with SI ' . $policy_data['basic_cover_si'];
|
||||
// echo 'insert policy';
|
||||
} else {
|
||||
$policy_data['employee_id'] = $emp_id;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
$policy_data['created_by'] = $file['created_by'];
|
||||
$policy_data['status'] = 'draft';
|
||||
$log_message = 'Insert Employee Policy for ' . $value['name'] . '(' . $value['emp_code'] . ') - client policy id -' . $file['policy_id'] . ' - with SI ' . $policy_data['basic_cover_si'];
|
||||
// echo 'update policy';
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
// $emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
$emp_policy_id = isset($policy_data['id']) ? $policy_data['id'] : $this->employeePolicyModel->getInsertID();
|
||||
$this->myLogger->logme('error', $log_message);
|
||||
|
||||
//save email of self for send mail later
|
||||
if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '') {
|
||||
if (strtolower($value['relationship']) == 'self' && $value['email_corporate'] != "") {
|
||||
$params['dataToInsert'] = $value; //holds employee master data
|
||||
$params['notification'] = $notification;
|
||||
$params['client_data'] = $client_details;
|
||||
$params['common'] = [
|
||||
'client_id' => $file['client_id'],
|
||||
'client_branch_id' => $file['client_branch_id'],
|
||||
'client_policy_id' => $file['policy_id'],
|
||||
'employee_policy_id' => $emp_policy_id ?? null,
|
||||
'employee_id' => $emp_id,
|
||||
'mail_type' => 'member_welcome_mail',
|
||||
];
|
||||
|
||||
//store email and mail content via helper to send notification
|
||||
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
// Kint::dump($emp_emails);
|
||||
// Kint::dump($key.'-'.count($excel_data));
|
||||
// if mail count is 20 send bulk mail and reset emp_emails variable
|
||||
// if (count($emp_emails) == 20 || $key == count($excel_data) ) {
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $emp_emails]);
|
||||
// // echo 'Mail triggered';
|
||||
// $emp_emails = [];
|
||||
// }
|
||||
|
||||
}
|
||||
$value['family_floater_key'] = $relation;
|
||||
|
||||
$policy_data['basic_cover_si'] = $row[9];
|
||||
$policy_data['date_coverage'] = $row[13];
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmployee($value, $file['client_branch_id']);
|
||||
unset($value['temp']);
|
||||
//save employee table
|
||||
// dd($employee['id']);
|
||||
if ($employee !== null) {
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee['id'];
|
||||
$value['emp_status'] = 'draft';
|
||||
|
||||
$log_message = 'Enrollment Update Employee - ' . $employee['name'] . '(' . $employee['emp_code'] . ') with PK ' . $employee['id'];
|
||||
} else {
|
||||
$value['emp_status'] = 'draft';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$log_message = 'Enrollment Insert Employee- ' . $value['name'] . '(' . $value['emp_code'] . ') with PK ';
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
if (isset($value['id'])) {
|
||||
$emp_id = $value['id'];
|
||||
} else {
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
$log_message .= $emp_id;
|
||||
}
|
||||
|
||||
// $emp_id = $this->employeeModel->getInsertID();
|
||||
// if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
// else{ $emp_id = $employee['id']; }
|
||||
|
||||
$this->myLogger->logme('error', $log_message);
|
||||
|
||||
//save policy table
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id, 'client_policy_id' => $file['policy_id']]);
|
||||
if (count($employee_policy)) {
|
||||
$policy_data['updated_by'] = $file['created_by'];
|
||||
$policy_data['id'] = $employee_policy[0]['id'];
|
||||
$policy_data['status'] = 'draft';
|
||||
|
||||
$log_message = 'Update Employee Policy for ' . $value['name'] . '(' . $value['emp_code'] . ') with PK- ' . $employee_policy[0]['id'] . ' client policy ID ' . $employee_policy[0]['client_policy_id'] . ' with SI ' . $policy_data['basic_cover_si'];
|
||||
// echo 'insert policy';
|
||||
} else {
|
||||
$policy_data['employee_id'] = $emp_id;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
$policy_data['created_by'] = $file['created_by'];
|
||||
$policy_data['status'] = 'draft';
|
||||
$log_message = 'Insert Employee Policy for ' . $value['name'] . '(' . $value['emp_code'] . ') - client policy id -' . $file['policy_id'] . ' - with SI ' . $policy_data['basic_cover_si'];
|
||||
// echo 'update policy';
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
$this->myLogger->logme('error', $log_message);
|
||||
|
||||
//save email of self for send mail later
|
||||
if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '') {
|
||||
if (strtolower($value['relationship']) == 'self' && $value['email_corporate'] != "") {
|
||||
$params['dataToInsert'] = $value; //holds employee master data
|
||||
$params['notification'] = $notification;
|
||||
$params['client_data'] = $client_details;
|
||||
$params['common'] = [
|
||||
'client_id' => $file['client_id'],
|
||||
'client_branch_id' => $file['client_branch_id'],
|
||||
'client_policy_id' => $file['policy_id'],
|
||||
'employee_policy_id' => $emp_policy_id ?? null,
|
||||
'employee_id' => $emp_id,
|
||||
'mail_type' => 'member_welcome_mail',
|
||||
];
|
||||
|
||||
//store email and mail content via helper to send notification
|
||||
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
// Kint::dump($emp_emails);
|
||||
// Kint::dump($key.'-'.count($excel_data));
|
||||
// if mail count is 20 send bulk mail and reset emp_emails variable
|
||||
// if (count($emp_emails) == 20 || $key == count($excel_data)) {
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $emp_emails]);
|
||||
// // echo 'Mail triggered';
|
||||
// $emp_emails = [];
|
||||
// }
|
||||
$value = [];
|
||||
$policy_data = [];
|
||||
$temp_unit = '';
|
||||
if(empty($row[12]))
|
||||
{
|
||||
$temp_unit = $existing_units[0];
|
||||
}
|
||||
|
||||
$value['emp_code'] = $row[1];
|
||||
$value['name'] = $row[2];
|
||||
$value['doj'] = (!empty($row[3]) ? convert_string_to_date($row[3],'Y-m-d'): null);
|
||||
$value['gender'] = $row[4];
|
||||
$value['relationship'] = ucfirst(trim($row[5]));
|
||||
$value['dob'] = convert_string_to_date($row[6],'Y-m-d');
|
||||
$value['email_corporate'] = $row[7];
|
||||
$value['mobile'] = $row[8];
|
||||
$value['band'] = $row[10];
|
||||
$value['basic_pay'] = $row[11];
|
||||
$value['unit'] = $temp_unit;
|
||||
$value['family_floater_key'] = null;
|
||||
$value['client_id'] = $file['client_id'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$value['file_id'] = $file_id;
|
||||
$value['is_addon_value'] = $policy_details['policy_type_id'] == 3 ? 1 : 0;
|
||||
|
||||
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
||||
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'father') {
|
||||
$relation = 'parent';
|
||||
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
|
||||
$relation = 'child';
|
||||
}else if(strtolower(trim($value['relationship'])) === 'father in law' || strtolower(trim($value['relationship'])) === 'mother in law'){
|
||||
$relation = 'parent_in_law';
|
||||
}else if(strtolower(trim($value['relationship'])) === 'spouse'){
|
||||
$relation = 'spouse';
|
||||
}else{
|
||||
$relation = 'self';
|
||||
}
|
||||
$value['family_floater_key'] = $relation;
|
||||
|
||||
$policy_data['basic_cover_si'] = $row[9];
|
||||
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
||||
unset($value['temp']);
|
||||
//save employee table
|
||||
// dd($employee['id']);
|
||||
if($employee !== null)
|
||||
{
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee['id'];
|
||||
$value['emp_status'] = 'draft';
|
||||
|
||||
$log_message = 'Enrollment Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['emp_status'] = 'draft';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
if (isset($value['id']))
|
||||
{ $emp_id = $value['id']; }
|
||||
else { $emp_id = $this->employeeModel->getInsertID();
|
||||
$log_message .= $emp_id;
|
||||
}
|
||||
|
||||
// $emp_id = $this->employeeModel->getInsertID();
|
||||
// if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
// else{ $emp_id = $employee['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
//save policy table
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
||||
if(count($employee_policy))
|
||||
{
|
||||
$policy_data['updated_by'] = $file['created_by'];
|
||||
$policy_data['id'] = $employee_policy[0]['id'];
|
||||
$policy_data['status'] = 'draft';
|
||||
|
||||
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
||||
// echo 'insert policy';
|
||||
}
|
||||
else
|
||||
{
|
||||
$policy_data['employee_id'] = $emp_id;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
$policy_data['created_by'] = $file['created_by'];
|
||||
$policy_data['status'] = 'draft';
|
||||
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
||||
// echo 'update policy';
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
//save email of self for send mail later
|
||||
if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '')
|
||||
{
|
||||
if(strtolower($value['relationship']) == 'self' && $value['email_corporate'] != "")
|
||||
{
|
||||
$params['dataToInsert'] = $value; //holds employee master data
|
||||
$params['notification'] = $notification;
|
||||
$params['client_data'] = $client_details;
|
||||
|
||||
//store email and mail content via helper to send notification
|
||||
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
}
|
||||
}
|
||||
}// endof if row is empty check
|
||||
} //end of for loop
|
||||
|
||||
|
||||
// for bulk mail queue job push
|
||||
if (!empty($emp_emails) && count($emp_emails) > 0) {
|
||||
|
||||
$emp_emails = array_chunk($emp_emails, 20);
|
||||
|
||||
foreach ($emp_emails as $key => $value) {
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]);
|
||||
}
|
||||
} // endof if row is empty check
|
||||
} //end of for loop
|
||||
|
||||
// dd($emp_emails);
|
||||
|
||||
// for bulk mail queue job push
|
||||
if (!empty($emp_emails) && count($emp_emails) > 0) {
|
||||
|
||||
$emp_emails = array_chunk($emp_emails, 20);
|
||||
|
||||
foreach ($emp_emails as $key => $value) {
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update();
|
||||
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
|
||||
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success'));
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success'));
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}//end of employeesEnrollmentInsert
|
||||
|
||||
}
|
||||
@ -102,7 +102,13 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
$employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->first();
|
||||
}else{
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||
//$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)
|
||||
->where('relationship', 'self')
|
||||
->where('emp_status !=', 'truncated')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user