summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;