Bugzilla – Attachment 131541 Details for
Bug 29517
CanItemBeReserved fetches biblio for agerestriction check if feature not enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29517: Check if agerestriction field is mapped before fetching biblio
Bug-29517-Check-if-agerestriction-field-is-mapped-.patch (text/plain), 2.68 KB, created by
Fridolin Somers
on 2022-03-10 08:03:14 UTC
(
hide
)
Description:
Bug 29517: Check if agerestriction field is mapped before fetching biblio
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2022-03-10 08:03:14 UTC
Size:
2.68 KB
patch
obsolete
>From c0788652e647d1266e12d862791e05eb761a7128 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 18 Nov 2021 12:03:36 +0000 >Subject: [PATCH] Bug 29517: Check if agerestriction field is mapped before > fetching biblio > >This patch simply adds a check of cached values to see if agerestriction enabled before >fetching the biblio object > >To test: >1 - prove -v t/db_dependent/Holds.t > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >--- > C4/Reserves.pm | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 6e86857db8..eae2fe77fe 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -24,6 +24,7 @@ package C4::Reserves; > use Modern::Perl; > > use C4::Accounts; >+use C4::Biblio qw( GetMarcFromKohaField ); > use C4::Circulation qw( CheckIfIssuedToPatron GetAgeRestriction GetBranchItemRule ); > use C4::Context; > use C4::Items qw( CartToShelf get_hostitemnumbers_of ); >@@ -397,7 +398,6 @@ sub CanItemBeReserved { > > # we retrieve borrowers and items informations # > # item->{itype} will come for biblioitems if necessery >- my $biblio = $item->biblio; > my $borrower = $patron->unblessed; > > # If an item is damaged and we don't allow holds on damaged items, we can stop right here >@@ -405,10 +405,13 @@ sub CanItemBeReserved { > if ( $item->damaged > && !C4::Context->preference('AllowHoldsOnDamagedItems') ); > >- # Check for the age restriction >- my ( $ageRestriction, $daysToAgeRestriction ) = >- C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower ); >- return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0; >+ if( GetMarcFromKohaField('biblioitems.agerestriction') ){ >+ my $biblio = $item->biblio; >+ # Check for the age restriction >+ my ( $ageRestriction, $daysToAgeRestriction ) = >+ C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower ); >+ return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0; >+ } > > # Check that the patron doesn't have an item level hold on this item already > return { status =>'itemAlreadyOnHold' } >@@ -416,7 +419,7 @@ sub CanItemBeReserved { > > # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) > if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') >- && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) { >+ && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) { > return { status =>'alreadypossession' }; > } > >-- >2.35.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 29517
:
127788
|
131541
|
132218