Bug 32413 - JSON reports shows inaccurate results with repeated parameters
Summary: JSON reports shows inaccurate results with repeated parameters
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-06 23:27 UTC by Christopher Brannon
Modified: 2024-03-07 15:44 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2022-12-06 23:27:43 UTC
If I create a report that uses a repeating parameter, for example <<library>>, more than once in a report, and then run a JSON call on that report, I get inaccurate results (Like every other result).

Currently, the only workaround is to make each parameter unique, and then repeat the parameter over as many times as it is needed in the report.  For example,

https://mydomain.com/cgi-bin/koha/svc/report?id=938&sql_params=blah would only return half the results if the report because I use the same parameters 7 times int he sql.  However, if I rename each parameter something different, like <<library1>>, <<library2>>,etc, and call https://mydomain.com/cgi-bin/koha/svc/report?id=938&sql_params=blah&sql_params=blah&sql_params=blah&sql_params=blah&sql_params=blah&sql_params=blah&sql_params=blah, it works.

The JSON call needs to be updated to accept repeated parameters.
Comment 1 Katrin Fischer 2022-12-07 00:11:23 UTC
Repeated params don't work for JSON, you need to actually repeat them in the URL right now. You don't need to name them differently, they can still be 'collapsed' for the SQL report when run in Koha.
Comment 2 Fridolin Somers 2024-03-07 15:16:05 UTC
Same issue with command-line runreport.pl, it dies because of repeating parameter
Comment 3 Fridolin Somers 2024-03-07 15:44:27 UTC
(In reply to Fridolin Somers from comment #2)
> Same issue with command-line runreport.pl, it dies because of repeating
> parameter

Ahhh forget that.
Runreport simply replaces <<>> with ? so it works.
But param is not repeated, you need as meany as there are <<>>