Bug 21729: DBRev 21.12.00.010
[koha.git] / installer / data / mysql / db_revs / 210600046.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => "24224",
5     description => "Move contents of OpacNavBottom system preference into additional contents",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9
10         # Get any existing value from the OpacNavBottom system preference
11         my ($opacnavbottom) = $dbh->selectrow_array( q|
12             SELECT value FROM systempreferences WHERE variable='OpacNavBottom';
13         |);
14         if( $opacnavbottom ){
15             # If there is a value in the OpacNavBottom preference, insert it into additional_contents
16             $dbh->do( "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacNavBottom', 'OpacNavBottom', NULL, ?, ?, 'default', CAST(NOW() AS date) )", undef, "OpacNavBottom default", $opacnavbottom );
17
18             # Remove the OpacNavBottom system preference
19             $dbh->do("DELETE FROM systempreferences WHERE variable='OpacNavBottom'");
20         } else {
21             say $out "No OpacNavBottom preference found. Update has already been run.";
22         }
23
24     },
25 }