Bug 12114: Fix encoding problem with reports JSON web service (staff)
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Sun, 20 Apr 2014 22:07:31 +0000 (00:07 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 25 Apr 2014 15:31:55 +0000 (15:31 +0000)
Repeat tests from first patch, but this time, access the report
with your staff client base URL.

<Staff BaseURL>/cgi-bin/koha/svc/report?id=<reportid>

Based on paste from Galen Charlton.

Followed test plan. Result as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
svc/report

index 0cff7dc..839a91b 100755 (executable)
@@ -22,7 +22,7 @@ use Modern::Perl;
 
 use C4::Auth;
 use C4::Reports::Guided;
-use JSON;
+use JSON::XS;
 use CGI;
 
 use Koha::Cache;
@@ -66,14 +66,14 @@ unless ($json_text) {
         else {
             $lines = $sth->fetchall_arrayref;
         }
-        $json_text = to_json($lines);
+        $json_text = encode_json($lines);
 
         if ($cache_active) {
             $cache->set_in_cache( $cache_key, $json_text, $report_rec->{cache_expiry} );
         }
     }
     else {
-        $json_text = to_json($errors);
+        $json_text = encode_json($errors);
     }
 }