From d37a73c6cee7e42a57c7157530fc84ebc03a2bae Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 11 Jan 2016 11:32:23 +0000 Subject: [PATCH] Bug 2669: Change checkboxes to radio buttons on dictionary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On creating new dictionary for report, the choice between "All dates" and "Date range" should be a real radio button, not 2 radio buttons with different names (which means they could be selected altogether...) Note that I don't understand what means 'All dates', there is no condition generated for the dictionary. We should not have to select a field if we don't want to add a condition on it :) Test plan: Create a new dictionary for the Patron module, then a date field (dateenrolled or birthdate, etc.) Confirm that the radio buttons now behave as radio buttons... Signed-off-by: Aleisha Looks so much nicer too! Radio buttons display as expected. Signed-off-by: Marc VĂ©ron --- .../prog/en/modules/reports/dictionary.tt | 36 ++++++-------- reports/dictionary.pl | 51 +++++++++++--------- 2 files changed, 41 insertions(+), 46 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt index f356cd9..c21af0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt @@ -189,28 +189,20 @@ [% END %] [% IF ( column.date ) %] -
  • Choose: - - - - - -
    All datesORDate range
    - - - - - - - - - -
    Start of date range -
    [% INCLUDE 'date-format.inc' %]
    -
    End of date range - -
    [% INCLUDE 'date-format.inc' %]
    -
  • +
  • + + + + +
  • +
  • + Start of date range + +
    [% INCLUDE 'date-format.inc' %]
    + End of date range + +
    [% INCLUDE 'date-format.inc' %]
    +
  • [% END %] [% IF ( column.text ) %]
  • diff --git a/reports/dictionary.pl b/reports/dictionary.pl index 964f76f..ae6fe7d 100755 --- a/reports/dictionary.pl +++ b/reports/dictionary.pl @@ -147,31 +147,34 @@ elsif ( $phase eq 'New Term step 5' ) { $query_criteria .= " AND $crit='$value'"; } - $value = $input->param( $crit . "_start_value" ); - if ($value) { - my %tmp_hash; - $tmp_hash{'name'} = "$crit Start"; - $tmp_hash{'value'} = $value; - push @criteria_loop, \%tmp_hash; - my $value_dt = eval { dt_from_string( $value ) }; - $value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } ) - if ( $value_dt ); - - $query_criteria .= " AND $crit >= '$value'"; - } - - $value = $input->param( $crit . "_end_value" ); - if ($value) { - my %tmp_hash; - $tmp_hash{'name'} = "$crit End"; - $tmp_hash{'value'} = $value; - push @criteria_loop, \%tmp_hash; - my $value_dt = eval { dt_from_string( $value ) }; - $value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } ) - if ( $value_dt ); - - $query_criteria .= " AND $crit <= '$value'"; + if ( my $date_type_value = $input->param( $crit . "_date_type_value" ) ) { + if ( $date_type_value eq 'range' ) { + if ( $value = $input->param( $crit . "_start_value" ) ) { + my %tmp_hash; + $tmp_hash{'name'} = "$crit Start"; + $tmp_hash{'value'} = $value; + push @criteria_loop, \%tmp_hash; + my $value_dt = eval { dt_from_string( $value ) }; + $value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } ) + if ( $value_dt ); + + $query_criteria .= " AND $crit >= '$value'"; + } + + if ( $value = $input->param( $crit . "_end_value" ) ) { + my %tmp_hash; + $tmp_hash{'name'} = "$crit End"; + $tmp_hash{'value'} = $value; + push @criteria_loop, \%tmp_hash; + my $value_dt = eval { dt_from_string( $value ) }; + $value = output_pref( { dt => $value_dt, dateonly => 1, dateformat => 'iso' } ) + if ( $value_dt ); + + $query_criteria .= " AND $crit <= '$value'"; + } + } + # else we want all dates } } $template->param( -- 1.7.10.4