Bug 27725: Use JavaScript to set history state during patron search
authorOwen Leonard <oleonard@myacpl.org>
Thu, 18 Feb 2021 16:37:37 +0000 (16:37 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Oct 2021 09:18:29 +0000 (11:18 +0200)
commit87e53a335242f9b47183d8437885b22706bbde3c
treed30fc3ba64be6d45b7db1fa1d4d8af7c1f00de83
parent90be2877c98e2c74bbdcea9e4a9e4ce4cf2455e2
Bug 27725: Use JavaScript to set history state during patron search

This patch modifies the patron search page so that clicks on the "Browse
by last name" letters add an entry to the browser history, allowing the
user to click back and forth from results while preserving their search.

To test, apply the patch and go to Patrons in the staff interface.

- Click one of the "Browse by last name" letters.
- The table of search results should load the correct data.
- In the browser's location bar you should see a query string added to
  the URL, e.g. /cgi-bin/koha/members/members-home.pl?firstletter=Q
- Click another letter.
- Click the back button. You should be returned to the search results
  for your first letter choice.
- Clicking the forward button should work correctly as well.
- Other patron searches (header search, sidebar search) should continue
  to work as expected.

EDIT: Clear single-letter querystring history item if only one result
was returned.

EDIT 2: Fixed handling of history state changes so that forward and back
buttons work correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 27725: (follow-up) Remove code for clearing search results

This patch removes code which cleared search results if there was no
first-letter search. It was unnecessary for the letter search
functionality and made all other searches fail.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt