for ( my $i = 0; $i < ($#split/2) ; $i++ ) {
my ($name,$authval) = split(/\|/,$split[$i*2+1]);
+ $authval =~ s/\:all$// if $authval;
push @sql_parameters, { 'name' => $name, 'authval' => $authval };
}
[% ELSE %]
<li><label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
<select name="[%- sql_param.input.name | html -%]" tabindex="1" size="1" id="[%- sql_param.input.id | html -%]">
+ [% IF (sql_param.include_all) %]<option value="%">All</option>[% END %]
[% FOREACH value IN sql_param.input.values %]
<option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
[% END %]
my @authval_errors;
my %uniq_params;
for(my $i=0;$i<($#split/2);$i++) {
- my ($text,$authorised_value) = split /\|/,$split[$i*2+1];
- my $sep = $authorised_value ? "|" : "";
- if( defined $uniq_params{$text.$sep.$authorised_value} ){
+ my ($text,$authorised_value_all) = split /\|/,$split[$i*2+1];
+ my $sep = $authorised_value_all ? "|" : "";
+ if( defined $uniq_params{$text.$sep.$authorised_value_all} ){
next;
- } else { $uniq_params{$text.$sep.$authorised_value} = "$i"; }
+ } else { $uniq_params{$text.$sep.$authorised_value_all} = "$i"; }
+ my ($authorised_value, $all) = split /:/, $authorised_value_all;
my $input;
my $labelid;
if ( not defined $authorised_value ) {
};
}
- push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value };
+ push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all };
}
$template->param('sql' => $sql,
'name' => $name,
FROM old_issues
WHERE YEAR(timestamp) = <<Year|custom_list>> AND
branchcode = <<Branch|branches>> AND
- borrowernumber = <<Borrower>>
+ borrowernumber = <<Borrower>> AND
+ itemtype = <<Item type|itemtypes:all>>
";
my @test_parameters_with_custom_list = (
{ 'name' => 'Year', 'authval' => 'custom_list' },
{ 'name' => 'Branch', 'authval' => 'branches' },
- { 'name' => 'Borrower', 'authval' => undef }
+ { 'name' => 'Borrower', 'authval' => undef },
+ { 'name' => 'Item type', 'authval' => 'itemtypes' }
);
is_deeply( GetParametersFromSQL($test_query_1), \@test_parameters_with_custom_list,