[Koha-patches] [PATCH] (MT #2565) fix aqplan csv export, and turn off debug

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed May 26 16:04:26 CEST 2010


This fix the csv export that doesn't export correctly the budget name, it's empty column.
And it turn off some SQL debug that slow down the result of the page and the csv export.
---
 C4/Budgets.pm   |    1 -
 admin/aqplan.pl |   10 ++++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/C4/Budgets.pm b/C4/Budgets.pm
index d2a5b76..21988b6 100644
--- a/C4/Budgets.pm
+++ b/C4/Budgets.pm
@@ -227,7 +227,6 @@ sub GetBudgetsPlanCell {
                 ((aqbudgets.sort1_authcat = ? AND sort1 =?) OR
                 (aqbudgets.sort2_authcat = ? AND sort2 =?))    |
         );
-        $sth->{TraceLevel} = 2;
         $sth->execute(  $cell->{'budget_id'},
                         $budget->{'sort1_authcat'},
                         $cell->{'authvalue'},
diff --git a/admin/aqplan.pl b/admin/aqplan.pl
index 82eef90..57d3f47 100755
--- a/admin/aqplan.pl
+++ b/admin/aqplan.pl
@@ -49,7 +49,7 @@ my ( $template, $borrowernumber, $cookie, $staff_flags ) = get_template_and_user
         type            => "intranet",
         authnotrequired => 0,
         flagsrequired   => { acquisition => 'planning_manage' },
-        debug           => 1,
+        debug           => 0,
     }
 );
 
@@ -453,7 +453,9 @@ output_html_with_http_headers $input, $cookie, $template->output;
 
 sub _print_to_csv {
     my ( $header, $results ) = @_;
-
+    
+    binmode STDOUT, ":utf8";
+    
     my $csv = Text::CSV_XS->new(
         {   sep_char     => $del,
             always_quote => 'TRUE',
@@ -474,9 +476,9 @@ sub _print_to_csv {
     $csv->combine(@col);
     my $str = $csv->string;
     print "$str\n";
-
     foreach my $row (@$results) {
-        my @col = ( $row->{'budget_name'}, $row->{'budget_amount'} );
+        $row->{'budget_name_indent'} =~ s/ / /g;
+        my @col = ( $row->{'budget_name_indent'}, $row->{'budget_amount'} );
         my $l = $row->{'lines'};
         foreach my $line (@$l) {
             push @col, $line->{'estimated_amount'};
-- 
1.7.0.4



More information about the Koha-patches mailing list