mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for CSV import
This commit is contained in:
parent
9ad6cae695
commit
12bd18f38b
@ -35,6 +35,9 @@ use Session;
|
|||||||
use stdClass;
|
use stdClass;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Carbon;
|
use Carbon;
|
||||||
|
use League\Csv\Reader;
|
||||||
|
use League\Csv\Statement;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ImportService.
|
* Class ImportService.
|
||||||
@ -653,8 +656,11 @@ class ImportService
|
|||||||
private function getCsvData($fileName)
|
private function getCsvData($fileName)
|
||||||
{
|
{
|
||||||
$this->checkForFile($fileName);
|
$this->checkForFile($fileName);
|
||||||
$file = file_get_contents($fileName);
|
|
||||||
$data = array_map("str_getcsv", preg_split('/\r*\n+|\r+/', $file));
|
$csv = Reader::createFromPath($fileName, 'r');
|
||||||
|
//$csv->setHeaderOffset(0); //set the CSV header offset
|
||||||
|
$stmt = new Statement();
|
||||||
|
$data = iterator_to_array($stmt->process($csv));
|
||||||
|
|
||||||
if (count($data) > 0) {
|
if (count($data) > 0) {
|
||||||
$headers = $data[0];
|
$headers = $data[0];
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
"laravel/socialite": "~3.0",
|
"laravel/socialite": "~3.0",
|
||||||
"laravel/tinker": "^1.0",
|
"laravel/tinker": "^1.0",
|
||||||
"laravelcollective/html": "5.4.*",
|
"laravelcollective/html": "5.4.*",
|
||||||
|
"league/csv": "^9.1",
|
||||||
"league/flysystem-aws-s3-v3": "~1.0",
|
"league/flysystem-aws-s3-v3": "~1.0",
|
||||||
"league/flysystem-rackspace": "~1.0",
|
"league/flysystem-rackspace": "~1.0",
|
||||||
"league/fractal": "0.13.*",
|
"league/fractal": "0.13.*",
|
||||||
|
528
composer.lock
generated
528
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user