本文整理汇总了PHP中SugarEmailAddress类的典型用法代码示例。如果您正苦于以下问题:PHP SugarEmailAddress类的具体用法?PHP SugarEmailAddress怎么用?PHP SugarEmailAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SugarEmailAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMarkEmailAddressInvalid
public function testMarkEmailAddressInvalid()
{
markEmailAddressInvalid($this->emailAddress);
$sea = new SugarEmailAddress();
$rs = $sea->retrieve_by_string_fields(array('email_address_caps' => trim(strtoupper($this->emailAddress))));
$this->assertTrue((bool) $rs->invalid_email);
}
示例2: readSugarEmailAddress
/**
* Fetch a SugarEmailAddress for retrieval/checking purposes
* @param $uuid - uuid (guid) of row to read in
* @return SugarEmailAddress
*/
protected function readSugarEmailAddress($uuid)
{
$sea = new SugarEmailAddress();
$sea->disable_row_level_security = true;
// SugarEmailAddress doesn't roll with security
$sea->retrieve($uuid);
return $sea;
}
示例3: testEmailAddressInFetchedRow
/**
* @group bug42279
*/
public function testEmailAddressInFetchedRow()
{
$sea = new SugarEmailAddress();
// this will populate contact->email1
$sea->populateLegacyFields($this->contact);
$email1 = $this->contact->email1;
// this should set fetched_row['email1'] to contatc->email1
$sea->handleLegacyRetrieve($this->contact);
$this->assertEquals($email1, $this->contact->fetched_row['email1']);
}
示例4: evaluate
/**
* Returns itself when evaluating.
*/
function evaluate()
{
$emailStr = $this->getParameters()->evaluate();
if ($emailStr == "") {
return AbstractExpression::$TRUE;
}
$lastChar = $emailStr[strlen($emailStr) - 1];
if (!preg_match('/[^\\.]/i', $lastChar)) {
return AbstractExpression::$FALSE;
}
// validate it
$emailArr = preg_split('/[,;]/', $emailStr);
for ($i = 0; $i < sizeof($emailArr); $i++) {
$emailAddress = trim($emailArr[$i]);
if ($emailAddress != '' && !SugarEmailAddress::isValidEmail($emailAddress)) {
return AbstractExpression::$FALSE;
}
}
return AbstractExpression::$TRUE;
}
示例5: apiSave
/**
* This should be called when the bean is saved from the API.
* Most fields can just use default, which calls the field's
* individual ->save() function instead.
*
* @param SugarBean $bean the bean performing the save
* @param array $params an array of parameters relevant to the save, which will be an array passed up to the API
* @param string $field The name of the field to save (the vardef name, not the form element name)
* @param array $properties Any properties for this field
*/
public function apiSave(SugarBean $bean, array $params, $field, $properties)
{
if (!is_array($params[$field])) {
// Not an array, don't do anything.
return;
}
if (!isset($bean->emailAddress)) {
$bean->emailAddress = BeanFactory::getBean('EmailAddresses');
}
if (empty($bean->emailAddress->addresses) && !isset($bean->emailAddress->hasFetched)) {
$oldAddresses = $bean->emailAddress->getAddressesByGUID($bean->id, $bean->module_name);
} else {
$oldAddresses = $bean->emailAddress->addresses;
}
array_walk($params[$field], array($this, 'formatEmails'));
$bean->emailAddress->addresses = array();
foreach ($params[$field] as $email) {
if (empty($email['email_address'])) {
// Can't save an empty email address
continue;
}
// Search each one for a matching set, otherwise use the defaults
$mergeAddr = array('primary_address' => false, 'invalid_email' => false, 'opt_out' => false);
foreach ($oldAddresses as $address) {
if (strtolower($address['email_address']) == strtolower($email['email_address'])) {
$mergeAddr = $address;
break;
}
}
$email = array_merge($mergeAddr, $email);
if (!SugarEmailAddress::isValidEmail($email['email_address'])) {
require_once 'include/api/SugarApiException.php';
throw new SugarApiExceptionInvalidParameter("{$email['email_address']} is an invalid email address");
}
$bean->emailAddress->addAddress($email['email_address'], $email['primary_address'], false, $email['invalid_email'], $email['opt_out']);
}
$bean->emailAddress->save($bean->id, $bean->module_dir, $params[$field]);
// Here is a hack for SugarEmailAddress.php so it doesn't attempt a legacy save
$bean->emailAddress->dontLegacySave = true;
$bean->emailAddress->populateLegacyFields($bean);
}
示例6: handleSave
function handleSave($prefix, $redirect = true, $useRequired = false)
{
require_once 'include/formbase.php';
$focus = new xVendor();
if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
$focus = populateFromPost($prefix, $focus);
if (isset($GLOBALS['check_notify'])) {
$check_notify = $GLOBALS['check_notify'];
} else {
$check_notify = FALSE;
}
if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
$duplicatexVendors = $this->checkForDuplicates($prefix);
if (isset($duplicatexVendors)) {
$location = 'module=xVendors&action=ShowDuplicates';
$get = '';
// Bug 25311 - Add special handling for when the form specifies many-to-many relationships
if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
$get .= '&xVendorsrelate_to=' . $_POST['relate_to'];
}
if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
$get .= '&xVendorsrelate_id=' . $_POST['relate_id'];
}
//add all of the post fields to redirect get string
foreach ($focus->column_fields as $field) {
if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
$get .= "&xVendors{$field}=" . urlencode($focus->{$field});
}
}
foreach ($focus->additional_column_fields as $field) {
if (!empty($focus->{$field})) {
$get .= "&xVendors{$field}=" . urlencode($focus->{$field});
}
}
if ($focus->hasCustomFields()) {
foreach ($focus->field_defs as $name => $field) {
if (!empty($field['source']) && $field['source'] == 'custom_fields') {
$get .= "&xVendors{$name}=" . urlencode($focus->{$name});
}
}
}
$emailAddress = new SugarEmailAddress();
$get .= $emailAddress->getFormBaseURL($focus);
//create list of suspected duplicate xvendor id's in redirect get string
$i = 0;
foreach ($duplicatexVendors as $xvendor) {
$get .= "&duplicate[{$i}]=" . $xvendor['id'];
$i++;
}
//add return_module, return_action, and return_id to redirect get string
$get .= '&return_module=';
if (!empty($_POST['return_module'])) {
$get .= $_POST['return_module'];
} else {
$get .= 'xVendors';
}
$get .= '&return_action=';
if (!empty($_POST['return_action'])) {
$get .= $_POST['return_action'];
}
//else $get .= 'DetailView';
if (!empty($_POST['return_id'])) {
$get .= '&return_id=' . $_POST['return_id'];
}
if (!empty($_POST['popup'])) {
$get .= '&popup=' . $_POST['popup'];
}
if (!empty($_POST['create'])) {
$get .= '&create=' . $_POST['create'];
}
$_SESSION['SHOW_DUPLICATES'] = $get;
//now redirect the post to modules/xVendors/ShowDuplicates.php
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
ob_clean();
$json = getJSONobj();
echo $json->encode(array('status' => 'dupe', 'get' => $location));
} else {
if (!empty($_REQUEST['ajax_load'])) {
echo "<script>SUGAR.ajaxUI.loadContent('index.php?{$location}');</script>";
} else {
if (!empty($_POST['to_pdf'])) {
$location .= '&to_pdf=' . $_POST['to_pdf'];
}
header("Location: index.php?{$location}");
}
}
return null;
}
}
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->save($check_notify);
$return_id = $focus->id;
$GLOBALS['log']->debug("Saved record with id of " . $return_id);
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
$json = getJSONobj();
//.........这里部分代码省略.........
示例7: handleSave
function handleSave($prefix, $redirect = true, $useRequired = false)
{
global $theme, $current_user;
require_once 'include/formbase.php';
global $timedate;
$focus = new Contact();
if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
if (!empty($_POST[$prefix . 'new_reports_to_id'])) {
$focus->retrieve($_POST[$prefix . 'new_reports_to_id']);
$focus->reports_to_id = $_POST[$prefix . 'record'];
} else {
$focus = populateFromPost($prefix, $focus);
if (!empty($focus->portal_password) && $focus->portal_password != $_POST[$prefix . 'old_portal_password']) {
$focus->portal_password = md5($focus->portal_password);
}
if (!isset($_POST[$prefix . 'email_opt_out'])) {
$focus->email_opt_out = 0;
}
if (!isset($_POST[$prefix . 'do_not_call'])) {
$focus->do_not_call = 0;
}
}
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if ($_REQUEST['action'] != 'BusinessCard' && $_REQUEST['action'] != 'ConvertLead' && $_REQUEST['action'] != 'ConvertProspect') {
if (!empty($_POST[$prefix . 'sync_contact'])) {
$focus->contacts_users_id = $current_user->id;
} else {
if (!isset($focus->users)) {
$focus->load_relationship('user_sync');
}
$focus->contacts_users_id = null;
$focus->user_sync->delete($focus->id, $current_user->id);
}
}
if (isset($GLOBALS['check_notify'])) {
$check_notify = $GLOBALS['check_notify'];
} else {
$check_notify = FALSE;
}
if (empty($_POST['dup_checked'])) {
$duplicateContacts = $this->checkForDuplicates($prefix);
if (isset($duplicateContacts)) {
$location = 'module=Contacts&action=ShowDuplicates';
$get = '';
if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
$get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
}
// Bug 25311 - Add special handling for when the form specifies many-to-many relationships
if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
$get .= '&Contactsrelate_to=' . $_POST['relate_to'];
}
if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
$get .= '&Contactsrelate_id=' . $_POST['relate_id'];
}
//add all of the post fields to redirect get string
foreach ($focus->column_fields as $field) {
if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
$get .= "&Contacts{$field}=" . urlencode($focus->{$field});
}
}
foreach ($focus->additional_column_fields as $field) {
if (!empty($focus->{$field})) {
$get .= "&Contacts{$field}=" . urlencode($focus->{$field});
}
}
if ($focus->hasCustomFields()) {
foreach ($focus->field_defs as $name => $field) {
if (!empty($field['source']) && $field['source'] == 'custom_fields') {
$get .= "&Contacts{$name}=" . urlencode($focus->{$name});
}
}
}
$emailAddress = new SugarEmailAddress();
$get .= $emailAddress->getFormBaseURL($focus);
//create list of suspected duplicate contact id's in redirect get string
$i = 0;
foreach ($duplicateContacts as $contact) {
$get .= "&duplicate[{$i}]=" . $contact['id'];
$i++;
}
//add return_module, return_action, and return_id to redirect get string
$get .= "&return_module=";
if (!empty($_POST['return_module'])) {
$get .= $_POST['return_module'];
} else {
$get .= "Contacts";
}
$get .= "&return_action=";
if (!empty($_POST['return_action'])) {
$get .= $_POST['return_action'];
}
//else $get .= "DetailView";
if (!empty($_POST['return_id'])) {
$get .= "&return_id=" . $_POST['return_id'];
}
//.........这里部分代码省略.........
示例8: saveEmailUpdate
/**
* Called when saving a new email and adds the case update to the case.
* @param $bean
* @param $event
* @param $arguments
*/
public function saveEmailUpdate($bean, $event, $arguments)
{
global $mod_strings;
if ($bean->intent != "createcase" || $bean->parent_type != "Cases") {
$GLOBALS['log']->warn("CaseUpdatesHook: saveEmailUpdate: Not a create case or wrong parent type");
return;
}
if (!$bean->parent_id) {
$GLOBALS['log']->warn("CaseUpdatesHook: saveEmailUpdate No parent id");
return;
}
if ($bean->cases) {
$GLOBALS['log']->warn("CaseUpdatesHook: saveEmailUpdate cases already set");
return;
}
if ($bean->fetched_row['parent_id']) {
//Will have been processed already
return;
}
$contact = BeanFactory::getBean("Contact");
$ea = new SugarEmailAddress();
$beans = $ea->getBeansByEmailAddress($bean->from_addr);
$contact_id = null;
foreach ($beans as $emailBean) {
if ($emailBean->module_name == "Contacts") {
$contact_id = $emailBean->id;
$this->linkAccountAndCase($bean->parent_id, $emailBean->account_id);
}
}
$case_update = new AOP_Case_Updates();
$case_update->name = $bean->name;
$case_update->contact_id = $contact_id;
$updateText = $this->unquoteEmail($bean->description_html ? $bean->description_html : $bean->description);
$case_update->description = $updateText;
$case_update->internal = false;
$case_update->case_id = $bean->parent_id;
$case_update->save();
}
示例9: email2Send
/**
* Sends Email for Email 2.0
*/
function email2Send($request)
{
global $mod_strings;
global $app_strings;
global $current_user;
global $sugar_config;
global $locale;
global $timedate;
global $beanList;
global $beanFiles;
$OBCharset = $locale->getPrecedentPreference('default_email_charset');
/**********************************************************************
* Sugar Email PREP
*/
/* preset GUID */
$orignialId = "";
if (!empty($this->id)) {
$orignialId = $this->id;
}
// if
if (empty($this->id)) {
$this->id = create_guid();
$this->new_with_id = true;
}
/* satisfy basic HTML email requirements */
$this->name = $request['sendSubject'];
$this->description_html = '<html><body>' . $request['sendDescription'] . '</body></html>';
/**********************************************************************
* PHPMAILER PREP
*/
$mail = new SugarPHPMailer();
$mail = $this->setMailer($mail, '', $_REQUEST['fromAccount']);
if (empty($mail->Host) && !$this->isDraftEmail($request)) {
$this->status = 'send_error';
if ($mail->oe->type == 'system') {
echo $app_strings['LBL_EMAIL_ERROR_PREPEND'] . $app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND'];
} else {
echo $app_strings['LBL_EMAIL_ERROR_PREPEND'] . $app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND'];
}
return false;
}
$subject = $this->name;
$mail->Subject = from_html($this->name);
// work-around legacy code in SugarPHPMailer
if ($_REQUEST['setEditor'] == 1) {
$_REQUEST['description_html'] = $_REQUEST['sendDescription'];
$this->description_html = $_REQUEST['description_html'];
} else {
$this->description_html = '';
$this->description = $_REQUEST['sendDescription'];
}
// end work-around
if ($this->isDraftEmail($request)) {
if ($this->type != 'draft' && $this->status != 'draft') {
$this->id = create_guid();
$this->new_with_id = true;
$this->date_entered = "";
}
// if
$q1 = "update emails_email_addr_rel set deleted = 1 WHERE email_id = '{$this->id}'";
$r1 = $this->db->query($q1);
}
// if
if (isset($request['saveDraft'])) {
$this->type = 'draft';
$this->status = 'draft';
$forceSave = true;
} else {
/* Apply Email Templates */
// do not parse email templates if the email is being saved as draft....
$toAddresses = $this->email2ParseAddresses($_REQUEST['sendTo']);
$sea = new SugarEmailAddress();
$object_arr = array();
if (isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id']) && ($_REQUEST['parent_type'] == 'Accounts' || $_REQUEST['parent_type'] == 'Contacts' || $_REQUEST['parent_type'] == 'Leads' || $_REQUEST['parent_type'] == 'Users' || $_REQUEST['parent_type'] == 'Prospects')) {
if (isset($beanList[$_REQUEST['parent_type']]) && !empty($beanList[$_REQUEST['parent_type']])) {
$className = $beanList[$_REQUEST['parent_type']];
if (isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
if (!class_exists($className)) {
require_once $beanFiles[$className];
}
$bean = new $className();
$bean->retrieve($_REQUEST['parent_id']);
$object_arr[$bean->module_dir] = $bean->id;
}
// if
}
// if
}
foreach ($toAddresses as $addrMeta) {
$addr = $addrMeta['email'];
$beans = $sea->getBeansByEmailAddress($addr);
foreach ($beans as $bean) {
if (!isset($object_arr[$bean->module_dir])) {
$object_arr[$bean->module_dir] = $bean->id;
}
}
}
//.........这里部分代码省略.........
示例10: isADuplicateRecord
/**
* Checks to see if the given bean is a duplicate based off the given indexes
*
* @param array $indexlist
* @return bool true if this bean is a duplicate or false if it isn't
*/
public function isADuplicateRecord($indexlist)
{
// loop through var def indexes and compare with selected indexes
foreach ($this->_getIndexVardefs() as $index) {
// if we get an index not in the indexlist, loop
if (!in_array($index['name'], $indexlist)) {
continue;
}
// This handles the special case of duplicate email checking
if ($index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2') {
$emailAddress = new SugarEmailAddress();
$email = $index['fields'][0];
if ($emailAddress->getCountEmailAddressByBean($this->_focus->{$email}, $this->_focus, $index['name'] == 'special_idx_email1') > 0) {
return true;
}
} else {
$index_fields = array('deleted' => '0');
foreach ($index['fields'] as $field) {
if ($field == 'deleted') {
continue;
}
if (!in_array($field, $index_fields)) {
if (strlen($this->_focus->{$field}) > 0) {
$index_fields[$field] = $this->_focus->{$field};
}
}
}
// if there are no valid fields in the index field list, loop
if (count($index_fields) <= 1) {
continue;
}
$newfocus = loadBean($this->_focus->module_dir);
$result = $newfocus->retrieve_by_string_fields($index_fields, true);
if (!is_null($result)) {
return true;
}
}
}
return false;
}
示例11: displayComposeEmail
/**
* Returns the templatized compose screen. Used by reply, forwards and draft status messages.
* @param object email Email bean in focus
*/
function displayComposeEmail($email)
{
global $locale;
global $current_user;
$ea = new SugarEmailAddress();
if (!empty($email)) {
$email->cids2Links();
$description = empty($email->description_html) ? $email->description : $email->description_html;
}
//Get the most complete address list availible for this email
$addresses = array('toAddresses' => 'to', 'ccAddresses' => 'cc', 'bccAddresses' => 'bcc');
foreach ($addresses as $var => $type) {
${$var} = "";
foreach (array("{$type}_addrs_names", "{$type}addrs", "{$type}_addrs") as $emailVar) {
if (!empty($email->{$emailVar})) {
${$var} = $email->{$emailVar};
break;
}
}
}
$ret = array();
$ret['type'] = $email->type;
$ret['name'] = $email->name;
$ret['description'] = $description;
$ret['from'] = isset($_REQUEST['composeType']) && $_REQUEST['composeType'] == 'forward' ? "" : $email->from_addr;
$ret['to'] = from_html($toAddresses);
$ret['uid'] = $email->id;
$ret['parent_name'] = $email->parent_name;
$ret['parent_type'] = $email->parent_type;
$ret['parent_id'] = $email->parent_id;
if ($email->type == 'draft') {
$ret['cc'] = from_html($ccAddresses);
$ret['bcc'] = $bccAddresses;
}
// reply all
if (isset($_REQUEST['composeType']) && $_REQUEST['composeType'] == 'replyAll') {
$ret['cc'] = from_html($ccAddresses);
$ret['bcc'] = $bccAddresses;
$userEmails = array();
$userEmailsMeta = $ea->getAddressesByGUID($current_user->id, 'Users');
foreach ($userEmailsMeta as $emailMeta) {
$userEmails[] = from_html(strtolower(trim($emailMeta['email_address'])));
}
$userEmails[] = from_html(strtolower(trim($email->from_addr)));
$ret['cc'] = from_html($email->cc_addrs);
$toAddresses = from_html($toAddresses);
$to = str_replace($this->addressSeparators, "::", $toAddresses);
$exTo = explode("::", $to);
if (is_array($exTo)) {
foreach ($exTo as $addr) {
$addr = strtolower(trim($addr));
if (!in_array($addr, $userEmails)) {
if (!empty($ret['cc'])) {
$ret['cc'] = $ret['cc'] . ", ";
}
$ret['cc'] = $ret['cc'] . trim($addr);
}
}
} elseif (!empty($exTo)) {
$exTo = trim($exTo);
if (!in_array($exTo, $userEmails)) {
$ret['cc'] = $ret['cc'] . ", " . $exTo;
}
}
}
return $ret;
}
示例12: handleSave
function handleSave($prefix, $redirect = true, $useRequired = false, $do_save = true, $exist_lead = null)
{
require_once 'modules/Campaigns/utils.php';
require_once 'include/formbase.php';
if (empty($exist_lead)) {
$focus = new Lead();
} else {
$focus = $exist_lead;
}
if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
$focus = populateFromPost($prefix, $focus);
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
//Check for duplicate Leads
if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
$duplicateLeads = $this->checkForDuplicates($prefix);
if (isset($duplicateLeads)) {
//Set the redirect location to call the ShowDuplicates action. This will map to view.showduplicates.php
$location = 'module=Leads&action=ShowDuplicates';
$get = '';
if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
$get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
}
if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
$get .= '&Leadsrelate_to=' . $_POST['relate_to'];
}
if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
$get .= '&Leadsrelate_id=' . $_POST['relate_id'];
}
//add all of the post fields to redirect get string
foreach ($focus->column_fields as $field) {
if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
$get .= "&Leads{$field}=" . urlencode($focus->{$field});
}
}
foreach ($focus->additional_column_fields as $field) {
if (!empty($focus->{$field})) {
$get .= "&Leads{$field}=" . urlencode($focus->{$field});
}
}
if ($focus->hasCustomFields()) {
foreach ($focus->field_defs as $name => $field) {
if (!empty($field['source']) && $field['source'] == 'custom_fields') {
$get .= "&Leads{$name}=" . urlencode($focus->{$name});
}
}
}
$emailAddress = new SugarEmailAddress();
$get .= $emailAddress->getFormBaseURL($focus);
//create list of suspected duplicate lead ids in redirect get string
$i = 0;
foreach ($duplicateLeads as $lead) {
$get .= "&duplicate[{$i}]=" . $lead['id'];
$i++;
}
//add return_module, return_action, and return_id to redirect get string
$get .= "&return_module=";
if (!empty($_POST['return_module'])) {
$get .= $_POST['return_module'];
} else {
$get .= "Leads";
}
$get .= "&return_action=";
if (!empty($_POST['return_action'])) {
$get .= $_POST['return_action'];
}
if (!empty($_POST['return_id'])) {
$get .= "&return_id=" . $_POST['return_id'];
}
if (!empty($_POST['popup'])) {
$get .= '&popup=' . $_POST['popup'];
}
if (!empty($_POST['create'])) {
$get .= '&create=' . $_POST['create'];
}
// for InboundEmail flow
if (!empty($_POST['start'])) {
$get .= '&start=' . $_POST['start'];
}
$_SESSION['SHOW_DUPLICATES'] = $get;
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
ob_clean();
$json = getJSONobj();
echo $json->encode(array('status' => 'dupe', 'get' => $location));
} else {
if (!empty($_REQUEST['ajax_load'])) {
echo "<script>SUGAR.ajaxUI.loadContent('index.php?{$location}');</script>";
} else {
if (!empty($_POST['to_pdf'])) {
$location .= '&to_pdf=' . $_POST['to_pdf'];
}
header("Location: index.php?{$location}");
}
}
return null;
}
//.........这里部分代码省略.........
示例13: foreach
}
}
foreach ($realtytemplates->additional_column_fields as $field) {
if (!empty($_POST['RealtyTemplates' . $field])) {
$input .= "<input type='hidden' name='{$field}' value='{$_POST['RealtyTemplates' . $field]}'>\n";
}
}
$input .= "<input type='hidden' name='record' value='{$_GET['record']}'>\n";
// Bug 25311 - Add special handling for when the form specifies many-to-many relationships
if (!empty($_POST['RealtyTemplatesrelate_to'])) {
$input .= "<input type='hidden' name='relate_to' value='{$_POST['RealtyTemplatesrelate_to']}'>\n";
}
if (!empty($_POST['RealtyTemplatesrelate_id'])) {
$input .= "<input type='hidden' name='relate_id' value='{$_POST['RealtyTemplatesrelate_id']}'>\n";
}
$emailAddress = new SugarEmailAddress();
$input .= $emailAddress->getEmailAddressWidgetDuplicatesView($realtytemplates);
$get = '';
if (!empty($_POST['return_module'])) {
$xtpl->assign('RETURN_MODULE', $_POST['return_module']);
} else {
$get .= "RealtyTemplates";
}
$get .= "&return_action=";
if (!empty($_POST['return_action'])) {
$xtpl->assign('RETURN_ACTION', $_POST['return_action']);
} else {
$get .= "DetailView";
}
///////////////////////////////////////////////////////////////////////////////
//// INBOUND EMAIL WORKFLOW
示例14: strtolower
$ie->email->status = 'read';
$ie->email->save();
$mod = strtolower($controller->module);
$ie->email->load_relationship($mod);
$ie->email->{$mod}->add($controller->bean->id);
if ($controller->bean->load_relationship('emails')) {
$controller->bean->emails->add($ie->email->id);
}
if ($controller->bean->module_dir == 'Cases') {
if ($controller->bean->load_relationship('contacts')) {
$emailAddressWithName = $ie->email->from_addr;
if (!empty($ie->email->reply_to_addr)) {
$emailAddressWithName = $ie->email->reply_to_addr;
}
// if
$emailAddress = SugarEmailAddress::_cleanAddress($emailAddressWithName);
$contactIds = $ie->email->emailAddress->getRelatedId($emailAddress, 'contacts');
if (!empty($contactIds)) {
$controller->bean->contacts->add($contactIds);
}
// if
}
// if
}
// if
echo $json->encode(array('id' => $ie->email->id));
}
break;
case "getImportForm":
$ie->retrieve($_REQUEST['ieId']);
// $ie->mailbox = $_REQUEST['mailbox'];
示例15: markEmailAddressInvalid
/**
* Given an email address, mark it as invalid.
*
* @param $email_address
*/
function markEmailAddressInvalid($email_address)
{
if (empty($email_address)) {
return;
}
$sea = new SugarEmailAddress();
$rs = $sea->retrieve_by_string_fields(array('email_address_caps' => trim(strtoupper($email_address))));
if ($rs != null) {
$sea->AddUpdateEmailAddress($email_address, 1, 0, $rs->id);
}
}