From 8a469ed85dd8943f8149f1e9557bf038ca7fdd9e Mon Sep 17 00:00:00 2001 From: btoumi Date: Mon, 12 Jun 2006 15:12:11 +0000 Subject: [PATCH] members.pm: add field fax in getguarantordata function memberentry.pl : move getgarantordata use before step1 and add default_city value from guarantor data (if exist) --- C4/Members.pm | 2 +- members/memberentry.pl | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 4dbb81fb8f..aa74812541 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1054,7 +1054,7 @@ sub getguarantordata { my $dbh = C4::Context->dbh; my $sth = $dbh->prepare( -"Select title,firstname,surname,streetnumber,address,streettype,address2,zipcode,city,phone,phonepro,mobile,email,emailpro from borrowers where borrowernumber =? " +"Select title,firstname,surname,streetnumber,address,streettype,address2,zipcode,city,phone,phonepro,mobile,email,emailpro,fax from borrowers where borrowernumber =? " ); $sth->execute($borrowerid); my $guarantor_data = $sth->fetchrow_hashref; diff --git a/members/memberentry.pl b/members/memberentry.pl index 198b4435a5..fe1db55a40 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -73,7 +73,7 @@ my $select_city=$input->param('select_city'); my $nok=$input->param('nok'); my @errors; - +my $default_city; # $check_categorytype contains the value of duplicate borrowers category type to redirect in good template in step =2 my $check_categorytype=$input->param('check_categorytype'); # NOTE: Alert for ethnicity and ethnotes fields, they are unvalided in all borrowers form @@ -118,16 +118,10 @@ if ($op eq 'add' or $op eq 'modify') { # recover the category type if the borrowers is a doublon ($check_categorytype,undef)=getcategorytype($check_category); } - # CHECKS step by step -# STEP 1 - if ($step eq 1) { - ###############test to take the right zipcode and city name ############## - if ($category_type ne 'I' and $guarantorid eq ''){ - my ($borrower_city,$borrower_zipcode)=&getzipnamecity($select_city); - $data{'city'}= $borrower_city; - $data{'zipcode'}=$borrower_zipcode; - } - if ($category_type eq 'C' and $guarantorid ne ''){ + + +#recover all data from guarantor address phone ,fax... +if ($category_type eq 'C' and $guarantorid ne '' and $data{'contactname'} eq ''){ my $guarantordata=getguarantordata($guarantorid); if (($data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'})) { $data{'contactfirstname'}=$guarantordata->{'firstname'}; @@ -145,8 +139,19 @@ if ($op eq 'add' or $op eq 'modify') { $data{'fax'}=$guarantordata->{'fax'}; $data{'email'}=$guarantordata->{'email'}; $data{'emailpro'}=$guarantordata->{'emailpro'}; + $default_city=getidcity($data{'city'}); } } + + # CHECKS step by step +# STEP 1 + if ($step eq 1) { + ###############test to take the right zipcode and city name ############## + if ($category_type ne 'I' and $guarantorid eq ''){ + my ($borrower_city,$borrower_zipcode)=&getzipnamecity($select_city); + $data{'city'}= $borrower_city; + $data{'zipcode'}=$borrower_zipcode; + } if ($categorycode ne 'I') { my $age = get_age(format_date_in_iso($data{dateofbirth})); my (undef,$agelimitmin,$agelimitmax)=getborrowercategory($data{'categorycode'}); @@ -284,7 +289,7 @@ if ($delete){ -default=>$default_category, -labels=>$labels); #test in city - my $default_city; + if ($op eq ''){ (my $selectcity=&getidcity($data{'city'})) if ($select_city eq ''); $default_city=$selectcity; -- 2.39.5