Browse Source

Bug 23797: DBRev 20.05.02.007

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20.05.x
Lucas Gass 4 years ago
parent
commit
416b1396d6
  1. 2
      Koha.pm
  2. 30
      installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-to-news.perl
  3. 37
      installer/data/mysql/updatedatabase.pl

2
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 = "20.05.02.005";
$VERSION = "20.05.02.007";
sub version {
return $VERSION;

30
installer/data/mysql/atomicupdate/bug_23797-move-OpacLoginInstructions-to-news.perl

@ -1,30 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
# get list of installed translations
require C4::Languages;
my @langs;
my $tlangs = C4::Languages::getTranslatedLanguages();
foreach my $language ( @$tlangs ) {
foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) {
push @langs, $sublanguage->{'rfc4646_subtag'};
}
}
# Get any existing value from the OpacLoginInstructions system preference
my ($opaclogininstructions) = $dbh->selectrow_array( q|
SELECT value FROM systempreferences WHERE variable='OpacLoginInstructions';
|);
if( $opaclogininstructions ){
foreach my $lang ( @langs ) {
print "Inserting OpacLoginInstructions contents into $lang news item...\n";
# If there is a value in the OpacLoginInstructions preference, insert it into opac_news
$dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacLoginInstructions_$lang", $opaclogininstructions);
}
}
# Remove the OpacLoginInstructions system preference
$dbh->do("DELETE FROM systempreferences WHERE variable='OpacLoginInstructions'");
SetVersion ($DBversion);
print "Upgrade to $DBversion done (Bug 23797: Convert OpacLoginInstructions system preference to news block)\n";
}

37
installer/data/mysql/updatedatabase.pl

@ -22318,6 +22318,43 @@ if( CheckVersion( $DBversion ) ) {
NewVersion ($DBversion, 23796, "Convert OpacCustomSearch system preference to news block");
}
$DBversion = '20.05.02.006';
if( CheckVersion( $DBversion ) ) {
$dbh->do( "ALTER TABLE opac_news CHANGE lang lang VARCHAR(50)" );
NewVersion( $DBversion, 23797, "Extend the opac_news lang column to accommodate longer value" );
}
$DBversion = '20.05.02.007';
if( CheckVersion( $DBversion ) ) {
# get list of installed translations
require C4::Languages;
my @langs;
my $tlangs = C4::Languages::getTranslatedLanguages();
foreach my $language ( @$tlangs ) {
foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) {
push @langs, $sublanguage->{'rfc4646_subtag'};
}
}
# Get any existing value from the OpacLoginInstructions system preference
my ($opaclogininstructions) = $dbh->selectrow_array( q|
SELECT value FROM systempreferences WHERE variable='OpacLoginInstructions';
|);
if( $opaclogininstructions ){
foreach my $lang ( @langs ) {
print "Inserting OpacLoginInstructions contents into $lang news item...\n";
# If there is a value in the OpacLoginInstructions preference, insert it into opac_news
$dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacLoginInstructions_$lang", $opaclogininstructions);
}
}
# Remove the OpacLoginInstructions system preference
$dbh->do("DELETE FROM systempreferences WHERE variable='OpacLoginInstructions'");
NewVersion ($DBversion, 23797, "Convert OpacLoginInstructions system preference to news block");
}
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';

Loading…
Cancel
Save