[Koha-patches] [PATCH] Bug 5668: Follow up - Star ratings

Katrin Fischer Katrin.Fischer.83 at web.de
Sun Jan 15 23:06:32 CET 2012


- adds new system preference OpacStarRatings to sysprefs.sql file
  - changes NULL NULL to 'yes|no|details','Choice'
- changes updatedatabase.pl
  - removes mysqlisms from the table definition
  - changes INSERT to make it more robust and match sysprefs.sql
---
 installer/data/mysql/sysprefs.sql      |    1 +
 installer/data/mysql/updatedatabase.pl |   18 +++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 918df5c..35f6f59 100755
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -330,3 +330,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','0',NULL,'yes|no|details','Choice');
\ No newline at end of file
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 1c2b9c3..631ad8c 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4621,17 +4621,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = '3.07.00.XXX';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do( qq |
- CREATE TABLE `ratings` (
-  `borrowernumber` int(11) NOT NULL,
-  `biblionumber` int(11) NOT NULL,
-  `rating_value` tinyint(1) NOT NULL,
-  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
-  PRIMARY KEY  (`borrowernumber`,`biblionumber`),
-  KEY `ratings_borrowers_fk_1` (`borrowernumber`),
-  KEY `ratings_biblionumber_fk_1` (`biblionumber`)
+ CREATE TABLE ratings (
+  borrowernumber int(11) NOT NULL,
+  biblionumber int(11) NOT NULL,
+  rating_value tinyint(1) NOT NULL,
+  timestamp timestamp NOT NULL default CURRENT_TIMESTAMP,
+  PRIMARY KEY  (borrowernumber,biblionumber),
+  KEY ratings_borrowers_fk_1 (borrowernumber),
+  KEY ratings_biblionumber_fk_1 (biblionumber)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |);
 
-    $dbh->do(qq|INSERT INTO `systempreferences` VALUES ('OpacStarRatings','0',NULL,NULL,NULL)|);
+    $dbh->do(qq/INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','0',NULL,'yes|no|details','Choice');/);
     print "Upgrade to $DBversion done (Add 'ratings' table and 'OpacStarRatings' syspref)\n";
     SetVersion($DBversion);
 }
-- 
1.7.5.4



More information about the Koha-patches mailing list