Add better support for user profile fields for addresses to the Cart and the EMS.

This commit is contained in:
Colin Kuskie 2011-08-11 16:27:29 -07:00
parent 39049e1c7c
commit 428ea58327
21 changed files with 1657 additions and 62 deletions

View file

@ -153,6 +153,19 @@ sub getId {
return $self->get("addressId");
}
#-------------------------------------------------------------------
=head2 isProfile ()
Returns 1 if the address is linked to the user's profile.
=cut
sub isProfile {
my $self = shift;
return ($self->get("isProfile") eq 1);
}
#-------------------------------------------------------------------
@ -192,7 +205,6 @@ sub new {
return $self;
}
#-------------------------------------------------------------------
=head2 update ( properties )
@ -259,16 +271,20 @@ The organization or company that this user is a part of.
The address book that this address belongs to.
=head4 isProfile
Whether or not this address is linked to the user profile. Defaults to 0
=cut
sub update {
my ($self, $newProperties) = @_;
my $id = id $self;
foreach my $field (qw(addressBookId 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 isProfile)) {
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
}
$self->addressBook->session->db->setRow("address","addressId",$properties{$id});
}
1;