diff --git a/app/Console/Commands/ChargeRenewalInvoices.php b/app/Console/Commands/ChargeRenewalInvoices.php index a89b2432a3e6..0241afc06391 100644 --- a/app/Console/Commands/ChargeRenewalInvoices.php +++ b/app/Console/Commands/ChargeRenewalInvoices.php @@ -6,6 +6,7 @@ use App\Ninja\Repositories\AccountRepository; use App\Services\PaymentService; use App\Models\Invoice; use App\Models\Account; +use Exception; /** * Class ChargeRenewalInvoices @@ -80,8 +81,12 @@ class ChargeRenewalInvoices extends Command continue; } - $this->info("Charging invoice {$invoice->invoice_number}"); - $this->paymentService->autoBillInvoice($invoice); + try { + $this->info("Charging invoice {$invoice->invoice_number}"); + $this->paymentService->autoBillInvoice($invoice); + } catch (Exception $exception) { + $this->info('Error: ' . $exception->getMessage()); + } } $this->info('Done'); diff --git a/app/Http/Controllers/DashboardApiController.php b/app/Http/Controllers/DashboardApiController.php index 297eed017c2d..75541aaeab9d 100644 --- a/app/Http/Controllers/DashboardApiController.php +++ b/app/Http/Controllers/DashboardApiController.php @@ -46,7 +46,7 @@ class DashboardApiController extends BaseAPIController 'paidToDateCurrency' => $paidToDate[0]->currency_id ? $paidToDate[0]->currency_id : 0, 'balances' => $balances[0]->value ? $balances[0]->value : 0, 'balancesCurrency' => $balances[0]->currency_id ? $balances[0]->currency_id : 0, - 'averageInvoice' => $averageInvoice[0]->invoice_avg ? $averageInvoice[0]->invoice_avg : 0, + 'averageInvoice' => (count($averageInvoice) && $averageInvoice[0]->invoice_avg) ? $averageInvoice[0]->invoice_avg : 0, 'averageInvoiceCurrency' => $averageInvoice[0]->currency_id ? $averageInvoice[0]->currency_id : 0, 'invoicesSent' => $metrics ? $metrics->invoices_sent : 0, 'activeClients' => $metrics ? $metrics->active_clients : 0, diff --git a/app/Ninja/PaymentDrivers/StripePaymentDriver.php b/app/Ninja/PaymentDrivers/StripePaymentDriver.php index 90b9d0ab4931..dcfb88094066 100644 --- a/app/Ninja/PaymentDrivers/StripePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/StripePaymentDriver.php @@ -402,7 +402,7 @@ class StripePaymentDriver extends BasePaymentDriver $paymentMethod = PaymentMethod::scope(false, $accountId)->where('source_reference', '=', $sourceRef)->first(); if (!$paymentMethod) { - throw new Exception('Unknown payment method'); + return false; } if ($eventType == 'customer.source.deleted' || $eventType == 'customer.bank_account.deleted') { diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index b73a499b08fb..98aa8b1aed90 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -353,9 +353,9 @@ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { var target = $(e.target).attr("href") // activated tab - var scrollmem = $('html,body').scrollTop(); - window.location.hash = target; - $('html,body').scrollTop(scrollmem); + if (history.pushState) { + history.pushState(null, null, target); + } }); }); diff --git a/resources/views/payments/bank_transfer.blade.php b/resources/views/payments/bank_transfer.blade.php index 73a26e010876..f0688ae5a09f 100644 --- a/resources/views/payments/bank_transfer.blade.php +++ b/resources/views/payments/bank_transfer.blade.php @@ -4,7 +4,8 @@ @parent @if (isset($accountGateway) && $accountGateway->getPlaidEnabled()) - + @endif