Koha/installer/data/mysql/db_revs/221200045.pl
Tomas Cohen Arazi 9633c0a7de
Bug 33297: DBRev 22.12.00.045
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-16 15:17:25 -03:00

30 lines
1.3 KiB
Perl
Executable file

use Modern::Perl;
return {
bug_number => "33297",
description => "Fix missing 's' in system preference 'RetainPatronSearchTerms'",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
my ($wrong_syspref_exists) = $dbh->selectrow_array(q{
SELECT COUNT(*) FROM systempreferences WHERE variable='RetainPatronSearchTerms'
});
if ($wrong_syspref_exists) {
# Correct preference may have been generated via interface
my ($correct_syspref_exists) = $dbh->selectrow_array(q{
SELECT COUNT(*) FROM systempreferences WHERE variable='RetainPatronsSearchTerms'
});
if ( $correct_syspref_exists ) {
$dbh->do(q{
DELETE FROM systempreferences WHERE variable='RetainPatronSearchTerms'
});
say $out "Wrong system preference 'RetainPatronSearchTerms' deleted";
} else {
$dbh->do(q{
UPDATE systempreferences SET variable='RetainPatronsSearchTerms' WHERE variable='RetainPatronSearchTerms'
});
say $out "Wrong system preference 'RetainPatronSearchTerms' renamed 'RetainPatronsSearchTerms'";
}
}
},
};