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.
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.
Same issue with command-line runreport.pl, it dies because of repeating parameter
(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 <<>>
Created attachment 172555 [details] [review] Bug 32413: Fix repeated param names for JSON report This patch fixes repeated param names for JSON report. To test: 1) Create a report SELECT count(*) from items where homebranch = <<Branchcode>> UNION ALL SELECT count(*) from deleteditems where homebranch = <<Branchcode>> 2) Run the report as JSON, cgi-bin/koha/svc/report?id=<id>&sql_params=<Branchcode> 3) Check that the second value is 0 4) Apply the patch 5) Run the report as JSON again 6) Check that the second value has the correct value Sponsored-by: Koha-Suomi Oy
Created attachment 172565 [details] [review] Bug 32413: Fix repeated param names for JSON report This patch fixes repeated param names for JSON report. To test: 1) Create a report SELECT count(*) from items where homebranch = <<Branchcode>> UNION ALL SELECT count(*) from deleteditems where homebranch = <<Branchcode>> 2) Run the report as JSON, cgi-bin/koha/svc/report?id=<id>&sql_params=<Branchcode> 3) Check that the second value is 0 4) Apply the patch 5) Run the report as JSON again 6) Check that the second value has the correct value 7) prove t/db_dependent/Koha/Reports.t Sponsored-by: Koha-Suomi Oy
Created attachment 173437 [details] [review] Bug 32413: Fix repeated param names for JSON report This patch fixes repeated param names for JSON report. To test: 1) Create a report SELECT count(*) from items where homebranch = <<Branchcode>> UNION ALL SELECT count(*) from deleteditems where homebranch = <<Branchcode>> 2) Run the report as JSON, cgi-bin/koha/svc/report?id=<id>&sql_params=<Branchcode> 3) Check that the second value is 0 4) Apply the patch 5) Run the report as JSON again 6) Check that the second value has the correct value 7) prove t/db_dependent/Koha/Reports.t Sponsored-by: Koha-Suomi Oy Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nice clear fix... going straight for QA here.
While this is a nice fix, it an break people scripts. Please add nice clear release notes to make this change more visible. It's also why I think we might want to hold back on backporting this. I know I have scripts I will need to adapt that use repeated params that are now sent multiple times to get around this.
Pushed for 24.11! Well done everyone, thank you!