From e6959057d2fcb5fd22f0fe5ad5ecda641525b3f0 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Fri, 10 Jun 2022 12:10:28 +0000
Subject: [PATCH] Bug 30025: DB update

Signed-off-by: AFHDubCoLib <andrewfh@dubcolib.org>
---
 .../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.20.1