|
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( { interface => 'intranet', category => "ActionLogs.$modulename.$actionname" } ); |
| 85 |
$logger->info( "ACTION LOG: " . to_json( { user => $usernumber, module => $modulename, action => $actionname, object => $objectnumber, info => $infos } ) ); |
| 80 |
} |
86 |
} |
| 81 |
|
87 |
|
| 82 |
=item cronlogaction |
88 |
=item cronlogaction |
|
Lines 144-153
sub displaylog {
Link Here
|
| 144 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
150 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
| 145 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
151 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
| 146 |
biblio.biblionumber, biblio.title, biblio.author |
152 |
biblio.biblionumber, biblio.title, biblio.author |
| 147 |
FROM action_logs |
153 |
FROM action_logs |
| 148 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
154 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
| 149 |
LEFT JOIN biblio ON action_logs.object=biblio.biblionumber |
155 |
LEFT JOIN biblio ON action_logs.object=biblio.biblionumber |
| 150 |
WHERE action_logs.module = 'cataloguing' |
156 |
WHERE action_logs.module = 'cataloguing' |
| 151 |
|; |
157 |
|; |
| 152 |
my %filtermap = (); |
158 |
my %filtermap = (); |
| 153 |
if ($modulename eq "catalogue" or $modulename eq "acqui") { |
159 |
if ($modulename eq "catalogue" or $modulename eq "acqui") { |
|
Lines 158-170
sub displaylog {
Link Here
|
| 158 |
); |
164 |
); |
| 159 |
} elsif ($modulename eq "members") { |
165 |
} elsif ($modulename eq "members") { |
| 160 |
$strsth=qq| |
166 |
$strsth=qq| |
| 161 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
167 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
| 162 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
168 |
borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.userid, |
| 163 |
bor2.cardnumber, bor2.surname, bor2.firstname, bor2.userid |
169 |
bor2.cardnumber, bor2.surname, bor2.firstname, bor2.userid |
| 164 |
FROM action_logs |
170 |
FROM action_logs |
| 165 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
171 |
LEFT JOIN borrowers ON borrowers.borrowernumber=action_logs.user |
| 166 |
LEFT JOIN borrowers as bor2 ON action_logs.object=bor2.borrowernumber |
172 |
LEFT JOIN borrowers as bor2 ON action_logs.object=bor2.borrowernumber |
| 167 |
WHERE action_logs.module = 'members' |
173 |
WHERE action_logs.module = 'members' |
| 168 |
|; |
174 |
|; |
| 169 |
%filtermap = ( |
175 |
%filtermap = ( |
| 170 |
user => 'borrowers.surname', |
176 |
user => 'borrowers.surname', |
|
Lines 204-210
sub displaylog {
Link Here
|
| 204 |
|
210 |
|
| 205 |
$logs = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info); |
211 |
$logs = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info); |
| 206 |
|
212 |
|
| 207 |
Return: |
213 |
Return: |
| 208 |
C<$logs> is a ref to a hash which containts all columns from action_logs |
214 |
C<$logs> is a ref to a hash which containts all columns from action_logs |
| 209 |
|
215 |
|
| 210 |
=cut |
216 |
=cut |
| 211 |
- |
|
|