Labels in the Cart for addresses are optional. They take the first line of the address if left blank. Tested w and w/o JS.

This commit is contained in:
Colin Kuskie 2010-09-01 12:22:55 -07:00
parent b8d7466e65
commit 5765739a95
4 changed files with 15 additions and 8 deletions

View file

@ -330,7 +330,7 @@ sub missingFields {
$addressData = $address;
}
my @missingFields = ();
FIELD: foreach my $field (qw/label firstName lastName address1 city state code country phoneNumber/) {
FIELD: foreach my $field (qw/firstName lastName address1 city state code country phoneNumber/) {
push @missingFields, $field if $addressData->{$field} eq '';
}
return @missingFields;
@ -456,11 +456,10 @@ sub processAddressForm {
email => $form->get($prefix . "email", "email"),
organization => $form->get($prefix . "organization"),
);
#my $label = $field eq 'address1' ? 'address'
# : $field eq 'phoneNumber' ? 'phone number'
# : $field
# ;
##Label is optional in the form, but required for the UI and API.
##Use the first address line in its place if it's missing
$addressData{label} = $addressData{address1} if ! $addressData{label};
return %addressData;
}