From: Moritz Bunkus Date: Mon, 7 Jul 2008 09:11:25 +0000 (+0000) Subject: Sortierung in Berichten über Angebote / Aufträge / Presianfragen auch auf- und abstei... X-Git-Tag: release-2.6.0beta1~88 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0000e2ae1b32d360b1cb44996f5a86a7207340a2;p=kivitendo-erp.git Sortierung in Berichten über Angebote / Aufträge / Presianfragen auch auf- und absteigbar sortierbar gemacht. --- 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};