Bugzilla – Attachment 97258 Details for
Bug 24350
Can't place holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24350: (follow-up) Clear Koha::Libraries->pickup_locations() and move logic to Koha::Template::Plugin::Branches->pickup_locations().
Bug-24350-follow-up-Clear-KohaLibraries-pickuploca.patch (text/plain), 4.57 KB, created by
Agustín Moyano
on 2020-01-12 04:16:32 UTC
(
hide
)
Description:
Bug 24350: (follow-up) Clear Koha::Libraries->pickup_locations() and move logic to Koha::Template::Plugin::Branches->pickup_locations().
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-01-12 04:16:32 UTC
Size:
4.57 KB
patch
obsolete
>From b0239d81a0b1d67c86a51a6db6e79cd5da78f5ab Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Sun, 12 Jan 2020 01:11:52 -0300 >Subject: [PATCH] Bug 24350: (follow-up) Clear > Koha::Libraries->pickup_locations() and move logic to > Koha::Template::Plugin::Branches->pickup_locations(). > >--- > Koha/Libraries.pm | 29 +------------------ > Koha/Template/Plugin/Branches.pm | 24 +++++++++++++-- > .../prog/en/includes/holds_table.inc | 2 +- > 3 files changed, 24 insertions(+), 31 deletions(-) > >diff --git a/Koha/Libraries.pm b/Koha/Libraries.pm >index c3464ee95b..e38b78a8b1 100644 >--- a/Koha/Libraries.pm >+++ b/Koha/Libraries.pm >@@ -65,20 +65,6 @@ If no parameters are given, all libraries with pickup_location => 1 are returned > sub pickup_locations { > my ($self, $params) = @_; > >- my $item = $params->{'item'}; >- my $biblio = $params->{'biblio'}; >- my $patron = $params->{'patron'}; >- >- if ($biblio && $item) { >- Koha::Exceptions::BadParameter->throw( >- error => "Koha::Libraries->pickup_locations takes either 'biblio' or " >- ." 'item' as parameter, but not both." >- ); >- } >- unless (! defined $patron || ref($patron) eq 'Koha::Patron') { >- $patron = Koha::Patrons->find($patron); >- } >- > # Select libraries that are configured as pickup locations > my $libraries = $self->search({ > pickup_location => 1 >@@ -86,20 +72,7 @@ sub pickup_locations { > order_by => ['branchname'] > }); > >- return $libraries unless $item or $biblio; >- if($item) { >- unless (ref($item) eq 'Koha::Item') { >- $item = Koha::Items->find($item); >- return $libraries unless $item; >- } >- return $item->pickup_locations( {patron => $patron} ); >- } else { >- unless (ref($biblio) eq 'Koha::Biblio') { >- $biblio = Koha::Biblios->find($biblio); >- return $libraries unless $biblio; >- } >- return $biblio->pickup_locations( {patron => $patron} ); >- } >+ return $libraries; > } > > =head3 search_filtered >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index 6ee4254402..d1e753b5f5 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -87,10 +87,30 @@ sub InIndependentBranchesMode { > > sub pickup_locations { > my ( $self, $params ) = @_; >- > my $search_params = $params->{search_params} || {}; > my $selected = $params->{selected}; >- my $libraries = Koha::Libraries->pickup_locations($search_params); >+ my $libraries; >+ >+ if(defined $search_params->{item} || defined $search_params->{biblio}) { >+ my $item = $search_params->{'item'}; >+ my $biblio = $search_params->{'biblio'}; >+ my $patron = $search_params->{'patron'}; >+ >+ unless (! defined $patron || ref($patron) eq 'Koha::Patron') { >+ $patron = Koha::Patrons->find($patron); >+ } >+ >+ 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()->as_list unless defined $libraries; > > for my $l (@$libraries) { > $l = $l->unblessed; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 6e66ffe06c..bb3cf7ce30 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -131,7 +131,7 @@ > [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" /> > [% ELSE %] > <select name="pickup"> >- [% PROCESS options_for_libraries libraries => Branches.pickup_locations( { search_params => { item => hold.itemnumber, patron => hold.patron }, selected => hold.branchcode }) %] >+ [% PROCESS options_for_libraries libraries => Branches.pickup_locations( { search_params => { item => hold.itemnumber, biblio => hold.biblionumber, patron => hold.patron }, selected => hold.branchcode }) %] > </select> > [% END %] > [% END %] >-- >2.17.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 24350
:
96860
|
96912
|
96913
|
97231
|
97258
|
97259
|
97260
|
97261
|
97352