4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
33 $debug = $ENV{DEBUG} || 0;
38 plugin that shows a stats on borrowers
43 $debug or $debug = $input->param('debug') || 0;
44 my $do_it = $input->param('do_it');
45 my $module = $input->param("module");
46 my $user = $input->param("user");
47 my $action = $input->param("action");
48 my $object = $input->param("object");
49 my $info = $input->param("info");
50 my $datefrom = $input->param("from");
51 my $dateto = $input->param("to");
52 my $basename = $input->param("basename");
53 my $mime = $input->param("MIME");
54 my $del = $input->param("sep");
55 my $output = $input->param("output") || "screen";
57 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
59 template_name => "tools/viewlog.tmpl",
63 flagsrequired => { tools => 1 },
69 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
70 dateformat => C4::Dates->new()->format(),
76 my $results = GetLogs($datefrom,$dateto,$user,$module,$action,$object,$info);
77 my $total = scalar @$results;
79 if ( $output eq "screen" ) {
80 # Printing results to screen
86 datefrom => $datefrom,
94 output_html_with_http_headers $input, $cookie, $template->output;
96 # Printing to a csv file
98 -type => 'application/vnd.sun.xml.calc',
99 -attachment => "$basename.csv",
100 -filename => "$basename.csv"
102 my $sep = C4::Context->preference("delimiter");
103 foreach my $line (@$results) {
104 ($module eq "catalogue") or next;
105 foreach (qw(timestamp firstname surname action info title author)) {
106 print $line->{$_} . $sep;
115 my @mime = ( C4::Context->preference("MIME") );
116 my $CGIextChoice = CGI::scrolling_list(
123 my @dels = ( C4::Context->preference("delimiter") );
124 my $CGIsepChoice = CGI::scrolling_list(
133 CGIextChoice => $CGIextChoice,
134 CGIsepChoice => $CGIsepChoice,
136 output_html_with_http_headers $input, $cookie, $template->output;