Main Koha release repository https://koha-community.org
Find a file
Mark Tompsett 25f134f525 Bug 11491: add option to supply field names in reports web service output
The staff and public catalog reports web services (/svc/report) return
JSON output, in particular an array contain an array for each row
of the report output.

This patch adds a URL parameter, annotated, which when supplied and
set to a value that evaluates to Perl true, will cause the output
to be emited as a JSON array of hashes, where each hash represents
a row of report output and the hash keys are the column names
or labels set in the report definition.

This patch also moves code around to make diffs between svc/report and
opac/svc/report smaller.

The suggestion to return an array of hashes was made by Chris Cormack.

TEST PLAN
---------
 1) Log into staff client
 2) Reports
 3) Used save reports
 4) Click the Action button on any report
     WITHOUT PARAMETERS.
    -- with parameters blows up in master and this.
 5) Click Edit
 6) Make the report public
 7) Update the SQL
 8) Note the ID number of the report
 9) Note the ID number of a non-public report
10) Make up a crazy ID number for a non-existant report
11) In a new tab (with the appropriate edits)
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of field values.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: Sorry this report is not public
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /usr/share/perl5/JSON.pm line 154.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /usr/share/perl5/JSON.pm line 154.

12) Apply the patch
13) ~/qa-test-tools/koha-qa.pl -v 2 -c 2
    -- There should be no problems. All OK.

14) In a new tab (with the appropriate edits)
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of hashes with field names as keys
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- Software error: Sorry this report is not public
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: There is no such report.
     https://OPAC/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: There is no such report.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 8&annotated=1
    -- JSON data has arrays of hashes with field names as keys
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9
    -- JSON data has arrays of field values.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 9&annotated=1
    -- JSON data has arrays of hashes with field names as keys
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10
    -- Software error: There is no such report.
     https://STAFF/cgi-bin/koha/svc/report?id=# from step 10&annotated=1
    -- Software error: There is no such report.

Signed-off-by: Holger Meißner <h.meissner.82@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-31 20:22:34 +00:00
acqui Bug 9823: Refactor return from GetReservesFromBiblionumber 2014-01-30 16:19:55 +00:00
admin Bug 11513: fix log warning noise in patron category editor 2014-01-31 16:15:09 +00:00
authorities Bug 11313: supply empty value in mandatory comboboxs in MARC record editors 2014-01-23 03:47:38 +00:00
basket Bug 10605: fix encoding issue on basket email (INTRANET) 2013-12-10 04:37:12 +00:00
C4 Bug 9823: (follow-up) improve POD for C4::Reserves::GetReservesFromBiblionumber 2014-01-30 16:48:26 +00:00
catalogue Bug 9823: QA follow-up for GetReservesFromBiblionumber calls 2014-01-30 16:23:34 +00:00
cataloguing Bug 11313: supply empty value in mandatory comboboxs in MARC record editors 2014-01-23 03:47:38 +00:00
circ Bug 11486: Show renewal count on 'check out' and 'details' tabs in patron record 2014-01-23 17:39:55 +00:00
course_reserves
debian Bug 11138: add auto_unsuspend_holds to daily crontab (Debian package) 2014-01-17 21:14:17 +00:00
docs Bug 7143: Updating about page and history 2014-01-16 15:28:13 +00:00
errors
etc Bug 11389: reenable Pg as a DB scheme that Koha can connect to 2014-01-13 20:56:14 +00:00
install_misc Bug 8798: DBIx::Class base classes for all Koha tables 2013-10-14 21:07:24 +00:00
installer Bug 10811: (follow-up) use "local-number" rather than "Local-Number" 2014-01-31 19:21:48 +00:00
Koha Bug 11268: (follow-up) update DBIC schema classes 2014-01-31 15:58:58 +00:00
koha-tmpl Bug 11513: (follow-up) format enrollment end date consistently 2014-01-31 16:21:05 +00:00
labels Bug 11222: fix crash that can occur in search for items to add to label batch 2013-11-23 19:54:38 +00:00
members Bug 11486: Show renewal count on 'check out' and 'details' tabs in patron record 2014-01-23 17:39:55 +00:00
misc Bug 11571: fix breakage of -f option for translate script 2014-01-26 15:50:41 +00:00
offline_circ Bug 10240: (follow-up) don't display patrons as lost or gone-no-address incorrectly 2013-10-11 01:57:05 +00:00
opac Bug 11491: add option to supply field names in reports web service output 2014-01-31 20:22:34 +00:00
OpenILS
patron_lists Bug 10565: (follow-up) add new user permission for patron list management 2013-10-14 22:43:03 +00:00
patroncards Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber 2013-10-14 21:08:02 +00:00
plugins
reports
reserve Bug 9823: Refactor return from GetReservesFromBiblionumber 2014-01-30 16:19:55 +00:00
reviews
rotating_collections
selenium
serials Bug 9823: Refactor return from GetReservesFromBiblionumber 2014-01-30 16:19:55 +00:00
services
skel
sms
suggestion Bug 10277 - Add C4::Context->IsSuperLibrarian() 2013-12-30 15:47:23 +00:00
svc Bug 11491: add option to supply field names in reports web service output 2014-01-31 20:22:34 +00:00
t Bug 9823: Refactor return from GetReservesFromBiblionumber 2014-01-30 16:19:55 +00:00
tags
test
tmp/modified_authorities
tools Bug 11477 - Add names for librarian and borrowers in the logs 2014-01-17 06:06:53 +00:00
virtualshelves Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
xt Bug 11304: fix display of detail page holdings tab in translated Bootstrap theme 2013-11-27 16:52:02 +00:00
.htaccess
.mailmap
about.pl
changelanguage.pl
edithelp.pl
fix-perl-path.PL
help.pl Bug 11238: contruct links to the appropriate manual version dynamically 2013-11-23 19:30:16 +00:00
INSTALL
install-CPAN.pl
INSTALL.debian
INSTALL.fedora7
INSTALL.opensuse
INSTALL.ubuntu
koha_perl_deps.pl
kohaversion.pl Bug 11268: DBRev 3.15.00.016 2014-01-31 15:55:24 +00:00
LICENSE
mainpage.pl
Makefile.PL Bug 10565: (follow-up) ensure that new patron_lists/ CGI directory is installed 2013-10-14 22:44:23 +00:00
MANIFEST.SKIP
README
README.robots
rewrite-config.PL

Koha is a free software integrated library system.

Koha is distributed under the GNU GPL version 3 or later.
Please read the file LICENSE for more details.

To install or upgrade Koha, please see the INSTALL file appropriate
to your platform.

Report bugs at http://bugs.koha-community.org/

Visit the Koha Project website at http://www.koha-community.org/