Bugzilla – Attachment 18189 Details for
Bug 10272
CheckReserves returns not respecting ReservesControlBranch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10272 - CheckReserves returns not respecting ReservesControlBranch
Bug-10272---CheckReserves-returns-not-respecting-R.patch (text/plain), 3.96 KB, created by
Kyle M Hall (khall)
on 2013-05-17 12:10:23 UTC
(
hide
)
Description:
Bug 10272 - CheckReserves returns not respecting ReservesControlBranch
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-05-17 12:10:23 UTC
Size:
3.96 KB
patch
obsolete
>From 63320235a83c5de831e7875e5e81e1e12e488e6a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 17 May 2013 07:08:24 -0500 >Subject: [PATCH] Bug 10272 - CheckReserves returns not respecting ReservesControlBranch > >CheckReserves is using the CircControl system preference to determine what >patrons an item can fill a hold for. It should be using ReservesControlBranch >instead. > >Test Plan: >1) Create an item at Library A, place holds for it for patrons at > Library B, Library C, and Library A in that order, > for pickup at the patrons home library. > >2) Make sure the holds policy for Library A is set to > Hold Policy = "From home library" and > Return Policy = "Item returns home". > > Make sure the holds policies for the other libraries are set to > Hold Policy = "From any library". > >3) Check the item in at Library C, the hold for the patron at Library B > should pop up, even though it's in violation of the circulation rules. > Don't click the confirm button! > >4) Apply this patch, and reload the page, > now the hold listed should be for the last hold, > the hold for the patron at Library A, which is correct. > >This patch adds the subroutine C4::Reserves::GetReservesControlBranch as >an equivilent to C4::Circulation::_GetCircControlBranch. >--- > C4/Reserves.pm | 27 ++++++++++++++++++++++++++- > opac/opac-reserve.pl | 2 +- > 2 files changed, 27 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index c8b0cdd..81111a9 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -130,6 +130,8 @@ BEGIN { > &ReserveSlip > &ToggleSuspend > &SuspendAll >+ >+ &GetReservesControlBranch > ); > @EXPORT_OK = qw( MergeHolds ); > } >@@ -863,7 +865,7 @@ sub CheckReserves { > if ( $res->{'priority'} && $res->{'priority'} < $priority ) { > my $borrowerinfo=C4::Members::GetMember(borrowernumber => $res->{'borrowernumber'}); > my $iteminfo=C4::Items::GetItem($itemnumber); >- my $branch=C4::Circulation::_GetCircControlBranch($iteminfo,$borrowerinfo); >+ my $branch = GetReservesControlBranch($iteminfo,$borrowerinfo); > my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$iteminfo->{'itype'}); > next if ($branchitemrule->{'holdallowed'} == 0); > next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $borrowerinfo->{'branchcode'})); >@@ -2168,6 +2170,29 @@ sub ReserveSlip { > ); > } > >+=head2 GetReservesControlBranch >+ >+ my $reserves_control_branch = GetReservesControlBranch($item, $borrower); >+ >+ Return the branchcode to be used to determine which reserves >+ policy applies to a transaction. >+ >+ C<$iteminfos> is a hashref for an item. Only 'homebranch' is used. >+ >+ C<$borrower> is a hashref to borrower. Only 'branchcode' is used. >+ >+=cut >+ >+sub GetReservesControlBranch { >+ my ($item, $borrower) = @_; >+ >+ my $reserves_control = C4::Context->preference('ReservesControlBranch'); >+ >+ my $branchcode = ( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'} : ( $reserves_control eq 'PatronLibrary' ) ? $borrower->{'branchcode'} : undef; >+ >+ return $branchcode; >+} >+ > =head1 AUTHOR > > Koha Development Team <http://koha-community.org/> >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index d0da2c5..add6e79 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -489,7 +489,7 @@ foreach my $biblioNum (@biblionumbers) { > # If there is no loan, return and transfer, we show a checkbox. > $itemLoopIter->{notforloan} = $itemLoopIter->{notforloan} || 0; > >- my $branch = ( C4::Context->preference('ReservesControlBranch') eq 'ItemHomeLibrary' ) ? $itemInfo->{'homebranch'} : $borr->{'branchcode'}; >+ my $branch = GetReservesControlBranch( $itemInfo, $borrower ); > > my $branchitemrule = GetBranchItemRule( $branch, $itemInfo->{'itype'} ); > my $policy_holdallowed = 1; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10272
:
18189
|
18190
|
18208
|
18907
|
18922
|
19012
|
19081
|
19435
|
20778
|
20864