[Koha-patches] [PATCH] DB BUMP 71 : add formatstring to labels_conf for specifying labels content

Ryan Higgins rch at liblime.com
Thu Apr 17 23:24:43 CEST 2008


---
 installer/data/mysql/kohastructure.sql |    1 +
 installer/data/mysql/updatedatabase.pl |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index c87a170..964614d 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1117,6 +1117,7 @@ CREATE TABLE `labels_conf` (
   `isbn` int(1) default '0',
   `startlabel` int(2) NOT NULL default '1',
   `printingtype` char(32) default 'BAR',
+  `formatstring` varchar(64) default NULL,
   `layoutname` char(20) NOT NULL default 'TEST',
   `guidebox` int(1) default '0',
   `active` tinyint(1) default '1',
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index e8fedf1..31c6602 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1281,6 +1281,26 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.00.00.070";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(" ALTER TABLE `subscription` ADD `serialsadditems` TINYINT( 1 ) NOT NULL DEFAULT '0';");
+    # fill the new field with the previous systempreference value, then drop the syspref
+    my $sth = $dbh->prepare("SELECT value FROM systempreferences WHERE variable='serialsadditems'");
+    $sth->execute;
+    my ($serialsadditems) = $sth->fetchrow();
+    $dbh->do("UPDATE subscription SET serialsadditems=$serialsadditems");
+    $dbh->do("DELETE FROM systempreferences WHERE variable='serialsadditems'");
+    print "Upgrade to $DBversion done ( moving serialsadditems from syspref to subscription )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.00.00.071";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE labels_conf ADD COLUMN formatstring VARCHAR(64) DEFAULT NULL;");
+	print "Upgrade to $DBversion done ( Adding format string to labels generator. )\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.5.2.1




More information about the Koha-patches mailing list