Bugzilla – Attachment 30074 Details for
Bug 12622
Exporting report as Open Document Spreadsheet results in Perl error when report has no results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12622: Fix export report as ods
PASSED-QA-Bug-12622-Fix-export-report-as-ods.patch (text/plain), 2.45 KB, created by
Katrin Fischer
on 2014-07-25 06:37:04 UTC
(
hide
)
Description:
[PASSED QA] Bug 12622: Fix export report as ods
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-07-25 06:37:04 UTC
Size:
2.45 KB
patch
obsolete
>From ff0aa7904ae1fb116b85b8f732aac1b85fcf7a48 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 22 Jul 2014 12:15:35 +0200 >Subject: [PATCH] [PASSED QA] Bug 12622: Fix export report as ods > >Bug 11679 introduces an ods export for reports. > >It looks quite buggy: >1/ You get a Perl error if the report has no results >2/ The ods file contains 1 lines less than the total results. > >Test plan: >After applying this patch, try to export a report which has no results >and verify you get an ods file with headers only. >Try to export a report which has a least 1 result and verify the >generated ods has the right number of lines. > >Signed-off-by: Robert Higgins <robert.higgins@catalyst.net.nz> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Fixes the reported problem, passes all tests and QA script. >Added the sign-off line for Robert. >--- > reports/guided_reports.pl | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index b6cb822..ad72b44 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -814,8 +814,10 @@ elsif ($phase eq 'Export'){ > my $table = $doc->getTable(0); > my @headers = header_cell_values( $sth ); > my $rows = $sth->fetchall_arrayref(); >- my ( $nb_rows, $nb_cols ) = ( scalar(@$rows), scalar(@{$rows->[0]}) ); >- $doc->expandTable( $table, $nb_rows, $nb_cols ); >+ my ( $nb_rows, $nb_cols ) = ( 0, 0 ); >+ $nb_rows = @$rows; >+ $nb_cols = @headers; >+ $doc->expandTable( $table, $nb_rows + 1, $nb_cols ); > > my $row = $doc->getRow( $table, 0 ); > my $j = 0; >@@ -823,13 +825,14 @@ elsif ($phase eq 'Export'){ > $doc->cellValue( $row, $j, $header ); > $j++; > } >- for ( my $i = 1; $i < $nb_rows +1 ; $i++ ) { >+ my $i = 1; >+ for ( @$rows ) { > $row = $doc->getRow( $table, $i ); > for ( my $j = 0 ; $j < $nb_cols ; $j++ ) { >- # FIXME Bug 11944 > my $value = Encode::encode( 'UTF8', $rows->[$i - 1][$j] ); > $doc->cellValue( $row, $j, $value ); > } >+ $i++; > } > $doc->save(); > binmode(STDOUT); >-- >1.9.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 12622
:
29952
|
30067
| 30074