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 use vars qw($debug $cgi_debug);
38 plugin that shows stats
44 $debug or $debug = $cgi_debug;
45 my $do_it = $input->param('do_it');
46 my @modules = $input->param("modules");
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 => 'view_system_logs' },
70 if ($src eq 'circ') { # if we were called from circulation, use the circulation menu and get data to populate it -fbcit
72 my $borrowernumber = $object;
73 my $data = GetMember($borrowernumber,'borrowernumber');
74 my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
75 $template->param( picture => 1 ) if $picture;
76 $template->param( menu => 1,
77 title => $data->{'title'},
78 initials => $data->{'initials'},
79 surname => $data->{'surname'},
80 borrowernumber => $borrowernumber,
81 firstname => $data->{'firstname'},
82 cardnumber => $data->{'cardnumber'},
83 categorycode => $data->{'categorycode'},
84 categoryname => $data->{'description'},
85 address => $data->{'address'},
86 address2 => $data->{'address2'},
87 city => $data->{'city'},
88 zipcode => $data->{'zipcode'},
89 phone => $data->{'phone'},
90 phonepro => $data->{'phonepro'},
91 email => $data->{'email'},
92 branchcode => $data->{'branchcode'},
93 branchname => GetBranchName($data->{'branchcode'}),
98 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
99 dateformat => C4::Dates->new()->format(),
103 #### This code was never really used - maybe some day some will fix it ###
104 #my @mime = ( C4::Context->preference("MIME") );
105 #my $CGIextChoice = CGI::scrolling_list(
112 #my @dels = ( C4::Context->preference("delimiter") );
113 #my $CGIsepChoice = CGI::scrolling_list(
121 # CGIextChoice => $CGIextChoice,
122 # CGIsepChoice => $CGIsepChoice,
127 my $results = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info);
128 my $total = scalar @$results;
129 foreach my $result (@$results){
130 if ($result->{'info'} eq 'item'){
131 # get item information so we can create a working link
132 my $item=GetItem($result->{'object'});
133 $result->{'biblionumber'}=$item->{'biblionumber'};
134 $result->{'biblioitemnumber'}=$item->{'biblionumber'};
138 if ( $output eq "screen" ) {
139 # Printing results to screen
145 datefrom => $datefrom,
153 #module => 'fix this', #this seems unused in actual code
154 foreach my $module (@modules) {
155 $template->param($module => 1);
158 output_html_with_http_headers $input, $cookie, $template->output;
160 # Printing to a csv file
161 print $input->header(
163 -attachment => "$basename.csv",
164 -filename => "$basename.csv"
166 my $sep = C4::Context->preference("delimiter");
167 foreach my $line (@$results) {
168 #next unless $modules[0] eq "catalogue";
169 foreach (qw(timestamp firstname surname action info title author)) {
170 print $line->{$_} . $sep;
179 #initialize some paramaters that might not be used in the template - it seems to evaluate EXPR even if a false TMPL_IF
185 output_html_with_http_headers $input, $cookie, $template->output;