From 2f4f3af26c95639320e5b27cdf49a3096394c0f6 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Wed, 20 May 2020 15:01:54 +0200
Subject: [PATCH] Bug 24854: Disable IDreamBooks sysprefs

---
 installer/data/mysql/atomicupdate/bug_24854.perl | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_24854.perl

diff --git a/installer/data/mysql/atomicupdate/bug_24854.perl b/installer/data/mysql/atomicupdate/bug_24854.perl
new file mode 100644
index 0000000000..f13a11b01c
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_24854.perl
@@ -0,0 +1,16 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    my $ft_enabled = $dbh->selectrow_array(q|
+        SELECT COUNT(*) FROM systempreferences WHERE variable like "IDreamBooks%" and value="1"
+    |);
+    if ( $ft_enabled ) {
+        $dbh->do(q|
+            UPDATE systempreferences
+            SET value="0"
+            WHERE variable like "IDreamBooks%"
+        |);
+    }
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 24854 - Disable IDreamBooks)\n";
+}
-- 
2.20.1