Bugzilla – Attachment 120668 Details for
Bug 28286
Place hold button not displayed when biblio has only Ordered items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28286: show "Place hold" button if item is holdable
Bug-28286-show-Place-hold-button-if-item-is-holdab.patch (text/plain), 3.89 KB, created by
Peter Vashchuk
on 2021-05-07 09:51:51 UTC
(
hide
)
Description:
Bug 28286: show "Place hold" button if item is holdable
Filename:
MIME Type:
Creator:
Peter Vashchuk
Created:
2021-05-07 09:51:51 UTC
Size:
3.89 KB
patch
obsolete
>From dd2ecf5b7280da9f64bb0835b4b0a6dfc29f5670 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Wed, 5 May 2021 16:30:26 +0300 >Subject: [PATCH] Bug 28286: show "Place hold" button if item is holdable > >This patch adds "filter_by_for_hold" method in "Items.pm" and >uses it in "cat-toolbar.inc" instead of "filter_by_for_load". > >Also this patch removes "filter_by_for_loan" method. > >To reproduce the bug: >1) go to /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX that has >item with notforloan value set as "Ordered" (-1) >2) see that button "Place hold" is not present >3) apply the patch >4) refresh the page and ensure that "Place hold" button appears even if >item is "Ordered" >--- > Koha/Items.pm | 10 +++++----- > .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 3 +-- > t/db_dependent/Koha/Items.t | 12 +++++++----- > 3 files changed, 13 insertions(+), 12 deletions(-) > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 2d81a24c59..b90105de3d 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -37,17 +37,17 @@ Koha::Items - Koha Item object set class > > =cut > >-=head3 filter_by_for_loan >+=head3 filter_by_for_hold > >- my $filtered_items = $items->filter_by_for_loan; >+ my $filtered_items = $items->filter_by_for_hold; > >-Return the items of the set that are loanable >+Return the items of the set that are holdable > > =cut > >-sub filter_by_for_loan { >+sub filter_by_for_hold { > my ($self) = @_; >- return $self->search( { notforloan => [ 0, undef ] } ); >+ return $self->search( { notforloan => { '<' => 1 } } ); # items with negative or zero notforloan value are holdable > } > > =head3 filter_by_visible_in_opac >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index a467c7a27f..41fb8d934c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -166,9 +166,8 @@ CAN_user_serials_create_subscription ) %] > <div class="btn-group"><a id="printbiblio" class="btn btn-default"><i class="fa fa-print"></i> Print</a></div> > > [% IF ( CAN_user_reserveforothers ) %] >- [%# biblio.items.filter_by_for_loan.count %] > [% SET items = biblio.items %] >- [% IF Context.Scalar(Context.Scalar(items, "filter_by_for_loan"), "count") %] >+ [% IF Context.Scalar(Context.Scalar(items, "filter_by_for_hold"), "count") %] > [% IF ( holdfor ) %] > <div class="btn-group"> > <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"> >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index 73e1ab4a29..900004d912 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -1470,15 +1470,17 @@ subtest 'can_be_transferred' => sub { > 'We get the same result also if we pass the from-library parameter.'); > }; > >-subtest 'filter_by_for_loan' => sub { >- plan tests => 3; >+subtest 'filter_by_for_hold' => sub { >+ plan tests => 4; > > my $biblio = $builder->build_sample_biblio; >- is( $biblio->items->filter_by_for_loan->count, 0, 'no item yet' ); >+ is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' ); > $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 1 } ); >- is( $biblio->items->filter_by_for_loan->count, 0, 'no item for loan' ); >+ is( $biblio->items->filter_by_for_hold->count, 0, 'no item for hold' ); > $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0 } ); >- is( $biblio->items->filter_by_for_loan->count, 1, '1 item for loan' ); >+ is( $biblio->items->filter_by_for_hold->count, 1, '1 item for hold' ); >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => -1 } ); >+ is( $biblio->items->filter_by_for_hold->count, 2, '2 items for hold' ); > > $biblio->delete; > }; >-- >2.31.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 28286
:
120521
|
120618
|
120619
|
120668
|
120672
|
120674
|
120701
|
120768