Allow addressBookId to be updated in an Address.

This is required for Address Book merging to work correctly in
Shop::AddressBook->newBySession.
This commit is contained in:
Colin Kuskie 2009-09-21 17:27:25 -07:00
parent 90b42437af
commit f2e8d6a70b
2 changed files with 12 additions and 16 deletions

View file

@ -263,10 +263,9 @@ The address book that this address belongs to.
sub update {
my ($self, $newProperties) = @_;
my $id = id $self;
foreach my $field (qw(email organization address1 address2 address3 state code city label firstName lastName country phoneNumber)) {
foreach my $field (qw(addressBookId email organization address1 address2 address3 state code city label firstName lastName country phoneNumber)) {
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
}
$properties{$id}{addressBookId} = $self->addressBook->getId;
$self->addressBook->session->db->setRow("address","addressId",$properties{$id});
}