From: G. Richardson Date: Mon, 18 Jun 2012 15:48:14 +0000 (+0200) Subject: Erlaubte Sortierparameter für Verkaufsbericht filtern X-Git-Tag: release-3.0.0beta1~329^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4cba27b69dc65adeb0fb5b90335302a8f7407fa3;p=kivitendo-erp.git Erlaubte Sortierparameter für Verkaufsbericht filtern Parameter nicht ungeprüft übergeben, aber Liste der erlauben Parameter muß gepflegt werden. --- diff --git a/SL/VK.pm b/SL/VK.pm index 9cf8bed8b..55c46f234 100644 --- a/SL/VK.pm +++ b/SL/VK.pm @@ -77,8 +77,13 @@ sub invoice_transactions { # Bestandteile von Erzeugnissen herausfiltern $where .= " AND i.assemblyitem is not true "; - my $sortorder; + # filter allowed parameters for mainsort and subsort as passed by POST + my @databasefields = qw(description customername country partsgroup business salesman month); + my ($mainsort) = grep { /^$form->{mainsort}$/ } @databasefields; + my ($subsort) = grep { /^$form->{subsort}$/ } @databasefields; + die "illegal parameter for mainsort or subsort" unless $mainsort and $subsort; + my $sortorder; # sorting by month is a special case, we don't want to sort alphabetically by # month name, so we also extract a numerical month in the from YYYYMM to sort # by in case of month sorting @@ -88,16 +93,15 @@ sub invoice_transactions { if ($form->{mainsort} eq 'month') { $sortorder .= "nummonth," } else { - $sortorder .= $form->{mainsort} . ","; + $sortorder .= $mainsort . ","; }; if ($form->{subsort} eq 'month') { $sortorder .= "nummonth," } else { - $sortorder .= $form->{subsort} . ","; + $sortorder .= $subsort . ","; }; $sortorder .= 'ar.transdate,ar.invnumber'; # Default sorting order after mainsort und subsort - if ($form->{customer_id}) { $where .= " AND ar.customer_id = ?"; push(@values, $form->{customer_id});