1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
This commit is contained in:
paulwer 2024-08-28 08:18:39 +02:00
parent b9f56f0e30
commit 2c7bf4f44d
2 changed files with 7 additions and 5 deletions

View File

@ -320,7 +320,9 @@ class PostMarkController extends BaseController
// perform // perform
try { try {
$inboundEngine->handleExpenseMailbox($inboundMail); $inboundEngine->handleExpenseMailbox($inboundMail);
} catch (\Exception $e) { } catch (\Exception $e) {
if ($e->getCode() == 409) if ($e->getCode() == 409)
return response()->json(['message' => $e->getMessage()], 409); return response()->json(['message' => $e->getMessage()], 409);

View File

@ -204,19 +204,19 @@ class InboundMailEngine
// throw error, only, when its not expected // throw error, only, when its not expected
switch (true) { switch (true) {
case ($err->getMessage() === 'E-Invoice standard not supported'): case ($err->getMessage() === 'E-Invoice standard not supported'):
case ($err->getMessage() === 'File type not supported'): case ($err->getMessage() === 'File type not supported or issue while parsing'):
break; break;
default: default:
throw $err; throw $err;
} }
} }
$is_imported_by_parser = array_search($expense->id, $parsed_expense_ids);
// populate missing data with data from email // populate missing data with data from email
if (!$expense) if (!$expense)
$expense = ExpenseFactory::create($company->id, $company->owner()->id); $expense = ExpenseFactory::create($company->id, $company->owner()->id);
$is_imported_by_parser = array_search($expense->id, $parsed_expense_ids);
if ($is_imported_by_parser) if ($is_imported_by_parser)
$expense->public_notes = $expense->public_notes . $email->subject; $expense->public_notes = $expense->public_notes . $email->subject;
@ -238,13 +238,13 @@ class InboundMailEngine
if ($email->body_document !== null) if ($email->body_document !== null)
array_push($documents, $email->body_document); array_push($documents, $email->body_document);
$this->saveDocuments($documents, $expense);
if ($is_imported_by_parser) if ($is_imported_by_parser)
$expense->saveQuietly(); $expense->saveQuietly();
else else
$expense->save(); $expense->save();
$this->saveDocuments($documents, $expense);
} }
} }