5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
27 use C4::Interface::CGI::Output;
33 plugin that shows a stats on catalogers
43 my $do_it=$input->param('do_it');
44 my $fullreportname = "parameters/viewlog.tmpl";
45 my $modulename = $input->param("module");
46 my $userfilter = $input->param("user");
47 my $actionfilter = $input->param("action");
48 my $fromfilter = $input->param("from");
49 my $tofilter = $input->param("to");
50 my $basename = $input->param("basename");
51 my $mime = $input->param("MIME");
52 my $del = $input->param("sep");
53 my $output = $input->param("output");
56 my ($template, $borrowernumber, $cookie)
57 = get_template_and_user({template_name => $fullreportname,
61 flagsrequired => {editcatalogue => 1},
64 $template->param(do_it => $do_it);
69 push @filters, {name=> 'user', value=> $userfilter} if ($userfilter);
70 push @filters, {name=> 'action', value=> $actionfilter} if ($actionfilter);
71 push @filters, {name=> 'from', value=> $fromfilter} if ($fromfilter);
72 push @filters, {name=> 'to', value=> $tofilter} if ($tofilter);
73 if ($modulename eq "catalogue"){
74 my $titlefilter = $input->param("title");
75 my $authorfilter = $input->param("author");
76 my $publisherfilter = $input->param("publisher");
77 my $callnumberfilter = $input->param("itemcallnumber");
79 push @filters, {name=> 'title', value=> $titlefilter} if ($titlefilter);
80 push @filters, {name=> 'author', value=> $authorfilter} if ($authorfilter);
81 push @filters, {name=> 'publisher', value=> $publisherfilter} if ($publisherfilter);
82 push @filters, {name=> 'callnumber', value=> $callnumberfilter} if ($callnumberfilter);
85 my ($count, $results) = displaylog( $modulename, @filters);
86 if ($output eq "screen"){
87 # Printing results to screen
88 $template->param(modulename =>$modulename, $modulename => 1, looprow => $results,counter=>$count);
89 output_html_with_http_headers $input, $cookie, $template->output;
92 # Printing to a csv file
93 print $input->header(-type => 'application/vnd.sun.xml.calc',
94 -attachment=>"$basename.csv",
95 -filename=>"$basename.csv" );
97 $sep =C4::Context->preference("delimiter");
101 foreach my $line ( @$results ) {
102 if ($modulename eq "catalogue"){
103 print $line->{timestamp}.$sep;
104 print $line->{firstname}.$sep;
105 print $line->{surname}.$sep;
106 print $line->{action}.$sep;
107 print $line->{info}.$sep;
108 print $line->{title}.$sep;
109 print $line->{author}.$sep;
117 my $dbh = C4::Context->dbh;
123 my @mime = ( C4::Context->preference("MIME") );
124 # foreach my $mime (@mime){
128 my $CGIextChoice=CGI::scrolling_list(
135 my @dels = ( C4::Context->preference("delimiter") );
136 my $CGIsepChoice=CGI::scrolling_list(
144 CGIextChoice => $CGIextChoice,
145 CGIsepChoice => $CGIsepChoice
147 output_html_with_http_headers $input, $cookie, $template->output;