From 23c7245a5a0bef08132071fbe2b087a1df0099c1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 7 Jul 2008 09:16:20 +0000 Subject: [PATCH] =?utf8?q?Sortierung=20in=20Berichten=20=C3=BCber=20Liefer?= =?utf8?q?scheine=20auch=20auf-=20und=20absteigbar=20sortierbar=20gemacht.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DO.pm | 5 +++-- bin/mozilla/do.pl | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SL/DO.pm b/SL/DO.pm index 3f623ec6d..390f51f32 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -142,12 +142,13 @@ sub transactions { "transaction_description" => "dord.transaction_description" ); - my $sortoder = "dord.id"; + my $sortdir = $form->{sortdir} ? 'ASC' : 'DESC'; + my $sortorder = "dord.id"; if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) { $sortorder = $allowed_sort_columns{$form->{sort}}; } - $query .= qq| ORDER by | . $sortorder; + $query .= qq| ORDER by | . $sortorder . " $sortdir"; $form->{DO} = selectall_hashref_query($form, $dbh, $query, @values); diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index c88f3b0ec..c3c4b07e4 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -409,7 +409,9 @@ sub orders { ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} }); - $form->{sort} ||= 'transdate'; + $form->{sort} ||= 'transdate'; + $form->{sortdir} = 1 unless (defined $form->{sortdir}); + $form->{sortdir} = $form->{sortdir} ? 1 : 0; DO->transactions(); @@ -456,7 +458,8 @@ sub orders { ); foreach my $name (qw(id transdate donumber ordnumber name employee shipvia)) { - $column_defs{$name}->{link} = $href . "&sort=$name"; + my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; + $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } $form->{"l_type"} = "Y"; @@ -469,7 +472,7 @@ sub orders { $report->set_export_options('orders', @hidden_variables); - $report->set_sort_indicator($form->{sort}, 1); + $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my @options; if ($form->{customer}) { -- 2.20.1