@@ -, +, @@ --- opac/opac-reserve.pl | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) --- a/opac/opac-reserve.pl +++ a/opac/opac-reserve.pl @@ -340,6 +340,13 @@ foreach my $biblioNum (@biblionumbers) { $biblioLoopIter{itemLoop} = []; my $numCopiesAvailable = 0; + # $canReserveMultiple is set to "yes" ( >0 ) if multiple items can be reserved + # it is set to 0 otherwise. depends on item-level_itypes syspref + # and the list of itypes that can be multiple reserved + my $canReserveMultiple=0; + unless (C4::Context->preference("item-level_itypes")) { + $canReserveMultiple = CanHoldMultipleItems($biblioLoopIter{itemtype}); + } foreach my $itemInfo (@{$biblioData->{itemInfos}}) { my $itemNum = $itemInfo->{itemnumber}; my $itemLoopIter = {}; @@ -354,6 +361,13 @@ foreach my $biblioNum (@biblionumbers) { $itemLoopIter->{description} = $itemInfo->{description}; $itemLoopIter->{imageurl} = $itemInfo->{imageurl}; } + # check if the itype is one that can be multiple reserved + if (C4::Context->preference("item-level_itypes")) { + # sum canReserveMultiple : if at least one item can be multiple reserved, then the flag will be >0 + # FIXME : there can be complex & strange cases, where some items can be multiple reserved, and some can't + # this case is not managed. Note it may be only theoric, and have no real case + $canReserveMultiple = $canReserveMultiple+CanHoldMultipleItems($itemInfo->{itype}); + } # If the holdingbranch is different than the homebranch, we show the # holdingbranch of the document too. @@ -457,7 +471,7 @@ foreach my $biblioNum (@biblionumbers) { $biblioLoopIter{bib_available} = 1; $biblioLoopIter{holdable} = 1; } - if ( $biblioLoopIter{already_reserved} && !CanHoldMultipleItems($biblioLoopIter{itemtype}) ) { + if ( $biblioLoopIter{already_reserved} && !$canReserveMultiple ) { $biblioLoopIter{holdable} = undef; warn "Already_Reserved"; } --