From 768506e94ace1f256b6d26d7ace651b3feb8de64 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 10 Jun 2022 12:10:28 +0000 Subject: [PATCH] Bug 30025: Split BiblioAddsAuthorities into two sysprefs Followed Nick's testing procedure, works good This patch adds two new sysprefs: AutoLinkBiblios AllowManualAuthorityEditing Both inherit the setting from BiblioAddsAuhtorities which is removed To test: 1 -Apply patches 2 - Update database 3 - Confirm old setting is transferred to new option 4 - Confirm you can edit authoriteis manually if AllowManualAuthorityEditing set to allow 5 - Confirm you cannot edit authorities manually if AllowManualAuthorityEditing set to don't allow 6 - Confirm a new bib is linked when AutoLinkBiblios is enabled (set AllowManualAuthorityEditing to add unlinked heading) 7 - Confirm new bib notlinked when AutoLinkBiblios is disabled 8 - Confim new bib not linked when AutoLinkBiblios is enabled, but heading doesn't match an authority and AutoCreateAuthorities is disabled 9 - Confim new bib linked to new authority when AutoLinkBiblios is enabled, but heading doesn't match an authority and AutoCreateAuthorities is enabled Signed-off-by: Michal Urban --- .../data/mysql/atomicupdate/bug_30025.pl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_30025.pl diff --git a/installer/data/mysql/atomicupdate/bug_30025.pl b/installer/data/mysql/atomicupdate/bug_30025.pl new file mode 100755 index 0000000000..d82246f49f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30025.pl @@ -0,0 +1,21 @@ +use Modern::Perl; + +return { + bug_number => "30025", + description => "Split and rename BiblioAddsAuthorities system preference", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + my $biblio_adds_authorities = C4::Context->preference('BiblioAddsAuthorities'); + # Do you stuffs here + $dbh->do(q{ + INSERT IGNORE INTO systempreferences + ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('AllowManualAuthorityEditing',?,NULL,'Allow manual entry in controlled fields during cataloging.','YesNo'), + ('AutoLinkBiblios',?,NULL,'If enabled, link biblio to authorities on creation and edit','YesNo') + },undef,($biblio_adds_authorities,$biblio_adds_authorities)); + say $out "Added AllowManualAuthorityEditing and AutoLinkBiblios"; + $dbh->do(q{DELETE FROM systempreferences WHERE variable="BiblioAddsAuthorities";}); + say $out "BiblioAddsAuthorities removed"; + }, +}; -- 2.25.1