From cdb3a4d4ad65f6c2f5ef9cc7eb63f447c7dee0a0 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 30 Aug 2023 16:32:52 +0200 Subject: [PATCH] Bug 31503: Change usermenu condition, add preference Content-Type: text/plain; charset=utf-8 Adds preference OPACCustomConsentTypes. Test plan: Run dbrev. Toggle value of OPACCustomConsentTypes / PrivacyPolicyConsent. Check user page for Consents tab. Signed-off-by: Marcel de Rooy --- installer/data/mysql/atomicupdate/bug31503.pl | 9 +++++++-- installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 9 +++++++++ koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug31503.pl b/installer/data/mysql/atomicupdate/bug31503.pl index 25871e187f..5be62e73b8 100755 --- a/installer/data/mysql/atomicupdate/bug31503.pl +++ b/installer/data/mysql/atomicupdate/bug31503.pl @@ -2,7 +2,7 @@ use Modern::Perl; return { bug_number => 31503, - description => "Change patron_consent.type", + description => "Change patron_consent.type, add pref OPACCustomConsentTypes", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; @@ -10,7 +10,12 @@ return { $dbh->do( q{ALTER TABLE `patron_consent` MODIFY `type` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'consent type, could be custom type'} ); - say $out "Changed column 'patron_consent.type'"; + + $dbh->do( + q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('OPACCustomConsentTypes', '0', NULL, 'If enabled, custom consent types can be registered on account page', 'YesNo')} + ); + say $out "Addedd preference 'OPACCustomConsentTypes'"; }, }; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 30197591a8..921887c9a5 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -442,6 +442,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'), ('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'), ('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'), +('OPACCustomConsentTypes', '0', NULL, 'If enabled, custom consent types can be registered on account page', 'YesNo'), ('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'), ('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'), 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 060e76b2de..6fd7fd314a 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 @@ -552,6 +552,15 @@ OPAC: summary: "in user summary box on OPAC homepage (the system preference OPACUserSummary must be enabled)" user: "on patron's 'your summary' page" - ". Note that displayed savings may be inaccurate if checkout history is anonymized." + - + - pref: OPACCustomConsentTypes + default: 0 + choices: + 1: Allow + 0: "Don't allow" + - "users to register consents for custom (plugin based) consent types on the user account page." + - "
Note: The consents tab is also visible when you enabled PrivacyPolicyConsent." + OpenURL: - - 'Complete URL of OpenURL resolver (starting with http:// or https://):' diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index 5f8b48cda8..a5e774cbe0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -24,7 +24,7 @@ [% END %] Personal details - [% IF Koha.Preference('PrivacyPolicyConsent') # remove when extending %] + [% IF Koha.Preference('PrivacyPolicyConsent') || Koha.Preference('OPACCustomConsentTypes') %] [% IF consentview %]
  • [% ELSE %]
  • [% END %] Consents
  • -- 2.30.2