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
33 plugin that shows a stats on borrowers
38 my $do_it = $input->param('do_it');
39 my $module = $input->param("module");
40 my $user = $input->param("user");
41 my $action = $input->param("action");
42 my $object = $input->param("object");
43 my $info = $input->param("info");
44 my $datefrom = $input->param("from");
45 my $dateto = $input->param("to");
46 my $basename = $input->param("basename");
47 my $mime = $input->param("MIME");
48 my $del = $input->param("sep");
49 my $output = $input->param("output") || "screen";
51 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
53 template_name => "tools/viewlog.tmpl",
57 flagsrequired => { tools => 1 },
64 my $results = GetLogs($datefrom,$dateto,$user,$module,$action,$object,$info);
65 my $total = scalar @$results;
67 if ( $output eq "screen" ) {
69 # Printing results to screen
75 datefrom => $datefrom,
83 output_html_with_http_headers $input, $cookie, $template->output;
88 # Printing to a csv file
90 -type => 'application/vnd.sun.xml.calc',
91 -attachment => "$basename.csv",
92 -filename => "$basename.csv"
95 $sep = C4::Context->preference("delimiter");
97 foreach my $line (@$results) {
98 if ( $module eq "catalogue" ) {
99 print $line->{timestamp} . $sep;
100 print $line->{firstname} . $sep;
101 print $line->{surname} . $sep;
102 print $line->{action} . $sep;
103 print $line->{info} . $sep;
104 print $line->{title} . $sep;
105 print $line->{author} . $sep;
113 my $dbh = C4::Context->dbh;
119 my @mime = ( C4::Context->preference("MIME") );
121 my $CGIextChoice = CGI::scrolling_list(
129 my @dels = ( C4::Context->preference("delimiter") );
130 my $CGIsepChoice = CGI::scrolling_list(
140 CGIextChoice => $CGIextChoice,
141 CGIsepChoice => $CGIsepChoice
143 output_html_with_http_headers $input, $cookie, $template->output;