Bugzilla – Attachment 104691 Details for
Bug 25421
Make Koha::Item and Koha::Biblio ->pickup_locations return an arrayref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25421: Remove use of Koha::Libraries->pickup_locations
Bug-25421-Remove-use-of-KohaLibraries-pickuplocati.patch (text/plain), 2.80 KB, created by
Jonathan Druart
on 2020-05-11 13:07:43 UTC
(
hide
)
Description:
Bug 25421: Remove use of Koha::Libraries->pickup_locations
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-05-11 13:07:43 UTC
Size:
2.80 KB
patch
obsolete
>From fc0f76e48391f6ad8b13a447e40d979bb8f4ba4e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 8 May 2020 10:04:30 -0300 >Subject: [PATCH] Bug 25421: Remove use of Koha::Libraries->pickup_locations > >The current implementation uses Koha::Libraries->pickup_locations which >is problematic and due to be removed by bug 24368. This patch makes the >trivial change of just searching for libraries that are marked with >pickup_location => 1. > >Calls to Koha::Item->pickup_locations and Koha::Biblio->pickup_locations >are as well adapted to the new arrayref return value. > >To test: >1. Pick a record with only one item >2. Place a biblio-level hold on it >3. Edit the items: remove the item >4. Go to the Holds tab >=> FAIL: It explodes >5. Apply this patch and restart: > $ sudo koha-plack --restart kohadev >6. Go back and go to the holds tab again >=> SUCCESS: No failure! >7. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Template/Plugin/Branches.pm | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index 2d246c0a72..e5c8bdc9b5 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -113,17 +113,25 @@ sub pickup_locations { > $patron = Koha::Patrons->find($patron); > } > >- if($item) { >- $item = Koha::Items->find($item) unless ref($item) eq 'Koha::Item'; >- @libraries = map { $_->unblessed } $item->pickup_locations( {patron => $patron} ) if defined $item; >- } elsif($biblio) { >- $biblio = Koha::Biblios->find($biblio) unless ref($biblio) eq 'Koha::Biblio'; >- @libraries = map { $_->unblessed } $biblio->pickup_locations( {patron => $patron} ) if defined $biblio; >+ if ($item) { >+ $item = Koha::Items->find($item) >+ unless ref($item) eq 'Koha::Item'; >+ @libraries = @{ $item->pickup_locations( { patron => $patron } ) } >+ if defined $item; >+ } >+ elsif ($biblio) { >+ $biblio = Koha::Biblios->find($biblio) >+ unless ref($biblio) eq 'Koha::Biblio'; >+ @libraries = @{ $biblio->pickup_locations( { patron => $patron } ) } >+ if defined $biblio; > } >- > } > >- @libraries = Koha::Libraries->pickup_locations() unless @libraries; >+ @libraries = Koha::Libraries->search( { pickup_location => 1 }, >+ { order_by => ['branchname'] } )->as_list >+ unless @libraries; >+ >+ @libraries = map { $_->unblessed } @libraries; > > for my $l (@libraries) { > if ( defined $selected and $l->{branchcode} eq $selected >-- >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 25421
:
104601
|
104602
|
104687
|
104688
|
104690
| 104691 |
104692