Bugzilla – Attachment 187980 Details for
Bug 41017
Show if item is on hold even if OverduesBlockRenewing is on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41017: Show if item is on hold even if OverduesBlockRenewing is on
Bug-41017-Show-if-item-is-on-hold-even-if-Overdues.patch (text/plain), 5.03 KB, created by
Jonathan Druart
on 2025-10-16 09:42:42 UTC
(
hide
)
Description:
Bug 41017: Show if item is on hold even if OverduesBlockRenewing is on
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-10-16 09:42:42 UTC
Size:
5.03 KB
patch
obsolete
>From 5cd99232934c39cc654c372328b1562726c1fbaf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 16 Oct 2025 11:29:27 +0200 >Subject: [PATCH] Bug 41017: Show if item is on hold even if > OverduesBlockRenewing is on > >"On hold" is useful for librarians and we should show it whether or not the item is overdue. > >There has been several attempts to fix this problem, in C4::Circulation::CanBookBeRenewed, >but this patch suggests to have a dedicated (ugly) test for this >specific situation. > >Test plan (from Caroline comment 0): >1. Go to a patron's account and checkout with a past date to create an overdue checkout >2. Place a hold for the same item for another patron >3. View the first patron's checkouts > --> In the "Renew" column, it says "On hold" > >4. Enable AllowRenewalOnHoldOverride >5. Go back to the patron's checkouts > --> The "Renew" column should still say "On hold" >6. Check the "Override renewal restrictions" box > --> A check box appears in the "Renew" column, which still displays "On hold" nonetheless > >7. Enable OverduesBlockRenewing ("block renewing for all the patron's items") (I think both blocks should work in this scenario, but the library has it set to all) >8. Enable AllowRenewalLimitOverride >9. Go back to the patron's checkouts > --> The "Renew" column displays "Not allowed: overdue" with mention of on hold >10. Check the "Override renewal restrictions" box > --> A check box appears in the "Renew" column with mention of on hold > >The "On hold" mention is displayed whether or not the item is overdue. >--- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 16 +++++++++++++++- > svc/checkouts | 11 ++++++++++- > 2 files changed, 25 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 185a5488db5..d6c742e4ee4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -416,6 +416,17 @@ function LoadIssuesTable() { > > span_style = "display: none"; > span_class = "renewals-allowed"; >+ >+ if (oObj.on_reserve) { >+ msg += >+ "<span style='display: block;'>" + >+ "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + >+ oObj.biblionumber + >+ "'>" + >+ __("On hold") + >+ "</a>" + >+ "</span>"; >+ } > } else if (oObj.can_renew_error == "too_soon") { > msg += > "<span class='renewals-disabled'>" + >@@ -564,7 +575,10 @@ function LoadIssuesTable() { > __("Recalled") + > "</a>" > ); >- } else if (oObj.can_renew_error == "on_reserve") { >+ } else if ( >+ oObj.can_renew_error == "on_reserve" || >+ oObj.on_reserve >+ ) { > return ( > "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + > oObj.biblionumber + >diff --git a/svc/checkouts b/svc/checkouts >index 9b45a03fbff..6d5771f6fd2 100755 >--- a/svc/checkouts >+++ b/svc/checkouts >@@ -158,8 +158,16 @@ while ( my $c = $sth->fetchrow_hashref() ) { > my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} ); > my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} ); > >+ my $item; # Will be fetched only if needed > my $checkout_obj = Koha::Checkouts->find( $c->{issue_id} ); > my ( $can_renew, $can_renew_error, $info ) = CanBookBeRenewed( $checkout_obj->patron, $checkout_obj ); >+ my $on_reserve; >+ if ( $can_renew_error eq 'overdue' ) { >+ $item ||= $checkout_obj->item; >+ # Set on_reserve if overdued (see C4::Circulation::CanBookBeRenewed) >+ $on_reserve = 1 >+ if $item->current_holds( { skip_future_holds => 1 } )->search( { non_priority => 0 } )->count; >+ } > my $can_renew_date = $can_renew_error && $can_renew_error eq 'too_soon' > ? output_pref( > { >@@ -219,7 +227,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { > > my $recalled = 0; > if ( C4::Context->preference('UseRecalls') ) { >- my $item = Koha::Items->find( $c->{itemnumber} ); >+ $item ||= $checkout_obj->item; > my $recall = undef; > $recall = $item->check_recalls if $item->can_be_waiting_recall; > if ( defined $recall ) { >@@ -308,6 +316,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { > }, > issued_today => !$c->{not_issued_today}, > recalled => $recalled, >+ on_reserve => $on_reserve, > }; > > if ( $c->{not_issued_today} ) { >-- >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 41017
:
187980
|
188105