From: Moritz Bunkus <m.bunkus@linet-services.de> Date: Mon, 7 Jul 2008 09:44:29 +0000 (+0000) Subject: Sortierung in Berichten über Eingangsrechnungen/Kreditorenbuchungen auch auf- und... X-Git-Tag: release-2.6.0beta1~85 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=262108d0f0d61ce6e4d3e436e9042c1002ec41f7;p=kivitendo-erp.git Sortierung in Berichten über Eingangsrechnungen/Kreditorenbuchungen auch auf- und absteigbar sortierbar gemacht. --- diff --git a/SL/AP.pm b/SL/AP.pm index 7629381b0..e9e1a7ecd 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -464,15 +464,16 @@ sub ap_transactions { my @a = (transdate, invnumber, name); push @a, "employee" if $self->{l_employee}; - my $sortorder = join(', ', @a); + my $sortdir = $form->{sortdir} ? 'ASC' : 'DESC'; + my $sortorder = join(', ', map { "$_ $sortdir" } @a); if (grep({ $_ eq $form->{sort} } qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee))) { - $sortorder = $form->{sort}; + $sortorder = $form->{sort} . " $sortdir"; } - $query .= " ORDER by $sortorder"; + $query .= " ORDER BY $sortorder"; my $sth = $dbh->prepare($query); $sth->execute(@values) || diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index a252f0ec8..b729cf0f6 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -1376,7 +1376,7 @@ sub ap_transactions { ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor}); - $form->{sort} ||= 'transdate'; + report_generator_set_default_sort('transdate', 1); AP->ap_transactions(\%myconfig, \%$form); @@ -1413,9 +1413,9 @@ sub ap_transactions { 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), }, ); - 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); @@ -1428,7 +1428,7 @@ sub ap_transactions { $report->set_export_options('ap_transactions', @hidden_variables); - $report->set_sort_indicator($form->{sort}, 1); + $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my @options; if ($form->{vendor}) {