Bugzilla – Attachment 108906 Details for
Bug 24683
Holds on biblios with different item types: rules for holds allowed are not applied correctly if any item type is available
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted
Bug-24683-Optimize-loop-in-ItemsAnyAvailableAndNot.patch (text/plain), 1.83 KB, created by
Katrin Fischer
on 2020-08-22 11:30:11 UTC
(
hide
)
Description:
Bug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-08-22 11:30:11 UTC
Size:
1.83 KB
patch
obsolete
>From 4ca8b172f870e4556ddb25fc6c7170f0608255ac Mon Sep 17 00:00:00 2001 >From: Andrew Nugged <nugged@gmail.com> >Date: Fri, 17 Jul 2020 14:59:19 +0300 >Subject: [PATCH] Bug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted > >Add cut-off shortcut (return from inside the loop) when first >"Any Available And Not Restricted" item found, because one is >enough for "Any". > >Testing: no change visible for code behavior/results, >it is just faster because won't loop over the whole set. > >Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Reserves.pm | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9d88339ef6..ee1a16936a 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1325,8 +1325,6 @@ sub ItemsAnyAvailableAndNotRestricted { > > my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } ); > >- my $any_available = 0; >- > foreach my $i (@items) { > my $reserves_control_branch = > GetReservesControlBranch( $i->unblessed(), $param->{patron}->unblessed ); >@@ -1334,7 +1332,8 @@ sub ItemsAnyAvailableAndNotRestricted { > C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); > my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); > >- $any_available = 1 >+ # we can return (end the loop) when first one found: >+ return 1 > unless $i->itemlost > || $i->notforloan > 0 > || $i->withdrawn >@@ -1347,7 +1346,7 @@ sub ItemsAnyAvailableAndNotRestricted { > || $branchitemrule->{holdallowed} == 3 && ! $item_library->validate_hold_sibling( { branchcode => $param->{patron}->branchcode } ); > } > >- return $any_available; >+ return 0; > } > > =head2 AlterPriority >-- >2.11.0
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 24683
:
99257
|
100966
|
105651
|
105652
|
107072
|
107073
|
107074
|
107075
|
107076
|
107116
|
107117
|
107118
|
107119
|
107120
|
108905
| 108906 |
108907
|
108908
|
108909