/**
  *
  * @return void
  */
 protected function removeReceiver()
 {
     $soap = new SoapClient($this->settings['wsdlUrl']);
     $userdata = $this->parseFields('fields.');
     if ($this->settings['directUnsubscription'] == "1") {
         if ($this->settings['unsubscribemethod'] == "delete") {
             $return = $soap->receiverDelete($this->settings['apiKey'], $this->settings['listId'], $userdata['email']);
         } else {
             $return = $soap->receiverSetInactive($this->settings['apiKey'], $this->settings['listId'], $userdata['email']);
         }
         if ($return->status == Tx_Formhandler_Finisher_CleverReach::STATUS_SUCCESS) {
             $this->utilityFuncs->debugMessage("User removed successfully");
         } else {
             $this->utilityFuncs->debugMessage("Error at removing \"" . $userdata['email'] . "\": " . $return->message);
         }
     } else {
         $return = $soap->formsUnsubscribeMail($this->settings['apiKey'], $this->settings['formId'], $userdata['email']);
         if ($return->status == Tx_Formhandler_Finisher_CleverReach::STATUS_SUCCESS) {
             $this->utilityFuncs->debugMessage("Unsubscribe mail sent");
         } else {
             $this->utilityFuncs->debugMessage("Unsubscription error for \"" . $userdata['email'] . "\": " . $return->message);
         }
     }
 }
 if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
     $error = true;
     $messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
 }
 if ($error == false) {
     //----------------------------- CleverReach Starts --------------------------------------
     if (CR_ENABLED == 'true') {
         $client = new SoapClient('http://api.cleverreach.com/soap/interface_v5.1.php?wsdl');
         // Check if email was changed and if so, delete old CleverReach record and create a new one.
         $query = 'SELECT customers_email_address FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id = ' . (int) $customer_id;
         $res = mysql_query($query);
         if ($res && mysql_num_rows($res)) {
             $old_email_address = mysql_result($res, 0, 0);
         }
         if ($old_email_address != $email_address) {
             $client->receiverDelete(CR_API_KEY, CR_LIST_ID, $old_email_address);
             $crReceiver = array('email' => utf8_encode($email_address), 'source' => utf8_encode('SwissCart'), 'attributes' => array(0 => array('key' => 'firstname', 'value' => utf8_encode($firstname)), 1 => array('key' => 'lastname', 'value' => utf8_encode($lastname))));
             $client->receiverAdd(CR_API_KEY, CR_LIST_ID, $crReceiver);
         } else {
             $crReceiver = array('email' => utf8_encode($email_address), 'source' => utf8_encode('SwissCart'), 'attributes' => array(0 => array('key' => 'firstname', 'value' => utf8_encode($firstname)), 1 => array('key' => 'lastname', 'value' => utf8_encode($lastname))));
             $ret = $client->receiverUpdate(CR_API_KEY, CR_LIST_ID, $crReceiver);
         }
     }
     //------------------------------ CleverReach Ends --------------------------------------
     $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax);
     if (ACCOUNT_GENDER == 'true') {
         $sql_data_array['customers_gender'] = $gender;
     }
     if (ACCOUNT_DOB == 'true') {
         $sql_data_array['customers_dob'] = tep_date_raw($dob);
     }
     if (isset($HTTP_POST_VARS['delete_reviews']) && $HTTP_POST_VARS['delete_reviews'] == 'on') {
         $reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . (int) $customers_id . "'");
         while ($reviews = tep_db_fetch_array($reviews_query)) {
             tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $reviews['reviews_id'] . "'");
         }
         tep_db_query("delete from " . TABLE_REVIEWS . " where customers_id = '" . (int) $customers_id . "'");
     } else {
         tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int) $customers_id . "'");
     }
     //----------------------------- CleverReach Starts --------------------------------------
     if (CR_ENABLED == 'true') {
         $client = new SoapClient('http://cleverreach.openstream.ch/soap/interface_v5.1.php?wsdl');
         $query = 'SELECT customers_email_address FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id = ' . (int) $customers_id;
         $res = mysql_query($query);
         if ($res && mysql_num_rows($res)) {
             $client->receiverDelete(CR_API_KEY, CR_LIST_ID, mysql_result($res, 0, 0));
         }
     }
     //------------------------------ CleverReach Ends --------------------------------------
     tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customers_id . "'");
     tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customers_id . "'");
     tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int) $customers_id . "'");
     tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int) $customers_id . "'");
     tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int) $customers_id . "'");
     tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int) $customers_id . "'");
     tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action'))));
     break;
 default:
     $customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int) $HTTP_GET_VARS['cID'] . "'");
     $customers = tep_db_fetch_array($customers_query);
     $cInfo = new objectInfo($customers);