Bug 34979: (follow-up) Only print message when preference was added
Implements Joubu's suggestion from comment#14 and improves
on it for the cases where we fix capitalization.
Test plan remains unchanged. You can run the database update
a second time to see the difference.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 92d98c1808
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
84d9dea1ae
commit
ad4c72aa8c
1 changed files with 63 additions and 40 deletions
|
@ -8,89 +8,112 @@ return {
|
|||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
# Fix missing system preferences
|
||||
say $out "Add missing system preferences, if necessary:";
|
||||
say $out "Fix mistakes in system preferences, if necessary:";
|
||||
my @missing;
|
||||
|
||||
$dbh->do(
|
||||
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')}
|
||||
);
|
||||
say $out "Added system preference 'RecordStaffUserOnCheckout'";
|
||||
) == 1
|
||||
&& push @missing, "RecordStaffUserOnCheckout";
|
||||
|
||||
$dbh->do(
|
||||
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')}
|
||||
);
|
||||
say $out "Added system preference 'HidePersonalPatronDetailOnCirculation'";
|
||||
) == 1
|
||||
&& push @missing, "HidePersonalPatronDetailOnCirculation";
|
||||
|
||||
$dbh->do(
|
||||
q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free')}
|
||||
);
|
||||
say $out "Added system preference 'OverDriveWebsiteID'";
|
||||
) == 1
|
||||
&& push @missing, "OverDriveWebsiteID";
|
||||
|
||||
$dbh->do(
|
||||
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')}
|
||||
);
|
||||
say $out "Added system preference 'OverDriveAuthName'";
|
||||
) == 1
|
||||
&& push @missing, "OverDriveAuthName";
|
||||
|
||||
$dbh->do(
|
||||
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')}
|
||||
);
|
||||
say $out "Added system preference 'OPACDetailQRCode'";
|
||||
) == 1
|
||||
&& push @missing, "OPACDetailQRCode";
|
||||
|
||||
$dbh->do(
|
||||
q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACPopupAuthorsSearch','0','Display the list of authors when clicking on one author.','','YesNo')}
|
||||
);
|
||||
say $out "Added system preference 'OPACPopupAuthorsSearch'";
|
||||
) == 1
|
||||
&& push @missing, "OPACPopupAuthorsSearch";
|
||||
|
||||
$dbh->do(
|
||||
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')}
|
||||
);
|
||||
say $out "Added system preference 'OPACSuggestionMandatoryFields'";
|
||||
) == 1
|
||||
&& push @missing, "OPACSuggestionMandatoryFields";
|
||||
|
||||
$dbh->do(
|
||||
q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACShibOnly','0','If ON enables shibboleth only authentication for the opac','','YesNo')}
|
||||
);
|
||||
say $out "Added system preference 'OPACShibOnly'";
|
||||
) == 1
|
||||
&& push @missing, "OPACShibOnly";
|
||||
|
||||
$dbh->do(
|
||||
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'}
|
||||
);
|
||||
say $out "Added system preference 'IntranetReadingHistoryHolds'";
|
||||
) == 1
|
||||
&& push @missing, "IntranetReadingHistoryHolds";
|
||||
|
||||
$dbh->do(
|
||||
q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo')}
|
||||
);
|
||||
say $out "Added system preference 'AutoApprovePatronProfileSettings'";
|
||||
) == 1
|
||||
&& push @missing, "AutoApprovePatronProfileSettings";
|
||||
|
||||
$dbh->do(
|
||||
q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('EmailSMSSendDriverFromAddress', '', '', 'Email SMS send driver from address override', 'Free')}
|
||||
);
|
||||
say $out "Added system preference 'EmailSMSSendDriverFromAddress'";
|
||||
) == 1
|
||||
&& push @missing, "EmailSMSSendDriverFromAddress";
|
||||
|
||||
$dbh->do(
|
||||
q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('staffShibOnly','0','If ON enables shibboleth only authentication for the staff client','','YesNo')}
|
||||
);
|
||||
say $out "Added system preference 'staffShibOnly'";
|
||||
) == 1
|
||||
&& push @missing, "staffShibOnly";
|
||||
|
||||
$dbh->do(
|
||||
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')}
|
||||
);
|
||||
say $out "Added system preference 'ManaToken'";
|
||||
) == 1
|
||||
&& push @missing, "ManaToken";
|
||||
|
||||
say $out "Fix mis-spelled system preferences";
|
||||
# Fix mis-spelled system preferences
|
||||
my @misspelled;
|
||||
my $pref;
|
||||
|
||||
# Fix Mis-spelled system preference
|
||||
$dbh->do(
|
||||
q{UPDATE systempreferences SET variable = 'OAI-PMH:AutoUpdateSetsEmbedItemData' WHERE variable = "OAI-PMH:AutoUpdateSetEmbedItemData"}
|
||||
);
|
||||
say $out "Updated system preference 'AutoUpdateSetsEmbedItemData'";
|
||||
$pref = $dbh->selectrow_array(
|
||||
q{SELECT variable FROM systempreferences WHERE variable = 'OAI-PMH:AutoUpdateSetEmbedItemData'});
|
||||
if ( $pref eq "OAI-PMH:AutoUpdateSetEmbedItemData" ) {
|
||||
$dbh->do(
|
||||
q{UPDATE systempreferences SET variable = 'OAI-PMH:AutoUpdateSetsEmbedItemData' WHERE variable = "OAI-PMH:AutoUpdateSetEmbedItemData"}
|
||||
);
|
||||
push @misspelled, "AutoUpdateSetsEmbedItemData";
|
||||
}
|
||||
|
||||
# Fix capitalization issues breaking unit tests
|
||||
$dbh->do(q{UPDATE systempreferences SET variable = 'ReplytoDefault' WHERE variable = "ReplyToDefault"});
|
||||
say $out "Updated system preference 'ReplytoDefault'";
|
||||
$pref = $dbh->selectrow_array(q{SELECT variable FROM systempreferences WHERE variable = 'ReplyToDefault'});
|
||||
if ( $pref eq "ReplyToDefault" ) {
|
||||
$dbh->do(q{UPDATE systempreferences SET variable = 'ReplytoDefault' WHERE variable = "ReplyToDefault"});
|
||||
push @misspelled, "ReplyToDefault";
|
||||
}
|
||||
|
||||
$dbh->do(q{UPDATE systempreferences SET variable = 'OPACPrivacy' WHERE variable = "OpacPrivacy"});
|
||||
say $out "Updated system preference 'OPACPrivacy'";
|
||||
$pref = $dbh->selectrow_array(q{SELECT variable FROM systempreferences WHERE variable = 'OpacPrivacy'});
|
||||
if ( $pref eq "OpacPrivacy" ) {
|
||||
$dbh->do(q{UPDATE systempreferences SET variable = 'OPACPrivacy' WHERE variable = "OpacPrivacy"});
|
||||
push @misspelled, "OPACPrivacy";
|
||||
}
|
||||
|
||||
$pref =
|
||||
$dbh->selectrow_array(q{SELECT variable FROM systempreferences WHERE variable = 'IllCheckAvailability'});
|
||||
if ( $pref eq "IllCheckAvailability" ) {
|
||||
$dbh->do(
|
||||
q{UPDATE systempreferences SET variable = 'ILLCheckAvailability' WHERE variable = "IllCheckAvailability"}
|
||||
);
|
||||
push @misspelled, "IllCheckAvailability";
|
||||
}
|
||||
|
||||
if ( @missing > 0 ) { say $out "Added system preferences: " . join( ", ", @missing ); }
|
||||
if ( @misspelled > 0 ) { say $out "Updated system preferences: " . join( ", ", @misspelled ); }
|
||||
if ( @missing == 0 && @misspelled == 0 ) { say $out "No updates required."; }
|
||||
|
||||
$dbh->do(
|
||||
q{UPDATE systempreferences SET variable = 'ILLCheckAvailability' WHERE variable = "IllCheckAvailability"});
|
||||
say $out "Updated system preference 'ILLCheckAvailability'";
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue