View | Details | Raw Unified | Return to bug 11998
Collapse All | Expand All

(-)a/C4/Context.pm (-1 lines)
Lines 106-112 use ZOOM; Link Here
106
use XML::Simple;
106
use XML::Simple;
107
use C4::Boolean;
107
use C4::Boolean;
108
use C4::Debug;
108
use C4::Debug;
109
use C4::LogStatic qw/ logaction /;
110
use Koha::Cache;
109
use Koha::Cache;
111
use POSIX ();
110
use POSIX ();
112
use DateTime::TimeZone;
111
use DateTime::TimeZone;
(-)a/C4/LogStatic.pm (-96 lines)
Lines 1-96 Link Here
1
package C4::LogStatic;
2
3
# This is a very simple logging system, designed to be only used in
4
# circumstances where C4::Context can't be loaded. Typically, this is
5
# only in C4::Context itself.
6
#
7
# This is intended to be temporary until C4::Context gets refactored to not
8
# handle things like sysprefs that need logged about.
9
10
11
# Copyright 2000-2002 Katipo Communications
12
# Copyright 2011 MJ Ray and software.coop
13
# Copyright 2014 Catalyst IT
14
#
15
# This file is part of Koha.
16
#
17
# Koha is free software; you can redistribute it and/or modify it under the
18
# terms of the GNU General Public License as published by the Free Software
19
# Foundation; either version 2 of the License, or (at your option) any later
20
# version.
21
#
22
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
23
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
24
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
25
#
26
# You should have received a copy of the GNU General Public License along
27
# with Koha; if not, write to the Free Software Foundation, Inc.,
28
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29
30
use strict;
31
use warnings;
32
33
use vars qw($VERSION @ISA @EXPORT);
34
35
BEGIN {
36
    # set the version for version checking
37
    $VERSION = 3.07.00.049;
38
    require Exporter;
39
    @ISA = qw(Exporter);
40
    @EXPORT = qw(&logaction);
41
}
42
43
=head1 NAME
44
45
C4::LogStatic - basic logging function for Koha.
46
47
=head1 SYNOPSIS
48
49
  use C4::LogStatic;
50
  logaction($dbh, $userenv, "module", "action", $objectnum, "what happened");
51
52
=head1 DESCRIPTION
53
54
This allows simple logging in situtations where C4::Context can't be loaded.
55
56
=head1 FUNCTIONS
57
58
=over 2
59
60
=item logaction
61
62
  logaction($dbh, $userenv, $modulename, $actionname, $objectnumber, $infos);
63
64
Adds a record into action_logs table to report the different changes upon the database.
65
Each log entry includes the number of the user currently logged in.  For batch
66
jobs, which operate without authenticating a user and setting up a session, the user
67
number is set to 0, which is the same as the superlibrarian's number.
68
69
=cut
70
71
#'
72
sub logaction {
73
    my ($dbh, $userenv, $modulename, $actionname, $objectnumber, $infos)=@_;
74
75
    # Get ID of logged in user.  if called from a batch job,
76
    # no user session exists and C4::Context->userenv() returns
77
    # the scalar '0'.
78
    my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : 0;
79
    $usernumber ||= 0;
80
81
    my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)");
82
    $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos);
83
    $sth->finish;
84
}
85
86
87
1;
88
__END__
89
90
=back
91
92
=head1 AUTHOR
93
94
Koha Development Team <http://koha-community.org/>
95
96
=cut
(-)a/Koha/Config/SystemPreference.pm (-1 / +56 lines)
Lines 1-5 Link Here
1
package Koha::Config::SystemPreference;
1
package Koha::Config::SystemPreference;
2
2
3
# Copyright 2014 Biblibre
4
# Copyright 2014 Catalyst IT
5
#
6
# This file is part of Koha.
7
#
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 3 of the License, or (at your option) any later
11
# version.
12
#
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.
16
#
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.
20
21
=head1 NAME
22
23
Koha::Config::SystemPreference - provides a simple interface to the system preference database
24
25
=head1 SYNOPSIS
26
27
    use Koha::Config::SystemPreference;
28
    my $set = Koha::Config::SystemPreference::set( $var, $value, $expl, $type, $options );
29
    my $deleted = Koha::Config::SystemPreference::delete($var);
30
31
=head1 NOTE
32
33
This has little documentation, and doesn't provide some obvious functions, this
34
is because it has a TODO list:
35
36
=over 4
37
38
=item
39
40
Re-implement in an OO way
41
42
=item
43
44
Handle caching here
45
46
=item
47
48
Complete documentation (when re-written)
49
50
=item
51
52
Move other functions in Koha to reference this rather than the functions
53
in C4::Context for working with preferences.
54
55
=back
56
57
=cut
58
3
use Koha::Database;
59
use Koha::Database;
4
use C4::Log qw( logaction );
60
use C4::Log qw( logaction );
5
61
6
- 

Return to bug 11998