From 74cc235347896c35955d40d11f83eea0ea9f0436 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 6 Mar 2009 17:05:25 +0100 Subject: [PATCH] Revert "Fix the guided report export, bad check of errors(bug #2672)" This reverts commit ae4b02cdc4786bfd87f924f639b416f37c47c631. --- reports/guided_reports.pl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 390243e89b..eb50d65825 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -19,10 +19,10 @@ use strict; use CGI; -use C4::Reports; +use C4::Reports::Guided; use C4::Auth; use C4::Output; -use C4::Dates qw( DHTMLcalendar ); +use C4::Dates; use C4::Debug; =head1 NAME @@ -45,7 +45,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { editcatalogue => 1 }, + flagsrequired => { reports => 1 }, debug => 1, } ); @@ -65,7 +65,7 @@ elsif ( $phase eq 'Build new' ) { $template->param( 'build1' => 1 ); # get report areas - my $areas = C4::Reports::get_report_areas(); + my $areas = get_report_areas(); $template->param( 'areas' => $areas ); } @@ -123,7 +123,7 @@ elsif ( $phase eq 'Report on this Area' ) { ); # get report types - my $types = C4::Reports::get_report_types(); + my $types = get_report_types(); $template->param( 'types' => $types ); } @@ -397,11 +397,13 @@ elsif ($phase eq 'Run this report'){ } elsif ($phase eq 'Export'){ + binmode STDOUT, ':utf8'; + # export results to tab separated text my $sql = $input->param('sql'); my $format = $input->param('format'); my ($results, $total, $errors) = execute_query($sql,1,0,0,$format); - if (!@$errors) { + if ($#$errors == -1) { $no_html=1; print $input->header( -type => 'application/octet-stream', -attachment=>'reportresults.csv' @@ -430,7 +432,7 @@ elsif ($phase eq 'Create report from SQL') { ); } $template->param('create' => 1); - my $types = C4::Reports::get_report_types(); + my $types = get_report_types(); if (my $type = $input->param('type')) { for my $i ( 0 .. $#{@$types}) { @$types[$i]->{'selected'} = 1 if @$types[$i]->{'id'} eq $type; -- 2.20.1