View | Details | Raw Unified | Return to bug 5920
Collapse All | Expand All

(-)a/cpanfile (-1 lines)
Lines 52-58 requires 'Getopt::Std', '1.05'; Link Here
52
requires 'HTML::Entities', '3.69';
52
requires 'HTML::Entities', '3.69';
53
requires 'HTML::FormatText', '1.23';
53
requires 'HTML::FormatText', '1.23';
54
requires 'HTML::Scrubber', '0.08';
54
requires 'HTML::Scrubber', '0.08';
55
requires 'HTML::Restrict', '';
56
requires 'HTTP::Cookies', '1.39';
55
requires 'HTTP::Cookies', '1.39';
57
requires 'HTTP::OAI', '3.2';
56
requires 'HTTP::OAI', '3.2';
58
requires 'HTTP::Request::Common', '1.26';
57
requires 'HTTP::Request::Common', '1.26';
(-)a/reports/guided_reports.pl (-17 / +16 lines)
Lines 40-46 use Koha::Util::OpenDocument qw( generate_ods ); Link Here
40
use Koha::Notice::Templates;
40
use Koha::Notice::Templates;
41
use Koha::TemplateUtils qw( process_tt );
41
use Koha::TemplateUtils qw( process_tt );
42
use C4::ClassSource qw( GetClassSources );
42
use C4::ClassSource qw( GetClassSources );
43
use HTML::Restrict;
43
use C4::Scrubber;
44
44
45
=head1 NAME
45
=head1 NAME
46
46
Lines 620-627 elsif ($op eq 'export'){ Link Here
620
    my @sql_params     = $input->multi_param('sql_params');
620
    my @sql_params     = $input->multi_param('sql_params');
621
    my $format         = $input->param('format');
621
    my $format         = $input->param('format');
622
    my $reportname     = $input->param('reportname');
622
    my $reportname     = $input->param('reportname');
623
    my $reportfilename = $reportname ? "$reportname-reportresults.$format" : "reportresults.$format" ;
623
    my $reportfilename = $reportname ? "$reportname-reportresults.$format" : "reportresults.$format";
624
    my $hr             = HTML::Restrict->new();
624
    my $scrubber       = C4::Scrubber->new();
625
625
626
    ($sql, undef) = $report->prep_report( \@param_names, \@sql_params );
626
    ($sql, undef) = $report->prep_report( \@param_names, \@sql_params );
627
    my ( $sth, $q_errors ) = execute_query( { sql => $sql, report_id => $report_id } );
627
    my ( $sth, $q_errors ) = execute_query( { sql => $sql, report_id => $report_id } );
Lines 630-638 elsif ($op eq 'export'){ Link Here
630
        if ($format eq 'tab') {
630
        if ($format eq 'tab') {
631
            $type = 'application/octet-stream';
631
            $type = 'application/octet-stream';
632
            $content .= join("\t", header_cell_values($sth)) . "\n";
632
            $content .= join("\t", header_cell_values($sth)) . "\n";
633
            $content = $hr->process(Encode::decode('UTF-8', $content));
633
            $content = $scrubber->scrub( Encode::decode( 'UTF-8', $content ) );
634
            while (my $row = $sth->fetchrow_arrayref()) {
634
            while ( my $row = $sth->fetchrow_arrayref() ) {
635
                $content .= join("\t", $hr->process(@$row)) . "\n";
635
                $content .= join( "\t", $scrubber->scrub(@$row) ) . "\n";
636
            }
636
            }
637
        } else {
637
        } else {
638
            if ( $format eq 'csv' ) {
638
            if ( $format eq 'csv' ) {
Lines 640-657 elsif ($op eq 'export'){ Link Here
640
                $type = 'application/csv';
640
                $type = 'application/csv';
641
                my $csv = Text::CSV::Encoded->new({ encoding_out => 'UTF-8', sep_char => $delimiter});
641
                my $csv = Text::CSV::Encoded->new({ encoding_out => 'UTF-8', sep_char => $delimiter});
642
                $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag();
642
                $csv or die "Text::CSV::Encoded->new({binary => 1}) FAILED: " . Text::CSV::Encoded->error_diag();
643
                if ($csv->combine(header_cell_values($sth))) {
643
                if ( $csv->combine( header_cell_values($sth) ) ) {
644
                    $content .= $hr->process(Encode::decode('UTF-8', $csv->string())) . "\n";
644
                    $content .= $scrubber->scrub( Encode::decode( 'UTF-8', $csv->string() ) ) . "\n";
645
645
646
                } else {
646
                } else {
647
                    push @$q_errors, { combine => 'HEADER ROW: ' . $csv->error_diag() } ;
647
                    push @$q_errors, { combine => 'HEADER ROW: ' . $csv->error_diag() };
648
                }
648
                }
649
                while (my $row = $sth->fetchrow_arrayref()) {
649
                while ( my $row = $sth->fetchrow_arrayref() ) {
650
                    if ($csv->combine(@$row)) {
650
                    if ( $csv->combine(@$row) ) {
651
                        $content .= $hr->process($csv->string()) . "\n";
651
                        $content .= $scrubber->scrub( $csv->string() ) . "\n";
652
652
653
                    } else {
653
                    } else {
654
                        push @$q_errors, { combine => $csv->error_diag() } ;
654
                        push @$q_errors, { combine => $csv->error_diag() };
655
                    }
655
                    }
656
                }
656
                }
657
            }
657
            }
Lines 667-676 elsif ($op eq 'export'){ Link Here
667
667
668
                # Other line in Unicode
668
                # Other line in Unicode
669
                my $sql_rows = $sth->fetchall_arrayref();
669
                my $sql_rows = $sth->fetchall_arrayref();
670
                foreach my $sql_row ( @$sql_rows ) {
670
                foreach my $sql_row (@$sql_rows) {
671
                    my @content_row;
671
                    my @content_row;
672
                    foreach my $sql_cell ( @$sql_row ) {
672
                    foreach my $sql_cell (@$sql_row) {
673
                        push @content_row, $hr->process(Encode::encode( 'UTF8', $sql_cell ));
673
                        push @content_row, $scrubber->scrub( Encode::encode( 'UTF8', $sql_cell ) );
674
674
675
                    }
675
                    }
676
                    push @$ods_content, \@content_row;
676
                    push @$ods_content, \@content_row;
677
- 

Return to bug 5920