FIX_ISSUE

This commit is contained in:
VENKATESHWARAN 2026-02-04 12:23:50 +05:30
parent 926040c308
commit 0ac07c331e
2 changed files with 19 additions and 3 deletions

View File

@ -517,10 +517,26 @@ class EmployeeController extends AdminController
$file_data = $this->fileModel->where('id', $file_id)->first();
$error = json_decode($file_data['reason'] ?? '{}', true);
if(!empty($error) && $retun_type == 'api'){
if(!empty($error) && $retun_type == 'api' && $file_data['status'] == 'failed'){
$send = isset($error['error_summary'][5]) || isset($error['error_summary'][6]) ? true : false;
if($send){
return $this->respond(['status' => false, 'code' => 404, 'message' => $error['error_data'] ?? 'System error', 'data' => []], 200);
$string = $error['error_data'] ?? 'System error';
$errorMap = [
"Column order conflict" => "Invalid file format. Please use the sample file.",
];
$message = $string; // Default to the original error
foreach ($errorMap as $keyword => $friendlyMessage) {
if (strpos($string, $keyword) !== false) {
$message = $friendlyMessage;
break; // Stop looking once we find a match
}
}
return $this->respond(['status' => false, 'code' => 404, 'message' => $message, 'data' => []], 200);
}
}

View File

@ -846,7 +846,7 @@ class EmployeeRestController extends AdminController
$responce = $employeeController->employeesUplodWithEvents($post_data);
// print_r($responce); die;
return $responce;
return $this->respond($responce, 200);
// if(!$responce['status']){
// $file_data = $this->getDataFromFilesTable(['file_id' => $responce['file_id']]);