Bug 14685: Fix set guarantor for a child or professional accounts

Bug 13970 removed some useful code to automatically set the guarantor
when creating a child.

But finally there is a better way to do the job, we just need to assume
that only children or professional can have a guarantor.

Test plan:
1/ Create an adult patron and add a child.
2/ The guarantor info should be retrieved and set on the child creation
page.
3/ Create an organization and add a child
4/ The guarantor info should be retrieved and set on the adult creation
page.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
This patch catches both cases, thanks Jonathan!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
This commit is contained in:
Jonathan Druart 2015-08-18 09:08:09 +01:00 committed by Tomas Cohen Arazi
parent 6256eac2f6
commit 438b62e8ff

View file

@ -238,8 +238,9 @@ if ( ( $op eq 'insert' ) and !$nodouble ) {
} }
#recover all data from guarantor address phone ,fax... #recover all data from guarantor address phone ,fax...
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) { if ( $guarantorid ) {
if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) { if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
$category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
$guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'}; $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
$newdata{'contactfirstname'}= $guarantordata->{'firstname'}; $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
$newdata{'contactname'} = $guarantordata->{'surname'}; $newdata{'contactname'} = $guarantordata->{'surname'};