Bug 4037: Correctly join the itemtypes array

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-02-08 16:07:48 +01:00
parent 8057a433f6
commit c8adefecb7
1 changed files with 5 additions and 8 deletions

View File

@ -489,7 +489,7 @@ lists of authorized values for certain item fields.
offset => $offset,
size => $size,
statushash => $statushash,
itemtypes => @itemsarray,
itemtypes => \@itemsarray,
} );
Retrieve a list of title/authors/barcode/callnumber, for biblio inventory.
@ -522,7 +522,7 @@ sub GetItemsForInventory {
my $size = $parameters->{'size'} // '';
my $statushash = $parameters->{'statushash'} // '';
my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // '';
my $items = $parameters->{'itemtypes'} // '';
my $itemtypes = $parameters->{'itemtypes'} || [];
my $dbh = C4::Context->dbh;
my ( @bind_params, @where_strings );
@ -592,12 +592,9 @@ sub GetItemsForInventory {
push( @where_strings, q{(reserves.found != 'W' OR reserves.found IS NULL)} );
}
if ( $items and @{$items} > 0 ){
my $joinedvals;
for my $itemtype (@{$items}){
$joinedvals = join(',', @{$items});
}
push @where_strings, "( biblioitems.itemtype IN (" . $joinedvals . ") OR items.itype IN (" . $joinedvals . ") )";
if ( @$itemtypes ) {
my $itemtypes_str = join ', ', @$itemtypes;
push @where_strings, "( biblioitems.itemtype IN (" . $itemtypes_str . ") OR items.itype IN (" . $itemtypes_str . ") )";
}
if ( @where_strings ) {