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
34 $debug = $ENV{DEBUG} || 0;
39 plugin that shows a stats on borrowers
44 $debug or $debug = $input->param('debug') || 0;
45 my $do_it = $input->param('do_it');
46 my $module = $input->param("module");
47 my $user = $input->param("user");
48 my $action = $input->param("action");
49 my $object = $input->param("object");
50 my $info = $input->param("info");
51 my $datefrom = $input->param("from");
52 my $dateto = $input->param("to");
53 my $basename = $input->param("basename");
54 my $mime = $input->param("MIME");
55 my $del = $input->param("sep");
56 my $output = $input->param("output") || "screen";
57 my $src = $input->param("src"); # this param allows us to be told where we were called from -fbcit
59 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
61 template_name => "tools/viewlog.tmpl",
65 flagsrequired => { tools => 1 },
70 warn "Source of call was $src";
72 if ($src eq 'circ') { # if we were called from circulation, use the circulation menu and get data to populate it -fbcit
74 my $borrowernumber = $object;
75 my $data = GetMember($borrowernumber,'borrowernumber');
76 my $picture = GetPatronImage($data->{'cardnumber'});
77 $template->param( menu => 1,
78 title => $data->{'title'},
79 initials => $data->{'initials'},
80 surname => $data->{'surname'},
81 borrowernumber => $borrowernumber,
82 firstname => $data->{'firstname'},
83 cardnumber => $data->{'cardnumber'},
84 categorycode => $data->{'categorycode'},
85 address => $data->{'address'},
86 address2 => $data->{'address2'},
87 city => $data->{'city'},
88 phone => $data->{'phone'},
89 phonepro => $data->{'phonepro'},
90 email => $data->{'email'},
91 branchcode => $data->{'branchcode'},
97 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
98 dateformat => C4::Dates->new()->format(),
104 my $results = GetLogs($datefrom,$dateto,$user,$module,$action,$object,$info);
105 my $total = scalar @$results;
106 foreach my $result (@$results){
107 if ($result->{'info'} eq 'item'){
108 # get item information so we can create a working link
109 my $item=GetItem($result->{'object'});
110 $result->{'biblionumber'}=$item->{'biblionumber'};
111 $result->{'biblioitemnumber'}=$item->{'biblionumber'};
115 if ( $output eq "screen" ) {
116 # Printing results to screen
123 datefrom => $datefrom,
131 output_html_with_http_headers $input, $cookie, $template->output;
133 # Printing to a csv file
134 print $input->header(
135 -type => 'application/vnd.sun.xml.calc',
136 -attachment => "$basename.csv",
137 -filename => "$basename.csv"
139 my $sep = C4::Context->preference("delimiter");
140 foreach my $line (@$results) {
141 ($module eq "catalogue") or next;
142 foreach (qw(timestamp firstname surname action info title author)) {
143 print $line->{$_} . $sep;
152 my @mime = ( C4::Context->preference("MIME") );
153 my $CGIextChoice = CGI::scrolling_list(
160 my @dels = ( C4::Context->preference("delimiter") );
161 my $CGIsepChoice = CGI::scrolling_list(
170 CGIextChoice => $CGIextChoice,
171 CGIsepChoice => $CGIsepChoice,
173 output_html_with_http_headers $input, $cookie, $template->output;