|
Lines 934-950
sub add_guarantors {
Link Here
|
| 934 |
my @new_guarantor_id = $input->multi_param('new_guarantor_id'); |
934 |
my @new_guarantor_id = $input->multi_param('new_guarantor_id'); |
| 935 |
my @new_guarantor_relationship = $input->multi_param('new_guarantor_relationship'); |
935 |
my @new_guarantor_relationship = $input->multi_param('new_guarantor_relationship'); |
| 936 |
|
936 |
|
| 937 |
for ( my $i = 0 ; $i < scalar @new_guarantor_id; $i++ ) { |
937 |
for ( my $i = 0 ; $i < scalar @new_guarantor_id ; $i++ ) { |
| 938 |
my $guarantor_id = $new_guarantor_id[$i]; |
938 |
my $guarantor_id = $new_guarantor_id[$i]; |
| 939 |
my $relationship = $new_guarantor_relationship[$i]; |
939 |
my $relationship = $new_guarantor_relationship[$i]; |
| 940 |
|
940 |
|
| 941 |
next unless $guarantor_id; |
941 |
next unless $guarantor_id; |
| 942 |
|
942 |
|
| 943 |
$patron->add_guarantor( |
943 |
my $existing_relationship_count = Koha::Patron::Relationships->search( |
| 944 |
{ |
944 |
{ |
|
|
945 |
guarantee_id => $patron->id, |
| 945 |
guarantor_id => $guarantor_id, |
946 |
guarantor_id => $guarantor_id, |
| 946 |
relationship => $relationship, |
|
|
| 947 |
} |
947 |
} |
| 948 |
); |
948 |
)->count; |
|
|
949 |
|
| 950 |
if ( $existing_relationship_count == 0 ) { |
| 951 |
$patron->add_guarantor( |
| 952 |
{ |
| 953 |
guarantor_id => $guarantor_id, |
| 954 |
relationship => $relationship, |
| 955 |
} |
| 956 |
); |
| 957 |
} |
| 949 |
} |
958 |
} |
| 950 |
} |
959 |
} |
| 951 |
- |
|
|