From 1f7740d951d160d8233498e49e7dffd430f697be Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Tue, 13 Aug 2013 14:55:32 +0200 Subject: [PATCH 1/5] Bug 10718 - items with no checkouts report does not work Bug 8124 has commented the option to download results items with no checkouts report into a file. But the perl code of this page uses the export into a file has default behavior since the input "output" is no more present. The consequence is that there are never results in page. This patch removes the code concerning file output from template and perl. Such a feature exists in guided reports. Test plan : Play with cgi-bin/koha/reports/catalogue_out.pl form and see if you get results --- reports/catalogue_out.pl | 55 +++++----------------------------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/reports/catalogue_out.pl b/reports/catalogue_out.pl index 8a22a18..fb41c26 100755 --- a/reports/catalogue_out.pl +++ b/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}), ); -- 1.7.10.4