I was discussing CanBookBeReserved with Pedro on bug 15516 when I noticed that the $itemtype in the following line of opac/opac-reserve.pl looks like it'll always be "undef" for "next available" holds: my $status = CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { itemtype => $itemtype } )->{status};
In reserve/request.pl we just use this code: my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); CanItemBeReserved( $patron, $item_object, undef, { get_from_cache => 1 } )->{status}; So it looks like the majority of CanBookBeReserved never runs because $params->{itemtype} will always be null. But that might be OK, because at the end of CanBookBeReserved we iterate through all the items attached to that bib and we check them using CanItemBeReserved...
Note we didn't notice this during manual testing but it came up when looking at t/db_dependent/Reserves.t
(In reply to David Cook from comment #0) > I was discussing CanBookBeReserved with Pedro on bug 15516 when I noticed > that the $itemtype in the following line of opac/opac-reserve.pl looks like > it'll always be "undef" for "next available" holds: > > my $status = CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { > itemtype => $itemtype } )->{status}; Are you sure? Turn on AllowHoldItemTypeSelection https://snipboard.io/sBaKNe.jpg If I select "Book" here, I hit CanBookBeReserved with itemtype=BK
(In reply to Jonathan Druart from comment #3) > (In reply to David Cook from comment #0) > > I was discussing CanBookBeReserved with Pedro on bug 15516 when I noticed > > that the $itemtype in the following line of opac/opac-reserve.pl looks like > > it'll always be "undef" for "next available" holds: > > > > my $status = CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { > > itemtype => $itemtype } )->{status}; > > Are you sure? No, that's why I framed the bug report title as a question. > Turn on AllowHoldItemTypeSelection > > https://snipboard.io/sBaKNe.jpg > If I select "Book" here, I hit CanBookBeReserved with itemtype=BK Thanks for sharing that. That's really helpful. It looks like there are a few bugs in the staff interface: it looks like "./reserve/placerequest.pl" isn't using the itemtype with "CanBookBeReserved", and "request.pl" is sending 2 "itemtype" arguments due to a duplicated "Request specific item type" field, so only the first field will ever work. I'll raise a different report for those.