From dc16b9a031f0a757ed5a17e81f1f269a5a30847f Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 4 Oct 2018 15:39:27 +0200 Subject: [PATCH] Bug 21487: Disable CataloguingLog syspref in UNIMARC_sync_date_created_with_marc_biblio.pl Script UNIMARC_sync_date_created_with_marc_biblio.pl edits MARC record to define 099 $c and $d. This should not be registered as a cataloguing change in action_logs table. So script must disable CataloguingLog syspref (if enabled) during its process. Test plan : 1) Don't apply the patch yet 2) Have the CataloguingLog system preference set to 'Log' 3) Create a new record 4) Count entries in action_logs table 5) Run : UNIMARC_sync_date_created_with_marc_biblio.pl --run -v 6) Check the CataloguingLog system preference is still 'Log' 7) Count entries in action_logs table => there are more 8) Apply the patch 9) Repeate from 3) to 6) 10) Count entries in action_logs table => there are the same Signed-off-by: David Nind --- .../maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl b/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl index a46dc7b0f4..ec6076096e 100755 --- a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl +++ b/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl @@ -12,6 +12,7 @@ BEGIN { eval { require "$FindBin::Bin/../kohalib.pl" }; } +use C4::Context; use C4::Biblio; use Getopt::Long; @@ -207,6 +208,13 @@ sub process { $dbh = C4::Context->dbh; my $mod_count = 0; + # Disable the syspref cache so we can change logging settings + C4::Context->disable_syspref_cache(); + # Save current CataloguingLog syspref value + my $CataloguingLog = C4::Context->preference('CataloguingLog'); + # Disable logging + C4::Context->set_preference( 'CataloguingLog', 0 ); + my $query = q{ SELECT biblionumber FROM biblio @@ -229,6 +237,9 @@ sub process { } $verbose and print "Number of modified biblios: " . $mod_count . "\n"; + + # Restore CataloguingLog + C4::Context->set_preference( 'CataloguingLog', $CataloguingLog ); } if ( lc( C4::Context->preference('marcflavour') ) eq "unimarc" ) { -- 2.11.0