Lines 414-420
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
414 |
if ($op eq 'insert'){ |
414 |
if ($op eq 'insert'){ |
415 |
# we know it's not a duplicate borrowernumber or there would already be an error |
415 |
# we know it's not a duplicate borrowernumber or there would already be an error |
416 |
$borrowernumber = &AddMember(%newdata); |
416 |
$borrowernumber = &AddMember(%newdata); |
417 |
add_guarantors( $borrowernumber, $input ); |
417 |
$patron = Koha::Patrons->find( $borrowernumber ); |
|
|
418 |
add_guarantors( $patron, $input ); |
418 |
$newdata{'borrowernumber'} = $borrowernumber; |
419 |
$newdata{'borrowernumber'} = $borrowernumber; |
419 |
|
420 |
|
420 |
# If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. |
421 |
# If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. |
Lines 512-518
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
Link Here
|
512 |
# updating any columns in the borrowers table, |
513 |
# updating any columns in the borrowers table, |
513 |
# which can happen if we're only editing the |
514 |
# which can happen if we're only editing the |
514 |
# patron attributes or messaging preferences sections |
515 |
# patron attributes or messaging preferences sections |
515 |
add_guarantors( $borrowernumber, $input ); |
516 |
add_guarantors( $patron, $input ); |
516 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
517 |
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { |
517 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
518 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
518 |
} |
519 |
} |
Lines 892-898
sub patron_attributes_form {
Link Here
|
892 |
} |
893 |
} |
893 |
|
894 |
|
894 |
sub add_guarantors { |
895 |
sub add_guarantors { |
895 |
my ( $borrowernumber, $input ) = @_; |
896 |
my ( $patron, $input ) = @_; |
896 |
|
897 |
|
897 |
my @new_guarantor_id = $input->multi_param('new_guarantor_id'); |
898 |
my @new_guarantor_id = $input->multi_param('new_guarantor_id'); |
898 |
my @new_guarantor_surname = $input->multi_param('new_guarantor_surname'); |
899 |
my @new_guarantor_surname = $input->multi_param('new_guarantor_surname'); |
Lines 905-929
sub add_guarantors {
Link Here
|
905 |
my $firstname = $new_guarantor_firstname[$i]; |
906 |
my $firstname = $new_guarantor_firstname[$i]; |
906 |
my $relationship = $new_guarantor_relationship[$i]; |
907 |
my $relationship = $new_guarantor_relationship[$i]; |
907 |
|
908 |
|
908 |
if ($guarantor_id) { |
909 |
$patron->add_guarantor( |
909 |
Koha::Patron::Relationship->new( |
910 |
{ |
910 |
{ |
911 |
guarantee_id => $patron->id, |
911 |
guarantee_id => $borrowernumber, |
912 |
guarantor_id => $guarantor_id, |
912 |
guarantor_id => $guarantor_id, |
913 |
surname => $surname, |
913 |
relationship => $relationship |
914 |
firstname => $firstname, |
914 |
} |
915 |
relationship => $relationship |
915 |
)->store(); |
916 |
} |
916 |
} |
917 |
); |
917 |
elsif ($surname) { |
|
|
918 |
Koha::Patron::Relationship->new( |
919 |
{ |
920 |
guarantee_id => $borrowernumber, |
921 |
surname => $surname, |
922 |
firstname => $firstname, |
923 |
relationship => $relationship |
924 |
} |
925 |
)->store(); |
926 |
} |
927 |
} |
918 |
} |
928 |
} |
919 |
} |
929 |
|
920 |
|
930 |
- |
|
|