summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-28 02:42:48 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-28 02:42:48 +0000
commit07c1576523439c0d62350bfa164d7c89f09db74a (patch)
tree25c7c94b313bb053350af2982f8556d7a5f4987a
parent1250e797afd9a206a1dc579601429c2af91de388 (diff)
Fixing the ordering of the rows returned by the tax retrieval query (anarcat
1818792). git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2012 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/Tax.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/LedgerSMB/Tax.pm b/LedgerSMB/Tax.pm
index bc0ba5fe..7c0d9681 100755
--- a/LedgerSMB/Tax.pm
+++ b/LedgerSMB/Tax.pm
@@ -49,15 +49,17 @@ sub init_taxes {
t.rate, t.chart_id, t.pass, m.taxmodulename
FROM tax t INNER JOIN chart c ON (t.chart_id = c.id)
INNER JOIN taxmodule m ON (t.taxmodule_id = m.taxmodule_id)
- WHERE c.accno = ? AND coalesce(validto, ?) >= ?
- ORDER BY coalesce(validto, now()) DESC|;
+ WHERE c.accno = ? AND
+ coalesce(validto::timestamp, 'infinity'::timestamp) >= ?
+ ORDER BY
+ coalesce(validto::timestamp, 'infinity'::timestamp) ASC|;
my $sth = $dbh->prepare($query);
foreach $taxaccount (@accounts) {
next if ( !defined $taxaccount );
if ( defined $taxaccounts2 ) {
next if $taxaccounts2 !~ /\b$taxaccount\b/;
}
- $sth->execute($taxaccount, $transdate, $transdate)
+ $sth->execute($taxaccount, $transdate)
|| $form->dberror($query);
my $ref = $sth->fetchrow_hashref;