Bugzilla – Attachment 130830 Details for
Bug 30085
Improve performance of CanItemBeReserved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30085: Don't fetch ReservesControlBranch twice
Bug-30085-Dont-fetch-ReservesControlBranch-twice.patch (text/plain), 3.46 KB, created by
Martin Renvoize (ashimema)
on 2022-02-18 12:34:10 UTC
(
hide
)
Description:
Bug 30085: Don't fetch ReservesControlBranch twice
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-02-18 12:34:10 UTC
Size:
3.46 KB
patch
obsolete
>From b748e45cb2ee5e89e545fa76ad88c9dcf193b400 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 11 Feb 2022 19:39:33 +0000 >Subject: [PATCH] Bug 30085: Don't fetch ReservesControlBranch twice > >We essentially copy the code from GetReservesControlBranch here, because we >also calculate 'branchfield' > >Setting it to "" vs undef makes no difference in this code, so lets not fetch this >again later. > >Rename the variable to make it clearer where the branchcode came from > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Reserves.pm | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9b39130e0e..697aa3cd20 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -421,16 +421,16 @@ sub CanItemBeReserved { > WHERE borrowernumber = ? > }; > >- my $branchcode = ""; >+ my $reserves_control_branch; > my $branchfield = "reserves.branchcode"; > > if ( $controlbranch eq "ItemHomeLibrary" ) { > $branchfield = "items.homebranch"; >- $branchcode = $item->homebranch; >+ $reserves_control_branch = $item->homebranch; > } > elsif ( $controlbranch eq "PatronLibrary" ) { > $branchfield = "borrowers.branchcode"; >- $branchcode = $borrower->{branchcode}; >+ $reserves_control_branch = $borrower->{branchcode}; > } > > # we retrieve rights >@@ -438,7 +438,7 @@ sub CanItemBeReserved { > my $reservesallowed = Koha::CirculationRules->get_effective_rule({ > itemtype => $item->effective_itemtype, > categorycode => $borrower->{categorycode}, >- branchcode => $branchcode, >+ branchcode => $reserves_control_branch, > rule_name => 'reservesallowed', > }) > ) { >@@ -452,7 +452,7 @@ sub CanItemBeReserved { > my $rights = Koha::CirculationRules->get_effective_rules({ > categorycode => $borrower->{'categorycode'}, > itemtype => $item->effective_itemtype, >- branchcode => $branchcode, >+ branchcode => $reserves_control_branch, > rules => ['holds_per_record','holds_per_day'] > }); > my $holds_per_record = $rights->{holds_per_record} // 1; >@@ -497,10 +497,10 @@ sub CanItemBeReserved { > my $sthcount = $dbh->prepare($querycount); > > if ( defined $ruleitemtype ) { >- $sthcount->execute( $patron->borrowernumber, $branchcode, $ruleitemtype ); >+ $sthcount->execute( $patron->borrowernumber, $reserves_control_branch, $ruleitemtype ); > } > else { >- $sthcount->execute( $patron->borrowernumber, $branchcode ); >+ $sthcount->execute( $patron->borrowernumber, $reserves_control_branch ); > } > > my $reservecount = "0"; >@@ -522,7 +522,7 @@ sub CanItemBeReserved { > my $rule = Koha::CirculationRules->get_effective_rule( > { > categorycode => $patron->categorycode, >- branchcode => $branchcode, >+ branchcode => $reserves_control_branch, > rule_name => 'max_holds', > } > ); >@@ -536,8 +536,6 @@ sub CanItemBeReserved { > return { status => 'tooManyReserves', limit => $rule->rule_value} if $total_holds_count >= $rule->rule_value; > } > >- my $reserves_control_branch = >- GetReservesControlBranch( $item->unblessed(), $patron->unblessed ); > my $branchitemrule = > C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->effective_itemtype ); > >-- >2.20.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 30085
:
130525
|
130526
|
130527
|
130528
|
130829
|
130830
|
130831
|
130832
|
130856
|
130857
|
130858
|
130859
|
138058