Bug 17268: Add macros table and permissions

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Heather Hernandez <Heather_Hernandez@nps.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick 2019-10-02 13:28:39 +00:00 committed by Martin Renvoize
parent 3d953d7988
commit 8b6be7cced
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,27 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
unless ( TableExists('advanced_editor_macros') ) {
$dbh->do(q|
CREATE TABLE advanced_editor_macros (
id INT(11) NOT NULL AUTO_INCREMENT,
name varchar(80) NOT NULL,
macro longtext NULL,
borrowernumber INT(11) default NULL,
shared TINYINT(1) default 0,
PRIMARY KEY (id),
CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;|
);
}
$dbh->do(q|
INSERT IGNORE INTO permissions (module_bit, code, description)
VALUES (9, 'create_shared_macros', 'Create public macros')
|);
$dbh->do(q|
INSERT IGNORE INTO permissions (module_bit, code, description)
VALUES (9, 'delete_shared_macros', 'Delete public macros')
|);
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 17682 - Add macros db table and permissions)\n";
}

View File

@ -4476,6 +4476,21 @@ CREATE TABLE `problem_reports` (
CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table advanced_editor_macros
--
DROP TABLE IF EXISTS advanced_editor_macros;
CREATE TABLE advanced_editor_macros (
id INT(11) NOT NULL AUTO_INCREMENT, -- Unique ID of the macro
name varchar(80) NOT NULL, -- Name of the macro
macro longtext NULL, -- The macro code itself
borrowernumber INT(11) default NULL, -- ID of the borrower who created this macro
shared TINYINT(1) default 0, -- Bit to define if shared or private macro
PRIMARY KEY (id),
CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@ -41,6 +41,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES
( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
( 9, 'fast_cataloging', 'Fast cataloging'),
( 9, 'advanced_editor', 'Use the advanced cataloging editor (requires edit_catalogue)'),
( 9, 'create_shared_macros', 'Create shared macros'),
( 9, 'delete_shared_macros', 'Delete shared macros'),
( 9, 'edit_items', 'Edit items'),
( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
( 9, 'delete_all_items', 'Delete all items at once'),

View File

@ -290,6 +290,16 @@
Use the advanced cataloging editor (requires edit_catalogue)
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'create_shared_macros' -%]
<span class="sub_permission create_shared_macros_subpermission">
Create shared macros (requires advanced_editor)
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'delete_shared_macros' -%]
<span class="sub_permission delete_shared_macros_subpermission">
Delete shared macros (requires advanced_editor)
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'edit_items' -%]
<span class="sub_permission edit_items_subpermission">
Edit items