Catch/log recurring invoice errors
This commit is contained in:
parent
19f9030200
commit
a85343c8e8
1 changed files with 12 additions and 4 deletions
|
|
@ -13,6 +13,8 @@ use DateTime;
|
|||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Auth;
|
||||
use Exception;
|
||||
use Utils;
|
||||
|
||||
/**
|
||||
* Class SendRecurringInvoices.
|
||||
|
|
@ -110,12 +112,18 @@ class SendRecurringInvoices extends Command
|
|||
$account = $recurInvoice->account;
|
||||
$account->loadLocalizationSettings($recurInvoice->client);
|
||||
Auth::loginUsingId($recurInvoice->user_id);
|
||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||
|
||||
if ($invoice && ! $invoice->isPaid()) {
|
||||
$this->info('Sending Invoice');
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
try {
|
||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue