From 5d9392a55b571ade0f02d5853746ee8e2875c2d1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 27 Jul 2018 16:58:32 +0300 Subject: [PATCH] Fix for tests --- app/Http/Requests/InvoiceRequest.php | 4 +++- app/Libraries/HistoryUtils.php | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Requests/InvoiceRequest.php b/app/Http/Requests/InvoiceRequest.php index 885208160fde..06406ea97b35 100644 --- a/app/Http/Requests/InvoiceRequest.php +++ b/app/Http/Requests/InvoiceRequest.php @@ -46,7 +46,9 @@ class InvoiceRequest extends EntityRequest if(request()->is('quotes/*') && request()->isMethod('get') && !$this->user()->can('view', ENTITY_QUOTE)) return false; - HistoryUtils::trackViewed($invoice); + if ($invoice) { + HistoryUtils::trackViewed($invoice); + } return true; } diff --git a/app/Libraries/HistoryUtils.php b/app/Libraries/HistoryUtils.php index e4d907891ce0..a9e6c68e9602 100644 --- a/app/Libraries/HistoryUtils.php +++ b/app/Libraries/HistoryUtils.php @@ -106,10 +106,6 @@ class HistoryUtils public static function trackViewed(EntityModel $entity) { - if (! $entity) { - return; - } - $entityType = $entity->getEntityType(); $trackedTypes = [ ENTITY_CLIENT,