Bug 29971

Summary: Remember selections across patron search pages
Product: Koha Reporter: Owen Leonard <oleonard>
Component: PatronsAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: cslone, david, gmcharlt, jonathan.druart, kyle.m.hall, lucas, sally.healey, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement to patron search remembers selections across multiple pages of search results and multiple different searches. The selected patrons can be added to a patron list or submitted for merging. Selections can be cleared manually and are automatically removed upon logout. Previously, selections were only remembered for the current page of search results.
Version(s) released in:
22.11.00
Bug Depends on:    
Bug Blocks: 34479, 34733, 34734, 28366, 31566, 33263    
Attachments: Bug 29971: Remember selections across patron search pages
Bug 29971: Remember selections across patron search pages
Bug 29971: Remember selections across patron search pages
Bug 29971: Remember selections across patron search pages
Bug 29971: Remember selections across patron search pages
Bug 29971: Remember selections across patron search pages
Bug 29971: Remember selections across patron search pages
Bug 29971: Add selenium tests

Description Owen Leonard 2022-01-28 18:59:37 UTC
I'd like to modify the patron search results page so that when the user checks a checkbox for a patron, the page remembers that selection even after they click to a different page of search results. This will allow the user to select patrons across pages, have the checkbox state persist, and be able to pass all selected patrons to a list or a merge operation.

My goal is to have this in place for Bug 28366, "Add batch patron modification to patron search results."
Comment 1 Owen Leonard 2022-01-28 19:19:30 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2022-01-31 12:22:32 UTC Comment hidden (obsolete)
Comment 3 Owen Leonard 2022-03-02 12:05:04 UTC
I think this is ready for testing, but I do have concerns about whether I have the workflow correct. As it is now you have to manually clear the "remembered" selections, which could cause confusion if someone is coming back to a new patron search some time later. I'm interested in how others think that works.
Comment 4 Sally 2022-03-16 10:16:10 UTC
Sorry Owen - the patch isn't applying.  

Auto-merging koha-tmpl/intranet-tmpl/prog/js/staff-global.js
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/js/staff-global.js
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
error: Failed to merge in the changes.
Patch failed at 0001 Bug 29971: Remember selections across patron search pages
Comment 5 Owen Leonard 2022-03-16 13:04:25 UTC Comment hidden (obsolete)
Comment 6 Biblibre Sandboxes 2022-03-16 15:20:38 UTC Comment hidden (obsolete)
Comment 7 Sally 2022-03-16 15:26:36 UTC
Works great, thanks Owen.  

To answer your comment, I think it works well like this.  The display is clear, shows that patrons are still selected, and there's a clear link to remove the selections.  Feels logical and natural to me.
Comment 8 Owen Leonard 2022-06-15 16:25:03 UTC
Created attachment 136097 [details] [review]
Bug 29971: Remember selections across patron search pages

This patch modifies the patron search results page to enable checkbox
selections to be remembered in the browser's localStorage. This allows
checkbox selections to persist while navigating through multiple pages
of search results or even across multiple different searches.

Once selected, these values can be added to a patron list or submitted
for merging. Selections can be cleared manually and will be
automatically be removed upon logout.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- In the staff interface perform a patron search in the Patrons module
  which will return multiple pages of results..
- Check checkboxes next to several patrons.
  - After one checkbox is checked the "Add to patron list" button should
    be enabled.
  - After more than one checkbox is checked the "Merge selected patrons"
    button should be enabled.
- A box should appear in the toolbar above the search results, "Patrons
  selected: X"
- Navigate to another page of results. Check more checkboxes. The
  "Patrons selected" information should be updated.
- Return to the first page of results. Your original selections should
  still be checked.
- Test that the correct set of patrons is used when clicking "Merge
  selected patrons" or when using "Add to patron list."
- Click the "Clear" button in the selections information box. Checkboxes
  should be cleared on every page of results you previously checked.
  - The "Add to patron list" and "Merge selected patrons" buttons should
    become disabled.
- After making several selections, log out of the staff interface and
  log back in, returning to the same patron search. Your selections
  should have been forgotten.
Comment 9 Owen Leonard 2022-06-15 16:25:46 UTC
The patron search stuff has changed enough that I think it's prudent to ask for a new signoff on this.
Comment 10 David Nind 2022-06-24 21:08:48 UTC
Created attachment 136534 [details] [review]
Bug 29971: Remember selections across patron search pages

This patch modifies the patron search results page to enable checkbox
selections to be remembered in the browser's localStorage. This allows
checkbox selections to persist while navigating through multiple pages
of search results or even across multiple different searches.

Once selected, these values can be added to a patron list or submitted
for merging. Selections can be cleared manually and will be
automatically be removed upon logout.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- In the staff interface perform a patron search in the Patrons module
  which will return multiple pages of results..
- Check checkboxes next to several patrons.
  - After one checkbox is checked the "Add to patron list" button should
    be enabled.
  - After more than one checkbox is checked the "Merge selected patrons"
    button should be enabled.
- A box should appear in the toolbar above the search results, "Patrons
  selected: X"
- Navigate to another page of results. Check more checkboxes. The
  "Patrons selected" information should be updated.
- Return to the first page of results. Your original selections should
  still be checked.
- Test that the correct set of patrons is used when clicking "Merge
  selected patrons" or when using "Add to patron list."
- Click the "Clear" button in the selections information box. Checkboxes
  should be cleared on every page of results you previously checked.
  - The "Add to patron list" and "Merge selected patrons" buttons should
    become disabled.
- After making several selections, log out of the staff interface and
  log back in, returning to the same patron search. Your selections
  should have been forgotten.

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 Jonathan Druart 2022-08-01 10:05:43 UTC
Created attachment 138455 [details] [review]
Bug 29971: Remember selections across patron search pages

This patch modifies the patron search results page to enable checkbox
selections to be remembered in the browser's localStorage. This allows
checkbox selections to persist while navigating through multiple pages
of search results or even across multiple different searches.

Once selected, these values can be added to a patron list or submitted
for merging. Selections can be cleared manually and will be
automatically be removed upon logout.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- In the staff interface perform a patron search in the Patrons module
  which will return multiple pages of results..
- Check checkboxes next to several patrons.
  - After one checkbox is checked the "Add to patron list" button should
    be enabled.
  - After more than one checkbox is checked the "Merge selected patrons"
    button should be enabled.
- A box should appear in the toolbar above the search results, "Patrons
  selected: X"
- Navigate to another page of results. Check more checkboxes. The
  "Patrons selected" information should be updated.
- Return to the first page of results. Your original selections should
  still be checked.
- Test that the correct set of patrons is used when clicking "Merge
  selected patrons" or when using "Add to patron list."
- Click the "Clear" button in the selections information box. Checkboxes
  should be cleared on every page of results you previously checked.
  - The "Add to patron list" and "Merge selected patrons" buttons should
    become disabled.
- After making several selections, log out of the staff interface and
  log back in, returning to the same patron search. Your selections
  should have been forgotten.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Jonathan Druart 2022-08-01 10:05:47 UTC
Created attachment 138456 [details] [review]
Bug 29971: Add selenium tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Tomás Cohen Arazi 2022-08-01 12:52:49 UTC
Hi! The added tests are failing for me. Can you review it ASAP?
Comment 14 Jonathan Druart 2022-08-05 08:32:44 UTC
(In reply to Tomás Cohen Arazi from comment #13)
> Hi! The added tests are failing for me. Can you review it ASAP?

Which one? The one that is failing on master? Yes that's expected, you are supposed to revert it.
Comment 15 Tomás Cohen Arazi 2022-08-05 17:54:59 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 16 Lucas Gass 2022-09-29 17:12:18 UTC
Enhancement will not be backported to 22.05.x series
Comment 17 Chris Slone 2023-07-27 16:12:08 UTC
I think this is a problematic implementation, as it seems to be retaining the selected patrons even after you perform a function (merge patrons, create a list, do a batch edit) and do a completely new search. This means that the previously selected patrons remain selected even when it doesn't really make logical sense. It's great to be able to select multiple patrons across different searches, but doing something like merging accounts should absolutely clear out that selection.

It seems to already be causing some issues, see this ticket:

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

We've also had some errors at our library from this (before we realized what was happening).
Comment 18 Owen Leonard 2023-08-04 16:47:37 UTC
(In reply to Chris Slone from comment #17)
> I think this is a problematic implementation

I created bug 34479 to discuss possible solutions.