summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-01-09 22:35:21 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-01-09 22:35:21 +0000
commit428f6a8085fdef7360473a4c9328766064475324 (patch)
tree0312ff5ff970ecbb4f45aa72da4c5cf2ee76a3f6 /LedgerSMB
parent7f92c3efa77d327d078a4974e0dd89e353662198 (diff)
Correcting trial balance and gl report not to pull unapproved transactions
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2031 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/GL.pm18
-rw-r--r--LedgerSMB/RP.pm7
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' ) {