Adding a log facility for actions watching.

Code to be widely used in order to report data modifications.
This commit is contained in:
hdl 2005-07-14 09:53:10 +00:00
parent 2950574dd6
commit ec94689218
2 changed files with 29 additions and 1 deletions

View file

@ -52,7 +52,7 @@ miscategorized items, etc.
@ISA = qw(Exporter);
@EXPORT = qw(&listsubjects &updatesub &shiftgroup &deletedbib &undeletebib
&updatetype);
&updatetype &logaction);
=item listsubjects
@ -215,6 +215,22 @@ sub updatetype{
$sth->finish;
}
=item logaction
&logaction($usernumber, $modulename, $actionname, $infos);
Adds a record into action_logs table to report the different changes upon the database
=cut
#'
sub logaction{
my ($usernumber,$modulename, $actionname, $infos)=@_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,info) values (now(),?,?,?,?)");
$sth->execute($usernumber,$modulename,$actionname,$infos);
$sth->finish;
}
END { } # module clean-up code here (global destructor)
1;

View file

@ -383,6 +383,14 @@ my %requiretables = (
itemtypecodes text default '',
PRIMARY KEY (mediatypecode)
)",
`action_logs` => "(
`timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL ,
`user` INT( 11 ) NOT NULL ,
`module` TEXT default '',
`action` TEXT default '' ,
`info` TEXT default '' ,
PRIMARY KEY ( `timestamp` , `user` )
)",
);
my %requirefields = (
@ -1502,6 +1510,10 @@ $sth->finish;
exit;
# $Log$
# Revision 1.107 2005/07/14 09:53:10 hdl
# Adding a log facility for actions watching.
# Code to be widely used in order to report data modifications.
#
# Revision 1.106 2005/07/06 17:47:22 hdl
# Add branch selection and filter for budgets and funds.
# May be too much... Funds could be enough....