Bugzilla – Attachment 155821 Details for
Bug 30825
Get rid of GetReservesControlBranch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30825: Add Koha::Item->holds_control_library
Bug-30825-Add-KohaItem-holdscontrollibrary.patch (text/plain), 1.96 KB, created by
Jonathan Druart
on 2023-09-18 14:18:30 UTC
(
hide
)
Description:
Bug 30825: Add Koha::Item->holds_control_library
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-09-18 14:18:30 UTC
Size:
1.96 KB
patch
obsolete
>From 394665d42c900398d68b2e580c09ae00c407e174 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 20 May 2022 11:46:12 -0300 >Subject: [PATCH] Bug 30825: Add Koha::Item->holds_control_library > >This simple method takes care of calculating the control branch for an >item and a patron, depending on a syspref. > >It targets replacing C4::Reserves::GetReservesControlBranch > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Item.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Item.pm | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index dba357e6800..e98387cecb5 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -483,6 +483,25 @@ sub holds { > return Koha::Holds->_new_from_dbic( $holds_rs ); > } > >+=head3 holds_control_library >+ >+ my $control_library = $item->holds_control_library( $patron ); >+ >+Given a I<Koha::Patron> object, this method returns a library id, for >+the library that is to be used for calculating circulation rules. It relies >+on the B<ReservesControlBranch> system preference. >+ >+=cut >+ >+sub holds_control_library { >+ my ( $self, $patron ) = @_; >+ >+ return ( >+ C4::Context->preference('ReservesControlBranch') eq 'ItemHomeLibrary' ) >+ ? $self->homebranch >+ : $patron->branchcode; >+} >+ > =head3 request_transfer > > my $transfer = $item->request_transfer( >@@ -740,8 +759,7 @@ sub pickup_locations { > > my $patron = $params->{patron}; > >- my $circ_control_branch = >- C4::Reserves::GetReservesControlBranch( $self->unblessed(), $patron->unblessed ); >+ my $circ_control_branch = $self->holds_control_library( $patron ); > my $branchitemrule = > C4::Circulation::GetBranchItemRule( $circ_control_branch, $self->itype ); > >-- >2.25.1
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 30825
:
135248
|
135249
|
135250
|
135275
|
135276
|
135277
|
135281
|
135488
|
135489
|
135490
|
152100
|
152101
|
152102
|
152103
|
152104
|
155820
|
155821
|
155822
|
155823
|
155824
|
155825
|
155826
|
155827