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
            public 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_public_macros', 'Create public macros')
19
    |);
20
    $dbh->do(q|
21
        INSERT IGNORE INTO permissions (module_bit, code, description)
22
        VALUES (9, 'delete_public_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 4446-4451 CREATE TABLE return_claims ( Link Here
4446
    CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4446
    CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4447
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4447
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4448
4448
4449
--
4450
-- Table structure for table advanced_editor_macros
4451
--
4452
4453
DROP TABLE IF EXISTS advanced_editor_macros;
4454
CREATE TABLE advanced_editor_macros (
4455
    id INT(11) NOT NULL AUTO_INCREMENT,     -- Unique ID of the macro
4456
    name varchar(80) NOT NULL,              -- Name of the macro
4457
    macro longtext NULL,                    -- The macro code itself
4458
    borrowernumber INT(11) default NULL,    -- ID of the borrower who created this macro
4459
    public TINYINT(1) default 0,                   -- Bit to define if public or private macro
4460
    PRIMARY KEY (id),
4461
    CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE
4462
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4463
4449
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
4464
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
4450
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
4465
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
4451
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
4466
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/userpermissions.sql (+2 lines)
Lines 40-45 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
40
   ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
40
   ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'),
41
   ( 9, 'fast_cataloging', 'Fast cataloging'),
41
   ( 9, 'fast_cataloging', 'Fast cataloging'),
42
   ( 9, 'advanced_editor', 'Use the advanced cataloging editor (requires edit_catalogue)'),
42
   ( 9, 'advanced_editor', 'Use the advanced cataloging editor (requires edit_catalogue)'),
43
   ( 9, 'create_public_macros', 'Create public macros'),
44
   ( 9, 'delete_public_macros', 'Delete public macros'),
43
   ( 9, 'edit_items', 'Edit items'),
45
   ( 9, 'edit_items', 'Edit items'),
44
   ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
46
   ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'),
45
   ( 9, 'delete_all_items', 'Delete all items at once'),
47
   ( 9, 'delete_all_items', 'Delete all items at once'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (-1 / +10 lines)
Lines 284-289 Link Here
284
            Use the advanced cataloging editor (requires edit_catalogue)
284
            Use the advanced cataloging editor (requires edit_catalogue)
285
        </span>
285
        </span>
286
        <span class="permissioncode">([% name | html %])</span>
286
        <span class="permissioncode">([% name | html %])</span>
287
    [%- CASE 'create_public_macros' -%]
288
        <span class="sub_permission create_public_macros_subpermission">
289
            Create public macros (requires advanced_editor)
290
        </span>
291
        <span class="permissioncode">([% name | html %])</span>
292
    [%- CASE 'delete_public_macros' -%]
293
        <span class="sub_permission delete_public_macros_subpermission">
294
            Delete public macros (requires advanced_editor)
295
        </span>
296
        <span class="permissioncode">([% name | html %])</span>
287
    [%- CASE 'edit_items' -%]
297
    [%- CASE 'edit_items' -%]
288
        <span class="sub_permission edit_items_subpermission">
298
        <span class="sub_permission edit_items_subpermission">
289
            Edit items
299
            Edit items
290
- 

Return to bug 17268