diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-01-10 00:07:03 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-01-10 00:07:03 +0000 |
commit | f0289c8e8762212c052f15d91fca00b65a707524 (patch) | |
tree | 07202d6f75704c9e2c783abd045b2201df0b38f5 | |
parent | 08e4db540ef5dc2b8ca90e27b11b5f8406d68224 (diff) |
Correcting outstanding report
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2033 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | LedgerSMB/AA.pm | 7 |
1 files 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); |