@@ -, +, @@ SELECT * FROM items WHERE itemnumber IN <> --- C4/Reports/Guided.pm | 1 + .../prog/en/modules/reports/guided_reports_start.tt | 5 +++++ reports/guided_reports.pl | 16 ++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) --- a/C4/Reports/Guided.pm +++ a/C4/Reports/Guided.pm @@ -916,6 +916,7 @@ Returns a hash containig all reserved words sub GetReservedAuthorisedValues { my %reserved_authorised_values = map { $_ => 1 } ( 'date', + 'list', 'branches', 'itemtypes', 'cn_source', --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -814,6 +814,11 @@ + [% ELSIF ( sql_param.input == 'textarea' ) %] +
  • + + +
  • [% ELSE %]
  • --- a/reports/guided_reports.pl +++ a/reports/guided_reports.pl @@ -220,7 +220,6 @@ elsif ( $phase eq 'Update SQL'){ my $cache_expiry_units = $input->param('cache_expiry_units'); my $public = $input->param('public'); my $save_anyway = $input->param('save_anyway'); - my @errors; # if we have the units, then we came from creating a report from SQL and thus need to handle converting units @@ -734,6 +733,9 @@ elsif ($phase eq 'Run this report'){ } elsif ( $authorised_value eq "date" ) { # require a date, provide a date picker $input = 'date'; + } elsif ( $authorised_value eq "list" ) { + # require a list, provide a textarea + $input = 'textarea'; } else { # defined $authorised_value, and not 'date' my $dbh=C4::Context->dbh; @@ -1118,7 +1120,17 @@ sub get_prepped_report { if ($split[$i*2+1] =~ /\|\s*date\s*$/) { $quoted = output_pref({ dt => dt_from_string($quoted), dateformat => 'iso', dateonly => 1 }) if $quoted; } - $quoted = C4::Context->dbh->quote($quoted); + unless( $split[$i*2+1] =~ /\|\s*list\s*$/ && $quoted ){ + $quoted = C4::Context->dbh->quote($quoted); + } else { + my @list = split /\n/, $quoted; + my @quoted_list; + foreach my $item ( @list ){ + $item =~ s/\r//; + push @quoted_list, C4::Context->dbh->quote($item); + } + $quoted="(".join(",",@quoted_list).")"; + } $sql =~ s/<<$split[$i*2+1]>>/$quoted/; } return $sql,$headers; --