@@ -, +, @@ required. field gdpr_proc_consent. --- .../opac-tmpl/bootstrap/en/modules/opac-memberentry.tt | 14 +++++++++++++- opac/opac-memberentry.pl | 8 ++++++++ opac/opac-registration-verify.pl | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -893,8 +893,20 @@ [% END %] [% END %] - [% UNLESS action == 'edit' %] + [% IF Koha.Preference('GDPR_Policy') && action != 'edit' %] + + [% END %] + + [% UNLESS action == 'edit' %]
+ Verification
  1. --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -30,6 +30,7 @@ use C4::Members::Attributes qw( GetBorrowerAttributes ); use C4::Form::MessagingPreferences; use Koha::AuthUtils; use Koha::Patrons; +use Koha::Patron::Consent; use Koha::Patron::Modification; use Koha::Patron::Modifications; use C4::Scrubber; @@ -207,8 +208,11 @@ if ( $action eq 'create' ) { $template->param( OpacPasswordChange => C4::Context->preference('OpacPasswordChange') ); + my $consent_dt = delete $borrower{gdpr_proc_consent}; my ( $borrowernumber, $password ) = AddMember_Opac(%borrower); + Koha::Patron::Consent->new({ borrowernumber => $borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; C4::Members::Attributes::SetBorrowerAttributes( $borrowernumber, $attributes ); + C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if $borrowernumber && C4::Context->preference('EnhancedMessagingPreferences'); $template->param( password_cleartext => $password ); @@ -353,6 +357,7 @@ sub GetMandatoryFields { C4::Context->preference("PatronSelfRegistrationBorrowerMandatoryField"); my @fields = split( /\|/, $BorrowerMandatoryField ); + push @fields, 'gdpr_proc_consent' if C4::Context->preference('GDPR_Policy'); foreach (@fields) { $mandatory_fields{$_} = 1; @@ -459,6 +464,9 @@ sub ParseCgiForBorrower { $borrower{'dateofbirth'} = undef; } + # Replace checkbox 'agreed' by datetime in gdpr_proc_consent + $borrower{gdpr_proc_consent} = dt_from_string if $borrower{gdpr_proc_consent} && $borrower{gdpr_proc_consent} eq 'agreed'; + return %borrower; } --- a/opac/opac-registration-verify.pl +++ a/opac/opac-registration-verify.pl @@ -24,6 +24,7 @@ use C4::Output; use C4::Members; use C4::Form::MessagingPreferences; use Koha::Patrons; +use Koha::Patron::Consent; use Koha::Patron::Modifications; my $cgi = new CGI; @@ -61,8 +62,10 @@ if ( my $borrower = $m->unblessed(); + my $consent_dt = delete $borrower->{gdpr_proc_consent}; my $password; ( $borrowernumber, $password ) = AddMember_Opac(%$borrower); + Koha::Patron::Consent->new({ borrowernumber => $borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; if ($borrowernumber) { $m->delete(); --