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

SF.net SVN: ledger-smb:[5605] branches/1.3/LedgerSMB/RP.pm



Revision: 5605
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5605&view=rev
Author:   ehuelsmann
Date:     2013-01-17 20:03:07 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
Actually *sort* on requested sort column in tax (collected) report.

Modified Paths:
--------------
    branches/1.3/LedgerSMB/RP.pm

Modified: branches/1.3/LedgerSMB/RP.pm
===================================================================
--- branches/1.3/LedgerSMB/RP.pm	2013-01-17 19:06:30 UTC (rev 5604)
+++ branches/1.3/LedgerSMB/RP.pm	2013-01-17 20:03:07 UTC (rev 5605)
@@ -1968,6 +1968,21 @@
     use strict;
     my ( $self, $myconfig, $form ) = @_;
 
+    my %orderings = (
+      transdate => 'gl.transdate',
+      invnumber => 'gl.invnumber',
+      name      => 'e.name',
+      id        => 'gl.id'
+    );
+
+    my $order = $form->{"sort"};
+    my $order_by;
+    if (defined $orderings{$order}) {
+       $order_by = "ORDER BY $orderings{$order}";
+    } else {
+       $order_by = "";
+    }
+
     my $dbh = $form->{dbh};
 
     my ( $null, $department_id ) = split /--/, $form->{department};
@@ -2016,7 +2031,9 @@
    HAVING (sum(CASE WHEN a.id is not null then ac.amount else 0 end) 
            <> 0 AND ? IS NOT NULL) 
           OR (? IS NULL and sum(CASE WHEN a.id is not null then ac.amount
-                                ELSE 0 END) = 0)|;
+                                ELSE 0 END) = 0)
+ $order_by
+|;
 
     my $sth = $dbh->prepare($query);
     $sth->execute($account_class, $account_class, 

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