Bug 34889: Convert PatronSelfRegistrationAdditionalInstructions system preference to HTML customization

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

To test you should have some content in the
PatronSelfRegistrationAdditionalInstructions 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 previously in the
   PatronSelfRegistrationAdditionalInstructions preference is
   now stored there.
 - The HTML customization entry form should offer
   PatronSelfRegistrationAdditionalInstructions as a choice under
   "Display location."
 - Go to Administration -> System preferences and enable
   "PatronSelfRegistration." Set "PatronSelfRegistrationVerifyByEmail"
   to "Don't require."
 - Go to the OPAC and click "Register here."
 - Submit a new registration and confirm that the content that was
   previously stored in the system preference is shown correctly on the
   registration confirmation page.
 - Update and reinstall active translations (for instance fr-FR):
   - cd misc/translator/
   - perl translate update fr-FR
   - perl translate install fr-FR
 - Enable the translation if necessary under Administration -> System
   preferences -> language.
 - Enable the "opaclanguagesdisplay" preference if necessary.
 - Edit the PatronSelfRegistrationAdditionalInstructions HTML
   customization and add unique content to the "fr-FR" tab.
 - Go to the OPAC and switch to your updated translation.
   Complete the online registration process again to confirm that the
   content you added for your translation shows up correctly on the
   confirmation page.
 - Go to Administration -> System preferences and confirm that the
   PatronSelfRegistrationAdditionalInstructions  preference has been
   removed.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-09-22 15:27:11 +00:00 committed by Tomas Cohen Arazi
parent fd0cb98622
commit c2b4115d9c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 39 additions and 9 deletions

View file

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

View file

@ -571,7 +571,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
('PatronSelfModificationMandatoryField','',NULL,'Define the required fields when a patron is editing their information via the OPAC','free'),
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'),
('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'),
('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo'),

View file

@ -799,12 +799,6 @@ OPAC:
type: modalselect
source: borrowers
exclusions: sort1|sort2|gonenoaddress|lost|flags
-
- "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
- pref: PatronSelfRegistrationAdditionalInstructions
type: textarea
syntax: text/html
class: html
-
- pref: PatronSelfRegistrationEmailMustBeUnique
choices:

View file

@ -524,7 +524,7 @@
[% END %]
[% END %]
[% ELSE %]
[% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup' ] %]
[% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions' ] %]
<optgroup label="OPAC">
[% FOREACH l IN opac_available_options.sort %]
[% IF l == location %]

View file

@ -4,6 +4,7 @@
[% SET OpacNavRight = AdditionalContents.get( location => "OpacNavRight", lang => news_lang, library => logged_in_user.branchcode || default_branch ) %]
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% SET PatronSelfRegistrationAdditionalInstructions = AdditionalContents.get( location => "PatronSelfRegistrationAdditionalInstructions", lang => lang, library => branchcode || default_branch ) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -69,7 +70,11 @@
</p>
[% END %]
<div id="PatronSelfRegistrationAdditionalInstructions">[% PatronSelfRegistrationAdditionalInstructions | $raw %]</div>
[% IF ( PatronSelfRegistrationAdditionalInstructions ) %]
<div id="PatronSelfRegistrationAdditionalInstructions">
[% PROCESS koha_news_block news => PatronSelfRegistrationAdditionalInstructions %]
</div>
[% END %]
</div> <!-- /#registration-complete -->
</div> <!-- / .col-7/9 -->