From 1bd9a51df3ac77b05b676c473e49cc7e793b4fc5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 22 Apr 2010 13:31:55 -0700 Subject: [PATCH] More AddressBook cleanup from removal of the sessionId. --- lib/WebGUI/Shop/AddressBook.pm | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/WebGUI/Shop/AddressBook.pm b/lib/WebGUI/Shop/AddressBook.pm index 27f712d8d..c03830f1f 100644 --- a/lib/WebGUI/Shop/AddressBook.pm +++ b/lib/WebGUI/Shop/AddressBook.pm @@ -287,15 +287,10 @@ sub newByUserId { } # check to see if this user or his session already has an address book - my @ids = $session->db->buildArray("select addressBookId from addressBook where (userId<>'1' and userId=?) or sessionId=?",[$session->user->userId, $session->getId]); + my @ids = $session->db->buildArray("select addressBookId from addressBook where userId=?",[$userId]); if (scalar(@ids) > 0) { my $book = $class->new($session, $ids[0]); - # convert it to a specific user if we can - if ($userId ne '1') { - $book->update({userId => $userId, sessionId => ''}); - } - # merge others if needed if (scalar(@ids) > 1) { # it's attached to the session or we have too many so lets merge them @@ -331,10 +326,6 @@ A hash reference that contains one of the following: Assign the user that owns this address book. -=head4 sessionId - -Assign the session, by id, that owns this address book. Will automatically be set to "" if a user owns it. - =head4 defaultAddressId The id of the address to be made the default for this address book. @@ -344,13 +335,9 @@ The id of the address to be made the default for this address book. sub update { my ($self, $newProperties) = @_; my $id = id $self; - foreach my $field (qw(userId sessionId defaultAddressId)) { + foreach my $field (qw(userId defaultAddressId)) { $properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field}; } - ##Having both a userId and sessionId will confuse create. - if ($properties{$id}{userId} ne "") { - $properties{$id}{sessionId} = ""; - } $self->session->db->setRow("addressBook","addressBookId",$properties{$id}); }