From dd2ecf5b7280da9f64bb0835b4b0a6dfc29f5670 Mon Sep 17 00:00:00 2001 From: Petro Vashchuk 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 ) %]
Print
[% 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 ) %]