Bug 15492: New sysprefs and permissions
[koha.git] / installer / data / mysql / atomicupdate / bug_15492.perl
1 $DBversion = 'XXX';
2 if( CheckVersion( $DBversion ) ) {
3
4     $dbh->do(q{
5         INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
6         VALUES ('SelfCheckInMainUserBlock', '', '70|10', 'Add a block of HTML that will display on the self check-in screen.', 'Textarea');
7     });
8
9     $dbh->do(q{
10         INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
11         VALUES ('SelfCheckInModule', 0, NULL, 'Enable the standalone self-checkin module.', 'YesNo');
12     });
13
14     $dbh->do(q{
15         INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
16         VALUES ('SelfCheckInModuleUserID', NULL, NULL, 'Patron ID (borrowernumber) to be allowed on the self-checkin module.', 'Integer');
17     });
18
19     $dbh->do(q{
20         INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
21         VALUES ('SelfCheckInTimeout', 120, NULL, 'Define the number of seconds before the self check-in module times out.', 'Integer');
22     });
23
24     $dbh->do(q{
25         INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
26         VALUES ('SelfCheckInUserCSS', '', NULL, 'Add CSS to be included in the self check-in module in an embedded <style> tag.', 'free');
27     });
28
29     $dbh->do(q{
30         INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
31         VALUES ('SelfCheckInUserJS', '', NULL, 'Define custom javascript for inclusion in the self check-in module.', 'free');
32     });
33
34     # Add new userflag for self check
35     $dbh->do(q{
36         INSERT IGNORE INTO userflags (bit,flag,flagdesc,defaulton) VALUES
37             (23,'self_check','Self check modules',0);
38     });
39
40     # Add self check-in module subpermission
41     $dbh->do(q{
42         INSERT IGNORE INTO permissions (module_bit,code,description)
43         VALUES (23, 'self_checkin_module', 'Log into the self check-in module');
44     });
45
46     # Add self check-in module subpermission
47     $dbh->do(q{
48         INSERT IGNORE INTO permissions (module_bit,code,description)
49         VALUES (23, 'self_checkout_module', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID');
50     });
51
52     # Update patrons with self_checkout permission
53     # IMPORTANT: Needs to happen before removing the old subpermission
54     $dbh->do(q{
55         UPDATE user_permissions
56         SET module_bit = 23,
57                   code = 'self_checkout_module'
58         WHERE module_bit = 1 AND code = 'self_checkout';
59     });
60
61     # Remove old self_checkout permission
62     $dbh->do(q{
63         DELETE IGNORE FROM permissions
64         WHERE  code='self_checkout';
65     });
66
67     SetVersion( $DBversion );
68     print "Upgrade to $DBversion done (Bug 15492: Add a standalone self-checkin module)\n";
69 }