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 4418-4423 CREATE TABLE return_claims ( Link Here
4418
    CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4418
    CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4419
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4419
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4420
4420
4421
--
4422
-- Table structure for table advanced_editor_macros
4423
--
4424
4425
DROP TABLE IF EXISTS advanced_editor_macros;
4426
CREATE TABLE advanced_editor_macros (
4427
    id INT(11) NOT NULL AUTO_INCREMENT,     -- Unique ID of the macro
4428
    name varchar(80) NOT NULL,              -- Name of the macro
4429
    macro longtext NULL,                    -- The macro code itself
4430
    borrowernumber INT(11) default NULL,    -- ID of the borrower who created this macro
4431
    shared TINYINT(1) default 0,            -- Bit to define if shared or private macro
4432
    PRIMARY KEY (id),
4433
    CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE
4434
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4435
4421
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
4436
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
4422
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
4437
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
4423
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
4438
/*!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 287-292 Link Here
287
            Use the advanced cataloging editor (requires edit_catalogue)
287
            Use the advanced cataloging editor (requires edit_catalogue)
288
        </span>
288
        </span>
289
        <span class="permissioncode">([% name | html %])</span>
289
        <span class="permissioncode">([% name | html %])</span>
290
    [%- CASE 'create_shared_macros' -%]
291
        <span class="sub_permission create_shared_macros_subpermission">
292
            Create shared macros (requires advanced_editor)
293
        </span>
294
        <span class="permissioncode">([% name | html %])</span>
295
    [%- CASE 'delete_shared_macros' -%]
296
        <span class="sub_permission delete_shared_macros_subpermission">
297
            Delete shared macros (requires advanced_editor)
298
        </span>
299
        <span class="permissioncode">([% name | html %])</span>
290
    [%- CASE 'edit_items' -%]
300
    [%- CASE 'edit_items' -%]
291
        <span class="sub_permission edit_items_subpermission">
301
        <span class="sub_permission edit_items_subpermission">
292
            Edit items
302
            Edit items
293
- 

Return to bug 17268