Fix error feedback for missing fields, when using the AddressBook to add an address.

This commit is contained in:
Colin Kuskie 2010-06-07 11:17:10 -07:00
parent 99063a3f76
commit 59fed35087
2 changed files with 15 additions and 1 deletions

View file

@ -8,6 +8,7 @@
- fixed #11610: Bad hover help for CS sortBy field
- fixed #11605: UserList refers to non-existent "publicEmail" user profiling field
- fixed #11595: Orphaned data in inbox_messageState
- fixed AddressBook feedback for missing fields.
7.9.6
- new checkbox in the asset manager for clearing the package flag on import

View file

@ -682,7 +682,20 @@ sub www_editAddressSave {
my %addressData = $self->processAddressForm();
my @missingFields = $self->missingFields(\%addressData);
if (@missingFields) {
return $self->www_editAddress(pop @missingFields);
my $i18n = WebGUI::International->new($self->session, "Shop");
my $missingField = pop @missingFields;
my $label = $missingField eq 'label' ? $i18n->get('label')
: $missingField eq 'firstName' ? $i18n->get('firstName')
: $missingField eq 'lastName' ? $i18n->get('lastName')
: $missingField eq 'address1' ? $i18n->get('address')
: $missingField eq 'city' ? $i18n->get('city')
: $missingField eq 'state' ? $i18n->get('state')
: $missingField eq 'country' ? $i18n->get('country')
: $missingField eq 'phoneNumber' ? $i18n->get('phone number')
: '' ;
if ($label) {
return $self->www_editAddress(sprintf($i18n->get('is a required field'), $label));
}
}
if ($form->get('addressId') eq '') {
$self->addAddress(\%addressData);