mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Fixes for expense imports
This commit is contained in:
parent
34524f3ed3
commit
b90fb4515f
@ -53,7 +53,7 @@ class ImportEDocument implements ShouldQueue
|
|||||||
|
|
||||||
public function middleware()
|
public function middleware()
|
||||||
{
|
{
|
||||||
return [new WithoutOverlapping($this->company->company_key)];
|
return [new WithoutOverlapping($this->company->company_key."_expense_import")];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function failed($exception = null)
|
public function failed($exception = null)
|
||||||
@ -63,7 +63,6 @@ class ImportEDocument implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->fail($exception); //manually fail - prevents future jobs with the same name from being discarded
|
$this->fail($exception); //manually fail - prevents future jobs with the same name from being discarded
|
||||||
|
|
||||||
config(['queue.failed.driver' => null]);
|
config(['queue.failed.driver' => null]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ class ParseEDocument extends AbstractService
|
|||||||
return (new ZugferdEDocument($this->file, $this->company))->run();
|
return (new ZugferdEDocument($this->file, $this->company))->run();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
nlog("Zugferd Exception: " . $e->getMessage());
|
nlog("Zugferd Exception: " . $e->getMessage());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case ($extension == 'xml' || $mimetype == 'application/xml') && stristr($this->file->get(), "urn:cen.eu:en16931:2017"):
|
case ($extension == 'xml' || $mimetype == 'application/xml') && stristr($this->file->get(), "urn:cen.eu:en16931:2017"):
|
||||||
case ($extension == 'xml' || $mimetype == 'application/xml') && stristr($this->file->get(), "urn:oasis:names:specification:ubl"):
|
case ($extension == 'xml' || $mimetype == 'application/xml') && stristr($this->file->get(), "urn:oasis:names:specification:ubl"):
|
||||||
@ -68,6 +69,7 @@ class ParseEDocument extends AbstractService
|
|||||||
}
|
}
|
||||||
catch(\Throwable $e){
|
catch(\Throwable $e){
|
||||||
nlog("UBL Import Exception: " . $e->getMessage());
|
nlog("UBL Import Exception: " . $e->getMessage());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ use App\Utils\Traits\SavesDocuments;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Repositories\ExpenseRepository;
|
use App\Repositories\ExpenseRepository;
|
||||||
|
use App\Repositories\VendorContactRepository;
|
||||||
|
use App\Repositories\VendorRepository;
|
||||||
use horstoeko\zugferd\ZugferdDocumentReader;
|
use horstoeko\zugferd\ZugferdDocumentReader;
|
||||||
use horstoeko\zugferdvisualizer\ZugferdVisualizer;
|
use horstoeko\zugferdvisualizer\ZugferdVisualizer;
|
||||||
use horstoeko\zugferdvisualizer\renderer\ZugferdVisualizerLaravelRenderer;
|
use horstoeko\zugferdvisualizer\renderer\ZugferdVisualizerLaravelRenderer;
|
||||||
@ -139,7 +141,9 @@ class ZugferdEDocument extends AbstractService
|
|||||||
if ($country)
|
if ($country)
|
||||||
$vendor->country_id = $country->id;
|
$vendor->country_id = $country->id;
|
||||||
|
|
||||||
$vendor->save();
|
$vendor_repo = new VendorRepository(new VendorContactRepository());
|
||||||
|
$vendor = $vendor_repo->save([], $vendor);
|
||||||
|
|
||||||
$expense->vendor_id = $vendor->id;
|
$expense->vendor_id = $vendor->id;
|
||||||
}
|
}
|
||||||
$expense->transaction_reference = $documentno;
|
$expense->transaction_reference = $documentno;
|
||||||
|
Loading…
Reference in New Issue
Block a user