Bug 18044: Label Batches not displaying
authorChris Nighswonger <cnighswonger@foundations.edu>
Sun, 5 Feb 2017 21:11:30 +0000 (16:11 -0500)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 7 Feb 2017 17:46:00 +0000 (17:46 +0000)
SQL expects lists to be comma separated. A trailing comma must also
be avoided.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Creators/Lib.pm

index c15b3e7..eb97bc1 100644 (file)
@@ -151,7 +151,7 @@ sub _build_query {
         $query .= ' WHERE 1 ';
         while ( my ( $field, $values ) = each %{ $params->{filters} } ) {
             if ( ref( $values ) ) {
-                $query .= " AND $field IN ( " . ( ('?') x scalar( @$values ) ) . " ) ";
+                $query .= " AND $field IN ( " . ( ('?,') x (@$values-1) ) . "? ) "; # a comma separates elements in a list...
                 push @where_args, @$values;
             } else {
                 $query .= " AND $field = ? ";