Bugzilla – Attachment 145299 Details for
Bug 32583
Restore display of only one item in catalogue/moredetails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32583 - Restore display of only one item in catalogue/moredetails
0001-Bug-32583-Restore-display-of-only-one-item-in-catalo.patch (text/plain), 6.26 KB, created by
Michael Hafen
on 2023-01-13 17:47:00 UTC
(
hide
)
Description:
Bug 32583 - Restore display of only one item in catalogue/moredetails
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2023-01-13 17:47:00 UTC
Size:
6.26 KB
patch
obsolete
>From 4c9ef61c822895546dc23a02e36244fa65594c8b Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Fri, 6 Jan 2023 14:41:57 -0700 >Subject: [PATCH] Bug 32583 - Restore display of only one item in > catalogue/moredetails >Content-Type: text/plain; charset="utf-8" > >Bug 31315 (Remove GetItemsInfo from moredetail) removed the code that limits >the items displayed to only one item if the itemnumber was passed as a >parameter to the page. >This restores that code. > >Test plan: > >1. find a title with multple items. >2. click on an items barcode in the holdings table on the title details page. >3. observe that all items are shown on the catalogue/moredetails page. >4. apply patch. >5. refresh (catalogue/moredetails) page. >6. observe that only the item for the barcode clicked on is shown. >--- > Koha/List/Patron.pm | 19 ++++++++++ > Koha/Patron.pm | 38 ++++++++++++++++++- > catalogue/moredetail.pl | 3 ++ > .../prog/en/modules/members/moremember.tt | 21 ++++++++++ > 4 files changed, 80 insertions(+), 1 deletion(-) > >diff --git a/Koha/List/Patron.pm b/Koha/List/Patron.pm >index cb91275d85..89489780c2 100644 >--- a/Koha/List/Patron.pm >+++ b/Koha/List/Patron.pm >@@ -42,6 +42,7 @@ BEGIN { > AddPatronList > ModPatronList > >+ GetListsWithPatron > AddPatronsToList > DelPatronsFromList > ); >@@ -156,6 +157,24 @@ sub ModPatronList { > return $list->update($params); > } > >+=head2 GetListsWithPatron >+ >+ GetListsWithPatron({ borrowernumber => $borrowernumber }); >+ >+=cut >+ >+sub GetListsWithPatron { >+ my ($params) = @_; >+ >+ my $borrowernumber = $params->{'borrowernumber'}; >+ >+ return unless ( $borrowernumber ); >+ >+ my @list_ids = map { $_->patron_list_id } Koha::Database->new()->schema()->resultset('PatronListPatron')->search( { borrowernumber => $borrowernumber } ); >+ >+ return Koha::List::Patron->search( { patron_list_id => { 'IN' => \@list_ids } }, {order_by => 'name'} ); >+} >+ > =head2 AddPatronsToList > > AddPatronsToList({ list => $list, cardnumbers => \@cardnumbers }); >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 96a72a393a..502794cf49 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -52,6 +52,7 @@ use Koha::Patron::Messages; > use Koha::Patron::Modifications; > use Koha::Patron::Relationships; > use Koha::Patrons; >+use Koha::List::Patron qw( GetListsWithPatron GetPatronLists ); > use Koha::Plugins; > use Koha::Recalls; > use Koha::Result::Boolean; >@@ -1049,7 +1050,7 @@ sub can_request_article { > > my $count = Koha::ArticleRequests->search( > [ { borrowernumber => $self->borrowernumber, status => [ 'REQUESTED', 'PENDING', 'PROCESSING' ] }, >- { borrowernumber => $self->borrowernumber, status => 'COMPLETED', updated_on => { '>=' => \'CAST(NOW() AS DATE)' } }, >+ { borrowernumber => $self->borrowernumber, status => 'COMPLETED', updated_on => { '>=' => 'CAST(NOW() AS DATE)' } }, > ] > )->count; > return $count < $limit ? 1 : 0; >@@ -1436,6 +1437,41 @@ sub get_enrollable_clubs { > return Koha::Clubs->get_enrollable($params); > } > >+=head3 get_patron_lists >+ >+=cut >+ >+sub get_patron_lists { >+ my ( $self ) = @_; >+ >+ return GetListsWithPatron({borrowernumber => $self->borrowernumber()}); >+} >+ >+=head3 get_joinable_patron_lists >+ >+=cut >+ >+sub get_joinable_patron_lists { >+ my ( $self ) = @_; >+ >+ my @lists = GetPatronLists(); >+ my %joined_lists = map { $_->patron_list_id => 1 } GetListsWithPatron({borrowernumber => $self->borrowernumber()})->as_list; >+ my @offsets; >+ >+ for ( my $i = 0; $i < $#lists; $i++ ) { >+ my $list = $lists[$i]; >+ my $id = $list->patron_list_id(); >+ if ( $joined_lists{$id} ) { >+ unshift @offsets, $i; >+ } >+ } >+ for my $i (@offsets) { >+ splice @lists, $i, 1; >+ } >+ >+ return @lists; >+} >+ > =head3 account_locked > > my $is_locked = $patron->account_locked >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index 90f2de0b07..e99855a40f 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -146,6 +146,9 @@ foreach ( keys %{$data} ) { > $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' ); > } > >+if ($itemnumber) { >+ @items = (grep {$_->itemnumber == $itemnumber} @items); >+} > my @item_data; > foreach my $item (@items){ > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index ef0a906c90..9edace5be2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -725,6 +725,15 @@ > </a> > </li> > [% END %] >+ >+ [% SET patron_lists = patron.get_patron_lists %] >+ [% IF CAN_user_tools_manage_patron_lists || patron_lists.count %] >+ <li role="presentation"> >+ <a id="pat_lists-tab-link" href="#pat_lists-tab" aria-controls="checkouts" role="tab" data-toggle="tab"> >+ Patron Lists ([% pat_lists_in.count | html %]) >+ </a> >+ </li> >+ [% END %] > </ul> > > <div class="tab-content"> >@@ -748,6 +757,18 @@ > </div> > [% END %] > >+ [% IF CAN_user_tools_manage_patron_lists || patron_lists.count %] >+ <div id="pat_lists-tab" role="tabpanel" class="tab-pane"> >+ Loading... >+ </div> >+ [% END %] >+ >+ [% IF CAN_user_clubs && ( enrollments.count || enrollable.count ) %] >+ <div id="clubs-tab" role="tabpanel" class="tab-pane"> >+ Loading... >+ </div> >+ [% END %] >+ > [% INCLUDE borrower_debarments.inc %] > > [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] >-- >2.34.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 32583
:
145109
|
145111
|
145227
|
145299
|
145301
|
145585
|
145712