X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/a53233e56a9d4001b47bcf412b4bfe46910d3117..ca12e8dfc4773aabc13818a0398e06e44028e2bc:/SL/AP.pm diff --git a/SL/AP.pm b/SL/AP.pm index 7629381b0..763fd3374 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -464,15 +464,14 @@ sub ap_transactions { my @a = (transdate, invnumber, name); push @a, "employee" if $self->{l_employee}; - my $sortorder = join(', ', @a); + my $sortdir = !defined $form->{sortdir} ? 'ASC' : $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}; + if (grep({ $_ eq $form->{sort} } qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee transaction_description))) { + $sortorder = $form->{sort} . " $sortdir"; } - $query .= " ORDER by $sortorder"; + $query .= " ORDER BY $sortorder"; my $sth = $dbh->prepare($query); $sth->execute(@values) ||