]> git.koha-community.org Git - koha.git/commit
Bug 24387: Rename "News" with "Additional contents"
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 6 Jul 2021 15:28:19 +0000 (17:28 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 16 Aug 2021 09:55:55 +0000 (11:55 +0200)
commit89ade834d6460fe08aa69c3571e36cd117574c09
treedd5ab0776d3d4107019fcc56269c4af8c752c284
parent556d0fcafff573017ea34b50cd5c118370fcc90a
Bug 24387: Rename "News" with "Additional contents"

One big patch for one big move.

The "News" feature (opac_news) has been hijacked to handle some system
preferences (bug 26050). The goal was to take profit of the UI (editor)
and the ability to translate the value.

Disclaimer: This patch is NOT offering the best implementation but, as
we still don't have bug 24975, it cannot be done now. And no, we don't
want to wait for it to move forward here. This patch is going into the
right direction anyway.

This enhancement is going to rename the "News" with a more genertic
"Additional contents". We have two different "categories" of content:
"news" and "html customizations".

What does it bring?
- A split on the UI for disambigate the two types of content (news and
syspref/html customizations)
- A simplification of the edit form: all languages will be translatable
on the same view (like the "notice templates")
- Ground will be prepared for different types of content (if needed later)
- Staff news can be translated

How was the "News" area working before this patch?
The opac_news DB table contained a (very inconsistent) 'lang' column.
The different values were:
- '' => news to display at the OPAC and staff interfaces
- 'koha' => news for staff only
- 'slip' => news for slip notices
- $lang => news for OPAC only, translated in $lang ('en', 'es-ES', etc.)
- "$location_$lang" => A syspref moved to this "news" area. The syspref
is $location, and is translated in $lang. Eg. OpacLoginInstructions_en,
OpacLoginInstructions_fr-FR, opacheader_es-ES

This patch is improving the DB structure with the following changes:
- renaming 'opac_news' with 'additional_contents'
- new 'category' column
 => 'news' or 'html_customizations'
- new 'location' column
 => For 'news': 'staff_and_opac', 'staff_only', 'slip'
 => For 'html_customizations': the old syspref name (eg. 'OpacLoginInstructions').
- new 'code' column (see later for more info)
- the 'lang' column will only contain the language code ('en', 'es-ES',
etc.). BUT a 'default' entry will ALWAYS exist for fallback behaviour.

We are getting closer to the 'notice template' table structure because
we want to match its UI. The 'code' column will bring us the ability to
group the different 'additional_contents' rows. The code for a given
news will be the same, but the (lang, title, content) will differ.
Examples:
  News 1 will have, for each of the translated versions
  (category, code,    location, branchcode)
  ('news',   'News1', $location, $branchcode||undef)
  And the 3 following columns will differ:
  (title,              content,               lang)
  ('title for news 1', 'content for news 1', 'default')
  ('titulo para 1',    'contenido para 1',   'es-ES')

Note that the "category" is not strictely necessary, but it seems better
to have the ability to split the different content by category/type
easily.

Additional changes:
- Syspref 'NewsToolEditor' is renamed 'AdditionalContentsEditor'
- Koha::NewItem => Koha::AdditionalContent
- Koha::News => Koha::AdditionalContents
- Script and template renamed from koha-news to additional-contents
- Foreign keys have been renamed
- Subpermission edit_news has been renamed edit_additional_contents
- The UI can now be accessed via a "News" or "HTML customizations" link
from the tools module. The related contents will then be displayed (both
categories are now split)

Changes not done here:
- Primary key 'idnew' could be renamed 'id'

Limitations of the upgrade:
News cannot be grouped by a unique code for existing translations.
=> A given news will be now displayed several times on the translated
interface
Any ideas to improve the upgrade behaviour?
We will have to add a warning in the release notes to tell libraries to
review their news.

Test plan:
0. Don't apply the patches
1. Translate the interfaces in some languages
. Create some news for staff and OPAC
. Create some content for different entry of HTML customizations
Note that you are forced to define a 'default'.
Also note that you are only forced to fill the title (not the content).
This is certainly problematic (see FIXME in the code) as sometime only
the content is displayed.
. Play with the interface (edit, delete, filter)
. Go to the different places the news are displayed, and confirm they
are displayed correctly (staff home, opac home, opac rss)
. Create 1+ news for 'slip', check an item out and 'print slip' (from
the circulation page). You must see the news.
. Go to the different places you are expecting the HTML customizations
to be present and confirm that you see them.
. Switch the lang of the interface and confirm that you now see the
content in the translated version
. Generate the templates in another language, don't translate the
content
. Use this language for the interface and confirm that the 'default'
version is displauyed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
49 files changed:
C4/Letters.pm
C4/Members.pm
Koha/AdditionalContent.pm [new file with mode: 0644]
Koha/AdditionalContents.pm [new file with mode: 0644]
Koha/Manual.pm
Koha/News.pm [deleted file]
Koha/NewsItem.pm [deleted file]
Koha/Template/Plugin/AdditionalContents.pm [new file with mode: 0644]
Koha/Template/Plugin/KohaNews.pm [deleted file]
installer/data/mysql/atomicupdate/bug_24387.perl [new file with mode: 0644]
installer/data/mysql/en/mandatory/sample_notices.yml
installer/data/mysql/en/optional/sample_news.yml
installer/data/mysql/fr-CA/facultatif/sample_news.sql
installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
installer/data/mysql/fr-FR/2-Optionel/sample_news.sql
installer/data/mysql/kohastructure.sql
installer/data/mysql/mandatory/sysprefs.sql
installer/data/mysql/mandatory/userpermissions.sql
installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
installer/data/mysql/nb-NO/2-Valgfritt/sample_news.sql
koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref
koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt [deleted file]
koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sci.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sco.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/maintenance.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt
mainpage.pl
opac/opac-main.pl
opac/opac-news-rss.pl
svc/letters/preview
t/db_dependent/Auth/haspermission.t
t/db_dependent/Koha/AdditionalContents.t [new file with mode: 0755]
t/db_dependent/Koha/News.t [deleted file]
t/db_dependent/Letters/TemplateToolkit.t
tools/additional-contents.pl [new file with mode: 0755]
tools/koha-news.pl [deleted file]
tools/letter.pl