[Koha-bugs] [Bug 19690] Smart rules: Term "If any unavailable" is confusing
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Apr 2 12:22:14 CEST 2019
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19690
--- Comment #8 from Magnus Enger <magnus at libriotech.no> ---
(In reply to Katrin Fischer from comment #7)
> Not quite, because it doesn't transport that it will take effect if at least
> one is on loan.
Ah, but that is not how the code in
C4::Reserves::IsAvailableForItemLevelRequest() works, I think:
1163 sub IsAvailableForItemLevelRequest {
1164 my $item = shift;
1165 my $borrower = shift;
1166 my $pickup_branchcode = shift;
...
1196 if ( $on_shelf_holds == 1 ) { # Yes
1197 return 1;
1198 } elsif ( $on_shelf_holds == 2 ) { # If all unavailable
1199 my @items =
1200 Koha::Items->search( { biblionumber => $item->{biblionumber} }
);
1201
1202 my $any_available = 0;
1203
1204 foreach my $i (@items) {
1205
...
1221 return $any_available ? 0 : 1;
1222 } else { # on_shelf_holds == 0 "If any unavailable" (the description
is rather cryptic and could still be improved)
1223 return $item->{onloan} || IsItemOnHoldAndFound(
$item->{itemnumber} );
1224 }
1225 }
If on_shelf_holds == 1 it always returns 1, the item that was passed in can
always be be put a hold on.
If on_shelf_holds == 2 it loops over all the items attached to the biblio of
the item that was passed in, so it can check if they all are unavailable or
not, and if any are available it returns 0. (There is a bug in how this is done
when holdallowed = 0 that I will report and submit a patch for soon.)
If on_shelf_holds == 0 it only checks the item that was passed in, there is no
looping over all the items to tell if at least one is onloan. (There is a small
bug in how this is done too...) So what the code does is look at the item that
was passed in to IsAvailableForItemLevelRequest and if it is onloan (or
OnHoldAndFound) it says it is OK to place a hold on that item. That is why I
think "If on loan" might make sense. Now this might not be what was intended
for the "If any unavailable" setting, but then the code is wrong, IMHO.
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list