From f953cc26e6e9569f6674e6186efc3e37b5c721b2 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 22 Feb 2017 10:53:03 +0100 Subject: [PATCH] Bug 9988: Remove further references to dontmerge MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit [1] The preference was sent to HEA. We can now send both AuthorityMergeMode as well as AuthorityMergeLimit. [2] A comment in authorities/merge.pl is removed. Note that a subsequent patch will modify and test the cron job. [3] Script misc/batchRebuildItemsTables.pl temporarily enabled dontmerge. This is equivalent to setting the mergelimit to zero. The function defnonull is no longer needed. (If the pref was NULL, we restore that value. Sub merge won't mind.) Test plan: [1] Run t/db_dependent/UsageStats.t [2] Run misc/batchRebuildItemsTables.pl -t This just ensures you it still compiles; the changes speak for itself. [3] Now git grep on dontmerge. You should only find hits in atomicupdate and misc/translator/po. Signed-off-by: Marcel de Rooy Signed-off-by: Marc Véron Signed-off-by: Jacek Ablewicz Signed-off-by: Julian Maurice Signed-off-by: Kyle M Hall --- C4/UsageStats.pm | 3 ++- authorities/merge.pl | 1 - misc/batchRebuildItemsTables.pl | 14 ++++---------- t/db_dependent/UsageStats.t | 3 ++- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 16f86df9a8..96e79fadbc 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -108,7 +108,8 @@ sub BuildReport { AuthDisplayHierarchy AutoCreateAuthorities BiblioAddsAuthorities - dontmerge + AuthorityMergeLimit + AuthorityMergeMode UseAuthoritiesForTracings CatalogModuleRelink hide_marc diff --git a/authorities/merge.pl b/authorities/merge.pl index 94bfc3d2fa..4279fef307 100755 --- a/authorities/merge.pl +++ b/authorities/merge.pl @@ -62,7 +62,6 @@ if ($merge) { ModAuthority( $recordid1, $record, $typecode ); # Now merge for biblios attached to $recordid2 - # We ignore dontmerge now, since recordid2 is deleted my $MARCfrom = GetAuthority( $recordid2 ); merge({ mergefrom => $recordid2, MARCfrom => $MARCfrom, mergeto => $recordid1, MARCto => $record }); diff --git a/misc/batchRebuildItemsTables.pl b/misc/batchRebuildItemsTables.pl index 9e38757d58..5545607a89 100755 --- a/misc/batchRebuildItemsTables.pl +++ b/misc/batchRebuildItemsTables.pl @@ -52,10 +52,9 @@ $dbh->{AutoCommit} = 0; #sysprefs C4::Context->disable_syspref_cache() if ( defined( C4::Context->disable_syspref_cache() ) ); my $CataloguingLog = C4::Context->preference('CataloguingLog'); -my $dontmerge = C4::Context->preference('dontmerge'); -$dontmerge = "0" unless defnonull($dontmerge); +my $mergelimit = C4::Context->preference('AuthorityMergeLimit'); $dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); -$dbh->do("UPDATE systempreferences SET value=1 where variable='dontmerge'"); +$dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'"); $dbh->commit() unless $test_parameter; my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber", '' ); @@ -98,16 +97,11 @@ while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow my $sthCataloguingLog = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='CataloguingLog'"); $sthCataloguingLog->execute($CataloguingLog); -my $sthdontmerge = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='dontmerge'"); -$sthdontmerge->execute($dontmerge); +my $sthmergelimit = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='AuthorityMergeLimit'"); +$sthmergelimit->execute($mergelimit); $dbh->commit() unless $test_parameter; my $timeneeded = time() - $starttime; print "$count MARC record done in $timeneeded seconds\n"; if ( scalar(@errors) > 0 ) { print "Some biblionumber could not be processed though: ", join( " ", @errors ); } - -sub defnonull { - my $var = shift; - return defined $var && $var ne q{}; -} diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index 6c1992594a..d11cbd48e3 100644 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -358,7 +358,8 @@ sub mocking_systempreferences_to_a_set_value { AuthDisplayHierarchy AutoCreateAuthorities BiblioAddsAuthorities - dontmerge + AuthorityMergeLimit + AuthorityMergeMode UseAuthoritiesForTracings CatalogModuleRelink hide_marc -- 2.39.5