Bug 34979: Fix mistakes in system preference files highlighted by unit test
[koha.git] / installer / data / mysql / atomicupdate / bug_34979.pl
1 use Modern::Perl;
2
3 return {
4     bug_number  => "34979",
5     description => "Fix system preference discrepancies",
6     up          => sub {
7         my ($args) = @_;
8         my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10         # Fix missing system preferences
11         say $out "Add missing system preferences, if necessary:";
12         $dbh->do(
13             q{INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('RecordStaffUserOnCheckout', '0', 'If enabled, when an item is checked out, the user who checked out the item is recorded', '', 'YesNo')}
14         );
15         say $out "Added system preference 'RecordStaffUserOnCheckout'";
16
17         $dbh->do(
18             q{INSERT IGNORE INTO  systempreferences (variable, value, options, explanation) VALUES ('HidePersonalPatronDetailOnCirculation', 0, 'YesNo', 'Hide patrons phone number, email address, street address and city in the circulation page')}
19         );
20         say $out "Added system preference 'HidePersonalPatronDetailOnCirculation'";
21
22         $dbh->do(
23             q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free')}
24         );
25         say $out "Added system preference 'OverDriveWebsiteID'";
26
27         $dbh->do(
28             q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveAuthName','','Authentication for OverDrive integration, used as fallback when no OverDrive library authnames are set','','Free')}
29         );
30         say $out "Added system preference 'OverDriveAuthName'";
31
32         $dbh->do(
33             q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('OPACDetailQRCode','0','','Enable the display of a QR Code on the OPAC detail page','YesNo')}
34         );
35         say $out "Added system preference 'OPACDetailQRCode'";
36
37         $dbh->do(
38             q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACPopupAuthorsSearch','0','Display the list of authors when clicking on one author.','','YesNo')}
39         );
40         say $out "Added system preference 'OPACPopupAuthorsSearch'";
41
42         $dbh->do(
43             q{INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('OPACSuggestionMandatoryFields','title','','Define the mandatory fields for a patron purchase suggestions made via OPAC.','multiple')}
44         );
45         say $out "Added system preference 'OPACSuggestionMandatoryFields'";
46
47         $dbh->do(
48             q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACShibOnly','0','If ON enables shibboleth only authentication for the opac','','YesNo')}
49         );
50         say $out "Added system preference 'OPACShibOnly'";
51
52         $dbh->do(
53             q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) SELECT 'IntranetReadingHistoryHolds', value, '', 'If ON, Holds history is enabled for all patrons', 'YesNo' FROM systempreferences WHERE variable = 'intranetreadinghistory'}
54         );
55         say $out "Added system preference 'IntranetReadingHistoryHolds'";
56
57         $dbh->do(
58             q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo')}
59         );
60         say $out "Added system preference 'AutoApprovePatronProfileSettings'";
61
62         $dbh->do(
63             q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES  ('EmailSMSSendDriverFromAddress', '', '', 'Email SMS send driver from address override', 'Free')}
64         );
65         say $out "Added system preference 'EmailSMSSendDriverFromAddress'";
66
67         $dbh->do(
68             q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('staffShibOnly','0','If ON enables shibboleth only authentication for the staff client','','YesNo')}
69         );
70         say $out "Added system preference 'staffShibOnly'";
71
72         $dbh->do(
73             q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('ManaToken','',NULL,'Security token used for authentication on Mana KB service (anti spam)','Textarea')}
74         );
75         say $out "Added system preference 'ManaToken'";
76
77         say $out "Fix mis-spelled system preferences";
78
79         # Fix Mis-spelled system preference
80         $dbh->do(
81             q{UPDATE systempreferences SET variable = 'OAI-PMH:AutoUpdateSetsEmbedItemData' WHERE variable = "OAI-PMH:AutoUpdateSetEmbedItemData"}
82         );
83         say $out "Updated system preference 'AutoUpdateSetsEmbedItemData'";
84
85         # Fix capitalization issues breaking unit tests
86         $dbh->do(q{UPDATE systempreferences SET variable = 'ReplytoDefault' WHERE variable = "ReplyToDefault"});
87         say $out "Updated system preference 'ReplytoDefault'";
88
89         $dbh->do(q{UPDATE systempreferences SET variable = 'OPACPrivacy' WHERE variable = "OpacPrivacy"});
90         say $out "Updated system preference 'OPACPrivacy'";
91
92         $dbh->do(
93             q{UPDATE systempreferences SET variable = 'ILLCheckAvailability' WHERE variable = "IllCheckAvailability"});
94         say $out "Updated system preference 'ILLCheckAvailability'";
95     },
96 };