From: Moritz Bunkus Date: Mon, 7 Jul 2008 09:51:55 +0000 (+0000) Subject: Sortierung in Berichten über Ausgangsrechnungen/Debitorenbuchungen auch auf- und... X-Git-Tag: release-2.6.0beta1~84 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=679db39f627675838659464293d384b0f8a79a96;p=kivitendo-erp.git Sortierung in Berichten über Ausgangsrechnungen/Debitorenbuchungen auch auf- und absteigbar sortierbar gemacht. --- diff --git a/SL/AR.pm b/SL/AR.pm index 0aa4ff372..d9a42ce36 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -468,15 +468,16 @@ sub ar_transactions { my @a = (transdate, invnumber, name); push @a, "employee" if $form->{l_employee}; - my $sortorder = join(', ', @a); + my $sortdir = $form->{sortdir} ? 'ASC' : 'DESC'; + my $sortorder = join(', ', map { "$_ $sortdir" } @a); if (grep({ $_ eq $form->{sort} } qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia))) { - $sortorder = $form->{sort}; + $sortorder = $form->{sort} . " $sortdir"; } - $query .= " WHERE $where ORDER by $sortorder"; + $query .= " WHERE $where ORDER BY $sortorder"; my $sth = $dbh->prepare($query); $sth->execute(@values) || diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 0498e117d..e0571633d 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1457,7 +1457,7 @@ sub ar_transactions { $form->{customer} = $form->unescape($form->{customer}); ($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer}); - $form->{sort} ||= 'transdate'; + report_generator_set_default_sort('transdate', 1); AR->ar_transactions(\%myconfig, \%$form); @@ -1500,9 +1500,9 @@ sub ar_transactions { 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), }, ); - foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid - employee shippingpoint shipvia)) { - $column_defs{$name}->{link} = $href . "&sort=$name"; + foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia)) { + 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 paid due); @@ -1515,7 +1515,7 @@ sub ar_transactions { $report->set_export_options('ar_transactions', @hidden_variables); - $report->set_sort_indicator($form->{sort}, 1); + $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my @options; if ($form->{customer}) {