mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improving error reporting API
This commit is contained in:
parent
1ab4bb636f
commit
4a033ce925
@ -282,12 +282,15 @@ class InvoiceApiController extends BaseAPIController
|
|||||||
$data = Input::all();
|
$data = Input::all();
|
||||||
$error = null;
|
$error = null;
|
||||||
|
|
||||||
$invoice = Invoice::scope($data['id'])->firstOrFail();
|
$invoice = Invoice::scope($data['id'])->withTrashed()->first();
|
||||||
|
|
||||||
$this->mailer->sendInvoice($invoice);
|
if(!$invoice)
|
||||||
|
return $this->errorResponse(['message'=>'Invoice does not exist.'], 400);
|
||||||
|
|
||||||
if($error) {
|
$emailAction = $this->mailer->sendInvoice($invoice);
|
||||||
$response['error'] = "There was an error sending the invoice";
|
|
||||||
|
if(($error) || ($emailAction === FALSE)) {
|
||||||
|
return $this->errorResponse(['message'=>'There was an error sending the invoice'], 400);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$response = json_encode(RESULT_SUCCESS, JSON_PRETTY_PRINT);
|
$response = json_encode(RESULT_SUCCESS, JSON_PRETTY_PRINT);
|
||||||
|
@ -41,6 +41,8 @@ class ContactMailer extends Mailer
|
|||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
$account = $invoice->account;
|
$account = $invoice->account;
|
||||||
|
|
||||||
|
$response = false;
|
||||||
|
|
||||||
if ($client->trashed()) {
|
if ($client->trashed()) {
|
||||||
return trans('texts.email_errors.inactive_client');
|
return trans('texts.email_errors.inactive_client');
|
||||||
} elseif ($invoice->trashed()) {
|
} elseif ($invoice->trashed()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user