Bug 18044: Label Batches not displaying

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>
This commit is contained in:
Chris Nighswonger 2017-02-05 16:11:30 -05:00 committed by Kyle M Hall
parent 4740438b41
commit 544cf17d6f

View 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 = ? ";