@@ -, +, @@ --- C4/AuthoritiesMarc.pm | 4 ++++ installer/data/mysql/en/mandatory/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/logs.pref | 6 ++++++ .../prog/en/modules/tools/viewlog.tmpl | 7 ++++++- 5 files changed, 24 insertions(+), 1 deletions(-) --- a/C4/AuthoritiesMarc.pm +++ a/C4/AuthoritiesMarc.pm @@ -26,6 +26,7 @@ use C4::Search; use C4::AuthoritiesMarc::MARC21; use C4::AuthoritiesMarc::UNIMARC; use C4::Charset; +use C4::Log; use vars qw($VERSION @ISA @EXPORT); @@ -701,6 +702,7 @@ sub AddAuthority { $sth->execute($authid,$authtypecode,$record->as_usmarc,$record->as_xml_record($format)); $sth->finish; } + logaction( "AUTHORITIES", "ADD", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); ModZebra($authid,'specialUpdate',"authorityserver",$oldRecord,$record); return ($authid); } @@ -718,6 +720,7 @@ sub DelAuthority { my ($authid) = @_; my $dbh=C4::Context->dbh; + logaction( "AUTHORITIES", "DELETE", $authid, "authority" ) if C4::Context->preference("AuthoritiesLog"); ModZebra($authid,"recordDelete","authorityserver",GetAuthority($authid),undef); $dbh->do("delete from auth_header where authid=$authid") ; @@ -748,6 +751,7 @@ sub ModAuthority { print AUTH $authid; close AUTH; } + logaction( "AUTHORITIES", "MODIFY", $authid, "BEFORE=>" . $oldrecord->as_formatted ) if C4::Context->preference("AuthoritiesLog"); return $authid; } --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ a/installer/data/mysql/en/mandatory/sysprefs.sql @@ -285,3 +285,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','0','YesNo'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -4014,6 +4014,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = 'XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','0','YesNo');"); + print "Upgrade to $DBversion done (Add AuthoritiesLog syspref)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref @@ -18,6 +18,12 @@ Logging: off: "Don't log" - any changes to bibliographic or item records. Since this occurs whenever a book is checked in or out as well, it is not advisable to turn this on. - + - pref: AuthoritiesLog + choices: + on: Log + off: "Don't log" + - changes to authorities records. + - - pref: FinesLog choices: on: Log --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl @@ -44,6 +44,7 @@