|
Lines 24-31
package C4::Log;
Link Here
|
| 24 |
use strict; |
24 |
use strict; |
| 25 |
use warnings; |
25 |
use warnings; |
| 26 |
|
26 |
|
|
|
27 |
use JSON qw( to_json ); |
| 28 |
|
| 27 |
use C4::Context; |
29 |
use C4::Context; |
| 28 |
use Koha::DateUtils; |
30 |
use Koha::DateUtils; |
|
|
31 |
use Koha::Logger; |
| 29 |
|
32 |
|
| 30 |
use vars qw(@ISA @EXPORT); |
33 |
use vars qw(@ISA @EXPORT); |
| 31 |
|
34 |
|
|
Lines 77-82
sub logaction {
Link Here
|
| 77 |
my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)"); |
80 |
my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)"); |
| 78 |
$sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos); |
81 |
$sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos); |
| 79 |
$sth->finish; |
82 |
$sth->finish; |
|
|
83 |
|
| 84 |
my $logger = Koha::Logger->get( |
| 85 |
{ |
| 86 |
interface => 'intranet', |
| 87 |
category => "ActionLogs.$modulename.$actionname" |
| 88 |
} |
| 89 |
); |
| 90 |
$logger->info( |
| 91 |
sub { |
| 92 |
"ACTION LOG: " . to_json( |
| 93 |
{ |
| 94 |
user => $usernumber, |
| 95 |
module => $modulename, |
| 96 |
action => $actionname, |
| 97 |
object => $objectnumber, |
| 98 |
info => $infos |
| 99 |
} |
| 100 |
); |
| 101 |
} |
| 102 |
); |
| 80 |
} |
103 |
} |
| 81 |
|
104 |
|
| 82 |
=item cronlogaction |
105 |
=item cronlogaction |
|
Lines 144-153
sub displaylog {
Link Here
|
| 144 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
167 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
| 145 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
168 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
| 146 |
biblio.biblionumber, biblio.title, biblio.author |
169 |
biblio.biblionumber, biblio.title, biblio.author |
| 147 |
FROM action_logs |
170 |
FROM action_logs |
| 148 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
171 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
| 149 |
LEFT JOIN biblio ON action_logs.object=biblio.biblionumber |
172 |
LEFT JOIN biblio ON action_logs.object=biblio.biblionumber |
| 150 |
WHERE action_logs.module = 'cataloguing' |
173 |
WHERE action_logs.module = 'cataloguing' |
| 151 |
|; |
174 |
|; |
| 152 |
my %filtermap = (); |
175 |
my %filtermap = (); |
| 153 |
if ($modulename eq "catalogue" or $modulename eq "acqui") { |
176 |
if ($modulename eq "catalogue" or $modulename eq "acqui") { |
|
Lines 158-170
sub displaylog {
Link Here
|
| 158 |
); |
181 |
); |
| 159 |
} elsif ($modulename eq "members") { |
182 |
} elsif ($modulename eq "members") { |
| 160 |
$strsth=qq| |
183 |
$strsth=qq| |
| 161 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
184 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
| 162 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
185 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
| 163 |
bor2.cardnumber, bor2.surname, bor2.firstname, bor2.userid |
186 |
bor2.cardnumber, bor2.surname, bor2.firstname, bor2.userid |
| 164 |
FROM action_logs |
187 |
FROM action_logs |
| 165 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
188 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
| 166 |
LEFT JOIN borrowers as bor2 ON action_logs.object=bor2.borrowernumber |
189 |
LEFT JOIN borrowers as bor2 ON action_logs.object=bor2.borrowernumber |
| 167 |
WHERE action_logs.module = 'members' |
190 |
WHERE action_logs.module = 'members' |
| 168 |
|; |
191 |
|; |
| 169 |
%filtermap = ( |
192 |
%filtermap = ( |
| 170 |
user => 'borrowers.surname', |
193 |
user => 'borrowers.surname', |
|
Lines 204-210
sub displaylog {
Link Here
|
| 204 |
|
227 |
|
| 205 |
$logs = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info); |
228 |
$logs = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info); |
| 206 |
|
229 |
|
| 207 |
Return: |
230 |
Return: |
| 208 |
C<$logs> is a ref to a hash which containts all columns from action_logs |
231 |
C<$logs> is a ref to a hash which containts all columns from action_logs |
| 209 |
|
232 |
|
| 210 |
=cut |
233 |
=cut |
| 211 |
- |
|
|