FIX_CLIENT_UPLOAD_ISSUE

This commit is contained in:
velz 2024-07-02 09:37:11 +05:30
parent ad96e3cbb8
commit 4e88c48b65
2 changed files with 27 additions and 28 deletions

View File

@ -656,7 +656,7 @@ class EmployeeRestController extends AdminController
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
//make an entry in DB
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $employee_id, 'status' => 'draft', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
$empServiceController = new EmployeeServiceController();
@ -689,34 +689,34 @@ class EmployeeRestController extends AdminController
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
$data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
$extractData['file_name']= $filename;
$extractData['client_id']= $client_id;
$extractData['client_branch_id']= $client_branch_id;
$extractData['status']= 'success';
$extractData['policy_id']= $policy_id;
$extractData['action']= 'enrollment';
$extractData['created_by']=$employee_id;
// $extractData['file_name']= $filename;
// $extractData['client_id']= $client_id;
// $extractData['client_branch_id']= $client_branch_id;
// $extractData['status']= 'success';
// $extractData['policy_id']= $policy_id;
// $extractData['action']= 'enrollment';
// $extractData['created_by']=$employee_id;
$file_data =$this->fileModel->insert($extractData);
// $file_data =$this->fileModel->insert($extractData);
$extra = [];
if (count($data[0]) == 11) {
$value = ['Sno','Emp_Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI','Grade'];
$check_miss_match = [];
for ($i=0; $i <count($value) ; $i++) {
if ($data[0][$i] != $value[$i]) {
$check_miss_match[]=$data[0][$i];
}
}
if (count($check_miss_match) > 0) {
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
}
}
// $extra = [];
// if (count($data[0]) == 11) {
// $value = ['Sno','Emp_Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI','Grade'];
// $check_miss_match = [];
// for ($i=0; $i <count($value) ; $i++) {
// if ($data[0][$i] != $value[$i]) {
// $check_miss_match[]=$data[0][$i];
// }
// }
// if (count($check_miss_match) > 0) {
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
// }
// }
if(count($data[0]) != 11){
return json_encode($data[0]);
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
}
// if(count($data[0]) != 11){
// return json_encode($data[0]);
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
// }
//this change the column name into index number
for ($i = 0; $i < count($data[0]); $i++) {

View File

@ -987,8 +987,7 @@ class EmployeeServiceController extends AdminController
}
}
//check self availbale in uploaded file
if(($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
if(($policy_details['base_policy'] == null && ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment')) || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
{
$res = check_self_available_in_family($family,$file['action']);
if(!$res['is_self_found'])