Bug 30055: Make patron searches use the REST API
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 2 Feb 2022 17:00:58 +0000 (18:00 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 4 Apr 2022 07:46:57 +0000 (09:46 +0200)
commit551721f7028e4de3bb32a12465fb5c7796030174
treee2f6c5d11ea36786e7a64e0f518fae5877028ec7
parent3c550c62ae4341a3846169d2c96ee9fd4f549459
Bug 30055: Make patron searches use the REST API

This patch will rewrite some of our patron searches to make them use the
REST API routes (and so the powerful the DataTables wrapper which will
bring all the nice DT feature to filter, sort, etc.)

The patron searches we will take into account here are those that we use
to select a patron in a pop-up:
 * Guarantor
 * Suggestion's manager
 * Patron's card
 * Serial routing list
 * Users to notify when order is received
 * Manager of an acquisition basket
 * Owner and users of a fund

Regarding permissions there are two main problematics:
 * Filter a patron set by patrons having a
specific subpermissions (in case of adding a manager to a suggestion or
when we deal with acquisition and funds). We added a new
Koha::Patrons->filter_by_have_subpermission method that will take in
parameter a subpermission. To make thing transparent for the callers we
are adding new routes, like /suggestions/managers to list the possible
managers of suggestions.
 * Restrict/allow access to the default patron searches /patrons
We need to access it when a logged in patron does not have borrowers
permission.
Ideally we need a separate "search_borrowers" subpermissions but it's
considered outside the scope of this change.

For each patch you will take care of testing the different permissions
that are into effect (either for the logged in patron or the patrons
returned by the search).

The tables should contain the same columns as prior to this patch,
except for "categories" and "library". We have the filter on top of the
page and so we need to add them to the table as new columns if they
weren't there before.

Test plan (for this patch):
Search for guarantor and select

Test plan (for all patches):
Add/Select patrons from the correct place where you can search for
patrons, play extensively with the filters/pagination/etc

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc
koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt [deleted file]
koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt [deleted file]
koha-tmpl/intranet-tmpl/prog/js/datatables.js
koha-tmpl/intranet-tmpl/prog/js/members.js
members/guarantor_search.pl [deleted file]
members/search.pl [new file with mode: 0755]