https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43996

--- Comment #2 from David Nind <[email protected]> ---
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 <[email protected]>
Signed-off-by: David Nind <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to