From ec94689218fa2cbf0360fa1a731bac4b0e028b63 Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 14 Jul 2005 09:53:10 +0000 Subject: [PATCH] Adding a log facility for actions watching. Code to be widely used in order to report data modifications. --- C4/Maintainance.pm | 18 +++++++++++++++++- updater/updatedatabase | 12 ++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/C4/Maintainance.pm b/C4/Maintainance.pm index 43d0434a1e..107361c892 100644 --- a/C4/Maintainance.pm +++ b/C4/Maintainance.pm @@ -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; diff --git a/updater/updatedatabase b/updater/updatedatabase index aae26b476d..58dea1ce0c 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -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.... -- 2.39.5