You are here

public function UcAddressesAddress::privChangeAddressBook in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 class/UcAddressesAddress.class.php \UcAddressesAddress::privChangeAddressBook()

Modify the address book of this address.

This can only be done if the address book already accepted the address as one of it's addresses.

@access public

Parameters

UcAddressesAddressBook $addressBook: The address book to move this address to.

Return value

boolean TRUE on success. FALSE otherwise.

File

class/UcAddressesAddress.class.php, line 625
Contains the UcAddressesAddress class.

Class

UcAddressesAddress
The main address class used by uc_addresses (and extension modules).

Code

public function privChangeAddressBook(UcAddressesAddressBook $addressBook) {
  foreach ($addressBook
    ->getAddresses() as $address) {
    if ($address === $this) {

      // Address appears in address book, changing address book approved.
      $this->addressBook = $addressBook;
      return TRUE;
    }
  }
  return FALSE;
}