Bugzilla – Attachment 172555 Details for
Bug 32413
JSON reports shows inaccurate results with repeated parameters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32413: Fix repeated param names for JSON report
0001-Bug-32413-Fix-repeated-param-names-for-JSON-report.patch (text/plain), 1.36 KB, created by
Johanna Räisä
on 2024-10-09 05:37:29 UTC
(
hide
)
Description:
Bug 32413: Fix repeated param names for JSON report
Filename:
MIME Type:
Creator:
Johanna Räisä
Created:
2024-10-09 05:37:29 UTC
Size:
1.36 KB
patch
obsolete
>From 6b53b5c03a54978351eb61ac41b8f3f3e8571fe5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Johanna=20R=C3=A4is=C3=A4?= <johanna.raisa@gmail.com> >Date: Tue, 8 Oct 2024 13:46:24 +0300 >Subject: [PATCH] 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 >--- > Koha/Report.pm | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/Koha/Report.pm b/Koha/Report.pm >index 55daece836..23a913b61d 100644 >--- a/Koha/Report.pm >+++ b/Koha/Report.pm >@@ -152,6 +152,12 @@ sub prep_report { > } > > my %lookup; >+ unless ( scalar @$param_names ) { >+ my @placeholders = $sql =~ /<<([^<>]+)>>/g; >+ foreach my $placeholder (@placeholders) { >+ push @$param_names, $placeholder unless grep { $_ eq $placeholder } @$param_names; >+ } >+ } > @lookup{@$param_names} = @$sql_params; > @split = split /<<|>>/, $sql; > for ( my $i = 0 ; $i < $#split / 2 ; $i++ ) { >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32413
:
172555
|
172565
|
173437