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> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
3d857d8e95
commit
cef4ef4fb1
2 changed files with 6 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue