From af677b11d18a04f284dd1e908f0cf2e0486104df 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 (cherry picked from commit 58f3635e6cbc6e5ca0fe086d161237c6e989bfe0) Signed-off-by: Frédéric Demians --- .../prog/en/modules/reports/dictionary.tt | 36 ++++++-------- reports/dictionary.pl | 49 ++++++++++--------- 2 files changed, 41 insertions(+), 44 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 d26cabfdc6..b97d5e50e8 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 400790c65c..4a3ffa1e4e 100755 --- a/reports/dictionary.pl +++ b/reports/dictionary.pl @@ -147,29 +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; - if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) { - my $date = C4::Dates->new($value); - $value = $date->output("iso"); - } - $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; - if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) { - my $date = C4::Dates->new($value); - $value = $date->output("iso"); + + 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; + if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) { + my $date = C4::Dates->new($value); + $value = $date->output("iso"); + } + $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; + if ( $value =~ C4::Dates->regexp( C4::Context->preference('dateformat') ) ) { + my $date = C4::Dates->new($value); + $value = $date->output("iso"); + } + $query_criteria .= " AND $crit <= '$value'"; + } } - $query_criteria .= " AND $crit <= '$value'"; + # else we want all dates } } $template->param( -- 2.39.5