From a2327c50ec4ce08210a272c41a5404af5a7ce3c0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 27 Jan 2015 19:19:44 +0100 Subject: [PATCH] Should fix query [skip ci] --- app/lib/FireflyIII/Report/ReportQuery.php | 35 ++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/app/lib/FireflyIII/Report/ReportQuery.php b/app/lib/FireflyIII/Report/ReportQuery.php index a07e50587b..113bcaaffe 100644 --- a/app/lib/FireflyIII/Report/ReportQuery.php +++ b/app/lib/FireflyIII/Report/ReportQuery.php @@ -372,22 +372,25 @@ class ReportQuery implements ReportQueryInterface } ) ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->where( - function ($query) { - $query->where( - function ($q) { - $q->where('transaction_types.type', 'Withdrawal'); - $q->where('acm_from.data', '!=', '"sharedExpense"'); - } - ); - $query->orWhere( - function ($q) { - $q->where('transaction_types.type', 'Transfer'); - $q->where('acm_from.data', '=', '"sharedExpense"'); - } - ); - } - ) + + ->where( + function ($query) { + $query->where( + function ($q) { + $q->where('transaction_types.type', 'Withdrawal'); + $q->where('acm_from.data', '!=', '"sharedExpense"'); + } + ); + $query->orWhere( + function ($q) { + $q->where('transaction_types.type', 'Transfer'); + $q->where('acm_to.data', '=', '"sharedExpense"'); + } + ); + } + ) + + ->before($end) ->after($start) ->where('transaction_journals.user_id', \Auth::user()->id)