Bug 15128 - (QA Followup) Don't get patrons suggestions if limit not set
[koha.git] / reports / dictionary.pl
index 964f76f..7d86f8d 100755 (executable)
@@ -92,7 +92,7 @@ elsif ( $phase eq 'New Term step 3' ) {
 elsif ( $phase eq 'New Term step 4' ) {
 
     # Choosing the values
-    my @columns                = $input->param('columns');
+    my @columns                = $input->multi_param('columns');
     my $columnstring           = join( ',', @columns );
     my @column_loop;
     foreach my $column (@columns) {
@@ -130,7 +130,7 @@ elsif ( $phase eq 'New Term step 4' ) {
 elsif ( $phase eq 'New Term step 5' ) {
     # Confirmation screen
     my $columnstring           = $input->param('columnstring');
-    my @criteria               = $input->param('criteria_column');
+    my @criteria               = $input->multi_param('criteria_column');
     my $query_criteria;
     my @criteria_loop;
 
@@ -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(