bug 2264: do not clear patron zipcode and city
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 19 Jun 2008 21:20:28 +0000 (16:20 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 20 Jun 2008 01:45:54 +0000 (20:45 -0500)
When edting only a part of the patron record (e.g.,
the library use section or the alternate address), the
zipcode and city were cleared due to an error in
form processing.  Now the city and zipcode are set
only of those fields are actually in the submitted form.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
members/memberentry.pl

index ba6b9d7..bf7379c 100755 (executable)
@@ -70,8 +70,6 @@ my $check_member=$input->param('check_member');
 my $name_city=$input->param('name_city');
 my $nodouble=$input->param('nodouble');
 my $select_city=$input->param('select_city');
-my $zipcode=$input->param('zipcode');
-my $city=$input->param('city');
 my $nok=$input->param('nok');
 my $guarantorinfo=$input->param('guarantorinfo');
 my $step=$input->param('step') || 0;
@@ -171,9 +169,10 @@ if (($category_type eq 'C' || $category_type eq 'P') and $guarantorid ne '' ){
 }
 
 ###############test to take the right zipcode and city name ##############
-if ( $guarantorid eq ''){
-    $newdata{'city'}= $city;
-    $newdata{'zipcode'}=$zipcode; 
+if ($guarantorid eq '') {
+    # 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'));
 }
 
 #builds default userid