Allow billingAddress to be set at the same time as the shippingAddress is set to it.

This commit is contained in:
Colin Kuskie 2010-04-28 20:15:26 -07:00
parent 131d4cb041
commit cf95ff6683

View file

@ -723,16 +723,19 @@ sub updateFromForm {
$cartProperties->{billingAddressId} = $newAddress->get('addressId'); $cartProperties->{billingAddressId} = $newAddress->get('addressId');
} }
elsif ($billingAddressId eq 'update_address' && $self->get('billingAddressId') && ! @missingBillingFields) { elsif ($billingAddressId eq 'update_address' && $self->get('billingAddressId') && ! @missingBillingFields) {
##User changed the address selector ##User updated the current address
my $address = $self->getBillingAddress(); my $address = $self->getBillingAddress();
$address->update(\%billingData); $address->update(\%billingData);
} }
elsif ($billingAddressId ne 'new_address' && $billingAddressId) { elsif ($billingAddressId ne 'new_address' && $billingAddressId) {
##User changed the address selector to another address field
$cartProperties->{billingAddressId} = $billingAddressId; $cartProperties->{billingAddressId} = $billingAddressId;
} }
else { else {
$self->session->log->warn('billing address: something else: '); $self->session->log->warn('billing address: something else: ');
} }
##Update now, so that you can add an address AND set the shipping address to be the same at the same time.
$self->update($cartProperties);
if ($self->requiresShipping) { if ($self->requiresShipping) {
my %shippingData = $book->processAddressForm('shipping_'); my %shippingData = $book->processAddressForm('shipping_');