From 459d662e76f412b94f07f6b20951f1dd6045ec85 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 5 Feb 2017 14:51:42 +0200 Subject: [PATCH] Remove draft invoices from the dashboard --- app/Ninja/Repositories/DashboardRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Ninja/Repositories/DashboardRepository.php b/app/Ninja/Repositories/DashboardRepository.php index 845ef5383fea..b0b1a95696b1 100644 --- a/app/Ninja/Repositories/DashboardRepository.php +++ b/app/Ninja/Repositories/DashboardRepository.php @@ -136,6 +136,7 @@ class DashboardRepository if ($entityType == ENTITY_INVOICE) { $records->select(DB::raw('sum(invoices.amount) as total, sum(invoices.balance) as balance, count(invoices.id) as count, '.$timeframe.' as '.$groupBy)) ->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD) + ->where('invoices.is_public', '=', true) ->where('is_recurring', '=', false); } elseif ($entityType == ENTITY_PAYMENT) { $records->select(DB::raw('sum(payments.amount - payments.refunded) as total, count(payments.id) as count, '.$timeframe.' as '.$groupBy)) @@ -166,6 +167,7 @@ class DashboardRepository ->where('clients.is_deleted', '=', false) ->where('invoices.is_deleted', '=', false) ->where('invoices.is_recurring', '=', false) + ->where('invoices.is_public', '=', true) ->where('invoices.invoice_type_id', '=', INVOICE_TYPE_STANDARD); if (!$viewAll){ @@ -227,6 +229,7 @@ class DashboardRepository ->where('accounts.id', '=', $accountId) ->where('clients.is_deleted', '=', false) ->where('invoices.is_deleted', '=', false) + ->where('invoices.is_public', '=', true) ->where('invoices.invoice_type_id', '=', INVOICE_TYPE_STANDARD) ->where('invoices.is_recurring', '=', false); @@ -292,6 +295,7 @@ class DashboardRepository ->where('invoices.balance', '>', 0) ->where('invoices.is_deleted', '=', false) ->where('invoices.deleted_at', '=', null) + ->where('invoices.is_public', '=', true) ->where('contacts.is_primary', '=', true) ->where('invoices.due_date', '<', date('Y-m-d')); @@ -318,6 +322,7 @@ class DashboardRepository ->where('invoices.quote_invoice_id', '=', null) ->where('invoices.balance', '>', 0) ->where('invoices.is_deleted', '=', false) + ->where('invoices.is_public', '=', true) ->where('contacts.is_primary', '=', true) ->where('invoices.due_date', '>=', date('Y-m-d')) ->orderBy('invoices.due_date', 'asc');