Browse Source
This patch builds on Bug 22318 to move the OpacLoginInstructions system
preference into the Koha news system, making it possible to have
language- and library-specific content.
To test you should have some content in the OpacLoginInstructions system
preference. Apply the patch and run the database update process.
- Go to the OPAC and click the login link.
- In the login modal, confirm that the content which was previously in
the OpacLoginInstructions system preference displays correctly
below the login form.
- While not logged in to the OPAC, navigate directly to
/cgi-bin/koha/opac-user.pl. The OpacLoginInstructions content should
display correctly here as well.
- In the staff client, go to Tools -> News and verify that the content
from OpacLoginInstructions is now stored in news items. There
should be one entry for each of the enabled translations in your
system, for instance 'OpacLoginInstructions_en',
'OpacLoginInstructions_fr-FR', 'OpacLoginInstructions_cs-CZ'
- Go to Administration -> System preferences and confirm that the
OpacLoginInstructions preference has been removed.
- To test the correct selection of language-specific content you must
run the translation update/install process for the languages you're
updating.
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit be1d25ba16
)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
20.05.x
6 changed files with 39 additions and 12 deletions
@ -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 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"; |
|||
} |
Loading…
Reference in new issue