Bug 30025: DBRev 22.06.00.047
[koha.git] / installer / data / mysql / db_revs / 220600047.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => "30025",
5     description => "Split and rename BiblioAddsAuthorities system preference",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9         my $biblio_adds_authorities = C4::Context->preference('BiblioAddsAuthorities');
10         # Do you stuffs here
11         $dbh->do(q{
12             INSERT IGNORE INTO systempreferences
13             ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
14             ('RequireChoosingExistingAuthority',?,NULL,'Require selecting existing authority entry in controlled fields during cataloging.','YesNo'),
15             ('AutoLinkBiblios',?,NULL,'If enabled, link biblio to authorities on creation and edit','YesNo')
16         },undef,($biblio_adds_authorities eq '1' ? '0' : '1', $biblio_adds_authorities));
17         say $out "Added RequireChoosingExistingAuthority and AutoLinkBiblios";
18         $dbh->do(q{DELETE FROM systempreferences WHERE variable="BiblioAddsAuthorities";});
19         say $out "BiblioAddsAuthorities removed";
20     },
21 };