1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Catch/log recurring invoice errors

This commit is contained in:
Hillel Coren 2017-07-12 12:37:19 +03:00
parent 19f9030200
commit a85343c8e8

View File

@ -13,6 +13,8 @@ use DateTime;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Auth; use Auth;
use Exception;
use Utils;
/** /**
* Class SendRecurringInvoices. * Class SendRecurringInvoices.
@ -110,12 +112,18 @@ class SendRecurringInvoices extends Command
$account = $recurInvoice->account; $account = $recurInvoice->account;
$account->loadLocalizationSettings($recurInvoice->client); $account->loadLocalizationSettings($recurInvoice->client);
Auth::loginUsingId($recurInvoice->user_id); Auth::loginUsingId($recurInvoice->user_id);
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
if ($invoice && ! $invoice->isPaid()) { try {
$this->info('Sending Invoice'); $invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
$this->mailer->sendInvoice($invoice); if ($invoice && ! $invoice->isPaid()) {
$this->info('Sending Invoice');
$this->mailer->sendInvoice($invoice);
}
} catch (Exception $exception) {
$this->info('Error: ' . $exception->getMessage());
Utils::logError($exception);
} }
Auth::logout(); Auth::logout();
} }
} }