X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=members%2Fmemberentry.pl;h=3b62849c22eac784a168092a94ea65472fef676b;hb=1aede39173841aa4f99e11266216894419bef388;hp=b3582f32c16fbaf5967f5d42cb3b315f16a2c952;hpb=239700d079ca6c33d3bc521c1f602e56f66069d1;p=koha.git diff --git a/members/memberentry.pl b/members/memberentry.pl index b3582f32c1..3b62849c22 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -136,7 +136,7 @@ if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') { } } # check permission to modify login info. - if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($dbh,$userenv->{'id'},{'staffaccess'=>1})) ) { + if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) ) { $NoUpdateLogin = 1; } } @@ -163,21 +163,27 @@ 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 '' ){ - my $guarantordata=GetMember($guarantorid); - $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'}; - if (!defined($data{'contactname'}) or $data{'contactname'} eq '' or $data{'contactname'} ne $guarantordata->{'surname'}) { - $data{'contactfirstname'}= $guarantordata->{'firstname'}; - $data{'contactname'} = $guarantordata->{'surname'}; - $data{'contacttitle'} = $guarantordata->{'title'}; - foreach (qw(streetnumber address streettype address2 zipcode city phone phonepro mobile fax email emailpro branchcode)) { - $data{$_} = $guarantordata->{$_}; - } - } +if ( defined($guarantorid) and + ( $category_type eq 'C' || $category_type eq 'P' ) and + $guarantorid ne '' and + $guarantorid ne '0' ) { + if (my $guarantordata=GetMember($guarantorid)) { + $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'}; + if ( !defined($data{'contactname'}) or $data{'contactname'} eq '' or + $data{'contactname'} ne $guarantordata->{'surname'} ) { + $newdata{'contactfirstname'}= $guarantordata->{'firstname'}; + $newdata{'contactname'} = $guarantordata->{'surname'}; + $newdata{'contacttitle'} = $guarantordata->{'title'}; + foreach (qw(streetnumber address streettype address2 + zipcode city phone phonepro mobile fax email emailpro branchcode)) { + $newdata{$_} = $guarantordata->{$_}; + } + } + } } ###############test to take the right zipcode and city name ############## -if (!defined($guarantorid) or $guarantorid eq '') { +if (!defined($guarantorid) or $guarantorid eq '' or $guarantorid eq '0') { # set only if parameter was passed from the form $newdata{'city'} = $input->param('city') if defined($input->param('city')); $newdata{'zipcode'} = $input->param('zipcode') if defined($input->param('zipcode')); @@ -303,13 +309,13 @@ if ($delete){ } if ($nok or !$nodouble){ - $op="add" if ($op eq "insert"); - $op="modify" if ($op eq "save"); - %data=%newdata; - $template->param( updtype => ($op eq 'add' ?'I':'M')); # used to check for $op eq "insert"... but we just changed $op! - unless ($step){ - $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1); - } + $op="add" if ($op eq "insert"); + $op="modify" if ($op eq "save"); + %data=%newdata; + $template->param( updtype => ($op eq 'add' ?'I':'M')); # used to check for $op eq "insert"... but we just changed $op! + unless ($step){ + $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1); + } } if (C4::Context->preference("IndependantBranches")) { my $userenv = C4::Context->userenv;