X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=reports%2Fserials_stats.pl;h=36f7cc5d5ddfde2e6567c204f9964a6f47622bea;hb=5a61a3bbfe94b3f3a2210dbd78884c8b53c5b533;hp=3143bd09c01c5bdd0969ccca617a84dad2ddcf29;hpb=9a43a47755c43a58c8cf6303cf7bfb678bb017d6;p=koha.git diff --git a/reports/serials_stats.pl b/reports/serials_stats.pl index 3143bd09c0..36f7cc5d5d 100755 --- a/reports/serials_stats.pl +++ b/reports/serials_stats.pl @@ -13,9 +13,9 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -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'); @@ -97,14 +96,24 @@ if($do_it){ while(my $row = $sth->fetchrow_hashref){ $row->{'enddate'} = format_date(GetExpirationDate($row->{'subscriptionid'})); $row->{'startdate'} = format_date($row->{'startdate'}); - push @datas, $row if ($expired || (not $expired && not HasSubscriptionExpired($row->{subscriptionid})) ); + $row->{expired} = HasSubscriptionExpired($row->{subscriptionid}); + push @datas, $row if ( + $expired + or ( + not $expired + and ( + not $row->{expired} + and not $row->{closed} + ) + ) + ); } - + if($output eq 'screen'){ $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 +135,7 @@ if($do_it){ print $item->{startdate}.$sep; print $item->{enddate}."\n"; } - exit(1); + exit; } }else{ ## We generate booksellers list @@ -141,25 +150,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 +162,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;