Bugzilla – Attachment 155789 Details for
Bug 31503
Allow several consent types on the consents tab of OPAC account page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31503: (follow-up) Use KohaPlugins.feature_enabled
Bug-31503-follow-up-Use-KohaPluginsfeatureenabled.patch (text/plain), 3.60 KB, created by
Martin Renvoize (ashimema)
on 2023-09-18 09:57:20 UTC
(
hide
)
Description:
Bug 31503: (follow-up) Use KohaPlugins.feature_enabled
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-09-18 09:57:20 UTC
Size:
3.60 KB
patch
obsolete
>From 98c47acbcb8c0ecfbf43081b3db785c82bc0c713 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 15 Sep 2023 16:42:25 +0100 >Subject: [PATCH] Bug 31503: (follow-up) Use KohaPlugins.feature_enabled > >This patch switches the code from using >Koha.preference('OPACCustomConsentTypes') to using >KohaPlugins.feature_enabled('patron_consent_type'). > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Patron/Consents.pm | 11 ++++------- > Koha/Template/Plugin/KohaPlugins.pm | 2 +- > .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 3 ++- > 3 files changed, 7 insertions(+), 9 deletions(-) > >diff --git a/Koha/Patron/Consents.pm b/Koha/Patron/Consents.pm >index 7dcb14d6a94..43572e796ad 100644 >--- a/Koha/Patron/Consents.pm >+++ b/Koha/Patron/Consents.pm >@@ -42,8 +42,7 @@ Koha::Objects class for handling patron consents > Returns an HASHref of available consent types like: > { type1 => {}, type2 => {}, .. } > >- Checks preferences OPACCustomConsentTypes and PrivacyPolicyConsent. >- Calls patron_consent_type plugins (if pref enabled). >+ Checks PrivacyPolicyConsent preference and any patron_consent_type plugins (if pref enabled). > > Note: The plugins return an ARRAYref with type, title and description like: > [ my_type => { title => { lang => 1, .. }, description => { lang => 2, .. } } ] >@@ -54,11 +53,9 @@ sub available_types { > my ($self) = shift; > my $response = {}; > $response->{GDPR_PROCESSING} = 1 if C4::Context->preference('PrivacyPolicyConsent'); >- if ( C4::Context->preference('OPACCustomConsentTypes') ) { >- foreach my $return ( Koha::Plugins->call('patron_consent_type') ) { >- next if ref($return) ne 'ARRAY' or @$return != 2; # ignoring bad input >- $response->{ $return->[0] } = $return->[1]; >- } >+ foreach my $return ( Koha::Plugins->call('patron_consent_type') ) { >+ next if ref($return) ne 'ARRAY' or @$return != 2; # ignoring bad input >+ $response->{ $return->[0] } = $return->[1]; > } > return $response; > } >diff --git a/Koha/Template/Plugin/KohaPlugins.pm b/Koha/Template/Plugin/KohaPlugins.pm >index 35ac34bcf3f..73b295dbaac 100644 >--- a/Koha/Template/Plugin/KohaPlugins.pm >+++ b/Koha/Template/Plugin/KohaPlugins.pm >@@ -291,7 +291,7 @@ This method returns true if the passed plugin hook method name is found to be in > =cut > > sub feature_enabled { >- my ($self, $method) = @_; >+ my ( $self, $method ) = @_; > > my $p = Koha::Plugins->new(); > return 0 unless $p; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index 5d594989e50..863ab70be4d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -1,4 +1,5 @@ > [% USE Koha %] >+[% USE KohaPlugins %] > [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %] > <div id="menu"> > <ul> >@@ -24,7 +25,7 @@ > [% END %] > <a href="/cgi-bin/koha/opac-memberentry.pl">Personal details</a></li> > >- [% IF Koha.Preference('PrivacyPolicyConsent') || Koha.Preference('CookieConsent') || Koha.Preference('OPACCustomConsentTypes') %] >+ [% IF Koha.Preference('PrivacyPolicyConsent') || Koha.Preference('CookieConsent') || KohaPlugins.feature_enabled('patron_consent_type') %] > [% IF consentview %]<li class="active">[% ELSE %]<li>[% END %] > <a href="/cgi-bin/koha/opac-patron-consent.pl">Consents</a> > </li> >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31503
:
140047
|
140048
|
140049
|
140050
|
140080
|
140081
|
140082
|
140083
|
140084
|
140085
|
140087
|
140088
|
140089
|
140090
|
140666
|
140667
|
140668
|
140669
|
140670
|
140671
|
140672
|
141216
|
141217
|
141218
|
141219
|
141220
|
141221
|
141222
|
141263
|
141264
|
141265
|
141266
|
141267
|
141268
|
141269
|
141302
|
141570
|
155000
|
155001
|
155002
|
155003
|
155177
|
155178
|
155179
|
155180
|
155189
|
155190
|
155191
|
155656
|
155657
|
155658
|
155659
|
155660
|
155661
|
155691
|
155694
|
155783
|
155784
|
155785
|
155786
|
155787
|
155788
|
155789
|
155790
|
155791
|
157117
|
157118
|
157119
|
157120
|
157121
|
157122
|
157123
|
157124
|
157125
|
157126
|
157773
|
157774
|
157775
|
157776
|
157777
|
157778
|
157779
|
157780
|
157781
|
157782
|
157783