From: Stephan Köhler Date: Sat, 7 Jan 2006 13:35:37 +0000 (+0000) Subject: Merge von 737 aus unstable: Bugfix 125 X-Git-Tag: release-2.2.0~49 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=44bd0e5177f6b04d1183911eb47118348d96c411;p=kivitendo-erp.git Merge von 737 aus unstable: Bugfix 125 BUG 125 solved. (Dank an Hartmut Goebel) --- 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 = "";