Bug 29971 - Remember selections across patron search pages
Summary: Remember selections across patron search pages
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 34479 34733 34734 28366 31566 33263
  Show dependency treegraph
 
Reported: 2022-01-28 18:59 UTC by Owen Leonard
Modified: 2024-07-04 20:38 UTC (History)
8 users (show)

See Also:
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
Circulation function:


Attachments
Bug 29971: Remember selections across patron search pages (13.77 KB, patch)
2022-01-28 19:19 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29971: Remember selections across patron search pages (14.41 KB, patch)
2022-01-31 12:22 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29971: Remember selections across patron search pages (14.43 KB, patch)
2022-03-16 13:04 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29971: Remember selections across patron search pages (14.50 KB, patch)
2022-03-16 15:20 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 29971: Remember selections across patron search pages (14.90 KB, patch)
2022-06-15 16:25 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29971: Remember selections across patron search pages (14.95 KB, patch)
2022-06-24 21:08 UTC, David Nind
Details | Diff | Splinter Review
Bug 29971: Remember selections across patron search pages (15.03 KB, patch)
2022-08-01 10:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 29971: Add selenium tests (4.22 KB, patch)
2022-08-01 10:05 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 (tcohen) 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 (tcohen) 2022-08-05 17:54:59 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 16 Lucas Gass (lukeg) 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.