[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [2012] branches/1.2/LedgerSMB/Tax.pm



Revision: 2012
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2012&view=rev
Author:   tetragon
Date:     2007-12-27 18:42:48 -0800 (Thu, 27 Dec 2007)

Log Message:
-----------
Fixing the ordering of the rows returned by the tax retrieval query (anarcat
1818792).

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Tax.pm

Modified: branches/1.2/LedgerSMB/Tax.pm
===================================================================
--- branches/1.2/LedgerSMB/Tax.pm	2007-12-28 02:40:43 UTC (rev 2011)
+++ branches/1.2/LedgerSMB/Tax.pm	2007-12-28 02:42:48 UTC (rev 2012)
@@ -49,15 +49,17 @@
 			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;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.