@@ -, +, @@ --- reports/catalogue_out.pl | 55 +++++----------------------------------------- 1 file changed, 5 insertions(+), 50 deletions(-) --- a/reports/catalogue_out.pl +++ a/reports/catalogue_out.pl @@ -24,11 +24,9 @@ use CGI; use C4::Auth; use C4::Context; use C4::Debug; -use C4::Branch; # GetBranches +use C4::Branch; # GetBranchesLoop use C4::Output; use C4::Koha; # GetItemTypes -use C4::Reports; # GetDelimiterChoices -use C4::Circulation; # use Date::Manip; # TODO: add not borrowed since date X criteria use Data::Dumper; @@ -43,8 +41,7 @@ my $do_it = $input->param('do_it'); my $limit = $input->param("Limit"); my $column = $input->param("Criteria"); my @filters = $input->param("Filter"); -my $output = $input->param("output"); -my $basename = $input->param("basename") || 'catalogue_out'; + my ($template, $borrowernumber, $cookie) = get_template_and_user({ template_name => "reports/catalogue_out.tmpl", query => $input, @@ -54,57 +51,17 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({ debug => 1, }); -our $sep = $input->param("sep"); -$sep = "\t" if ((! defined $sep) or $sep eq 'tabulation'); - $template->param(do_it => $do_it); if ($do_it) { my $results = calculate($limit, $column, \@filters); - if ($output eq "screen") { - # Printing results to screen - $template->param(mainloop => $results); - output_html_with_http_headers $input, $cookie, $template->output; - } else { - # Printing to a csv file FIXME: This is broken rather badly, if it ever worked at all here. - print $input->header( - -type => 'application/vnd.sun.xml.calc', - -encoding => 'utf-8', - -attachment=>"$basename.csv", - -filename =>"$basename.csv" ); - my $cols = @$results[0]->{loopcol}; - my $lines = @$results[0]->{looprow}; -# header - print "num /". @$results[0]->{column} .$sep; -# Other header - foreach my $col ( @$cols ) { - print $col->{coltitle}.$sep; - } - print "Total\n"; -# Table - foreach my $line ( @$lines ) { - my $x = $line->{loopcell}; # FIXME: No Such thing. - print $line->{rowtitle}.$sep; - foreach my $cell (@$x) { - print $cell->{value}.$sep; - } - print $line->{totalrow}, "\n"; - } -# footer - print "TOTAL"; - foreach my $col ( @$cols ) { - print $sep.$col->{totalcol}; - } - print $sep.@$results[0]->{total}; - } + $template->param(mainloop => $results); + output_html_with_http_headers $input, $cookie, $template->output; exit; # in either case, exit after do_it } # Displaying choices (i.e., not do_it) -my @values; -my %select; -my @mime = ( map { +{type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation -my $itemtypes = GetItemTypes; +my $itemtypes = GetItemTypes(); my @itemtypeloop; foreach (sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys %$itemtypes) { push @itemtypeloop, { @@ -114,8 +71,6 @@ foreach (sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{descriptio } $template->param( - CGIextChoice => \@mime, - CGIsepChoice => GetDelimiterChoices, itemtypeloop => \@itemtypeloop, branchloop => GetBranchesLoop($input->param("branch") || C4::Context->userenv->{branch}), ); --