Bug 27353: Set X-Base-Total-Count header for REST API
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 6 Jan 2021 15:34:23 +0000 (16:34 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 28 Jan 2021 15:41:21 +0000 (16:41 +0100)
commit7ddb60e292bd0014cff9ab8416f6138c8e6b03b7
tree5a4e8fea9bb19b2907ae0571dad63bc557890479
parent58c1ddc15176a347c2d2a8a8b3b0feda3d7084b8
Bug 27353: Set X-Base-Total-Count header for REST API

We already set X-Total-Count to the total number of filtered rows,
but we don't have the total number of non-filtered rows.

Test plan:
This is easy to test on top of bug 27352 or bug 27251, apply them if not
pushed yet.
1. Create 40 items with public notes = "xxx" for biblionumber=4
then, using Postman (or whatever you prefer):
http://kohadev-intra.mydnsname.org:8081/api/v1/biblios/4/items?_page=1&_per_page=20&q=[{"me.public_notes"%3A{"like"%3A"%25x%25"}}]&_match=contains
Check the headers and confirm you see X-Total-Count=40 and
X-Base-Total-Count=44

2. go to /cgi-bin/koha/tools/quotes.pl
You see "Showing 1 to 20 of 28 entries"
Search "he"
Showing 1 to 20 of 22 entries (filtered from 28 total entries)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/REST/Plugin/Objects.pm
Koha/REST/Plugin/Pagination.pm
Koha/REST/V1/Patrons.pm
koha-tmpl/intranet-tmpl/prog/js/datatables.js
koha-tmpl/opac-tmpl/bootstrap/js/datatables.js