-elsif ($phase eq 'New Term step 5'){
- # Confirmation screen
- my $area = $input->param('area');
- my $columnstring = $input->param('columnstring');
- my $definition_name=$input->param('definition_name');
- my $definition_description=$input->param('definition_description');
- my @criteria = $input->param('criteria_column');
- my $query_criteria;
- my @criteria_loop;
- foreach my $crit (@criteria) {
- my $value = $input->param( $crit . "_value" );
- if ($value) {
- $query_criteria .= " AND $crit='$value'";
- my %tmp_hash;
- $tmp_hash{'name'}=$crit;
- $tmp_hash{'value'} = $value;
- push @criteria_loop,\%tmp_hash;
- }
-
- $value = $input->param( $crit . "_start_value" );
- if ($value) {
- $query_criteria .= " AND $crit > '$value'";
- my %tmp_hash;
- $tmp_hash{'name'}="$crit Start";
- $tmp_hash{'value'} = $value;
- push @criteria_loop,\%tmp_hash;
- }
- $value = $input->param( $crit . "_end_value" );
- if ($value) {
- $query_criteria .= " AND $crit <= '$value'";
- my %tmp_hash;
- $tmp_hash{'name'}="$crit End";
- $tmp_hash{'value'} = $value;
- push @criteria_loop,\%tmp_hash;
- }
- }
- $template->param( 'step_5' => 1,
- 'area' => $area,
- 'definition_name' => $definition_name,
- 'definition_description' => $definition_description,
- 'query' => $query_criteria,
- 'columnstring' => $columnstring,
- 'criteria_loop' => \@criteria_loop,
- );
+elsif ( $phase eq 'New Term step 5' ) {
+ # Confirmation screen
+ my $columnstring = $input->param('columnstring');
+ my @criteria = $input->multi_param('criteria_column');
+ my $query_criteria;
+ my @criteria_loop;
+
+ foreach my $crit (@criteria) {
+ my $value = $input->param( $crit . "_value" );
+ if ($value) {
+ my %tmp_hash;
+ $tmp_hash{'name'} = $crit;
+ $tmp_hash{'value'} = $value;
+ push @criteria_loop, \%tmp_hash;
+
+ $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;
+
+ $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;
+
+ $query_criteria .= " AND $crit <= '$value'";
+ }
+ }
+ # else we want all dates
+ }
+ }
+ $template->param(
+ 'step_5' => 1,
+ 'area' => $area,
+ 'definition_name' => $definition_name,
+ 'definition_description' => $definition_description,
+ 'query' => $query_criteria,
+ 'columnstring' => $columnstring,
+ 'criteria_loop' => \@criteria_loop,
+ );