From 52934483e322e3294112a3528ef65556f3c18850 Mon Sep 17 00:00:00 2001
From: Fridolin Somers <fridolin.somers@biblibre.com>
Date: Wed, 6 Jan 2021 15:32:37 +0100
Subject: [PATCH] Bug 27351: Fix UsageStatsCountry system preference wrong type

UsageStatsCountry system preference type 'YesNo' is wrong since it has
several values.
Change to 'Choice'.
Looks like this error whas only in updatedabase 3.17.00.030.

Test plan :
1) Run atomic update
2) Check in database 'UsageStatsCountry' system preference type is
   'Choice'

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
---
 installer/data/mysql/atomicupdate/bug_27351.sql | 1 +
 installer/data/mysql/updatedatabase.pl          | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 installer/data/mysql/atomicupdate/bug_27351.sql

diff --git a/installer/data/mysql/atomicupdate/bug_27351.sql b/installer/data/mysql/atomicupdate/bug_27351.sql
new file mode 100644
index 0000000000..25d0013793
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_27351.sql
@@ -0,0 +1 @@
+UPDATE systempreferences SET `type` = 'Choice' WHERE `variable` = 'UsageStatsCountry';
\ No newline at end of file
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 8db165a434..4524b18495 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8873,7 +8873,7 @@ if ( CheckVersion($DBversion) ) {
         q{
        INSERT INTO systempreferences (variable, value, options, explanation, type )
        VALUES
-        ('UsageStatsCountry', '', NULL, 'The country where your library is located, to be shown on the Hea Koha community website', 'YesNo'),
+        ('UsageStatsCountry', '', NULL, 'The country where your library is located, to be shown on the Hea Koha community website', 'Choice'),
         ('UsageStatsID', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.',  'Free'),
         ('UsageStatsLastUpdateTime', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.', 'Free'),
         ('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
-- 
2.11.0