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 <galen.charlton@liblime.com>
This commit is contained in:
John Beppu 2008-12-22 11:07:53 -06:00 committed by Chris Cormack
parent baf0235291
commit ba773f76d8
5 changed files with 36 additions and 3 deletions

View File

@ -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'),

View File

@ -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'),

View File

@ -2156,7 +2156,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`)
@ -2176,7 +2176,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`)

View File

@ -2097,6 +2097,35 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = '3.00.04.008';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("CREATE TABLE branch_transfer_limits (
limitId int(8) NOT NULL auto_increment,
toBranch varchar(4) NOT NULL,
fromBranch varchar(4) NOT NULL,
itemtype varchar(4) NOT NULL,
PRIMARY KEY (limitId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8"
);
$dbh->do("INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo')");
print "Upgrade to $DBversion done (added branch_transfer_limits table and UseBranchTransferLimits system preference)\n";
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)
Drop all foreign keys of the table $table

View File

@ -10,7 +10,7 @@
use strict;
sub kohaversion {
our $VERSION = '3.00.04.007';
our $VERSION = '3.00.04.009';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install