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
28 use C4::Interface::CGI::Output;
34 plugin that shows a stats on borrowers
44 my $do_it=$input->param('do_it');
45 my $fullreportname = "admin/viewlog.tmpl";
46 my $modulename = $input->param("module");
47 my $userfilter = $input->param("user");
48 my $actionfilter = $input->param("action");
49 my $fromfilter = $input->param("from");
50 my $tofilter = $input->param("to");
51 my $basename = $input->param("basename");
52 my $mime = $input->param("MIME");
53 my $del = $input->param("sep");
54 my $output = $input->param("output");
56 #warn "module : ".$modulename;
57 my ($template, $borrowernumber, $cookie)
58 = get_template_and_user({template_name => $fullreportname,
62 flagsrequired => {editcatalogue => 1},
65 $template->param(do_it => $do_it);
70 push @filters, {name=> 'user', value=> $userfilter} if ($userfilter);
71 push @filters, {name=> 'action', value=> $actionfilter} if ($actionfilter);
72 push @filters, {name=> 'from', value=> $fromfilter} if ($fromfilter);
73 push @filters, {name=> 'to', value=> $tofilter} if ($tofilter);
74 if ($modulename eq "catalogue"){
75 my $titlefilter = $input->param("title");
76 my $authorfilter = $input->param("author");
77 my $publisherfilter = $input->param("publisher");
78 my $callnumberfilter = $input->param("itemcallnumber");
80 push @filters, {name=> 'title', value=> $titlefilter} if ($titlefilter);
81 push @filters, {name=> 'author', value=> $authorfilter} if ($authorfilter);
82 push @filters, {name=> 'publisher', value=> $publisherfilter} if ($publisherfilter);
83 push @filters, {name=> 'callnumber', value=> $callnumberfilter} if ($callnumberfilter);
86 my ($count, $results) = displaylog( $modulename, @filters);
87 if ($output eq "screen"){
88 # Printing results to screen
89 $template->param(modulename =>$modulename, $modulename => 1, looprow => $results);
90 output_html_with_http_headers $input, $cookie, $template->output;
93 # Printing to a csv file
94 print $input->header(-type => 'application/vnd.sun.xml.calc',
95 -attachment=>"$basename.csv",
96 -filename=>"$basename.csv" );
98 $sep =C4::Context->preference("delimiter");
102 foreach my $line ( @$results ) {
103 if ($modulename eq "catalogue"){
104 print $line->{timestamp}.$sep;
105 print $line->{firstname}.$sep;
106 print $line->{surname}.$sep;
107 print $line->{action}.$sep;
108 print $line->{info}.$sep;
109 print $line->{title}.$sep;
110 print $line->{author}.$sep;
118 my $dbh = C4::Context->dbh;
124 my @mime = ( C4::Context->preference("MIME") );
125 # foreach my $mime (@mime){
129 my $CGIextChoice=CGI::scrolling_list(
136 my @dels = ( C4::Context->preference("delimiter") );
137 my $CGIsepChoice=CGI::scrolling_list(
145 CGIextChoice => $CGIextChoice,
146 CGIsepChoice => $CGIsepChoice
148 output_html_with_http_headers $input, $cookie, $template->output;