Bug 28288: Prevent XSISBN.t to fail if service is returning 500
[srvgit] / opac / opac-registration-verify.pl
index 91e31c0..71ea329 100755 (executable)
@@ -27,8 +27,9 @@ use Koha::AuthUtils;
 use Koha::Patrons;
 use Koha::Patron::Consent;
 use Koha::Patron::Modifications;
+use Koha::Patron::Categories;
 
-my $cgi = new CGI;
+my $cgi = CGI->new;
 my $dbh = C4::Context->dbh;
 
 unless ( C4::Context->preference('PatronSelfRegistration') ) {
@@ -59,11 +60,12 @@ if (
     );
 
     my $patron_attrs = $m->unblessed;
-    $patron_attrs->{password} ||= Koha::AuthUtils::generate_password;
+    $patron_attrs->{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($patron_attrs->{categorycode}));
     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};
+    delete $patron_attrs->{changed_fields};
     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;
@@ -79,6 +81,9 @@ if (
               C4::Context->preference(
                 'PatronSelfRegistrationAdditionalInstructions')
         );
+
+        my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-registration-confirmation.tt','opac',$cgi);
+        $template->param( news_lang => $news_lang );
     }
 
 }