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

(-)a/installer/data/mysql/atomicupdate/bug_34979.pl (-44 / +66 lines)
Lines 8-96 return { Link Here
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
9
10
        # Fix missing system preferences
10
        # Fix missing system preferences
11
        say $out "Add missing system preferences, if necessary:";
11
        say $out "Fix mistakes in system preferences, if necessary:";
12
        my @missing;
13
12
        $dbh->do(
14
        $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')}
15
            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
        );
16
            ) == 1
15
        say $out "Added system preference 'RecordStaffUserOnCheckout'";
17
            && push @missing, "RecordStaffUserOnCheckout";
16
18
17
        $dbh->do(
19
        $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')}
20
            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
        );
21
            ) == 1
20
        say $out "Added system preference 'HidePersonalPatronDetailOnCirculation'";
22
            && push @missing, "HidePersonalPatronDetailOnCirculation";
21
23
22
        $dbh->do(
24
        $dbh->do(
23
            q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free')}
25
            q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free')}
24
        );
26
            ) == 1
25
        say $out "Added system preference 'OverDriveWebsiteID'";
27
            && push @missing, "OverDriveWebsiteID";
26
28
27
        $dbh->do(
29
        $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')}
30
            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
        );
31
            ) == 1
30
        say $out "Added system preference 'OverDriveAuthName'";
32
            && push @missing, "OverDriveAuthName";
31
33
32
        $dbh->do(
34
        $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')}
35
            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
        );
36
            ) == 1
35
        say $out "Added system preference 'OPACDetailQRCode'";
37
            && push @missing, "OPACDetailQRCode";
36
38
37
        $dbh->do(
39
        $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')}
40
            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
        );
41
            ) == 1
40
        say $out "Added system preference 'OPACPopupAuthorsSearch'";
42
            && push @missing, "OPACPopupAuthorsSearch";
41
43
42
        $dbh->do(
44
        $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')}
45
            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
        );
46
            ) == 1
45
        say $out "Added system preference 'OPACSuggestionMandatoryFields'";
47
            && push @missing, "OPACSuggestionMandatoryFields";
46
48
47
        $dbh->do(
49
        $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')}
50
            q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACShibOnly','0','If ON enables shibboleth only authentication for the opac','','YesNo')}
49
        );
51
            ) == 1
50
        say $out "Added system preference 'OPACShibOnly'";
52
            && push @missing, "OPACShibOnly";
51
53
52
        $dbh->do(
54
        $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'}
55
            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
        );
56
            ) == 1
55
        say $out "Added system preference 'IntranetReadingHistoryHolds'";
57
            && push @missing, "IntranetReadingHistoryHolds";
56
58
57
        $dbh->do(
59
        $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')}
60
            q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo')}
59
        );
61
            ) == 1
60
        say $out "Added system preference 'AutoApprovePatronProfileSettings'";
62
            && push @missing, "AutoApprovePatronProfileSettings";
61
63
62
        $dbh->do(
64
        $dbh->do(
63
            q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES  ('EmailSMSSendDriverFromAddress', '', '', 'Email SMS send driver from address override', 'Free')}
65
            q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES  ('EmailSMSSendDriverFromAddress', '', '', 'Email SMS send driver from address override', 'Free')}
64
        );
66
            ) == 1
65
        say $out "Added system preference 'EmailSMSSendDriverFromAddress'";
67
            && push @missing, "EmailSMSSendDriverFromAddress";
66
68
67
        $dbh->do(
69
        $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')}
70
            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
        );
71
            ) == 1
70
        say $out "Added system preference 'staffShibOnly'";
72
            && push @missing, "staffShibOnly";
71
73
72
        $dbh->do(
74
        $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')}
75
            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
        );
76
            ) == 1
75
        say $out "Added system preference 'ManaToken'";
77
            && push @missing, "ManaToken";
76
78
77
        say $out "Fix mis-spelled system preferences";
79
        # Fix mis-spelled system preferences
78
80
        my @misspelled;
79
        # Fix Mis-spelled system preference
81
        my $pref;
80
        $dbh->do(
82
81
            q{UPDATE systempreferences SET variable = 'OAI-PMH:AutoUpdateSetsEmbedItemData' WHERE variable = "OAI-PMH:AutoUpdateSetEmbedItemData"}
83
        $pref = $dbh->selectrow_array(
82
        );
84
            q{SELECT variable FROM systempreferences WHERE variable = 'OAI-PMH:AutoUpdateSetEmbedItemData'});
83
        say $out "Updated system preference 'AutoUpdateSetsEmbedItemData'";
85
        if ( $pref eq "OAI-PMH:AutoUpdateSetEmbedItemData" ) {
86
            $dbh->do(
87
                q{UPDATE systempreferences SET variable = 'OAI-PMH:AutoUpdateSetsEmbedItemData' WHERE variable = "OAI-PMH:AutoUpdateSetEmbedItemData"}
88
            );
89
            push @misspelled, "AutoUpdateSetsEmbedItemData";
90
        }
84
91
85
        # Fix capitalization issues breaking unit tests
92
        # Fix capitalization issues breaking unit tests
86
        $dbh->do(q{UPDATE systempreferences SET variable = 'ReplytoDefault' WHERE variable = "ReplyToDefault"});
93
        $pref = $dbh->selectrow_array(q{SELECT variable FROM systempreferences WHERE variable = 'ReplyToDefault'});
87
        say $out "Updated system preference 'ReplytoDefault'";
94
        if ( $pref eq "ReplyToDefault" ) {
88
95
            $dbh->do(q{UPDATE systempreferences SET variable = 'ReplytoDefault' WHERE variable = "ReplyToDefault"});
89
        $dbh->do(q{UPDATE systempreferences SET variable = 'OPACPrivacy' WHERE variable = "OpacPrivacy"});
96
            push @misspelled, "ReplyToDefault";
90
        say $out "Updated system preference 'OPACPrivacy'";
97
        }
98
99
        $pref = $dbh->selectrow_array(q{SELECT variable FROM systempreferences WHERE variable = 'OpacPrivacy'});
100
        if ( $pref eq "OpacPrivacy" ) {
101
            $dbh->do(q{UPDATE systempreferences SET variable = 'OPACPrivacy' WHERE variable = "OpacPrivacy"});
102
            push @misspelled, "OPACPrivacy";
103
        }
104
105
        $pref =
106
            $dbh->selectrow_array(q{SELECT variable FROM systempreferences WHERE variable = 'IllCheckAvailability'});
107
        if ( $pref eq "IllCheckAvailability" ) {
108
            $dbh->do(
109
                q{UPDATE systempreferences SET variable = 'ILLCheckAvailability' WHERE variable = "IllCheckAvailability"}
110
            );
111
            push @misspelled, "IllCheckAvailability";
112
        }
113
114
        if ( @missing > 0 )    { say $out "Added system preferences: " . join( ", ", @missing ); }
115
        if ( @misspelled > 0 ) { say $out "Updated system preferences: " . join( ", ", @misspelled ); }
116
        if ( @missing == 0 && @misspelled == 0 ) { say $out "No updates required."; }
91
117
92
        $dbh->do(
93
            q{UPDATE systempreferences SET variable = 'ILLCheckAvailability' WHERE variable = "IllCheckAvailability"});
94
        say $out "Updated system preference 'ILLCheckAvailability'";
95
    },
118
    },
96
};
119
};
97
- 

Return to bug 34979