Lines 102-107
my @errors;
Link Here
|
102 |
my $borrower_data; |
102 |
my $borrower_data; |
103 |
my $NoUpdateLogin; |
103 |
my $NoUpdateLogin; |
104 |
my $userenv = C4::Context->userenv; |
104 |
my $userenv = C4::Context->userenv; |
|
|
105 |
my @messages; |
105 |
|
106 |
|
106 |
## Deal with guarantor stuff |
107 |
## Deal with guarantor stuff |
107 |
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; |
108 |
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; |
Lines 444-449
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
444 |
# FIXME Urgent error handling here, we cannot fail without relevant feedback |
445 |
# FIXME Urgent error handling here, we cannot fail without relevant feedback |
445 |
# Lot of code will need to be removed from this script to handle exceptions raised by Koha::Patron->store |
446 |
# Lot of code will need to be removed from this script to handle exceptions raised by Koha::Patron->store |
446 |
warn "Patron creation failed! - $@"; # Maybe we must die instead of just warn |
447 |
warn "Patron creation failed! - $@"; # Maybe we must die instead of just warn |
|
|
448 |
push @messages, {error => 'error_on_insert_patron'}; |
449 |
$op = "add"; |
447 |
} else { |
450 |
} else { |
448 |
add_guarantors( $patron, $input ); |
451 |
add_guarantors( $patron, $input ); |
449 |
$borrowernumber = $patron->borrowernumber; |
452 |
$borrowernumber = $patron->borrowernumber; |
Lines 484-490
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
484 |
} |
487 |
} |
485 |
} |
488 |
} |
486 |
|
489 |
|
487 |
if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) { |
490 |
if ( $patron && (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) ) { |
488 |
C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template, 1, $newdata{'categorycode'}); |
491 |
C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template, 1, $newdata{'categorycode'}); |
489 |
} |
492 |
} |
490 |
|
493 |
|
Lines 494-500
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
494 |
$hsbnd_chooser = 1 if $input->param('housebound_chooser'); |
497 |
$hsbnd_chooser = 1 if $input->param('housebound_chooser'); |
495 |
$hsbnd_deliverer = 1 if $input->param('housebound_deliverer'); |
498 |
$hsbnd_deliverer = 1 if $input->param('housebound_deliverer'); |
496 |
# Only create a HouseboundRole if patron has a role. |
499 |
# Only create a HouseboundRole if patron has a role. |
497 |
if ( $hsbnd_chooser || $hsbnd_deliverer ) { |
500 |
if ( $patron && ( $hsbnd_chooser || $hsbnd_deliverer ) ) { |
498 |
Koha::Patron::HouseboundRole->new({ |
501 |
Koha::Patron::HouseboundRole->new({ |
499 |
borrowernumber_id => $borrowernumber, |
502 |
borrowernumber_id => $borrowernumber, |
500 |
housebound_chooser => $hsbnd_chooser, |
503 |
housebound_chooser => $hsbnd_chooser, |
Lines 556-577
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
556 |
} |
559 |
} |
557 |
} |
560 |
} |
558 |
|
561 |
|
559 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
562 |
if ( $patron ) { |
560 |
$patron->extended_attributes->filter_by_branch_limitations->delete; |
563 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
561 |
$patron->extended_attributes($extended_patron_attributes); |
564 |
$patron->extended_attributes->filter_by_branch_limitations->delete; |
562 |
} |
565 |
$patron->extended_attributes($extended_patron_attributes); |
|
|
566 |
} |
563 |
|
567 |
|
564 |
if ( $destination eq 'circ' and not C4::Auth::haspermission( C4::Context->userenv->{id}, { circulate => 'circulate_remaining_permissions' } ) ) { |
568 |
if ( $destination eq 'circ' and not C4::Auth::haspermission( C4::Context->userenv->{id}, { circulate => 'circulate_remaining_permissions' } ) ) { |
565 |
# If we want to redirect to circulation.pl and need to check if the logged in user has the necessary permission |
569 |
# If we want to redirect to circulation.pl and need to check if the logged in user has the necessary permission |
566 |
$destination = 'not_circ'; |
570 |
$destination = 'not_circ'; |
|
|
571 |
} |
572 |
print scalar( $destination eq "circ" ) |
573 |
? $input->redirect( |
574 |
"/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber") |
575 |
: $input->redirect( |
576 |
"/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber" |
577 |
); |
578 |
exit; # You can only send 1 redirect! After that, content or other headers don't matter. |
567 |
} |
579 |
} |
568 |
print scalar( $destination eq "circ" ) |
|
|
569 |
? $input->redirect( |
570 |
"/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber") |
571 |
: $input->redirect( |
572 |
"/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber" |
573 |
); |
574 |
exit; # You can only send 1 redirect! After that, content or other headers don't matter. |
575 |
} |
580 |
} |
576 |
|
581 |
|
577 |
if ($delete){ |
582 |
if ($delete){ |
Lines 843-848
if ( C4::Context->preference('TranslateNotices') ) {
Link Here
|
843 |
$template->param( languages => $translated_languages ); |
848 |
$template->param( languages => $translated_languages ); |
844 |
} |
849 |
} |
845 |
|
850 |
|
|
|
851 |
$template->param( messages => \@messages ); |
846 |
output_html_with_http_headers $input, $cookie, $template->output; |
852 |
output_html_with_http_headers $input, $cookie, $template->output; |
847 |
|
853 |
|
848 |
sub parse_extended_patron_attributes { |
854 |
sub parse_extended_patron_attributes { |
849 |
- |
|
|