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
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #use warnings; FIXME - Bug 2505
34 use C4
::Search
; # enabled_staff_search_views
36 use vars
qw($debug $cgi_debug);
40 plugin that shows stats
46 $debug or $debug = $cgi_debug;
47 my $do_it = $input->param('do_it');
48 my @modules = $input->param("modules");
49 my $user = $input->param("user");
50 my $action = $input->param("action");
51 my $object = $input->param("object");
52 my $info = $input->param("info");
53 my $datefrom = $input->param("from");
54 my $dateto = $input->param("to");
55 my $basename = $input->param("basename");
56 my $mime = $input->param("MIME");
57 #my $del = $input->param("sep");
58 my $output = $input->param("output") || "screen";
59 my $src = $input->param("src"); # this param allows us to be told where we were called from -fbcit
61 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
63 template_name => "tools/viewlog.tmpl",
67 flagsrequired => { tools => 'view_system_logs' },
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, $dberror) = GetPatronImage($data->{'cardnumber'});
77 $template->param( picture => 1 ) if $picture;
78 $template->param( menu => 1,
79 title => $data->{'title'},
80 initials => $data->{'initials'},
81 surname => $data->{'surname'},
82 borrowernumber => $borrowernumber,
83 firstname => $data->{'firstname'},
84 cardnumber => $data->{'cardnumber'},
85 categorycode => $data->{'categorycode'},
86 categoryname => $data->{'description'},
87 address => $data->{'address'},
88 address2 => $data->{'address2'},
89 city => $data->{'city'},
90 zipcode => $data->{'zipcode'},
91 phone => $data->{'phone'},
92 phonepro => $data->{'phonepro'},
93 email => $data->{'email'},
94 branchcode => $data->{'branchcode'},
95 branchname => GetBranchName($data->{'branchcode'}),
100 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
101 dateformat => C4::Dates->new()->format(),
103 C4::Search::enabled_staff_search_views,
106 #### This code was never really used - maybe some day some will fix it ###
107 #my @mime = ( C4::Context->preference("MIME") );
108 #my $CGIextChoice = CGI::scrolling_list(
115 #my @dels = ( C4::Context->preference("delimiter") );
116 #my $CGIsepChoice = CGI::scrolling_list(
124 # CGIextChoice => $CGIextChoice,
125 # CGIsepChoice => $CGIsepChoice,
130 my $results = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info);
131 my $total = scalar @$results;
132 foreach my $result (@$results){
133 if ($result->{'info'} eq 'item'){
134 # get item information so we can create a working link
135 my $item=GetItem($result->{'object'});
136 $result->{'biblionumber'}=$item->{'biblionumber'};
137 $result->{'biblioitemnumber'}=$item->{'biblionumber'};
141 if ( $output eq "screen" ) {
142 # Printing results to screen
148 datefrom => $datefrom,
156 #module => 'fix this', #this seems unused in actual code
157 foreach my $module (@modules) {
158 $template->param($module => 1);
161 output_html_with_http_headers $input, $cookie, $template->output;
163 # Printing to a csv file
164 print $input->header(
166 -attachment => "$basename.csv",
167 -filename => "$basename.csv"
169 my $sep = C4::Context->preference("delimiter");
170 foreach my $line (@$results) {
171 #next unless $modules[0] eq "catalogue";
172 foreach (qw(timestamp firstname surname action info title author)) {
173 print $line->{$_} . $sep;
182 #initialize some paramaters that might not be used in the template - it seems to evaluate EXPR even if a false TMPL_IF
188 output_html_with_http_headers
$input, $cookie, $template->output;