From 4c5b4d51646f2acbc33b48cda3c8002dcc3039e8 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 20 Oct 2016 17:50:59 +0300 Subject: [PATCH] Filter buy now clients and invoices --- app/Ninja/Repositories/ClientRepository.php | 1 + app/Ninja/Repositories/InvoiceRepository.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Ninja/Repositories/ClientRepository.php b/app/Ninja/Repositories/ClientRepository.php index 48788de3a97d..d1a2d77df101 100644 --- a/app/Ninja/Repositories/ClientRepository.php +++ b/app/Ninja/Repositories/ClientRepository.php @@ -31,6 +31,7 @@ class ClientRepository extends BaseRepository ->where('clients.account_id', '=', \Auth::user()->account_id) ->where('contacts.is_primary', '=', true) ->where('contacts.deleted_at', '=', null) + ->whereRaw('(clients.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices ->select( DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'), DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'), diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index d92573deea5a..1b7cb59ab9ac 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -50,6 +50,7 @@ class InvoiceRepository extends BaseRepository ->where('contacts.deleted_at', '=', null) ->where('invoices.is_recurring', '=', false) ->where('contacts.is_primary', '=', true) + ->whereRaw('(clients.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices ->select( DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'), DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'),