@@ -, +, @@ you are logged out when saving. When you login again, all OPAC requests are redirected to your consents tab. --- C4/Auth.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -36,6 +36,7 @@ use Koha::AuthUtils qw(get_script_name hash_password); use Koha::Library::Groups; use Koha::Libraries; use Koha::Patrons; +use Koha::Patron::Consents; use POSIX qw/strftime/; use List::MoreUtils qw/ any /; use Encode qw( encode is_utf8); @@ -179,6 +180,22 @@ sub get_template_and_user { ); } + # If we enforce GDPR and the user did not consent, redirect + if( $in->{type} eq 'opac' && $user && + $in->{'template_name'} !~ /opac-patron-consent/ && + C4::Context->preference('GDPR_Policy') eq 'Enforced' ) + { + my $consent = Koha::Patron::Consents->search({ + borrowernumber => getborrowernumber($user), + type => 'GDPR_PROCESSING', + given_on => { '!=', undef }, + })->next; + if( !$consent ) { + print $in->{query}->redirect(-uri => '/cgi-bin/koha/opac-patron-consent.pl', -cookie => $cookie); + safe_exit; + } + } + if ( $in->{type} eq 'opac' && $user ) { my $kick_out; --