Bug 5673: test guarantorid consistently
Incorrect checking of guarantorid was causing moremember.pl to try and construct addresses using data from non-existent guarantors ensure that test is consistently checking that value is defined and not '', '0' or 0 [ i.e. what perl does for you anyway!!] Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
f692123bf1
commit
49b5f77194
|
|
@ -198,10 +198,7 @@ if (($op eq 'insert') and !$nodouble){
|
|||
}
|
||||
|
||||
#recover all data from guarantor address phone ,fax...
|
||||
if ( defined($guarantorid) and
|
||||
( $category_type eq 'C' || $category_type eq 'P' ) and
|
||||
$guarantorid ne '' and
|
||||
$guarantorid ne '0' ) {
|
||||
if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) {
|
||||
if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) {
|
||||
$guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
|
||||
if ( !defined($data{'contactname'}) or $data{'contactname'} eq '' or
|
||||
|
|
@ -438,7 +435,9 @@ foreach (qw(C A S P I X)) {
|
|||
$template->param('typeloop' => \@typeloop);
|
||||
|
||||
# test in city
|
||||
$select_city=getidcity($data{'city'}) if defined $guarantorid and ($guarantorid ne '0');
|
||||
if ( $guarantorid ) {
|
||||
$select_city = getidcity($data{city});
|
||||
}
|
||||
($default_city=$select_city) if ($step eq 0);
|
||||
if (!defined($select_city) or $select_city eq '' ){
|
||||
$default_city = &getidcity($data{'city'});
|
||||
|
|
@ -639,7 +638,7 @@ $template->param(
|
|||
$template->param(
|
||||
nodouble => $nodouble,
|
||||
borrowernumber => $borrowernumber, #register number
|
||||
guarantorid => (defined($borrower_data->{'guarantorid'})) ? $borrower_data->{'guarantorid'} : $guarantorid,
|
||||
guarantorid => (($borrower_data->{'guarantorid'})) ? $borrower_data->{'guarantorid'} : $guarantorid,
|
||||
ethcatpopup => $ethcatpopup,
|
||||
relshiploop => \@relshipdata,
|
||||
city_loop => $city_arrayref,
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ $data->{ "sex_".$data->{'sex'}."_p" } = 1;
|
|||
|
||||
my $catcode;
|
||||
if ( $category_type eq 'C') {
|
||||
if ($data->{'guarantorid'} ne '0' ) {
|
||||
if ($data->{guarantorid} ) {
|
||||
my $data2 = GetMember( 'borrowernumber' => $data->{'guarantorid'} );
|
||||
foreach (qw(address city B_address B_city phone mobile zipcode country B_country)) {
|
||||
$data->{$_} = $data2->{$_};
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ if ( $op eq 'multi' ) {
|
|||
|
||||
elsif ( $op eq 'update' ) {
|
||||
my $member = GetMember('borrowernumber'=>$borrowernumber);
|
||||
$member->{'guarantorid'} = '0';
|
||||
$member->{'guarantorid'} = 0;
|
||||
$member->{'categorycode'} = $catcode;
|
||||
my $borcat = GetBorrowercategory($catcode);
|
||||
$member->{'category_type'} = $borcat->{'category_type'};
|
||||
|
|
|
|||
Loading…
Reference in New Issue