From c9535a606a342350db4666515915e6a57a3661d2 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 7 Aug 2012 15:09:35 -0400 Subject: [PATCH] Bug 8588 - Duplicate field IDs cause problems with SQL report parameter entry Changes to markup and script to enable unique ids on form fields. These changes allow for working label+input pairs on one or more text and select inputs and multiple working datepickers. To test, create a report with more than one date parameter, at least one text parameter, and one or more authorised value parameters. The datepickers should each work properly, and labels should by clickable. Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain --- .../en/modules/reports/guided_reports_start.tt | 16 +++++++++++----- reports/guided_reports.pl | 8 ++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index a1528228f0..21d8235d5c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -504,16 +504,22 @@ canned reports and writing custom SQL reports.

Enter parameters for report [% name %]:

[% IF ( notes ) %]

[% notes %]

[% END %] +
+
    [% FOREACH sql_param IN sql_params %] [% IF sql_param.input == 'date' %] -

    - [% sql_param.entry %]: -

    +
  1. + +
  2. + [% ELSIF ( sql_param.input == 'text' ) %] +
  3. [% ELSE %] -

    [% sql_param.entry %]: [% sql_param.input %]

    +
  4. [% sql_param.input %]
  5. [% END %] [% END %] - +
+
+
[% END %] diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 1112274a2c..8a2aada943 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -508,6 +508,7 @@ elsif ($phase eq 'Run this report'){ for(my $i=0;$i<($#split/2);$i++) { my ($text,$authorised_value) = split /\|/,$split[$i*2+1]; my $input; + my $labelid; if ($authorised_value eq "date") { $input = 'date'; } @@ -563,8 +564,11 @@ elsif ($phase eq 'Run this report'){ $authorised_lib{$value} = $lib; } } + $labelid = $text; + $labelid =~ s/\W//g; $input =CGI::scrolling_list( # FIXME: factor out scrolling_list -name => "sql_params", + -id => "sql_params_".$labelid, -values => \@authorised_values, # -default => $value, -labels => \%authorised_lib, @@ -575,9 +579,9 @@ elsif ($phase eq 'Run this report'){ ); } else { - $input = ""; + $input = "text"; } - push @tmpl_parameters, {'entry' => $text, 'input' => $input }; + push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid }; } $template->param('sql' => $sql, 'name' => $name, -- 2.39.5