/**
  * Updates an existing customer record in the legacy customer table.
  *
  * @param Model_Core_Customer $customer
  * An up-to-date Customer object that will be used to update the corresponding
  * record in the data store.
  *
  * @return void
  */
 public function updateCustomer($customer)
 {
     //Retrieve the data from the Customer object and format where necessary
     //ready for insertion into the data storage.
     $legacyIdentifier = $customer->getIdentifier(Model_Core_Customer::LEGACY_IDENTIFIER);
     $address1 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE1);
     $address2 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE2);
     $address3 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE3);
     $telephone1 = $customer->getTelephone(Model_Core_Customer::TELEPHONE1);
     $telephone2 = $customer->getTelephone(Model_Core_Customer::TELEPHONE2);
     if ($customer->getIsForeignAddress()) {
         $isForeignAddress = 'yes';
     } else {
         $isForeignAddress = 'no';
     }
     $data = array('password' => $customer->getPassword(), 'title' => $customer->getTitle(), 'firstname' => $customer->getFirstName(), 'lastname' => $customer->getLastName(), 'landname' => $customer->getLandlordName(), 'personaladdress1' => $address1, 'personaladdress3' => $address2, 'personaladdress5' => $address3, 'personalpostcode' => $customer->getPostcode(), 'country' => $customer->getCountry(), 'isForeignAddress' => $isForeignAddress, 'phone1' => $telephone1, 'phone2' => $telephone2, 'fax' => $customer->getFax(), 'email' => $customer->getEmailAddress(), 'occupation' => $customer->getOccupation(), 'date_of_birth_at' => $customer->getDateOfBirthAt());
     $where = $this->quoteInto('refno = ?', $legacyIdentifier);
     $this->update($data, $where);
 }
示例#2
0
 /**
  * Updates an existing customer record in the customers table.
  *
  * @param Model_Core_Customer $customer
  * An up-to-date Customer object that will be used to update the corresponding
  * record in the data store.
  *
  * @return void
  */
 public function updateCustomer($customer)
 {
     //Retrieve the data from the Customer object and format where necessary
     //ready for insertion into the data storage.
     $identifier = $customer->getIdentifier(Model_Core_Customer::IDENTIFIER);
     $address1 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE1);
     $address2 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE2);
     $address3 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE3);
     $telephone1 = $customer->getTelephone(Model_Core_Customer::TELEPHONE1);
     $telephone2 = $customer->getTelephone(Model_Core_Customer::TELEPHONE2);
     if ($customer->getIsForeignAddress()) {
         $isForeignAddress = 1;
     } else {
         $isForeignAddress = 0;
     }
     $landlordName = $customer->getLandlordName();
     if (empty($landlordName)) {
         $landlordName = '';
     }
     $data = array('password' => $customer->getPassword(), 'title' => $customer->getTitle(), 'first_name' => $customer->getFirstName(), 'last_name' => $customer->getLastName(), 'landname' => $landlordName, 'address1' => $address1, 'address2' => $address2, 'address3' => $address3, 'postcode' => $customer->getPostcode(), 'country' => $customer->getCountry(), 'foreign_address' => $isForeignAddress, 'telephone1' => $telephone1, 'telephone2' => $telephone2, 'email_address' => $customer->getEmailAddress(), 'occupation' => $customer->getOccupation(), 'type_id' => isset($this->_legacyTypeMap[$customer->typeID]) ? $this->_legacyTypeMap[$customer->typeID] : null);
     // Check account loading flag
     if ($customer->getAccountLoadComplete() != null) {
         $data['account_load_complete'] = $customer->getAccountLoadComplete() == true ? 1 : 0;
     }
     // Check email validation flag has been set to a boolean value.
     // This check must be performed as the customer manager sometimes
     // retrieves legacy customers which don't know about email validation
     // and runs this store method on the new customer record, resulting
     // in a reset of the validation flag.
     if ($customer->getEmailValidated() != null) {
         // Email validation flag has been set, stored within the record
         $data['email_validated'] = $customer->getEmailValidated() == true ? 1 : 0;
     }
     $where = $this->quoteInto('id = ?', $identifier);
     $this->update($data, $where);
 }
示例#3
0
 /**
  * Identifies if this customer is the same as the customer passed in.
  *
  * This method will identify a customer as equal to another customer if the
  * datas are the same.
  *
  * @param Model_Core_Customer $otherCustomer
  * The customer to compare this customer against.
  *
  * @return boolean
  * Returns true if the customers are equal, false otherwise.
  *
  * @todo
  * This method is incomplete.
  */
 public function equals($otherCustomer)
 {
     if ($this->_id != $otherCustomer->getIdentifier(self::IDENTIFIER)) {
         return false;
     }
     if ($this->_legacyId != $otherCustomer->getIdentifier(self::LEGACY_IDENTIFIER)) {
         return false;
     }
     if (strcasecmp($this->_title, $otherCustomer->getTitle()) != 0) {
         return false;
     }
     if (strcasecmp($this->_title, $otherCustomer->getFirstName()) != 0) {
         return false;
     }
     if (strcasecmp($this->_lastName, $otherCustomer->getLastname()) != 0) {
         return false;
     }
     if (strcasecmp($this->_addressLine1, $otherCustomer->getAddressLine(self::ADDRESSLINE1)) != 0) {
         return false;
     }
     if (strcasecmp($this->_addressLine2, $otherCustomer->getAddressLine(self::ADDRESSLINE2)) != 0) {
         return false;
     }
     if (strcasecmp($this->_addressLine3, $otherCustomer->getAddressLine(self::ADDRESSLINE3)) != 0) {
         return false;
     }
     if (strcasecmp($this->_postCode, $otherCustomer->getPostCode()) != 0) {
         return false;
     }
     if (strcasecmp($this->_country, $otherCustomer->getCountry()) != 0) {
         return false;
     }
     if ($this->_isForeignAddress != $otherCustomer->getIsForeignAddress()) {
         return false;
     }
     if ($this->_telephone1 != $otherCustomer->getTelephone(self::TELEPHONE1)) {
         return false;
     }
     if ($this->_telephone2 != $otherCustomer->getTelephone(self::TELEPHONE2)) {
         return false;
     }
     if ($this->_fax != $otherCustomer->getFax()) {
         return false;
     }
     if (strcasecmp($this->_emailAddress, $otherCustomer->getEmailAddress()) != 0) {
         return false;
     }
     if ($this->_password != $otherCustomer->getPassword()) {
         return false;
     }
     if ($this->_securityquestion != $otherCustomer->getSecurityQuestion()) {
         return false;
     }
     if ($this->_securityanswer != $otherCustomer->getSecurityAnswer()) {
         return false;
     }
     if (strcasecmp($this->_occupation, $otherCustomer->getOccupation()) != 0) {
         return false;
     }
     if ($this->_accountLoadComplete != $otherCustomer->getAccountLoadComplete()) {
         return false;
     }
     if ($this->_emailValidated != $otherCustomer->getEmailValidated()) {
         return false;
     }
     return true;
 }