@@ -, +, @@ CataloguingLog into separate system preferences --- C4/Items.pm | 8 ++++---- C4/Log.pm | 17 +++++++++-------- C4/UsageStats.pm | 1 + installer/data/mysql/atomicupdate/bug_17195.sql | 2 ++ .../prog/en/modules/admin/preferences/logs.pref | 8 +++++++- misc/batchRebuildItemsTables.pl | 8 ++++---- misc/migration_tools/bulkmarcimport.pl | 3 +++ t/Log.t | 1 + t/db_dependent/UsageStats.t | 1 + 9 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_17195.sql --- a/C4/Items.pm +++ a/C4/Items.pm @@ -312,7 +312,7 @@ sub AddItem { ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver" ); - logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); + logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLogItems"); return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber); } @@ -407,7 +407,7 @@ sub AddItemBatchFromMarc { push @itemnumbers, $itemnumber; # FIXME not checking error $item->{'itemnumber'} = $itemnumber; - logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); + logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLogItems"); my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields); $item_field->replace_with($new_item_marc->field($itemtag)); @@ -613,7 +613,7 @@ sub ModItem { # item status is possible ModZebra( $biblionumber, "specialUpdate", "biblioserver" ); - logaction("CATALOGUING", "MODIFY", $itemnumber, "item ".Dumper($item)) if C4::Context->preference("CataloguingLog"); + logaction("CATALOGUING", "MODIFY", $itemnumber, "item ".Dumper($item)) if C4::Context->preference("CataloguingLogItems"); } =head2 ModItemTransfer @@ -689,7 +689,7 @@ sub DelItem { ModZebra( $biblionumber, "specialUpdate", "biblioserver" ); #search item field code - logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); + logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLogItems"); return $deleted; } --- a/C4/Log.pm +++ a/C4/Log.pm @@ -138,14 +138,15 @@ C<$status> is a hasref like this example: #' sub GetLogStatus { my %hash; - $hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); - $hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); - $hash{HoldsLog} = C4::Context->preference("HoldsLog"); - $hash{IssueLog} = C4::Context->preference("IssueLog"); - $hash{ReturnLog} = C4::Context->preference("ReturnLog"); - $hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog"); - $hash{LetterLog} = C4::Context->preference("LetterLog"); - $hash{FinesLog} = C4::Context->preference("FinesLog"); + $hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); + $hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); + $hash{CataloguingLogItems} = C4::Context->preference("CataloguingLogItems"); + $hash{HoldsLog} = C4::Context->preference("HoldsLog"); + $hash{IssueLog} = C4::Context->preference("IssueLog"); + $hash{ReturnLog} = C4::Context->preference("ReturnLog"); + $hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog"); + $hash{LetterLog} = C4::Context->preference("LetterLog"); + $hash{FinesLog} = C4::Context->preference("FinesLog"); return \%hash; } --- a/C4/UsageStats.pm +++ a/C4/UsageStats.pm @@ -212,6 +212,7 @@ sub BuildReport { AuthoritiesLog BorrowersLog CataloguingLog + CataloguingLogItems FinesLog IssueLog LetterLog --- a/installer/data/mysql/atomicupdate/bug_17195.sql +++ a/installer/data/mysql/atomicupdate/bug_17195.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) +SELECT 'CataloguingLogItems', value, NULL,'If ON, log edit/create/delete actions on bibliographic item data. WARNING: this feature is very resource consuming.','YesNo' FROM systempreferences WHERE variable = 'CataloguingLog'; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref @@ -17,7 +17,13 @@ Logging: choices: 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. + - any changes to bibliographic records. + - + - pref: CataloguingLogItems + choices: + on: Log + off: "Don't log" + - any changes to 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: --- a/misc/batchRebuildItemsTables.pl +++ a/misc/batchRebuildItemsTables.pl @@ -49,10 +49,10 @@ my $dbh = C4::Context->dbh; $dbh->{AutoCommit} = 0; #sysprefs C4::Context->disable_syspref_cache() if ( defined( C4::Context->disable_syspref_cache() ) ); -my $CataloguingLog = C4::Context->preference('CataloguingLog'); +my $CataloguingLogItems = C4::Context->preference('CataloguingLogItems'); my $dontmerge = C4::Context->preference('dontmerge'); $dontmerge="0" unless defnonull($dontmerge); -$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); +$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLogItems'"); $dbh->do("UPDATE systempreferences SET value=1 where variable='dontmerge'"); $dbh->commit() unless $test_parameter; my ($itemfield,$itemnumbersubfield) = &GetMarcFromKohaField("items.itemnumber",''); @@ -91,8 +91,8 @@ while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow } } -my $sthCataloguingLog = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='CataloguingLog'"); -$sthCataloguingLog->execute($CataloguingLog); +my $sthCataloguingLogItems = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='CataloguingLogItems'"); +$sthCataloguingLogItems->execute($CataloguingLogItems); my $sthdontmerge = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='dontmerge'"); $sthdontmerge->execute($dontmerge); $dbh->commit() unless $test_parameter; --- a/misc/migration_tools/bulkmarcimport.pl +++ a/misc/migration_tools/bulkmarcimport.pl @@ -132,9 +132,11 @@ if ((not defined $sourcesubfield) && (not defined $sourcetag)){ C4::Context->disable_syspref_cache(); # Save current CataloguingLog and AuthoritiesLog sysprefs values my $CataloguingLog = C4::Context->preference( 'CataloguingLog' ); +my $CataloguingLogItems = C4::Context->preference( 'CataloguingLogItems' ); my $AuthoritiesLog = C4::Context->preference( 'AuthoritiesLog' ); # Disable logging for both C4::Context->set_preference( 'CataloguingLog', 0 ); +C4::Context->set_preference( 'CataloguingLogItems', 0 ); C4::Context->set_preference( 'AuthoritiesLog', 0 ); if ($fk_off) { @@ -523,6 +525,7 @@ if ($fk_off) { # Restore CataloguingLog C4::Context->set_preference( 'CataloguingLog', $CataloguingLog ); +C4::Context->set_preference( 'CataloguingLogItems', $CataloguingLogItems ); # Restore AuthoritiesLog C4::Context->set_preference( 'AuthoritiesLog', $AuthoritiesLog ); --- a/t/Log.t +++ a/t/Log.t @@ -15,6 +15,7 @@ BEGIN { t::lib::Mocks::mock_preference('BorrowersLog', 1); t::lib::Mocks::mock_preference('CataloguingLog', 1); +t::lib::Mocks::mock_preference('CataloguingLogItems', 1); t::lib::Mocks::mock_preference('IssueLog', 1); t::lib::Mocks::mock_preference('ReturnLog', 1); t::lib::Mocks::mock_preference('SubscriptionLog', 1); --- a/t/db_dependent/UsageStats.t +++ a/t/db_dependent/UsageStats.t @@ -464,6 +464,7 @@ sub mocking_systempreferences_to_a_set_value { AuthoritiesLog BorrowersLog CataloguingLog + CataloguingLogItems FinesLog IssueLog LetterLog --