From b2c5945340701076e81ee16d75c21606d794cef4 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 31 Jan 2022 21:13:04 -1000 Subject: [PATCH] Bug 24220: DBRev 21.12.00.012 Signed-off-by: Fridolin Somers --- Koha.pm | 2 +- ...e-opacmoresearches-to-addtional-content.pl | 23 ---------------- installer/data/mysql/db_revs/211200012.pl | 27 +++++++++++++++++++ 3 files changed, 28 insertions(+), 24 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl create mode 100755 installer/data/mysql/db_revs/211200012.pl diff --git a/Koha.pm b/Koha.pm index 0b471dd2b0..f51d56538a 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "21.12.00.011"; +$VERSION = "21.12.00.012"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl b/installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl deleted file mode 100644 index c89361eac0..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24220_move-opacmoresearches-to-addtional-content.pl +++ /dev/null @@ -1,23 +0,0 @@ -use Modern::Perl; - -return { - bug_number => "24220", - description => "Move OpacMoreSearches to additional contents", - up => sub { - my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; - # Get any existing value from the OpacMoreSearches system preference - my ( $opacmoresearches ) = $dbh->selectrow_array( q| - SELECT value FROM systempreferences WHERE variable='OpacMoreSearches'; - |); - if( $opacmoresearches ){ - # Insert any values found from system preference into additional_contents - foreach my $lang ( 'default' ) { - $dbh->do( "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacMoreSearches', 'OpacMoreSearches', NULL, ?, ?, ?, CAST(NOW() AS date) )", undef, "OpacMoreSearches $lang", $opacmoresearches, $lang ); - } - # Remove old system preference - $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMoreSearches'"); - say $out "Bug 24220 update done"; - } - } -} diff --git a/installer/data/mysql/db_revs/211200012.pl b/installer/data/mysql/db_revs/211200012.pl new file mode 100755 index 0000000000..8b08646593 --- /dev/null +++ b/installer/data/mysql/db_revs/211200012.pl @@ -0,0 +1,27 @@ +use Modern::Perl; + +return { + bug_number => "24220", + description => "Move OpacMoreSearches to additional contents", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Get any existing value from the OpacMoreSearches system preference + my ( $opacmoresearches ) = $dbh->selectrow_array(q{ + SELECT value FROM systempreferences WHERE variable='OpacMoreSearches' + }); + if( $opacmoresearches ){ + # Insert any values found from system preference into additional_contents + $dbh->do(q{ + INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) + VALUES ('html_customizations', 'OpacMoreSearches', 'OpacMoreSearches', NULL, ?, ?, ?, CAST(NOW() AS date) ) + }, undef, "OpacMoreSearches default", $opacmoresearches, 'default'); + # Remove old system preference + $dbh->do(q{ + DELETE FROM systempreferences WHERE variable='OpacMoreSearches' + }); + } else { + say $out "No OpacMoreSearches preference found. Value was empty or update has already been run."; + } + }, +}; -- 2.39.5