From 58f3635e6cbc6e5ca0fe086d161237c6e989bfe0 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=utf8 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 Signed-off-by: Kyle M Hall Signed-off-by: Brendan A Gallagher (cherry picked from commit bb6658c2e680d615bccd6d5d2f4c971035a44ea1) Signed-off-by: Julian Maurice --- .../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 f356cd9b02..c21af0d68d 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 964f76f581..ae6fe7dd15 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( -- 2.39.5