Bug 35152: Convert RoutingListNote system preference to additional contents

This patch moves the RoutingListNote system preference into HTML
customizations, making it possible to have language- and
library-specific content.

To test you should have some content in the RoutingListNote
system preference before applying the patch. Apply the patch and run
the database update process.

- In the staff client, go to Tools -> HTML customizations and verify
  that the content from RoutingListNote is now stored there.
- The HTML customization entry form should offer RoutingListNote
  as a choice under "Display location."
- Update and reinstall active translations (for instance fr-FR):
  - perl misc/translator/translate update fr-FR
  - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Edit the RoutingListNote HTML customization and add unique
  content to the "fr-FR" tab.

- Go to Serials and create a subscription if necessary.
- From the subscription detail page, click "Create routing list" in the
  left-hand sidebar.
- Add one or more recipients to the list and click "Save".
- On the "Preview routing list" page click "Save and preview routing
  slip".
- In the pop-up window with the routing list preview you should see the
  content you added to the RoutingListNote HTML customization.
- Switch to your updated translation and confirm that the content you
  added for your translation shows up correctly.
- Go to Administration -> System preferences and search for
  "RoutingListNote." It should return no results.

NOTE: This patch does not keep the default content which was stored by
the RoutingListNote system preference. Having a default value for that
kind of preference is not standard. Instead I have updated the
description of the RoutingSerials preference to add a mention of the
RoutingListNote HTML customization option.

Sponsored-by: Athens County Public Libraries

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2025-01-13 17:10:43 +00:00 committed by Katrin Fischer
parent 0e2c3f1d38
commit 41a2d2edd2
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
6 changed files with 60 additions and 9 deletions

View file

@ -0,0 +1,41 @@
use Modern::Perl;
return {
bug_number => "35152",
description => "Move RoutingListNote to additional contents",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
# Get any existing value from the RoutingListNote system preference
my ($routinglistnote) = $dbh->selectrow_array(
q|
SELECT value FROM systempreferences WHERE variable='RoutingListNote';
|
);
if ($routinglistnote) {
# Insert any values found from system preference into additional_contents
$dbh->do(
"INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'RoutingListNote', 'RoutingListNote', NULL, CAST(NOW() AS date) )"
);
my ($insert_id) = $dbh->selectrow_array(
"SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'RoutingListNote' AND location = 'RoutingListNote' LIMIT 1",
{}
);
$dbh->do(
"INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'RoutingListNote default', ?, 'default' )",
undef, $insert_id, $routinglistnote
);
say $out "Added 'RoutingListNote' additional content";
}
# Remove old system preference
$dbh->do("DELETE FROM systempreferences WHERE variable='RoutingListNote'");
say $out "Removed system preference 'RoutingListNote'";
},
};

View file

@ -694,7 +694,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('RisExportAdditionalFields', '', NULL , 'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'),
('RoundFinesAtPayment','0', NULL,'If enabled any fines with fractions of a cent will be rounded to the nearest cent when payments are coll ected. e.g. 1.004 will be paid off by a 1.00 payment','YesNo'),
('RoutingListAddReserves','0','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'),
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),

View file

@ -90,6 +90,10 @@
Show the following content on the patron self-registration confirmation page.
</div>
<div id="RoutingListNote" class="hint customization_note">
Include the following note on all routing list slips.
</div>
<div id="SCOMainUserBlock_notes" class="hint customization_note">
Show this content on the web-based self checkout screen.
</div>

View file

@ -20,18 +20,13 @@ Serials:
choices:
1: Use
0: "Don't use"
- the routing list feature in the serials module.
- the routing list feature in the serials module. A custom message can be shown on routing slips by creating an <a href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations">HTML customization</a> in the RoutingListNote region.
-
- pref: RoutingListAddReserves
choices:
1: Place
0: "Don't place"
- received serials on hold if they are on a routing list.
-
- "Include the following note on all routing lists:"
- pref: RoutingListNote
type: textarea
class: code
-
- Show the
- pref: StaffSerialIssueDisplayCount

View file

@ -1,6 +1,7 @@
[% USE raw %]
[% USE Koha %]
[% PROCESS 'i18n.inc' %]
[% USE AdditionalContents %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
@ -39,7 +40,18 @@
</div> <!-- /.page-section -->
<div id="routingnotes">
<p id="generalroutingnote">[% Koha.Preference('RoutingListNote') | $raw %]</p>
[%- SET RoutingListNote = AdditionalContents.get( location => "RoutingListNote", lang => lang, library => logged_in_user.branchcode ) -%]
[% IF ( RoutingListNote.content && RoutingListNote.content.count > 0 ) %]
<div id="[% RoutingListNote.location | html %]">
[% FOREACH n IN RoutingListNote.content %]
<div class="[% n.lang | html %]_item">
<div class="[% n.lang | html %]_body">[% n.content | $raw %]</div>
</div>
[% END %]
</div>
[% END %]
<p id="routingnote">[% routingnotes | html %]</p>
</div>

View file

@ -538,7 +538,7 @@
[% END %]
[% END %]
</optgroup>
[% SET staff_available_options = [ 'IntranetmainUserblock', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffLoginInstructions', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %]
[% SET staff_available_options = [ 'IntranetmainUserblock', 'RoutingListNote', 'StaffAcquisitionsHome', 'StaffAuthoritiesHome', 'StaffCataloguingHome', 'StaffListsHome', 'StaffLoginInstructions', 'StaffPatronsHome', 'StaffPOSHome', 'StaffSerialsHome' ] %]
<optgroup label="Staff interface">
[% FOREACH l IN staff_available_options.sort %]
[% IF l == location %]