mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 19:24:40 -04:00
fixes
This commit is contained in:
parent
74b7581354
commit
7e9e33b846
@ -41,8 +41,6 @@ class ParseEDocument extends AbstractService
|
|||||||
/** @var \App\Models\Account $account */
|
/** @var \App\Models\Account $account */
|
||||||
$account = auth()->user()->account;
|
$account = auth()->user()->account;
|
||||||
|
|
||||||
$expense = null;
|
|
||||||
|
|
||||||
// try to parse via Zugferd lib
|
// try to parse via Zugferd lib
|
||||||
$zugferd_exception = null;
|
$zugferd_exception = null;
|
||||||
try {
|
try {
|
||||||
@ -52,7 +50,7 @@ class ParseEDocument extends AbstractService
|
|||||||
case $this->file->getExtension() == 'xml' && stristr($this->file->get(), "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0"):
|
case $this->file->getExtension() == 'xml' && stristr($this->file->get(), "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0"):
|
||||||
case $this->file->getExtension() == 'xml' && stristr($this->file->get(), "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_2.1"):
|
case $this->file->getExtension() == 'xml' && stristr($this->file->get(), "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_2.1"):
|
||||||
case $this->file->getExtension() == 'xml' && stristr($this->file->get(), "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_2.0"):
|
case $this->file->getExtension() == 'xml' && stristr($this->file->get(), "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_2.0"):
|
||||||
$expense = (new ZugferdEDocument($this->file))->run();
|
return (new ZugferdEDocument($this->file))->run();
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$zugferd_exception = $e;
|
$zugferd_exception = $e;
|
||||||
@ -62,16 +60,12 @@ class ParseEDocument extends AbstractService
|
|||||||
$mindee_exception = null;
|
$mindee_exception = null;
|
||||||
if (config('services.mindee.api_key') && (Ninja::isSelfHost() || (Ninja::isHosted() && $account->isPaid() && $account->plan == 'enterprise')))
|
if (config('services.mindee.api_key') && (Ninja::isSelfHost() || (Ninja::isHosted() && $account->isPaid() && $account->plan == 'enterprise')))
|
||||||
try {
|
try {
|
||||||
$expense = (new MindeeEDocument($this->file))->run();
|
return (new MindeeEDocument($this->file))->run();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// ignore not available exceptions
|
// ignore not available exceptions
|
||||||
$mindee_exception = $e;
|
$mindee_exception = $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return expense, when available and supress any errors occured before
|
|
||||||
if ($expense)
|
|
||||||
return $expense;
|
|
||||||
|
|
||||||
// log exceptions and throw error
|
// log exceptions and throw error
|
||||||
if ($zugferd_exception)
|
if ($zugferd_exception)
|
||||||
nlog("Zugferd Exception: " . $zugferd_exception->getMessage());
|
nlog("Zugferd Exception: " . $zugferd_exception->getMessage());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user