Bugzilla – Attachment 99706 Details for
Bug 23795
Convert OpacCredits system preference to news block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23794: Convert opaccredits system preference to news block
Bug-23794-Convert-opaccredits-system-preference-to.patch (text/plain), 8.80 KB, created by
Owen Leonard
on 2020-02-27 15:32:01 UTC
(
hide
)
Description:
Bug 23794: Convert opaccredits system preference to news block
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-02-27 15:32:01 UTC
Size:
8.80 KB
patch
obsolete
>From e50cf307695d187c6079db3955044b18fed6ddcd Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 11 Dec 2019 17:03:01 +0000 >Subject: [PATCH] Bug 23794: Convert opaccredits system preference to news > block > >This patch builds on Bug 22318 to move the opaccredits 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 opaccredits system >preference. Apply the patch and run the database update process. > > - Go to the OPAC and confirm that the content which was previously in > the opaccredits system preference now displays correctly where > it was before. > - In the staff client, go to Tools -> News and verify that the content > from opaccredits is now stored in news items. There should be > one entry for each of the enabled translations in your system, for > instance 'opaccredits_en', 'opaccredits_fr-FR', > 'opaccredits_cs-CZ' > - Go to Administration -> System preferences and confirm that the > opaccredits preference has been removed. > >https://bugs.koha-community.org/show_bug.cgi?id=23795 >--- > C4/Auth.pm | 2 -- > .../bug_23795-move-opaccredits-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 +- > .../bootstrap/en/includes/opac-bottom.inc | 8 +++--- > 6 files changed, 35 insertions(+), 14 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_23795-move-opaccredits-to-news.perl > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index bf35b006c7b..1de16d62438 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -584,7 +584,6 @@ sub get_template_and_user { > hidelostitems => C4::Context->preference("hidelostitems"), > mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', > opacbookbag => "" . C4::Context->preference("opacbookbag"), >- opaccredits => "" . C4::Context->preference("opaccredits"), > OpacFavicon => C4::Context->preference("OpacFavicon"), > opaclanguagesdisplay => "" . C4::Context->preference("opaclanguagesdisplay"), > opacreadinghistory => C4::Context->preference("opacreadinghistory"), >@@ -1263,7 +1262,6 @@ sub checkauth { > opacuserlogin => C4::Context->preference("opacuserlogin"), > OpacNav => C4::Context->preference("OpacNav"), > OpacNavBottom => C4::Context->preference("OpacNavBottom"), >- opaccredits => C4::Context->preference("opaccredits"), > OpacFavicon => C4::Context->preference("OpacFavicon"), > opacreadinghistory => C4::Context->preference("opacreadinghistory"), > opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"), >diff --git a/installer/data/mysql/atomicupdate/bug_23795-move-opaccredits-to-news.perl b/installer/data/mysql/atomicupdate/bug_23795-move-opaccredits-to-news.perl >new file mode 100644 >index 00000000000..225820b0ac3 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23795-move-opaccredits-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 opaccredits system preference >+ my ($opaccredits) = $dbh->selectrow_array( q| >+ SELECT value FROM systempreferences WHERE variable='opaccredits'; >+ |); >+ if( $opaccredits ){ >+ foreach my $lang ( @langs ) { >+ print "Inserting opaccredits contents into $lang news item...\n"; >+ # If there is a value in the opaccredits preference, insert it into opac_news >+ $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "opaccredits_$lang", $opaccredits); >+ } >+ } >+ # Remove the opaccredits system preference >+ $dbh->do("DELETE FROM systempreferences WHERE variable='opaccredits'"); >+ SetVersion ($DBversion); >+ print "Upgrade to $DBversion done (Bug 23795: Convert OpacCredits system preference to news block)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index b565b7f0bf2..a8dc7911589 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -371,7 +371,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'), > ('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'), > ('OpacCustomSearch','','70|10','Replace the search box on the OPAC with the provided HTML','Textarea'), >-('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'), > ('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), > ('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'), > ('OPACdidyoumean','',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 9c9b2b7f009..25440eed05b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -251,12 +251,6 @@ OPAC: > syntax: text/html > class: code > - >- - "Include the following HTML in the footer of all pages in the OPAC:" >- - pref: opaccredits >- type: textarea >- syntax: text/html >- class: code >- - > - 'Include a "More Searches" box on the detail pages of items on the OPAC, with the following HTML (leave blank to disable):' > - '<br />Note: The placeholders {BIBLIONUMBER}, {CONTROLNUMBER}, {TITLE}, {ISBN}, {ISSN} and {AUTHOR} will be replaced with information from the displayed record.' > - pref: OPACSearchForTitleIn >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index e73e613194b..59f95778e85 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -327,7 +327,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% END %] > [% FOREACH lang_lis IN lang_list %] > <optgroup label="[% lang_lis.language | html %]"> >- [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader' ] %] >+ [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'opaccredits' ] %] > [% IF ( location == '' ) %] > [% SET location_lang = lang_lis.language %] > [% location = BLOCK %]OPAC news[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index af060ff7b3a..39f139b1dd7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -1,16 +1,16 @@ > [% USE raw %] > [% USE Koha %] >+[% USE KohaNews %] > [%- USE KohaPlugins -%] > [% USE Asset %] >+[% SET opaccredits = KohaNews.get( location => "opaccredits", lang => lang, library => branchcode ) %] > [% UNLESS ( is_popup ) %] > [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] > [% IF ( opaccredits ) %] > <div class="container-fluid"> > <div class="row-fluid"> >- <div class="span12"> >- <div id="opaccredits" class="noprint"> >- [% opaccredits | $raw %] >- </div> >+ <div id="opaccredits"> >+ [% PROCESS koha_news_block news => opaccredits %] > </div> > </div> > </div> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23795
:
99706
|
101581
|
101696
|
106102
|
106103
|
106104