( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_itime) );
$where_clause = defined($where_clause) ? $where_clause : '';
- $main::lxdebug->message(0, "where_clause = ".$where_clause);
my $query =
qq|SELECT DISTINCT $select{trans}
FROM inventory i1
my $sort_order = $form->{order};
$sort_col = $filter{sort} unless $sort_col;
- $sort_col = "parts_id" unless $sort_col;
+ # falls $sort_col gar nicht in dem Bericht aufgenommen werden soll,
+ # führt ein entsprechenes order by $sort_col zu einem SQL-Fehler
+ # entsprechend parts_id als default lassen, wenn $sort_col UND l_$sort_col
+ # vorhanden sind (bpsw. l_partnumber = 'Y', für in Bericht aufnehmen).
+ # S.a. Bug 1597 jb 12.5.2011
+ $sort_col = "parts_id" unless ($sort_col && $form->{"l_$sort_col"});
$sort_order = $filter{order} unless $sort_order;
$sort_col =~ s/ASC|DESC//; # kill stuff left in from previous queries
my $orderby = $sort_col;