Koha/svc
Jonathan Druart 89ade834d6 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>
2021-08-16 11:55:55 +02:00
..
cataloguing Bug 28750: (bug 17600 follow-up) Use full path for subroutines 2021-07-26 16:28:52 +02:00
club Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
config
hold Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
letters Bug 24387: Rename "News" with "Additional contents" 2021-08-16 11:55:55 +02:00
mana Bug 27061: Remove duplicate permission check in svc/mana/search 2021-04-30 17:07:32 +02:00
members Bug 17600: Fix other occurrences in svc 2021-07-26 16:41:07 +02:00
records Bug 24663: Force authentication in svc/records/preview (?) 2020-09-03 10:40:35 +02:00
virtualshelves Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
article_request Bug 20472: Edit URL field on staff form 2021-07-12 15:47:34 +02:00
authentication Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
authorised_values Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
barcode Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
bib Bug 17600: Fix other occurrences in svc 2021-07-26 16:41:07 +02:00
bib_framework Bug 28750: fix svc/bib_framework 2021-07-26 16:28:52 +02:00
bib_profile Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
checkin Bug 17600: Fix other occurrences in svc 2021-07-26 16:41:07 +02:00
checkout_notes Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
checkouts Bug 26976: Display 0 if renewalsallowed is not defined 2020-12-04 15:32:56 +01:00
convert_report Bug 24663: Remove authnotrequired if set to 0 2020-09-03 10:40:35 +02:00
cover_images Bug 25898: Prohibit indirect object notation 2020-10-15 12:56:30 +02:00
creator_batches Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
holds Bug 24412: (follow-up) prevent error in svc/holds 2020-11-06 15:55:17 +01:00
import_bib Bug 17600: Fix other occurrences in svc 2021-07-26 16:41:07 +02:00
localization
new_bib Bug 28750: (bug 17600 follow-up) Use full routine names in svc/new_bib svc/bib 2021-07-26 16:28:52 +02:00
problem_reports Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
renew Bug 17600: Fix other occurrences in svc 2021-07-26 16:41:07 +02:00
report Bug 17600: Fix other occurrences in svc 2021-07-26 16:41:07 +02:00
return_claims Bug 28271: Preselect the current item lost value 2021-06-21 10:50:09 +02:00
split_callnumbers