Bug 31566

Summary: 'Patrons selected' counter doubles on 'Select all'
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Staff interfaceAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: david, gmcharlt
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Bug Depends on: 29971    
Bug Blocks:    
Attachments: Bug 31566: 'Patrons selected' counter doubles on 'Select all'
Bug 31566: 'Patrons selected' counter doubles on 'Select all'
Bug 31566: 'Patrons selected' counter doubles on 'Select all'

Description Martin Renvoize 2022-09-14 15:12:57 UTC
The new 'Patrons selected' feedback introduced on bug 29971 doesn't work as expected with the 'Select all' feature.. if you click "Select all" once it counts as expected.. if you work with the checkboxes, the counter changes as expected.. if you change your mind and click 'Select all' again, the counter adds all results again, effectively doubling the count each time you click it.
Comment 1 Owen Leonard 2022-09-23 15:26:37 UTC
Created attachment 140923 [details] [review]
Bug 31566: 'Patrons selected' counter doubles on 'Select all'

This patch refines the JavaScript which is run when the "Select all"
or "Clear all" controls are clicked. The script now checks to see
whether the checkbox is checked before triggering the change function.

To test, apply the patch and perform a patron search in the staff
interface which will return multiple results.

- After the patron search results are displayed, test the "Select
  all" control. The visible search results should all be checked,
  and the "Patrons selected" counter at the top should be
  incremented correctly.
- Clicking the "Select all" control again should have no effect.
  The "Patrons selected" counter should not increment again.
- Test the "Clear all" control to confirm that checkboxes are
  unchecked and the counter updates correctly.
- Test with multiple pages of patron search results to confirm
  that the controls work correctly on any page of results..
Comment 2 David Nind 2022-09-23 17:29:53 UTC
Created attachment 140959 [details] [review]
Bug 31566: 'Patrons selected' counter doubles on 'Select all'

This patch refines the JavaScript which is run when the "Select all"
or "Clear all" controls are clicked. The script now checks to see
whether the checkbox is checked before triggering the change function.

To test, apply the patch and perform a patron search in the staff
interface which will return multiple results.

- After the patron search results are displayed, test the "Select
  all" control. The visible search results should all be checked,
  and the "Patrons selected" counter at the top should be
  incremented correctly.
- Clicking the "Select all" control again should have no effect.
  The "Patrons selected" counter should not increment again.
- Test the "Clear all" control to confirm that checkboxes are
  unchecked and the counter updates correctly.
- Test with multiple pages of patron search results to confirm
  that the controls work correctly on any page of results..

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2022-09-23 17:33:35 UTC
Noted when testing:

- The dropdown list for 'Show X entries' has the options: 10 20 (default) 20 50 100 All 

- Note that 20 is repeated.

- This was there before the patch was applied, so not related to this bug and I should probably log as a separate one.
Comment 4 Katrin Fischer 2022-09-26 22:06:29 UTC
Created attachment 141016 [details] [review]
Bug 31566: 'Patrons selected' counter doubles on 'Select all'

This patch refines the JavaScript which is run when the "Select all"
or "Clear all" controls are clicked. The script now checks to see
whether the checkbox is checked before triggering the change function.

To test, apply the patch and perform a patron search in the staff
interface which will return multiple results.

- After the patron search results are displayed, test the "Select
  all" control. The visible search results should all be checked,
  and the "Patrons selected" counter at the top should be
  incremented correctly.
- Clicking the "Select all" control again should have no effect.
  The "Patrons selected" counter should not increment again.
- Test the "Clear all" control to confirm that checkboxes are
  unchecked and the counter updates correctly.
- Test with multiple pages of patron search results to confirm
  that the controls work correctly on any page of results..

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2022-10-03 16:53:25 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!