[Bug 43996] New: Holds tab count is not updated after cancelling holds in the patron holds table
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 Bug ID: 43996 Summary: Holds tab count is not updated after cancelling holds in the patron holds table Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, lisette@bywatersolutions.com, tomascohen@gmail.com Target Milestone: --- The count badge on the Holds tab of a patron's circulation.pl and moremember.pl pages is not updated when a hold is cancelled in the holds table. Since Bug 40551 the patron holds table cancels holds through the API and just reloads the table rows, instead of reloading the page. The badge is rendered by the server from Koha::Holds->count_holds (a hold group counts as one hold), so it keeps showing the old number until the page is reloaded. This is on vanilla 25.11 as well as main. To reproduce: 1. Place a hold for a patron 2. Open circulation.pl or moremember.pl for that patron and click the Holds tab: it shows "Holds (1)" 3. Cancel the hold 4. The table is updated but the badge still shows 1 The fix recounts from the rows of the holds table every time it is drawn, using the same definition as the server (hold group = one hold). The table loads all of the patron's holds at once (svc/holds ignores paging), so its rows are all the holds. The badge is hidden when the count reaches 0, as it is on a fresh page load. A small helper, updateTabCount() in staff-global.js, does the update so other tabs can reuse it. The same problem exists on other patron tabs and could be fixed separately with the helper: Recalls (cancel/expire in place), Bookings (the JS updates .bookings_count but the badge has no such class) and Claims (resolving a claim reloads the table, not #return-claims-count). Test plan: 1. Place 4 holds for a patron 2. Go to the patron's circulation.pl page and open the Holds tab: the badge shows 4 3. Cancel one hold: the badge shows 3 (before the patch it stayed at 4) 4. Select two holds, click "Cancel selected" and confirm: the badge shows 1 5. Cancel the last hold: the badge disappears 6. Repeat on members/moremember.pl 7. If DisplayAddHoldGroups is enabled, group two holds: the badge counts the group as one hold, the same as after a page reload 8. Suspend and resume a hold: the badge does not change -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210448 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210448&action=edit Bug 43996: Update the Holds tab count after cancelling holds in place Since Bug 40551 the patron holds table cancels holds through the API and only reloads the table, instead of reloading the whole page. The count badge on the Holds tab (circulation.pl and moremember.pl) is rendered by the server from Koha::Holds->count_holds, so it kept showing the old number after a hold was cancelled. Recount from the rows of the holds table whenever it is drawn, using the same definition as the server (a hold group counts as one hold), so every in-place action that changes the number of holds is covered: single cancel, cancel selected, and grouping holds. Suspending and resuming do not change the count. The badge is hidden when the count reaches 0, as it is when the page is rendered with no holds. The badge gets a patron_holds_count class as a hook (.holds_count is already used by an item table), and the update goes through a new small helper, updateTabCount() in staff-global.js, so the other tabs can use it. To test: 1. Place 4 holds for a patron 2. Go to the patron's circulation.pl page and open the Holds tab => The badge shows (4) 3. Cancel one hold => Before: the badge still shows 4 => After: the badge shows 3 4. Select two holds, click "Cancel selected" and confirm => The badge shows 1 5. Cancel the last hold => The badge disappears 6. Repeat 1-5 on members/moremember.pl 7. If DisplayAddHoldGroups is enabled, group two holds => The badge counts the group as one hold, matching the number shown after a page reload 8. Suspend and resume a hold => The badge does not change Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210448|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 210562 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210562&action=edit Bug 43996: Update the Holds tab count after cancelling holds in place Since Bug 40551 the patron holds table cancels holds through the API and only reloads the table, instead of reloading the whole page. The count badge on the Holds tab (circulation.pl and moremember.pl) is rendered by the server from Koha::Holds->count_holds, so it kept showing the old number after a hold was cancelled. Recount from the rows of the holds table whenever it is drawn, using the same definition as the server (a hold group counts as one hold), so every in-place action that changes the number of holds is covered: single cancel, cancel selected, and grouping holds. Suspending and resuming do not change the count. The badge is hidden when the count reaches 0, as it is when the page is rendered with no holds. The badge gets a patron_holds_count class as a hook (.holds_count is already used by an item table), and the update goes through a new small helper, updateTabCount() in staff-global.js, so the other tabs can use it. To test: 1. Place 4 holds for a patron 2. Go to the patron's circulation.pl page and open the Holds tab => The badge shows (4) 3. Cancel one hold => Before: the badge still shows 4 => After: the badge shows 3 4. Select two holds, click "Cancel selected" and confirm => The badge shows 1 5. Cancel the last hold => The badge disappears 6. Repeat 1-5 on members/moremember.pl 7. If DisplayAddHoldGroups is enabled, group two holds => The badge counts the group as one hold, matching the number shown after a page reload 8. Suspend and resume a hold => The badge does not change Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |katrin.fischer@bsz-bw.de |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This seems to work quite well. One small discrepancy maybe: The patch takes some extra care to only count grouped holds once. When you cancel holds, all entries of a list are counted, which also makes sense. So the tab might show a different total than the button to cancel when you "select all". -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210562|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 211383 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211383&action=edit Bug 43996: Update the Holds tab count after cancelling holds in place Since Bug 40551 the patron holds table cancels holds through the API and only reloads the table, instead of reloading the whole page. The count badge on the Holds tab (circulation.pl and moremember.pl) is rendered by the server from Koha::Holds->count_holds, so it kept showing the old number after a hold was cancelled. Recount from the rows of the holds table whenever it is drawn, using the same definition as the server (a hold group counts as one hold), so every in-place action that changes the number of holds is covered: single cancel, cancel selected, and grouping holds. Suspending and resuming do not change the count. The badge is hidden when the count reaches 0, as it is when the page is rendered with no holds. The badge gets a patron_holds_count class as a hook (.holds_count is already used by an item table), and the update goes through a new small helper, updateTabCount() in staff-global.js, so the other tabs can use it. To test: 1. Place 4 holds for a patron 2. Go to the patron's circulation.pl page and open the Holds tab => The badge shows (4) 3. Cancel one hold => Before: the badge still shows 4 => After: the badge shows 3 4. Select two holds, click "Cancel selected" and confirm => The badge shows 1 5. Cancel the last hold => The badge disappears 6. Repeat 1-5 on members/moremember.pl 7. If DisplayAddHoldGroups is enabled, group two holds => The badge counts the group as one hold, matching the number shown after a page reload 8. Suspend and resume a hold => The badge does not change Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996 --- Comment #5 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org