From f0289c8e8762212c052f15d91fca00b65a707524 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 10 Jan 2008 00:07:03 +0000 Subject: Correcting outstanding report git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2033 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/AA.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm index 182a6867..7b9da818 100644 --- a/LedgerSMB/AA.pm +++ b/LedgerSMB/AA.pm @@ -736,6 +736,7 @@ sub transactions { my $buysell = 'buy'; my $acc_trans_join; my $acc_trans_flds; + my $approved = ($form->{approved}) ? 'TRUE' : 'FALSE'; if ( $form->{vc} eq 'vendor' ) { $ml = -1; @@ -754,7 +755,9 @@ sub transactions { SELECT SUM(ac.amount) * -1 * $ml FROM acc_trans ac JOIN chart c ON (c.id = ac.chart_id) + WHERE ac.trans_id = a.id + AND ($approved OR ac.approved) AND (c.link LIKE '%${ARAP}_paid%' OR c.link = '')|; if ( $form->{transdateto} ) { @@ -957,9 +960,9 @@ sub transactions { } # the third state, all invoices, sets no explicit toggles. It just selects them all, as normal. + # $approved is safe as it is set to either "TRUE" or "FALSE" - $approved = ($form->{approved}) ? 'NULL' : 'FALSE'; - $query .= "WHERE (coalesce($approved, TRUE) OR a.approved) AND $where + $query .= "WHERE ($approved OR a.approved) AND $where ORDER BY $sortorder"; my $sth = $dbh->prepare($query); $sth->execute(@paidargs) || $form->dberror($query); -- cgit v1.2.3