From 52d2c632712c66a72f4d258ea0f6fa195475a078 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 4 Mar 2008 22:31:16 +0000 Subject: [PATCH] added utility method --- lib/WebGUI/Shop/AddressBook.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Shop/AddressBook.pm b/lib/WebGUI/Shop/AddressBook.pm index 962b23996..2f9a27af2 100644 --- a/lib/WebGUI/Shop/AddressBook.pm +++ b/lib/WebGUI/Shop/AddressBook.pm @@ -180,6 +180,23 @@ sub getId { #------------------------------------------------------------------- +=head2 getAddress ( id ) + +Returns an address object. + +=head3 id + +An address object's unique id. + +=cut + +sub getAddress { + my ($self, $addressId) = @_; + return WebGUI::Shop::Address->new($self, $addressId); +} + +#------------------------------------------------------------------- + =head2 getAddresses ( ) Returns an array reference of address objects that are in this book. @@ -191,7 +208,7 @@ sub getAddresses { my @addressObjects = (); my $addresses = $self->session->db->read("select addressId from address where addressBookId=?",[$self->getId]); while (my ($addressId) = $addresses->array) { - push(@addressObjects, WebGUI::Shop::Address->new($self, $addressId)); + push(@addressObjects, $self->getAddress($addressId)); } return \@addressObjects; }