This commit is contained in:
2023-08-31 11:36:10 +07:00
parent 7df5586258
commit 8f74be633e
2 changed files with 9 additions and 9 deletions

View File

@@ -432,8 +432,8 @@ class CorporateController extends Controller
$result_headers = array_keys($headers_map_to_table_fields); $result_headers = array_keys($headers_map_to_table_fields);
$result_headers = array_merge($result_headers, ['Ingest Code', 'Ingest Note']); $result_headers = array_merge($result_headers, ['Ingest Code', 'Ingest Note']);
$import->read($fileRead); // $import->read($fileRead);
$import->write($fileWrite, 'xsls'); // $import->write($fileWrite, 'xsls');
$import->addArrayToRow($result_headers); $import->addArrayToRow($result_headers);
} }
$doc_headers_indexes = []; $doc_headers_indexes = [];
@@ -462,16 +462,16 @@ class CorporateController extends Controller
$corporateService->handleBenefitRow($corporate, $row_data); $corporateService->handleBenefitRow($corporate, $row_data);
} }
// Write Success Result to File // Write Success Result to File
$import->read($fileRead); // $import->read($fileRead);
$import->write($fileWrite, 'xsls'); // $import->write($fileWrite, 'xsls');
$result_headers = array_merge($row_data, ['Ingest Code' =>200, 'Ingest Note' => 'Success']); $result_headers = array_merge($row_data, ['Ingest Code' =>200, 'Ingest Note' => 'Success']);
$import->addArrayToRow($result_headers, $sheet->getName()); $import->addArrayToRow($result_headers, $sheet->getName());
} catch (ImportRowException $e) { } catch (ImportRowException $e) {
// Write Data Validation Error to File // Write Data Validation Error to File
$import->read($fileRead); // $import->read($fileRead);
$import->write($fileWrite, 'xsls'); // $import->write($fileWrite, 'xsls');
$import->addArrayToRow(array_merge($row_data, [ $import->addArrayToRow(array_merge($row_data, [
'Ingest Code' => $e->getCode(), 'Ingest Code' => $e->getCode(),
'Ingest Note' => $e->getMessage(), 'Ingest Note' => $e->getMessage(),
@@ -479,8 +479,8 @@ class CorporateController extends Controller
} catch (\Exception $e) { } catch (\Exception $e) {
// throw new \Exception($e); // throw new \Exception($e);
// Write Server Error to File // Write Server Error to File
$import->read($fileRead); // $import->read($fileRead);
$import->write($fileWrite, 'xsls'); // $import->write($fileWrite, 'xsls');
$import->addArrayToRow(array_merge($row_data, [ $import->addArrayToRow(array_merge($row_data, [
'Ingest Code' => 500, 'Ingest Code' => 500,
'Ingest Note' => env('APP_DEBUG') ? $e->getMessage() : 'Server Error', 'Ingest Note' => env('APP_DEBUG') ? $e->getMessage() : 'Server Error',

View File

@@ -78,7 +78,7 @@ class ImportService{
} }
} }
$newRow = $this->makeRow($array); $newRow = $this->makeRow($array);
// $this->writer->addRow($newRow); $this->writer->addRow($newRow);
return $this; return $this;
} }