Lines 22-27
use Digest::MD5 qw( md5_base64 md5_hex );
Link Here
|
22 |
use JSON qw( to_json ); |
22 |
use JSON qw( to_json ); |
23 |
use List::MoreUtils qw( any each_array uniq ); |
23 |
use List::MoreUtils qw( any each_array uniq ); |
24 |
use String::Random qw( random_string ); |
24 |
use String::Random qw( random_string ); |
|
|
25 |
use Try::Tiny; |
25 |
|
26 |
|
26 |
use C4::Auth qw( get_template_and_user ); |
27 |
use C4::Auth qw( get_template_and_user ); |
27 |
use C4::Output qw( output_html_with_http_headers ); |
28 |
use C4::Output qw( output_html_with_http_headers ); |
Lines 213-218
if ( $action eq 'create' ) {
Link Here
|
213 |
C4::Letters::SendQueuedMessages({ message_id => $message_id }); |
214 |
C4::Letters::SendQueuedMessages({ message_id => $message_id }); |
214 |
} |
215 |
} |
215 |
else { |
216 |
else { |
|
|
217 |
$borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})); |
218 |
my $consent_dt = delete $borrower{gdpr_proc_consent}; |
219 |
my $patron; |
220 |
try { |
221 |
$patron = Koha::Patron->new( \%borrower )->store; |
222 |
Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $patron && $consent_dt; |
223 |
} catch { |
224 |
my $type = ref($_); |
225 |
my $info = "$_"; |
226 |
$template->param( error_type => $type, error_info => $info ); |
227 |
$template->param( borrower => \%borrower ); |
228 |
}; |
229 |
|
216 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |
230 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |
217 |
{ |
231 |
{ |
218 |
template_name => "opac-registration-confirmation.tt", |
232 |
template_name => "opac-registration-confirmation.tt", |
Lines 220-231
if ( $action eq 'create' ) {
Link Here
|
220 |
query => $cgi, |
234 |
query => $cgi, |
221 |
authnotrequired => 1, |
235 |
authnotrequired => 1, |
222 |
} |
236 |
} |
223 |
); |
237 |
) if $patron; |
224 |
|
238 |
|
225 |
$borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})); |
|
|
226 |
my $consent_dt = delete $borrower{gdpr_proc_consent}; |
227 |
my $patron = Koha::Patron->new( \%borrower )->store; |
228 |
Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; |
229 |
if ( $patron ) { |
239 |
if ( $patron ) { |
230 |
$patron->extended_attributes->filter_by_branch_limitations->delete; |
240 |
$patron->extended_attributes->filter_by_branch_limitations->delete; |
231 |
$patron->extended_attributes($attributes); |
241 |
$patron->extended_attributes($attributes); |
Lines 280-287
if ( $action eq 'create' ) {
Link Here
|
280 |
$patron->notify_library_of_registration($notify_library); |
290 |
$patron->notify_library_of_registration($notify_library); |
281 |
} |
291 |
} |
282 |
|
292 |
|
283 |
} else { |
|
|
284 |
# FIXME Handle possible errors here |
285 |
} |
293 |
} |
286 |
$template->param( |
294 |
$template->param( |
287 |
PatronSelfRegistrationAdditionalInstructions => |
295 |
PatronSelfRegistrationAdditionalInstructions => |
288 |
- |
|
|