bug 5783: Authorities edit logging

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Tomas Cohen Arazi 2011-03-03 16:54:00 -05:00 committed by Chris Cormack
parent b2e7b5aaca
commit 8af91c079a
5 changed files with 24 additions and 1 deletions

View File

@ -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);
my $sth = $dbh->prepare("DELETE FROM auth_header WHERE authid=?");
$sth->execute($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;
}

View File

@ -287,3 +287,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
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 ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','0','YesNo');

View File

@ -4044,6 +4044,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)

View File

@ -17,6 +17,12 @@ Logging:
on: Log
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:

View File

@ -44,6 +44,7 @@
<select name="modules" id="modules" multiple="multiple">
<option value="" selected="selected">All</option>
<option value ="CATALOGUING">Catalog</option>
<option value ="AUTHORITIES">Authorities</option>
<option value ="MEMBERS">Patrons</option>
<option value ="ACQUISITION">Acquisitions</option>
<option value ="SERIAL">Serials</option>
@ -172,7 +173,11 @@
<!-- TMPL_IF EXPR="module eq 'SERIAL'" -->
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="object" -->"> <!-- TMPL_VAR NAME="object" --> </a>
<!-- TMPL_ELSE -->
<!-- TMPL_VAR NAME="object" -->
<!-- TMPL_IF EXPR="module eq 'AUTHORITIES'" -->
<a href="/cgi-bin/koha/authorities/detail.pl?authid=<!-- TMPL_VAR NAME="object" -->" title="Display detail for this authority">auth <!-- TMPL_VAR NAME="object" --></a>
<!-- TMPL_ELSE -->
<!-- TMPL_VAR NAME="object" -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->