Bug 27854: Clean GET /patrons controller
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 3 Mar 2021 19:37:09 +0000 (16:37 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 9 Mar 2021 09:31:47 +0000 (10:31 +0100)
commit46a024a6e09a5ff7ace3be5ac5f171ec8d53a427
treecc45fd55864dc8187bddef6660672a9a28b86e81
parent4a65fe61f482a08932a5d210df1ec0c59dd7771e
Bug 27854: Clean GET /patrons controller

The controller method was written a lot of time before the enhancements
we added to the objects.search helper, and it is now much easier to
handle the 'restricted' param use case.

No need to do it like that anymore.

This patch fetches the 'restricted' param from the query parameters and
cleans it from the validated data, so we can just pass the resultset to
$c->objects->search as in all other controllers.

And we had tests for the expected behavior, so testing this is as easy
as:

1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass! Of course!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/REST/V1/Patrons.pm