Bug 41017

Summary: Show if item is on hold even if OverduesBlockRenewing is on
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: CirculationAssignee: Jonathan Druart <jonathan.druart>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, dcook, gmcharlt, jonathan.druart, jyorio, katrin.fischer, kyle, marie-luce.laflamme, mikko.liimatainen, nick, sbrown
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41873
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41484
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41017: Show if item is on hold even if OverduesBlockRenewing is on
Bug 41017: Show if item is on hold even if OverduesBlockRenewing is on
Bug 41017: (bug 41484 follow-up) Adjust 'on hold'

Description Caroline Cyr La Rose 2025-10-14 17:29:20 UTC
I've had a comment by a library that uses OverduesBlockRenewing as well as  AllowRenewalLimitOverride (and AllowRenewalOnHoldOverride) that when the item is overdue, the fact that it's on hold is not displayed in the patron's checkouts. Their issue is that while they don't want patrons renewing overdue items from the OPAC, they sometimes override the renewal in the staff interface, but end up unknowingly renewing something that is on hold...

To recreate in main:
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" (OK) No mention of on hold (NOT OK?)
10. Check the "Override renewal restrictions" box
   --> A check box appears in the "Renew" column (OK), still no mention of on hold (NOT OK?)

The "On hold" mention should be displayed whether or not the item is overdue.
Comment 1 Marie-Luce Laflamme 2025-10-15 18:32:20 UTC
Just adding a bit of background: this behaviour was also present in versions 22.05 and earlier. At that time, Koha prioritised the "no renewal" message when reaching the renewal limit or overdue instead of showing the "hold" alert. It was fixed in 23.05 but seems to have reappeared in 24.05.

others bugs mentioning this:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26440
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36331
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34809
Comment 2 Jonathan Druart 2025-10-16 09:28:48 UTC
*** Bug 26440 has been marked as a duplicate of this bug. ***
Comment 3 Jonathan Druart 2025-10-16 09:29:02 UTC
*** Bug 40900 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Druart 2025-10-16 09:42:42 UTC
Created attachment 187980 [details] [review]
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.
Comment 5 Caroline Cyr La Rose 2025-10-16 15:28:52 UTC
I tried the patch, but it looks the same as before... I don't see a mention of oh hold at step 9 or 10.

Is there something i should have done after applying the patch? I only did reset_all, but maybe there's something else?
Comment 6 Jonathan Druart 2025-10-17 04:03:21 UTC
(In reply to Caroline Cyr La Rose from comment #5)
> I tried the patch, but it looks the same as before... I don't see a mention
> of oh hold at step 9 or 10.
> 
> Is there something i should have done after applying the patch? I only did
> reset_all, but maybe there's something else?

There is nothing else. restart_all should be enough.
I have retried following the test plan and it still works for me: https://snipboard.io/tzNIbT.jpg
Comment 7 Caroline Cyr La Rose 2025-10-17 15:13:05 UTC
I have retried again and I don't see it... I stopped and restarted my KTD in case that was it (also pulled just in case).

I tried three times with a variation of the following

ktd down
git reset --hard origin/main (in koha)
git pull (in koha)
git pull (in koha-testing-docker)
ktd pull
ktd up
git bz apply 41017
reset_all

With AllowRenewalOnHoldOverride I see the "On hold" message (normal)
With OverduesBlockRenewing set to either blocking options and AllowRenewalLimitOverride set to allow I don't see the "On hold" message
https://snipboard.io/1kL0Zw.jpg

I notice yours doesn't have the same columns as mine. I don't have an extra column where it says "On hold" and I don't have the Claimed returned option.
Comment 8 Marie-Luce Laflamme 2025-10-17 15:36:07 UTC
Created attachment 188105 [details] [review]
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 <marie-luce.laflamme@inlibro.com>
Comment 9 Caroline Cyr La Rose 2025-10-17 19:06:08 UTC
Marie-Luce was able to see the change on a "vintage" installation after restarting apache. I tried reset_all AND restart_all on ktd and I still don't see it. :(
Comment 10 Marie-Luce Laflamme 2025-12-05 00:23:51 UTC
I wanted to test the patch in a sandbox, but unfortunately it won't apply. Even after restarting all services (including Apache), Koha still isn't displaying "on hold". KTD and Open Fifth Sandbox aren't displaying "on hold", whereas my old "vintage" main is.
Here is the sandbox in case anyone is interested in checking.
https://staff-mlinlibro.sandboxes.ptfs-europe.co.uk/cgi-bin/koha/circ/circulation.pl?borrowernumber=3
Comment 11 Jonathan Druart 2025-12-05 08:43:11 UTC
(In reply to Marie-Luce Laflamme from comment #10)
> I wanted to test the patch in a sandbox, but unfortunately it won't apply.
> Even after restarting all services (including Apache), Koha still isn't
> displaying "on hold". KTD and Open Fifth Sandbox aren't displaying "on
> hold", whereas my old "vintage" main is.
> Here is the sandbox in case anyone is interested in checking.
> https://staff-mlinlibro.sandboxes.ptfs-europe.co.uk/cgi-bin/koha/circ/
> circulation.pl?borrowernumber=3

At which steps?
Comment 12 Marie-Luce Laflamme 2025-12-05 14:25:17 UTC
Sorry, I've forgot to mention that it doesn't work in step 9 and 10 after enabling all system preferences in the test plan:
- AllowRenewalOnHoldOverride
- OverduesBlockRenewing ("block renewing for all the patron's items")
- AllowRenewalLimitOverride.

Unfortunately, Koha isn't displaying the "on hold" mention in the 'renew' column whether or not you check the override check box.

Have a look at this example: https://staff-mlinlibro.sandboxes.ptfs-europe.co.uk/cgi-bin/koha/circ/circulation.pl?borrowernumber=3
Comment 13 Mikko Liimatainen 2026-02-16 11:42:57 UTC
Bug https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26440 had a suggestion to show "On hold" with no remaining renewals. It seems to me that could be accomplished here by checking if $can_renew_error is "too_many" and doing the same thing that this fix is doing. Could we get that as well here?
Comment 14 Katrin Fischer 2026-02-18 14:35:14 UTC
*** Bug 41873 has been marked as a duplicate of this bug. ***
Comment 15 Katrin Fischer 2026-02-18 14:36:33 UTC
Sorry, late to the party :( 

I filed the third duplicate bug for this today - what do we need to get this moving again?
Comment 16 Marie-Luce Laflamme 2026-02-19 15:01:39 UTC
We received feedback from clients about this. It's impacting library staff and slowing down their workflow.

Ideally, "On hold" should take priority over other messages in the renewal column to avoid confusion and ensure smoother processing.

Thanks for looking into this.
Comment 17 Jonathan Druart 2026-02-20 08:19:17 UTC
I have retried and everything is working for me. I see that at step 10:
https://snipboard.io/zP03ko.jpg
https://snipboard.io/qFHhTL.jpg
Comment 18 Jonathan Druart 2026-02-20 08:19:55 UTC
Created attachment 193501 [details] [review]
Bug 41017: (bug 41484 follow-up) Adjust 'on hold'

Patch from commit f63ae1e
Comment 19 David Nind 2026-02-20 11:56:21 UTC
I attempted to test, but found the test plan confusing because of:

1. The wording changes from bug 41484.
2. It's not clear to me what the current behavour is (allowing or not allowing staff
   to override the renewal), and what it should be after the patch.

Could the test plan be updated to reflect the before and after behavour, along with the updated wording?
Comment 20 Katrin Fischer 2026-02-20 11:58:45 UTC
Hi David, the override should not be allowed, if you also have AllowRenewalOnHoldOverride set to "Allow", but the hold information should always be visible.
Comment 21 Katrin Fischer 2026-02-20 11:59:16 UTC
(In reply to Katrin Fischer from comment #20)
> Hi David, the override should not be allowed, if you also have
> AllowRenewalOnHoldOverride set to "Allow", but the hold information should
> always be visible.

I'll try to have a go in a bit.
Comment 22 Katrin Fischer 2026-02-23 11:07:58 UTC
I am sorry, but this still doesn't work as expected and the text was changed to the simpler 'on hold' before in the cases it did show. Can you please have another look?

1) QA checks

Is this something in my config not being right?

[FAIL] svc/checkouts
   FAIL	  tidiness
		File is not tidy, please run `perl misc/devel/tidy.pl svc/checkouts`

2) Testing

Test cases:
- Patron A with 3 checkouts from different records, all on hold for others
  1) renewal still possible
  2) overdue, renewals possible
  3) renewals maxed out

Expectation: 
- We want the system to ALWAYS show "on hold" for these checkouts, independent of system preference settings.
  - in the list of checkouts initially
  - after override renewal is clicked
- Renewals of 'on hold' should be blocked with AllowRenewalOnHoldOverride "not allow"

Testing:

Combination A:
- AllowRenewalLimitOverride = Allow
- AllowRenewalOnHoldOverride = Not allow
- OverduesBlockRenewing = block renewing for all

FAIL 
- All items show "no renewal allowed: overdue, 'on hold' is missing.
- Items can be renewed with override.

Combination B:
- AllowRenewalLimitOverride = Allow
- AllowRenewalOnHoldOverride = Not allow
- OverduesBlockRenewing = only this item

FAIL
- On hold information is only shown for 1 out of 3.
  1) OK renewal still possible
  2) FAIL overdue, renewals possible
  3) FAIL renewals maxed out
- Overdue item and maxed out renewals don't show 'hold' info (2 + 3)
- FAIL Item with option to renew shows 'hold info' (1), but new text "Item on hold for another patron" is too long. Please change back to the "On hold" previously used.

Combination C:
- AllowRenewalLimitOverride = Allow
- AllowRenewalOnHoldOverride = Not allow
- OverduesBlockRenewing = allow renewing

FAIL
- On hold inforation is only shown for 2 out of 3
  1) OK renewal still possible
  2) OK overdue, renewals possible
  3) FAIL renewals maxed out
- override renewal doesn't activate checkbox for visible 'on holds'

Combination D:
- AllowRenewalLimitOverride = Allow
- AllowRenewalOnHoldOverride = Allow
- OverduesBlockRenewing = allow renewing

FAIL
- On hold inforation is only shown for 2 out of 3
  1) OK renewal still possible
  2) OK overdue, renewals possible
  3) FAIL renewals maxed out
- override renewal does activate checkboxes for visible 'on holds' (OK, but should be all 3)
Comment 23 David Nind 2026-02-23 19:55:44 UTC
Thanks Katrin!