Bugzilla – Attachment 117209 Details for
Bug 27071
Hold pickup library match not enforced correctly on intranet when using hold groups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27071: (follow-up) Get rid of loop
Bug-27071-follow-up-Get-rid-of-loop.patch (text/plain), 1.39 KB, created by
Martin Renvoize (ashimema)
on 2021-02-23 13:41:15 UTC
(
hide
)
Description:
Bug 27071: (follow-up) Get rid of loop
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-23 13:41:15 UTC
Size:
1.39 KB
patch
obsolete
>From dec1338a03b7e1b82a68b39539a32b40f67066b7 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 22 Feb 2021 09:27:12 -0300 >Subject: [PATCH] Bug 27071: (follow-up) Get rid of loop > >This patch gets rid of a loop on the librarary's groups siblings, and >acknowledges ->get_hold_libraries returns a proper Koha::Libraries >iterator that can be chained with a new query on the passed branchcode. >This way we only fetch a count from the DB and no loop needs to take >place on the code. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Libraries.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Library.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/Koha/Library.pm b/Koha/Library.pm >index 8dcb2bb48b..c1ebd2f3ca 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -244,8 +244,8 @@ sub validate_hold_sibling { > return 1 if $params->{branchcode} eq $self->id; > > my $branchcode = $params->{branchcode}; >- my @hold_libraries = $self->get_hold_libraries; >- return grep {$_->branchcode eq $branchcode} @hold_libraries; >+ return $self->get_hold_libraries->search( { branchcode => $branchcode } ) >+ ->count > 0; > } > > =head2 Internal methods >-- >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 27071
:
113928
|
113929
|
113963
|
116599
|
116600
|
116601
|
116602
|
116603
|
117140
|
117141
|
117142
|
117143
|
117144
|
117145
|
117184
|
117185
|
117186
|
117187
|
117188
|
117189
|
117204
|
117205
|
117206
|
117207
|
117208
| 117209