Bug 20837: Use ReservesControlBranch to determine holdability of items

To test:
 1 - Set a default holds plicy for an item type as 'from home library'
 2 - Set CircControl to 'logged in library'
 3 - Log in as staff from a library without the rule set
 4 - Note you can set holds for patrons of any library on items of type
above
 5 - Toggle ReservesControlBranch and note that nothing changes
 6 - Toggle CircControl and note some combinations don't allow holds
 7 - Apply patch
 8 - Toggle ReservesControlBranch and note that holdability is affected
 9 - Toggle CircControl and note holdability does not change
10 - Read the note on admin/smartrules.pl and confirm it makes sense

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2018-05-30 16:05:04 +00:00
parent 28e536892a
commit bf1100fbf1
2 changed files with 8 additions and 10 deletions

View File

@ -442,10 +442,10 @@ sub CanItemBeReserved {
return { status => 'tooManyReserves', limit => $rule->rule_value} if $total_holds_count >= $rule->rule_value;
}
my $circ_control_branch =
C4::Circulation::_GetCircControlBranch( $item->unblessed(), $borrower );
my $reserves_control_branch =
GetReservesControlBranch( $item->unblessed(), $borrower );
my $branchitemrule =
C4::Circulation::GetBranchItemRule( $circ_control_branch, $item->itype ); # FIXME Should not be item->effective_itemtype?
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); # FIXME Should not be item->effective_itemtype?
if ( $branchitemrule->{holdallowed} == 0 ) {
return { status => 'notReservable' };
@ -1174,9 +1174,7 @@ sub IsAvailableForItemLevelRequest {
my $patron = Koha::Patrons->find( $borrower->{borrowernumber} );
my $item_object = Koha::Items->find( $item->{itemnumber } );
my $itemtype = $item_object->effective_itemtype;
my $notforloan_per_itemtype
= $dbh->selectrow_array("SELECT notforloan FROM itemtypes WHERE itemtype = ?",
undef, $itemtype);
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan;
return 0 if
$notforloan_per_itemtype ||
@ -1203,9 +1201,8 @@ sub IsAvailableForItemLevelRequest {
my $any_available = 0;
foreach my $i (@items) {
my $circ_control_branch = C4::Circulation::_GetCircControlBranch( $i->unblessed(), $borrower );
my $branchitemrule = C4::Circulation::GetBranchItemRule( $circ_control_branch, $i->itype );
my $reserves_control_branch = GetReservesControlBranch( $i->unblessed(), $borrower );
my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype );
$any_available = 1
unless $i->itemlost

View File

@ -1,5 +1,6 @@
[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE Branches %]
[% USE Categories %]
[% USE CirculationRules %]
@ -687,7 +688,7 @@
<li><strong>No holds allowed:</strong> No patron may put this book on hold.</li>
</ul>
<p><strong>Note: </strong>If the system preference 'AllowHoldPolicyOverride' is enabled, these policies can be overridden by your circulation staff.</br />
<strong>Important: </strong>The policies are based on the patron's home library, not the library where the hold is being placed.
<strong>Important: </strong>The policies are applied based on the ReservesControlBranch system preference which is set to <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReservesControlBranch">[% Koha.Preference('ReservesControlBranch') %]</a>.
</p>
<form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">