ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / opac / opac-registration-verify.pl
index 3748f5c..ce78ffa 100755 (executable)
@@ -25,6 +25,7 @@ use C4::Members;
 use C4::Form::MessagingPreferences;
 use Koha::AuthUtils;
 use Koha::Patrons;
+use Koha::Patron::Consent;
 use Koha::Patron::Modifications;
 
 my $cgi = new CGI;
@@ -62,10 +63,14 @@ if (
 
     my $patron_attrs = $m->unblessed;
     $patron_attrs->{password} ||= Koha::AuthUtils::generate_password;
-
+    my $consent_dt = delete $patron_attrs->{gdpr_proc_consent};
     $patron_attrs->{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory');
+    delete $patron_attrs->{timestamp};
+    delete $patron_attrs->{verification_token};
     my $patron = Koha::Patron->new( $patron_attrs )->store;
 
+    Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt;
+
     if ($patron) {
         $m->delete();
         C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $patron->borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if C4::Context->preference('EnhancedMessagingPreferences');