Bug 10110: Problems with diacritics in saved SQL reports
Adds decoding for cgi params (for completeness). Apparently, the NAME attribute of DBI statement handle has a UTF8 bug. Fixing this by decoding the returned column names. Did this in a shared routine. http://bugs.koha-community.org/show_bug.cgi?id=10110 Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Copying test plan from bug report: Example SQL: select branchname as "Bibliothek (üöä)", branchname "Bibiothek (üäa)", branchname from branches where branchcode = <<Bibliothekskürzel|branches>> 1) Create report with given example SQL or your own including some diacritics in the columnnames 2) Save the report and run it 3) Verify column names are broken before patch, but fixed after.. All tests and QA script pass. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
parent
3d589018e7
commit
d050e557f4
|
|
@ -18,7 +18,7 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
||||
use CGI;
|
||||
use CGI qw/-utf8/;
|
||||
use Text::CSV;
|
||||
use URI::Escape;
|
||||
use C4::Reports::Guided;
|
||||
|
|
@ -725,9 +725,8 @@ elsif ($phase eq 'Run this report'){
|
|||
unless ($sth) {
|
||||
die "execute_query failed to return sth for report $report_id: $sql";
|
||||
} else {
|
||||
my $headref = $sth->{NAME} || [];
|
||||
my @headers = map { +{ cell => $_ } } @$headref;
|
||||
$template->param(header_row => \@headers);
|
||||
my $headers= header_cell_loop($sth);
|
||||
$template->param(header_row => $headers);
|
||||
while (my $row = $sth->fetchrow_arrayref()) {
|
||||
my @cells = map { +{ cell => $_ } } @$row;
|
||||
push @rows, { cells => \@cells };
|
||||
|
|
@ -844,7 +843,13 @@ elsif ($phase eq 'Save Compound'){
|
|||
# pass $sth, get back an array of names for the column headers
|
||||
sub header_cell_values {
|
||||
my $sth = shift or return ();
|
||||
return @{$sth->{NAME}};
|
||||
my @cols;
|
||||
foreach my $c (@{$sth->{NAME}}) {
|
||||
#FIXME apparently DBI still needs a utf8 fix for this?
|
||||
utf8::decode($c);
|
||||
push @cols, $c;
|
||||
}
|
||||
return @cols;
|
||||
}
|
||||
|
||||
# pass $sth, get back a TMPL_LOOP-able set of names for the column headers
|
||||
|
|
|
|||
Loading…
Reference in New Issue