From 934d6c8bbaafc4cce306510b5c8e8fe1e6c401fe Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Thu, 25 Apr 2019 10:39:14 +0100
Subject: [PATCH] Bug 8995: (QA follow-up) Convert db update to perl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 .../mysql/atomicupdate/8995_OpenURL_sysprefs.sql  |  6 ------
 installer/data/mysql/atomicupdate/bug_8995.perl   | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)
 delete mode 100644 installer/data/mysql/atomicupdate/8995_OpenURL_sysprefs.sql
 create mode 100644 installer/data/mysql/atomicupdate/bug_8995.perl

diff --git a/installer/data/mysql/atomicupdate/8995_OpenURL_sysprefs.sql b/installer/data/mysql/atomicupdate/8995_OpenURL_sysprefs.sql
deleted file mode 100644
index ff70900e3e..0000000000
--- a/installer/data/mysql/atomicupdate/8995_OpenURL_sysprefs.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
-  ('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free'),
-  ('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free'),
-  ('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free'),
-  ('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo'),
-  ('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free');
diff --git a/installer/data/mysql/atomicupdate/bug_8995.perl b/installer/data/mysql/atomicupdate/bug_8995.perl
new file mode 100644
index 0000000000..d1fd16a5dd
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_8995.perl
@@ -0,0 +1,15 @@
+$DBversion = 'XXX';    # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        INSERT IGNORE INTO `systempreferences` (`variable`, `value`, `explanation`, `options`, `type`) VALUES
+          ('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free'),
+          ('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free'),
+          ('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free'),
+          ('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo'),
+          ('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free');
+    });
+
+    SetVersion($DBversion);
+    print
+"Upgrade to $DBversion done (Bug 8995 - Add new preferences for OpenURLResolvers)\n";
+}
-- 
2.20.1