From 44bd0e5177f6b04d1183911eb47118348d96c411 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20K=C3=B6hler?= Date: Sat, 7 Jan 2006 13:35:37 +0000 Subject: [PATCH] Merge von 737 aus unstable: Bugfix 125 BUG 125 solved. (Dank an Hartmut Goebel) --- SL/GL.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SL/GL.pm b/SL/GL.pm index a080b85fc..11cbe3646 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -342,6 +342,17 @@ sub all_transactions { my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|; + my $sortorder = join ', ', $form->sort_columns(qw(transdate reference source description accno)); + my %ordinal = ( transdate => 6, + reference => 4, + source => 7, + description => 5 ); + map { $sortorder =~ s/$_/$ordinal{$_}/ } keys %ordinal; + + if ($form->{sort}) { + $sortorder = $form->{sort} . ',' . $sortorder; + } + my $query = qq|SELECT g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, t.taxkey AS sorttax, g.description, ac.transdate, ac.source, ac.trans_id, @@ -371,7 +382,7 @@ sub all_transactions { AND ac.chart_id = c.id AND a.vendor_id = ct.id AND a.id = ac.trans_id - ORDER BY transdate, trans_id, taxkey DESC, sorttax DESC, oid|; + ORDER BY $sortorder, oid|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); my $trans_id = ""; -- 2.20.1