FIX_API_FILE_UPLOAD : RV
This commit is contained in:
parent
c4e65bbe4e
commit
0eeab18d95
@ -4435,11 +4435,13 @@ class ClientController extends AdminController
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $res = $employeeRestController->excelFileFormatValidation(['file_id' => 897]);
|
||||
// $res = $employeeRestController->getExcelErrorData(['file_id' => 897]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
|
||||
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
|
||||
// dd($res);
|
||||
|
||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -751,7 +751,7 @@ class EmployeeRestController extends AdminController
|
||||
$jwt = $this->request->getHeaderLine('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
|
||||
$token = $jwtParts[2];
|
||||
$token = $jwtParts[1];
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
|
||||
@ -1075,7 +1075,7 @@ class EmployeeRestController extends AdminController
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->myLogger->logme("error", ($e->getMessage().' --- '.$e->getLine()));
|
||||
$this->myLogger->logme("error", ($e->getMessage().' --- '.$e->getLine() . '----' . $e->getTraceAsString()));
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ use App\Helpers\sendMailNotification;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use Kint\Kint;
|
||||
@ -1804,9 +1805,10 @@ class EmployeeServiceController extends AdminController
|
||||
public function getExcelErrorData($file_id){
|
||||
|
||||
try {
|
||||
$file = $this->fileModel->find($file_id);
|
||||
$error_data = json_decode($file['reason']);
|
||||
// dd($error_data);
|
||||
// $file = $this->fileModel->find($file_id);
|
||||
$file = $this->fileModel->where('id', $file_id)->first();
|
||||
$error_data = json_decode($file['reason']);
|
||||
// dd($error_data);
|
||||
// return $error_data;
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
@ -1822,10 +1824,21 @@ class EmployeeServiceController extends AdminController
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . 'N' . $highestRowAndColumn['row']);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
|
||||
$excel_data = array_filter($excel_data, function($row) {
|
||||
// Check if all cells in the row are empty or null
|
||||
foreach ($row as $cell) {
|
||||
if (!is_null($cell) && $cell !== '') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// echo '<pre>';
|
||||
// Kint::dump($excel_data);
|
||||
if($error_data->error_type == 1){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user