History importer fixes

This commit is contained in:
snipe 2019-08-13 18:00:21 -07:00
parent 6c7e5cb9cf
commit 99cd552d5c

View file

@ -570,15 +570,17 @@ class AssetsController extends Controller
*/ */
public function postImportHistory(Request $request) public function postImportHistory(Request $request)
{ {
if (!$request->hasFile('user_import_csv')) {
return back()->with('error', 'No file provided. Please select a file for import and try again. ');
}
if (!ini_get("auto_detect_line_endings")) { if (!ini_get("auto_detect_line_endings")) {
ini_set("auto_detect_line_endings", '1'); ini_set("auto_detect_line_endings", '1');
} }
$csv = Reader::createFromPath(Input::file('user_import_csv')); $csv = Reader::createFromPath(Input::file('user_import_csv'));
$csv->setNewline("\r\n"); $csv->setHeaderOffset(0);
//get the first row, usually the CSV header
//$headers = $csv->fetchOne();
$results = $csv->getRecords(); $results = $csv->getRecords();
$item = array(); $item = array();
$status = array(); $status = array();