From fe5cc9933f800a17d83f8bd3878f6d59c023e739 Mon Sep 17 00:00:00 2001 From: John Beppu Date: Mon, 22 Dec 2008 11:07:53 -0600 Subject: [PATCH] bug 2874 [1/3]: schema changes for overriding blocked renewals Two new subpermissions of circulate were added: - circulate_remaining_permissions - override_renewals Also, the following schema alterations were made - permissions.code : varchar(30) => varchar(64) - user_permissions.code : varchar(30) => varchar(64) (The reason for this was because "circulate_remaining_permissions" was greater than 30 characters long and wouldn't fit.) Signed-off-by: Galen Charlton --- installer/data/mysql/en/mandatory/userpermissions.sql | 2 ++ .../data/mysql/fr-FR/1-Obligatoire/userpermissions.sql | 2 ++ installer/data/mysql/kohastructure.sql | 4 ++-- installer/data/mysql/updatedatabase.pl | 9 +++++++++ kohaversion.pl | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql index 8f7e1c391f..29b3b0526c 100644 --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ b/installer/data/mysql/en/mandatory/userpermissions.sql @@ -1,4 +1,6 @@ INSERT INTO permissions (module_bit, code, description) VALUES + ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), + ( 1, 'override_renewals', 'Override blocked renewals'), (13, 'edit_news', 'Write news for the OPAC and staff interfaces'), (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'), (13, 'edit_calendar', 'Define days when the library is closed'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql index 8f7e1c391f..29b3b0526c 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql @@ -1,4 +1,6 @@ INSERT INTO permissions (module_bit, code, description) VALUES + ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'), + ( 1, 'override_renewals', 'Override blocked renewals'), (13, 'edit_news', 'Write news for the OPAC and staff interfaces'), (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'), (13, 'edit_calendar', 'Define days when the library is closed'), diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fe924e6fa0..a8d4e8dea7 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2153,7 +2153,7 @@ CREATE TABLE language_script_mapping ( DROP TABLE IF EXISTS `permissions`; CREATE TABLE `permissions` ( `module_bit` int(11) NOT NULL DEFAULT 0, - `code` varchar(30) DEFAULT NULL, + `code` varchar(64) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`module_bit`, `code`), CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) @@ -2173,7 +2173,7 @@ DROP TABLE IF EXISTS `user_permissions`; CREATE TABLE `user_permissions` ( `borrowernumber` int(11) NOT NULL DEFAULT 0, `module_bit` int(11) NOT NULL DEFAULT 0, - `code` varchar(30) DEFAULT NULL, + `code` varchar(64) DEFAULT NULL, CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ba533919f9..5a2209eca7 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2113,6 +2113,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.009"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE permissions MODIFY `code` varchar(64) DEFAULT NULL"); + $dbh->do("ALTER TABLE user_permissions MODIFY `code` varchar(64) DEFAULT NULL"); + $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions')"); + $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'override_renewals', 'Override blocked renewals')"); + print "Upgrade to $DBversion done (added subpermissions for circulate permission)\n"; + SetVersion ($DBversion); +} =item DropAllForeignKeys($table) diff --git a/kohaversion.pl b/kohaversion.pl index 9baede23fc..510a3c3ccb 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.008'; + our $VERSION = '3.01.00.009'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5