diff options
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/GL.pm | 18 | ||||
-rw-r--r-- | LedgerSMB/RP.pm | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/LedgerSMB/GL.pm b/LedgerSMB/GL.pm index 8979d3ca..7ed6ab4c 100644 --- a/LedgerSMB/GL.pm +++ b/LedgerSMB/GL.pm @@ -417,6 +417,15 @@ sub all_transactions { } else { $chart_id = 'NULL'; } + + if (!defined $form->{approved}){ + $approved = 'true'; + } elsif ($form->{approved} eq 'all') { + $approved = 'NULL'; + } else { + $approved = $dbh->quote($form->{approved}); + } + my $query = qq|SELECT g.id, 'gl' AS type, $false AS invoice, g.reference, g.description, ac.transdate, ac.source, ac.amount, c.accno, c.gifi_accno, g.notes, c.link, @@ -429,6 +438,9 @@ sub all_transactions { WHERE $glwhere AND (ac.chart_id = $chart_id OR $chart_id IS NULL) + AND ($approved IS NULL OR + $approved = + (ac.approved AND g.approved)) UNION ALL @@ -445,6 +457,9 @@ sub all_transactions { WHERE $arwhere AND (ac.chart_id = $chart_id OR $chart_id IS NULL) + AND ($approved IS NULL OR + $approved = + (ac.approved AND a.approved)) UNION ALL @@ -461,6 +476,9 @@ sub all_transactions { WHERE $apwhere AND (ac.chart_id = $chart_id OR $chart_id IS NULL) + AND ($approved IS NULL OR + $approved = + (ac.approved AND a.approved)) ORDER BY $sortorder|; my $sth = $dbh->prepare($query); diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm index bd27677f..b51d7290 100644 --- a/LedgerSMB/RP.pm +++ b/LedgerSMB/RP.pm @@ -925,6 +925,13 @@ sub get_accounts { $project = qq| AND ac.project_id = $project_id|; } + if (!defined $form->{approved}){ + $approved = 'true'; + } elsif ($form->{approved} eq 'all') { + $approved = 'NULL'; + } else { + $approved = $dbh->quote($form->{approved}); + } if ( $form->{accounttype} eq 'gifi' ) { |