From 0000e2ae1b32d360b1cb44996f5a86a7207340a2 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 7 Jul 2008 09:11:25 +0000 Subject: [PATCH] =?utf8?q?Sortierung=20in=20Berichten=20=C3=BCber=20Angebo?= =?utf8?q?te=20/=20Auftr=C3=A4ge=20/=20Presianfragen=20auch=20auf-=20und?= =?utf8?q?=20absteigbar=20sortierbar=20gemacht.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/OE.pm | 5 +++-- bin/mozilla/oe.pl | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 3dd83b768..faae5d6f7 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -148,7 +148,8 @@ sub transactions { push(@values, '%' . $form->{transaction_description} . '%'); } - my $sortorder = join(', ', ("o.id", $form->sort_columns("transdate", $ordnumber, "name"))); + my $sortdir = $form->{sortdir} ? 'ASC' : 'DESC'; + my $sortorder = join(', ', map { "${_} ${sortdir} " } ("o.id", $form->sort_columns("transdate", $ordnumber, "name"))); my %allowed_sort_columns = ( "transdate" => "o.transdate", "reqdate" => "o.reqdate", @@ -162,7 +163,7 @@ sub transactions { "transaction_description" => "o.transaction_description" ); if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) { - $sortorder = $allowed_sort_columns{$form->{sort}}; + $sortorder = $allowed_sort_columns{$form->{sort}} . " ${sortdir}"; } $query .= qq| ORDER by | . $sortorder; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index bc4cc453a..5c1a9c246 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -888,7 +888,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; OE->transactions(\%myconfig, \%$form); @@ -967,7 +969,8 @@ sub orders { ); foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman 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"; } my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr); @@ -979,7 +982,7 @@ sub orders { $report->set_columns(%column_defs); $report->set_column_order(@columns); $report->set_export_options('orders', @hidden_variables); - $report->set_sort_indicator($form->{sort}, 1); + $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my @options; my ($department) = split m/--/, $form->{department}; -- 2.20.1