[Koha-patches] [PATCH] Bug 1883 follow-up: Adding default OPAC_SUG values

Owen Leonard oleonard at myacpl.org
Mon Feb 7 21:54:11 CET 2011


Adds two default authorized values in the category OPAC_SUG:

damaged, "The copy on the shelf is damaged"
bestseller, "Upcoming title by popular author"
---
 installer/data/mysql/updatedatabase.pl |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 4618636..732fb58 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3987,6 +3987,20 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.03.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+
+    my ($opac_sug_count);
+    eval { $opac_sug_count = $dbh->do("SELECT 1 FROM authorised_values WHERE category='OPAC_SUG'"); };
+    if ($opac_sug_count == 0) {
+        $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','The copy on the shelf is damaged','The copy on the shelf is damaged')");
+        $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Upcoming title by popular author','Upcoming title by popular author')");
+    }
+
+    print "Upgrade to $DBversion done: Adding some default authorized values in the OPAC_SUG category for patrons to select when submitting a suggestion (Bug 1883)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
-- 
1.7.3



More information about the Koha-patches mailing list