/**
* Updates a client record.
*
* @return mixed
* @param array $record The client record to update.
*/
private function updateClient($record)
{
// get the account settings
$url = BackendModel::getModuleSetting($this->getModule(), 'cm_url');
$username = BackendModel::getModuleSetting($this->getModule(), 'cm_username');
$password = BackendModel::getModuleSetting($this->getModule(), 'cm_password');
// try and update the client info
try {
// fetch complete list of timezones as pairs
$timezones = BackendMailmotorCMHelper::getTimezonesAsPairs();
// init CampaignMonitor object
$cm = new CampaignMonitor($url, $username, $password, 10, $this->clientID);
// update the client
$cm->updateClientBasics($record['company_name'], $record['contact_name'], $record['contact_email'], $record['country'], $timezones[$record['timezone']]);
} catch (Exception $e) {
// add an error to the email field
$this->redirect(BackendModel::createURLForAction('settings') . '&error=campaign-monitor-error&var=' . $e->getMessage() . '#tabSettingsClient');
}
}