Bugzilla – Attachment 185005 Details for
Bug 38412
Koha should warn when hold on bibliographic record requires hold policy override
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38412: Display warning on biblio level
Bug-38412-Display-warning-on-biblio-level.patch (text/plain), 9.42 KB, created by
Nick Clemens (kidclamp)
on 2025-08-01 13:12:01 UTC
(
hide
)
Description:
Bug 38412: Display warning on biblio level
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-08-01 13:12:01 UTC
Size:
9.42 KB
patch
obsolete
>From 5fed998313a7cd200c9a846cc33516263f560c01 Mon Sep 17 00:00:00 2001 >From: CJ Lynce <cj.lynce@westlakelibrary.org> >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 <thibaud.guillot@biblibre.com> >Sponsored-by: BibLibre >Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org> >Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../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 @@ > </div> > [% 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 ) %] > <div class="alert alert-warning"> > [% UNLESS ( multi_hold ) %] > <h3>Cannot place hold</h3> >@@ -472,7 +472,7 @@ > <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li> > [% ELSIF ( ageRestricted ) %] > <li><strong>Age restricted</strong></li> >- [% ELSIF ( none_available ) %] >+ [% ELSIF ( none_available || none_available_override ) %] > <li> <strong>No items are available</strong> to be placed on hold.</li> > [% ELSIF ( maxreserves ) %] > <li >@@ -672,7 +672,7 @@ > <fieldset class="action"> > [% IF ( patron.borrowernumber ) %] > [% IF ( override_required ) %] >- <button type="submit" id="hold_grp_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button> >+ <button type="submit" id="hold_grp_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button> > [% ELSIF ( none_available ) %] > <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button> > [% ELSE %] >@@ -767,7 +767,7 @@ > <fieldset class="action"> > [% IF ( patron.borrowernumber ) %] > [% IF ( override_required ) %] >- <button type="submit" id="hold_any_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button> >+ <button type="submit" id="hold_any_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button> > [% ELSIF ( none_available ) %] > <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button> > [% ELSE %] >@@ -1017,7 +1017,7 @@ > <fieldset class="action"> > [% IF ( patron.borrowernumber ) %] > [% IF ( override_required ) %] >- <button type="submit" id="hold_item_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button> >+ <button type="submit" id="hold_item_btn" class="btn btn-primary"><i class="fa fa-exclamation-triangle "></i> Place hold</button> > [% ELSIF ( none_available ) %] > <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button> > [% ELSE %] >@@ -1167,7 +1167,7 @@ > <fieldset class="action"> > [% IF ( patron AND patron.borrowernumber ) %] > [% IF ( override_required ) %] >- <button type="submit" id="hold_multi_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button> >+ <button type="submit" id="hold_multi_btn" class="btn btn-primary "><i class="fa fa-exclamation-triangle "></i> Place holds</button> > [% ELSIF ( no_bibs_available ) %] > <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button> > [% 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
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 38412
:
182450
|
182767
|
184021
|
184564
| 185005