Bug 2669: Change checkboxes to radio buttons on dictionary

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 <aleishaamohia@hotmail.com>

Looks so much nicer too!

Radio buttons display as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-01-11 11:32:23 +00:00 committed by Brendan A Gallagher
parent 6a2bf8d31b
commit bb6658c2e6
2 changed files with 38 additions and 43 deletions

View file

@ -189,28 +189,20 @@
</select></li>
[% END %]
[% IF ( column.date ) %]
<li><span class="label">Choose: </span><table>
<tr valign="top">
<td><input type="radio" name="[% column.name %]_all" value="all" />All dates</td>
<td>OR</td>
<td><input type="radio" name="dates" value="range" />Date range<br />
<table>
<tr>
<td>Start of date range</td>
<td><input type="text" size="10" id="from" name="[% column.name %]_start_value" value="" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</td>
</tr>
<tr>
<td>End of date range</td>
<td>
<input type="text" size="10" id="to" name="[% column.name %]_end_value" value="" class="datepickerto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</td>
</tr>
</table></td>
</tr>
</table></li>
<li class="radio">
<label for="all_dates">All dates</label>
<input type="radio" id="all_dates" name="[% column.name %]_date_type_value" value="all" checked="checked" />
<label for="date_range">Date range</label>
<input type="radio" id="date_range" name="[% column.name %]_date_type_value" value="range" />
</li>
<li class="radio">
Start of date range
<input type="text" size="10" id="from" name="[% column.name %]_start_value" value="" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
End of date range
<input type="text" size="10" id="to" name="[% column.name %]_end_value" value="" class="datepickerto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
[% END %]
[% IF ( column.text ) %]
<li><label for="[% column.name %]_value">Search string matches: </label> <input type="text" size="13" name="[% column.name %]_value" /></li>

View file

@ -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 );
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'";
}
$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 );
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'";
$query_criteria .= " AND $crit <= '$value'";
}
}
# else we want all dates
}
}
$template->param(