From db4dbdc87ea986ea45f6c82eec30e5a6d9b77eb7 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 12 Sep 2016 08:51:41 +0300 Subject: [PATCH] Cleaning up errors from the logs --- app/Console/Commands/ChargeRenewalInvoices.php | 9 +++++++-- app/Http/Controllers/DashboardApiController.php | 2 +- app/Ninja/PaymentDrivers/StripePaymentDriver.php | 2 +- resources/views/header.blade.php | 6 +++--- resources/views/payments/bank_transfer.blade.php | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/Console/Commands/ChargeRenewalInvoices.php b/app/Console/Commands/ChargeRenewalInvoices.php index a89b2432a3..0241afc063 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 297eed017c..75541aaeab 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 90b9d0ab49..dcfb880940 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 b73a499b08..98aa8b1aed 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 73a26e0108..f0688ae5a0 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