@@ -, +, @@ news block - Go to the OPAC and confirm that the content which was previously in the OpacMainUserBlock system preference now displays correctly where it was before. - In the staff client, go to Tools -> News and verify that the content from OpacMainUserBlock is now stored in news items. There should be one entry for each of the enabled translations in your system, for instance 'opacmainuserblock_en', 'opacmainuserblock_fr-FR', 'opacmainuserblock_cs-CZ' - Go to Administration -> System preferences and confirm that the OpacMainUserBlock preference has been removed. --- C4/Auth.pm | 1 - .../bug_23794-move-opacmainuserblock-to-news.perl | 30 ++++++++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 - .../prog/en/modules/admin/preferences/opac.pref | 6 ----- .../prog/en/modules/tools/koha-news.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-main.tt | 9 +++++-- 6 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-to-news.perl --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -571,7 +571,6 @@ sub get_template_and_user { OpacBrowser => C4::Context->preference("OpacBrowser"), OpacCloud => C4::Context->preference("OpacCloud"), OpacKohaUrl => C4::Context->preference("OpacKohaUrl"), - OpacMainUserBlock => "" . C4::Context->preference("OpacMainUserBlock"), OpacNav => "" . C4::Context->preference("OpacNav"), OpacNavBottom => "" . C4::Context->preference("OpacNavBottom"), OpacPasswordChange => C4::Context->preference("OpacPasswordChange"), --- a/installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-to-news.perl +++ a/installer/data/mysql/atomicupdate/bug_23794-move-opacmainuserblock-to-news.perl @@ -0,0 +1,30 @@ +$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 OpacMainUserBlock system preference + my ($opacmainuserblock) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='OpacMainUserBlock'; + |); + if( $opacmainuserblock ){ + foreach my $lang ( @langs ) { + print "Inserting OpacMainUserBlock contents into $lang news item...\n"; + # If there is a value in the OpacMainUserBlock preference, insert it into opac_news + $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacMainUserBlock_$lang", $opacmainuserblock); + } + } + # Remove the OpacMainUserBlock system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMainUserBlock'"); + SetVersion ($DBversion); + print "Upgrade to $DBversion done (Bug 23794: Move contents of OpacMainUserBlock preference to Koha news system)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -403,7 +403,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacLoginInstructions', '', '60|10', 'Instructions to display on the OPAC login form when a patron is not logged in', 'Textarea'), ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), ('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'), -('OpacMainUserBlock','Welcome to Koha...\r\n