From dbe7de2d05f7a0a366646ab47f9f33ec790600ce Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 24 Nov 2015 22:54:04 +0200 Subject: [PATCH] Working on invoice CSV import --- app/Services/ImportService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 32dac4c68df2..a5b12d11fff8 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -69,12 +69,12 @@ class ImportService private function execute($source, $entityType, $file) { - Excel::load($file, function ($reader) use ($source, $entityType, $transformer) { + Excel::load($file, function ($reader) use ($source, $entityType) { $this->checkData($entityType, count($reader->all())); $maps = $this->createMaps(); - $reader->each(function ($row) use ($source, $entityType, $transformer, $maps) { + $reader->each(function ($row) use ($source, $entityType, $maps) { $this->saveData($source, $entityType, $row, $maps); }); }); @@ -112,7 +112,7 @@ class ImportService $data = $this->fractal->createData($resource)->toArray(); - if (!$data['invoice_number']) { + if ($entityType == ENTITY_INVOICE && !$data['invoice_number']) { $account = Auth::user()->account; $invoice = Invoice::createNew(); $data['invoice_number'] = $account->getNextInvoiceNumber($invoice);