|
Lines 24-32
package C4::Log;
Link Here
|
| 24 |
use strict; |
24 |
use strict; |
| 25 |
use warnings; |
25 |
use warnings; |
| 26 |
|
26 |
|
| 27 |
use C4::Context; |
|
|
| 28 |
use C4::Dates qw(format_date); |
| 29 |
|
| 30 |
use vars qw($VERSION @ISA @EXPORT); |
27 |
use vars qw($VERSION @ISA @EXPORT); |
| 31 |
|
28 |
|
| 32 |
BEGIN { |
29 |
BEGIN { |
|
Lines 68-73
number is set to 0, which is the same as the superlibrarian's number.
Link Here
|
| 68 |
sub logaction { |
65 |
sub logaction { |
| 69 |
my ($modulename, $actionname, $objectnumber, $infos)=@_; |
66 |
my ($modulename, $actionname, $objectnumber, $infos)=@_; |
| 70 |
|
67 |
|
|
|
68 |
# Require on demand so we can be called from C4::Context; |
| 69 |
require C4::Context; |
| 71 |
# Get ID of logged in user. if called from a batch job, |
70 |
# Get ID of logged in user. if called from a batch job, |
| 72 |
# no user session exists and C4::Context->userenv() returns |
71 |
# no user session exists and C4::Context->userenv() returns |
| 73 |
# the scalar '0'. |
72 |
# the scalar '0'. |
|
Lines 97-102
C<$status> is a hasref like this example:
Link Here
|
| 97 |
|
96 |
|
| 98 |
#' |
97 |
#' |
| 99 |
sub GetLogStatus { |
98 |
sub GetLogStatus { |
|
|
99 |
require C4::Context; |
| 100 |
my %hash; |
100 |
my %hash; |
| 101 |
$hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); |
101 |
$hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); |
| 102 |
$hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); |
102 |
$hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); |
|
Lines 122-128
returns a table of hash containing who did what on which object at what time
Link Here
|
| 122 |
|
122 |
|
| 123 |
#' |
123 |
#' |
| 124 |
sub displaylog { |
124 |
sub displaylog { |
| 125 |
my ($modulename, @filters) = @_; |
125 |
my ($modulename, @filters) = @_; |
|
|
126 |
require C4::Context; |
| 126 |
my $dbh = C4::Context->dbh; |
127 |
my $dbh = C4::Context->dbh; |
| 127 |
my $strsth=qq| |
128 |
my $strsth=qq| |
| 128 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
129 |
SELECT action_logs.timestamp, action_logs.action, action_logs.info, |
|
Lines 173-182
sub displaylog {
Link Here
|
| 173 |
my @results; |
174 |
my @results; |
| 174 |
my $count; |
175 |
my $count; |
| 175 |
my $hilighted=1; |
176 |
my $hilighted=1; |
|
|
177 |
require C4::Dates; |
| 176 |
while (my $data = $sth->fetchrow_hashref){ |
178 |
while (my $data = $sth->fetchrow_hashref){ |
| 177 |
$data->{hilighted} = ($hilighted>0); |
179 |
$data->{hilighted} = ($hilighted>0); |
| 178 |
$data->{info} =~ s/\n/<br\/>/g; |
180 |
$data->{info} =~ s/\n/<br\/>/g; |
| 179 |
$data->{day} = format_date($data->{timestamp}); |
181 |
$data->{day} = C4::Dates::format_date($data->{timestamp}); |
| 180 |
push @results, $data; |
182 |
push @results, $data; |
| 181 |
$count++; |
183 |
$count++; |
| 182 |
$hilighted = -$hilighted; |
184 |
$hilighted = -$hilighted; |
|
Lines 202-207
sub GetLogs {
Link Here
|
| 202 |
my $object = shift; |
204 |
my $object = shift; |
| 203 |
my $info = shift; |
205 |
my $info = shift; |
| 204 |
|
206 |
|
|
|
207 |
require C4::Context; |
| 205 |
my $iso_datefrom = C4::Dates->new($datefrom,C4::Context->preference("dateformat"))->output('iso'); |
208 |
my $iso_datefrom = C4::Dates->new($datefrom,C4::Context->preference("dateformat"))->output('iso'); |
| 206 |
my $iso_dateto = C4::Dates->new($dateto,C4::Context->preference("dateformat"))->output('iso'); |
209 |
my $iso_dateto = C4::Dates->new($dateto,C4::Context->preference("dateformat"))->output('iso'); |
| 207 |
|
210 |
|