View | Details | Raw Unified | Return to bug 17268
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl (+27 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    unless ( TableExists('advanced_editor_macros') ) {
4
        $dbh->do(q|
5
            CREATE TABLE advanced_editor_macros (
6
            id INT(11) NOT NULL AUTO_INCREMENT,
7
            name varchar(80) NOT NULL,
8
            macro longtext NULL,
9
            borrowernumber INT(11) default NULL,
10
            shared TINYINT(1) default 0,
11
            PRIMARY KEY (id),
12
            CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE
13
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;|
14
        );
15
    }
16
    $dbh->do(q|
17
        INSERT IGNORE INTO permissions (module_bit, code, description)
18
        VALUES (9, 'create_shared_macros', 'Create public macros')
19
    |);
20
    $dbh->do(q|
21
        INSERT IGNORE INTO permissions (module_bit, code, description)
22
        VALUES (9, 'delete_shared_macros', 'Delete public macros')
23
    |);
24
25
    SetVersion( $DBversion );
26
    print "Upgrade to $DBversion done (Bug 17682 - Add macros db table and permissions)\n";
27
}
(-)a/installer/data/mysql/kohastructure.sql (+15 lines)
Lines 4475-4480 CREATE TABLE `problem_reports` ( Link Here
4475
    CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4475
    CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
4476
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4476
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4477
4477
4478
--
4479
-- Table structure for table advanced_editor_macros
4480
--
4481
4482
DROP TABLE IF EXISTS advanced_editor_macros;
4483
CREATE TABLE advanced_editor_macros (
4484
    id INT(11) NOT NULL AUTO_INCREMENT,     -- Unique ID of the macro
4485
    name varchar(80) NOT NULL,              -- Name of the macro
4486
    macro longtext NULL,                    -- The macro code itself
4487
    borrowernumber INT(11) default NULL,    -- ID of the borrower who created this macro
4488
    shared TINYINT(1) default 0,            -- Bit to define if shared or private macro
4489
    PRIMARY KEY (id),
4490
    CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE
4491
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4492
4478
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
4493
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
4479
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
4494
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
4480
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
4495
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/userpermissions.sql (+2 lines)
Lines 41-46 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
41
   ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
41
   ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
42
   ( 9, 'fast_cataloging', 'Fast cataloging'),
42
   ( 9, 'fast_cataloging', 'Fast cataloging'),
43
   ( 9, 'advanced_editor', 'Use the advanced cataloging editor (requires edit_catalogue)'),
43
   ( 9, 'advanced_editor', 'Use the advanced cataloging editor (requires edit_catalogue)'),
44
   ( 9, 'create_shared_macros', 'Create shared macros'),
45
   ( 9, 'delete_shared_macros', 'Delete shared macros'),
44
   ( 9, 'edit_items', 'Edit items'),
46
   ( 9, 'edit_items', 'Edit items'),
45
   ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
47
   ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
46
   ( 9, 'delete_all_items', 'Delete all items at once'),
48
   ( 9, 'delete_all_items', 'Delete all items at once'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (-1 / +10 lines)
Lines 290-295 Link Here
290
            Use the advanced cataloging editor (requires edit_catalogue)
290
            Use the advanced cataloging editor (requires edit_catalogue)
291
        </span>
291
        </span>
292
        <span class="permissioncode">([% name | html %])</span>
292
        <span class="permissioncode">([% name | html %])</span>
293
    [%- CASE 'create_shared_macros' -%]
294
        <span class="sub_permission create_shared_macros_subpermission">
295
            Create shared macros (requires advanced_editor)
296
        </span>
297
        <span class="permissioncode">([% name | html %])</span>
298
    [%- CASE 'delete_shared_macros' -%]
299
        <span class="sub_permission delete_shared_macros_subpermission">
300
            Delete shared macros (requires advanced_editor)
301
        </span>
302
        <span class="permissioncode">([% name | html %])</span>
293
    [%- CASE 'edit_items' -%]
303
    [%- CASE 'edit_items' -%]
294
        <span class="sub_permission edit_items_subpermission">
304
        <span class="sub_permission edit_items_subpermission">
295
            Edit items
305
            Edit items
296
- 

Return to bug 17268