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
try {
$inboundEngine->handleExpenseMailbox($inboundMail);
} catch (\Exception $e) {
if ($e->getCode() == 409)
return response()->json(['message' => $e->getMessage()], 409);

View File

@ -204,19 +204,19 @@ class InboundMailEngine
// throw error, only, when its not expected
switch (true) {
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;
default:
throw $err;
}
}
$is_imported_by_parser = array_search($expense->id, $parsed_expense_ids);
// populate missing data with data from email
if (!$expense)
$expense = ExpenseFactory::create($company->id, $company->owner()->id);
$is_imported_by_parser = array_search($expense->id, $parsed_expense_ids);
if ($is_imported_by_parser)
$expense->public_notes = $expense->public_notes . $email->subject;
@ -238,13 +238,13 @@ class InboundMailEngine
if ($email->body_document !== null)
array_push($documents, $email->body_document);
$this->saveDocuments($documents, $expense);
if ($is_imported_by_parser)
$expense->saveQuietly();
else
$expense->save();
$this->saveDocuments($documents, $expense);
}
}