From 5fed998313a7cd200c9a846cc33516263f560c01 Mon Sep 17 00:00:00 2001 From: CJ Lynce Date: Fri, 11 Jul 2025 17:02:17 +0000 Subject: [PATCH] Bug 38412: Display warning on biblio level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When no item is available, with AllowHoldPolicyOverride, a triangle appears on each item to be forced, but if you choose “next item available” without having any item available, you won't see anything. Additionally, the top warning message about "No items are available" does not show when 'AllowHoldPolicyOverride' is set to allow and no items are available (e.g. withdrawn, lost, damanged, depending on settings) This patch corrects an error in request.pl where no incrementation of $num_override happens when an item is forced. This causes the warning triangle to appear on the 'Place hold' button on the bib level. The top warning message is restored as well. Finally, this patch changes the display of the fa-warning-triangle icon on the 'Place hold' buttons to increase contrast with the button color, making it easier to see and increasing accessibility. Test plan: 1) Set circulations rules for specific category and/or itemtype (for example 1 hold allowed for staff on books). Set AllowHoldPolicyOverride on "Allow". 2) Search for a book biblio with multiple items, and set each item to a non-circulating status (withdrawn, lost, etc.) 3) Place a hold for a staff category patron for this bib record. 4) Normally you will see triangles on each item on specific section but you can force it. When you just select the next item available none triangle and none alert showing. 5) Apply this patch and restart_all. 6) Refresh your browser page. 7) Normally now there is a triangle into 'Place hold' submit button and an alert message appears on the top of the page. The triangle is also more visible. 8) Test other hold limits, such as max holds per record, to ensure the appropriate top alert message appears and the triangle alert appears on the 'Place hold' button. Co-authored-by: Thibaud Guillot Sponsored-by: BibLibre Sponsored-by: Westlake Porter Public Library Signed-off-by: Emily Lamancusa Signed-off-by: Nick Clemens --- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 12 ++++++------ reserve/request.pl | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 1a949d3c4b8..f0e3e2c18c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -449,7 +449,7 @@ [% END %] - [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recall ) %] + [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || none_available_override || alreadypossession || ageRestricted || recall ) %]
[% UNLESS ( multi_hold ) %]

Cannot place hold

@@ -472,7 +472,7 @@
  • [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] already has a hold on this item.
  • [% ELSIF ( ageRestricted ) %]
  • Age restricted
  • - [% ELSIF ( none_available ) %] + [% ELSIF ( none_available || none_available_override ) %]
  • No items are available to be placed on hold.
  • [% ELSIF ( maxreserves ) %]
  • [% IF ( patron.borrowernumber ) %] [% IF ( override_required ) %] - + [% ELSIF ( none_available ) %] [% ELSE %] @@ -767,7 +767,7 @@
    [% IF ( patron.borrowernumber ) %] [% IF ( override_required ) %] - + [% ELSIF ( none_available ) %] [% ELSE %] @@ -1017,7 +1017,7 @@
    [% IF ( patron.borrowernumber ) %] [% IF ( override_required ) %] - + [% ELSIF ( none_available ) %] [% ELSE %] @@ -1167,7 +1167,7 @@
    [% IF ( patron AND patron.borrowernumber ) %] [% IF ( override_required ) %] - + [% ELSIF ( no_bibs_available ) %] [% ELSIF ( none_available ) %] diff --git a/reserve/request.pl b/reserve/request.pl index 5908ab692b7..304fc3f47e2 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -391,6 +391,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) my $num_override = 0; my $hiddencount = 0; my $num_alreadyheld = 0; + my $valid_items = 0; # iterating through all items first to check if any of them available # to pass this value further inside down to IsAvailableForItemLevelRequest to @@ -515,6 +516,11 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) && IsAvailableForItemLevelRequest( $item_object, $patron, undef ) ) { + $valid_items = 1; + } + + if ($valid_items) { + # Send the pickup locations count to the UI, the pickup locations will be pulled using the API my $pickup_locations = $item_object->pickup_locations( { patron => $patron } ); $item->{pickup_locations_count} = $pickup_locations->count; @@ -546,6 +552,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) if ( @pickup_locations || C4::Context->preference('AllowHoldPolicyOverride') ) { $num_items_available++; $item->{override} = 1; + $num_override++; my $default_pickup_location; @@ -590,6 +597,9 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) { # That is, if all items require an override $template->param( override_required => 1 ); + if ( $valid_items == 0 ) { + $template->param( none_available_override => 1 ); + } } elsif ( $num_items_available == 0 ) { $template->param( none_available => 1 ); $biblioloopiter{warn} = 1; -- 2.39.5