From ae4b02cdc4786bfd87f924f639b416f37c47c631 Mon Sep 17 00:00:00 2001 From: Nahuel Angelinetti Date: Wed, 15 Oct 2008 10:03:41 +0200 Subject: [PATCH] Fix the guided report export, bad check of errors(bug #2672) Signed-off-by: Henri-Damien LAURENT --- reports/guided_reports.pl | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index eb50d65825..390243e89b 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -19,10 +19,10 @@ use strict; use CGI; -use C4::Reports::Guided; +use C4::Reports; use C4::Auth; use C4::Output; -use C4::Dates; +use C4::Dates qw( DHTMLcalendar ); use C4::Debug; =head1 NAME @@ -45,7 +45,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { reports => 1 }, + flagsrequired => { editcatalogue => 1 }, debug => 1, } ); @@ -65,7 +65,7 @@ elsif ( $phase eq 'Build new' ) { $template->param( 'build1' => 1 ); # get report areas - my $areas = get_report_areas(); + my $areas = C4::Reports::get_report_areas(); $template->param( 'areas' => $areas ); } @@ -123,7 +123,7 @@ elsif ( $phase eq 'Report on this Area' ) { ); # get report types - my $types = get_report_types(); + my $types = C4::Reports::get_report_types(); $template->param( 'types' => $types ); } @@ -397,13 +397,11 @@ 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 == -1) { + if (!@$errors) { $no_html=1; print $input->header( -type => 'application/octet-stream', -attachment=>'reportresults.csv' @@ -432,7 +430,7 @@ elsif ($phase eq 'Create report from SQL') { ); } $template->param('create' => 1); - my $types = get_report_types(); + my $types = C4::Reports::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.39.5