|
Lines 76-81
my $cardnumber = $input->param('cardnumber');
Link Here
|
| 76 |
my $check_member = $input->param('check_member'); |
76 |
my $check_member = $input->param('check_member'); |
| 77 |
my $nodouble = $input->param('nodouble'); |
77 |
my $nodouble = $input->param('nodouble'); |
| 78 |
my $duplicate = $input->param('duplicate'); |
78 |
my $duplicate = $input->param('duplicate'); |
|
|
79 |
my $mailacctdetails= $input->param('mailacctdetails') // 0; |
| 80 |
|
| 79 |
$nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're |
81 |
$nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're |
| 80 |
# modifying an existing patron, it ipso facto |
82 |
# modifying an existing patron, it ipso facto |
| 81 |
# isn't a duplicate. Marking FIXME because this |
83 |
# isn't a duplicate. Marking FIXME because this |
|
Lines 376-414
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
| 376 |
$borrowernumber = &AddMember(%newdata); |
378 |
$borrowernumber = &AddMember(%newdata); |
| 377 |
$newdata{'borrowernumber'} = $borrowernumber; |
379 |
$newdata{'borrowernumber'} = $borrowernumber; |
| 378 |
|
380 |
|
| 379 |
# If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. |
381 |
C4::Members::SendAutoEmail( \%newdata, $template ); # send alert? |
| 380 |
if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'} && $newdata{'password'}) { |
|
|
| 381 |
#look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead |
| 382 |
my $emailaddr; |
| 383 |
if (C4::Context->preference("AutoEmailPrimaryAddress") ne 'OFF' && |
| 384 |
$newdata{C4::Context->preference("AutoEmailPrimaryAddress")} =~ /\w\@\w/ ) { |
| 385 |
$emailaddr = $newdata{C4::Context->preference("AutoEmailPrimaryAddress")} |
| 386 |
} |
| 387 |
elsif ($newdata{email} =~ /\w\@\w/) { |
| 388 |
$emailaddr = $newdata{email} |
| 389 |
} |
| 390 |
elsif ($newdata{emailpro} =~ /\w\@\w/) { |
| 391 |
$emailaddr = $newdata{emailpro} |
| 392 |
} |
| 393 |
elsif ($newdata{B_email} =~ /\w\@\w/) { |
| 394 |
$emailaddr = $newdata{B_email} |
| 395 |
} |
| 396 |
# if we manage to find a valid email address, send notice |
| 397 |
if ($emailaddr) { |
| 398 |
$newdata{emailaddr} = $emailaddr; |
| 399 |
my $err; |
| 400 |
eval { |
| 401 |
$err = SendAlerts ( 'members', \%newdata, "ACCTDETAILS" ); |
| 402 |
}; |
| 403 |
if ( $@ ) { |
| 404 |
$template->param(error_alert => $@); |
| 405 |
} elsif ( ref($err) eq "HASH" && defined $err->{error} and $err->{error} eq "no_email" ) { |
| 406 |
$template->{VARS}->{'error_alert'} = "no_email"; |
| 407 |
} else { |
| 408 |
$template->{VARS}->{'info_alert'} = 1; |
| 409 |
} |
| 410 |
} |
| 411 |
} |
| 412 |
|
382 |
|
| 413 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
383 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
| 414 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
384 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
|
Lines 425-430
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
| 425 |
# updating any columns in the borrowers table, |
395 |
# updating any columns in the borrowers table, |
| 426 |
# which can happen if we're only editing the |
396 |
# which can happen if we're only editing the |
| 427 |
# patron attributes or messaging preferences sections |
397 |
# patron attributes or messaging preferences sections |
|
|
398 |
|
| 399 |
C4::Members::SendAutoEmail( \%newdata, $template ) if $mailacctdetails; |
| 400 |
# send alert if asked for |
| 428 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
401 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
| 429 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
402 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
| 430 |
} |
403 |
} |
|
Lines 649-660
if (C4::Context->preference('uppercasesurnames')) {
Link Here
|
| 649 |
$data{'surname'} &&= uc( $data{'surname'} ); |
622 |
$data{'surname'} &&= uc( $data{'surname'} ); |
| 650 |
$data{'contactname'} &&= uc( $data{'contactname'} ); |
623 |
$data{'contactname'} &&= uc( $data{'contactname'} ); |
| 651 |
} |
624 |
} |
| 652 |
|
|
|
| 653 |
foreach (qw(dateenrolled dateexpiry dateofbirth)) { |
625 |
foreach (qw(dateenrolled dateexpiry dateofbirth)) { |
| 654 |
$data{$_} = format_date($data{$_}); # back to syspref for display |
626 |
$data{$_} = format_date($data{$_}); # back to syspref for display |
| 655 |
$template->param( $_ => $data{$_}); |
627 |
$template->param( $_ => $data{$_}); |
| 656 |
} |
628 |
} |
| 657 |
|
629 |
|
|
|
630 |
if( $data{password} eq '!' ) { |
| 631 |
# This marks a disabled userid; note however that this is normally |
| 632 |
# the result of saving a new patron without a password. |
| 633 |
# If we do not clear it, the form gives the impression that a password |
| 634 |
# has been entered, although it is only an exclamation mark. |
| 635 |
# Clearing it may be more clear for staff :) |
| 636 |
# AddMember will insert the ! again if no password is entered. |
| 637 |
$data{password}=''; |
| 638 |
$data{password2}=''; |
| 639 |
} |
| 640 |
|
| 658 |
if (C4::Context->preference('ExtendedPatronAttributes')) { |
641 |
if (C4::Context->preference('ExtendedPatronAttributes')) { |
| 659 |
$template->param(ExtendedPatronAttributes => 1); |
642 |
$template->param(ExtendedPatronAttributes => 1); |
| 660 |
patron_attributes_form($template, $borrowernumber); |
643 |
patron_attributes_form($template, $borrowernumber); |
| 661 |
- |
|
|