FIX_EXCEL_ERR_NOT_SHOWN,CHANGE_SELF_CHECK_FOR_INCEPTION

This commit is contained in:
velz 2024-04-09 18:06:27 +05:30
parent 4df91e42f3
commit 7778ac48a4
3 changed files with 54 additions and 9 deletions

View File

@ -372,6 +372,17 @@ class EmployeeServiceController extends AdminController
}
}
}
if($file['action'] == 'inception')
{
$res = check_self_available_in_family($family,$file['action']);
// dd($res);
if(!$res['is_self_found'])
{
array_push($result['error_summary'],14); // Self not found
$result['error_data'][ $res['emp_code'] ]['name_of_emp_dep']['error'][] = "Self not found ";
}
}
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception')
@ -935,7 +946,7 @@ class EmployeeServiceController extends AdminController
try {
$file = $this->fileModel->find($file_id);
$error_data = json_decode($file['reason']);
// dd($error_data);
// return $error_data;
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
@ -955,7 +966,7 @@ class EmployeeServiceController extends AdminController
$excelErrorData['excel_header'] = $excel_data[0];
unset($excel_data[0]);
// echo '<pre>';
// Kint::dump($excel_data);
if($error_data->error_type == 1){
$finalArray = [];
@ -998,13 +1009,24 @@ class EmployeeServiceController extends AdminController
}
}
// dd(array_keys($allErrors));
foreach ($allErrors as $key => $value){
$data = ['value' => $excel_data[$key][1], 'error'=>$value,];
$excel_data[$key][1] = $data;
array_push($typeTowArray, $excel_data[$key]);
// echo $key;
// print_r($value);
foreach($excel_data as $excel_data_index => $excel_data_value)
{
if($excel_data_value[0] == $key)
{
$data = ['value' => $excel_data[$excel_data_index][1], 'error'=>$value,];
$excel_data[$excel_data_index][1] = $data;
array_push($typeTowArray, $excel_data[$excel_data_index]);
break;
}
}
}
// dd($data);
foreach ($typeTowArray as $fkey => $value){
foreach ($value as $vkey => $arrayData){
if(!is_array($arrayData)){
@ -1021,7 +1043,7 @@ class EmployeeServiceController extends AdminController
}catch (\Exception $e) {
// Handle any exceptions
$errorMessage = $e->getMessage();
$errorMessage = $e->getMessage();//die();
$this->myLogger->logme('error', $errorMessage);
return false; // You can return an error response here
}

View File

@ -290,6 +290,26 @@ if (!function_exists('name_dup_check_within_family'))
}
}
if (!function_exists('check_self_available_in_family'))
{
function check_self_available_in_family($family_data)
{
$is_self_found = false;
foreach ($family_data as $rkey => $row)
{
if($row[5] != null && strtolower($row[5]) == 'self')//$row[5] = relationship $row[4] = Gender
{
$is_self_found = true;
break;
}
}
return ['is_self_found' => $is_self_found,'emp_code' => $family_data[0][1]];
}
}
if (!function_exists('name_and_empid_check_in_db'))

View File

@ -329,7 +329,7 @@ function fetchFileError(file_id) {
file_error_html += "<strong>Duplicate entry</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
break;
case 10:
file_error_html += "<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
file_error_html += "<strong>Record Not Found</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
break;
case 11:
file_error_html += "<strong>Rule conflict: Dependents not allowed</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
@ -340,6 +340,9 @@ function fetchFileError(file_id) {
case 13:
file_error_html += "<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
break;
case 14:
file_error_html += "<strong>Self Not found</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
break;
default:
file_error_html += "";