Merge remote-tracking branch 'origin/new/bug_7751'
[koha.git] / reports / serials_stats.pl
index 30dec07..9aff54b 100755 (executable)
@@ -48,7 +48,6 @@ my $expired    = $input->param("expired");
 my $order      = $input->param("order");
 my $output     = $input->param("output");
 my $basename   = $input->param("basename");
-my $mime       = $input->param("MIME");
 our $sep       = $input->param("sep") || '';
 $sep = "\t" if ($sep eq 'tabulation');
 
@@ -104,7 +103,7 @@ if($do_it){
         $template->param(datas => \@datas,
                          do_it => 1);
     }else{
-        binmode STDOUT, ':utf8';
+        binmode STDOUT, ':encoding(UTF-8)';
         print $input->header(-type => 'application/vnd.sun.xml.calc',
                          -encoding => 'utf-8',
                              -name => "$basename.csv",
@@ -126,7 +125,7 @@ if($do_it){
             print $item->{startdate}.$sep;
             print $item->{enddate}."\n";
         }
-        exit(1);
+        exit;
     }
 }else{
     ## We generate booksellers list
@@ -141,25 +140,11 @@ if($do_it){
     while(my $row = $sth->fetchrow_hashref){
         push(@booksellers,$row)
     }
-   
-    ## We generate branchlist
-    my $branches=GetBranches();
-       my @branchloop;
-       foreach (sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches) {
-               my $thisbranch = ''; # FIXME: populate $thisbranch to preselect one
-               my %row = (branchcode => $_,
-                       selected => ($thisbranch eq $_ ? 1 : 0),
-                       branchname => $branches->{$_}->{'branchname'},
-               );
-               push @branchloop, \%row;
-       } 
-    
-    my @mime = ( C4::Context->preference("MIME") );
-       # warn 'MIME(s): ' . join ' ', @mime;
+
        my $CGIextChoice=CGI::scrolling_list(
                                -name => 'MIME',
                                -id => 'MIME',
-                               -values   => \@mime,
+                               -values   => ['CSV'], # FIXME translation
                                -size     => 1,
                                -multiple => 0 );
        my $CGIsepChoice=GetDelimiterChoices;
@@ -167,7 +152,7 @@ if($do_it){
                CGIextChoice => $CGIextChoice,
                CGIsepChoice => $CGIsepChoice,
         booksellers  => \@booksellers,
-        branches     => \@branchloop);
+        branches     => GetBranchesLoop(C4::Context->userenv->{'branch'}));
 }
 
 output_html_with_http_headers $input, $cookie, $template->output;