[Koha-patches] [PATCH] bug 2335: adding SMSSendDriver system preference - DB update to version 3.00.00.105

Andrew Moore andrew.moore at liblime.com
Wed Jul 30 18:18:02 CEST 2008


Previously, the SMSSendDriver system preference was set as a local use system
preference. This patch makes it an official system preference under the "Patron" tab.
This system preference determines which SMS::Send driver is used to send SMS messages.

I have attempted to take care to not overwrite this system preference if it has already
been set.
---
 admin/systempreferences.pl                         |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql     |    2 ++
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |   16 ++++++++++++++++
 kohaversion.pl                                     |    2 +-
 5 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 670a55c..c81146e 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -184,6 +184,7 @@ my %tabsysprefs;
     $tabsysprefs{AutoEmailOpacUser}="Patrons";
     $tabsysprefs{AutoEmailPrimaryAddress}="Patrons";
     $tabsysprefs{EnhancedMessagingPreferences}="Patrons";
+    $tabsysprefs{'SMSSendDriver'}             = 'Patrons';
 
 # I18N/L10N
     $tabsysprefs{dateformat}="I18N/L10N";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index f9139a9..a579169 100755
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -210,3 +210,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo');
 -- FIXME: add FrameworksLoaded, noOPACUserLogin, ReadingHistory ?
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free');
+
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index a059cf2..59d9930 100755
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -210,4 +210,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free');
 
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 07685ce..989b0ed 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1903,6 +1903,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.00.00.105';
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+
+    # it is possible that this syspref is already defined since the feature was added some time ago.
+    unless ( $dbh->do(q(SELECT variable FROM systempreferences WHERE variable = 'SMSSendDriver')) ) {
+        $dbh->do(<<'END_SQL');
+INSERT INTO `systempreferences`
+  (variable,value,explanation,options,type)
+VALUES
+('SMSSendDriver','','Sets which SMS::Send driver is used to send SMS messages.','','free')
+END_SQL
+    }
+    print "Upgrade to $DBversion done (added SMSSendDriver system preference)\n";
+    SetVersion($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index c73df3a..69e1628 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.00.00.104';
+    our $VERSION = '3.00.00.105';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.5.6




More information about the Koha-patches mailing list