From 4a4c065545745e90cc046230b5c79c11f3e823d3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart 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. Signed-off-by: Marie-Luce Laflamme --- 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 += + "" + + "" + + __("On hold") + + "" + + ""; + } } else if (oObj.can_renew_error == "too_soon") { msg += "" + @@ -564,7 +575,10 @@ function LoadIssuesTable() { __("Recalled") + "" ); - } else if (oObj.can_renew_error == "on_reserve") { + } else if ( + oObj.can_renew_error == "on_reserve" || + oObj.on_reserve + ) { return ( "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.43.0