function save($check_notify = false) { $this->name = SugarCleaner::cleanHtml($this->name); $this->description = SugarCleaner::cleanHtml($this->description); global $current_user, $sugar_config; parent::save($check_notify); $email_template = new EmailTemplate(); if ($_REQUEST['module'] == 'Import') { //Don't send email on import return; } if (!isAOPEnabled()) { return; } if ($this->internal) { return; } $signature = array(); $addDelimiter = true; $aop_config = $sugar_config['aop']; if ($this->assigned_user_id) { if ($aop_config['contact_email_template_id']) { $email_template = $email_template->retrieve($aop_config['contact_email_template_id']); $signature = $current_user->getDefaultSignature(); } if ($email_template) { foreach ($this->getContacts() as $contact) { $GLOBALS['log']->info("AOPCaseUpdates: Calling send email"); $emails = array(); $emails[] = $contact->emailAddress->getPrimaryAddress($contact); $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter, $contact->id); } } } else { $emails = $this->getEmailForUser(); if ($aop_config['user_email_template_id']) { $email_template = $email_template->retrieve($aop_config['user_email_template_id']); } $addDelimiter = false; if ($emails && $email_template) { $GLOBALS['log']->info("AOPCaseUpdates: Calling send email"); $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter, $this->contact_id); } } if ($emails && $email_template) { $GLOBALS['log']->info("AOPCaseUpdates: Calling send email"); $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter); } }
function updateUser($bean, $event, $arguments) { if (!isAOPEnabled()) { return; } if (isset($bean->joomla_account_access) && $bean->joomla_account_access != '') { global $sugar_config; $aop_config = $sugar_config['aop']; $template = new EmailTemplate(); $template->retrieve($aop_config['joomla_account_creation_email_template_id']); $object_arr['Contacts'] = $bean->id; $body_html = aop_parse_template($template->body_html, $object_arr); $body_html = str_replace("\$joomla_pass", $bean->joomla_account_access, $body_html); $body_html = str_replace("\$portal_address", $aop_config['joomla_url'], $body_html); $body_plain = aop_parse_template($template->body, $object_arr); $body_plain = str_replace("\$joomla_pass", $bean->joomla_account_access, $body_plain); $body_plain = str_replace("\$portal_address", $aop_config['joomla_url'], $body_plain); $this->sendEmail($bean->email1, $template->subject, $body_html, $body_plain, $bean); } }
* * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not * reasonably feasible for technical reasons, the Appropriate Legal Notices must * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". ********************************************************************************/ require_once 'modules/AOP_Case_Updates/util.php'; if (!isAOPEnabled()) { //Use the default require 'modules/InboundEmail/EditView.php'; exit; } $_REQUEST['edit'] = 'true'; require_once 'include/SugarFolders/SugarFolders.php'; require_once 'include/templates/TemplateGroupChooser.php'; // GLOBALS global $mod_strings; global $app_strings; global $app_list_strings; global $current_user; $focus = new InboundEmail(); $focus->checkImap(); $javascript = new Javascript();
private function sendCreationEmail(aCase $bean, $contact) { if (!isAOPEnabled()) { return; } require_once "include/SugarPHPMailer.php"; $mailer = new SugarPHPMailer(); $admin = new Administration(); $admin->retrieveSettings(); $mailer->prepForOutbound(); $mailer->setMailerForSystem(); $email_template = new EmailTemplate(); $aop_config = $this->getAOPConfig(); $email_template = $email_template->retrieve($aop_config['case_creation_email_template_id']); if (!$aop_config['case_creation_email_template_id'] || !$email_template) { $GLOBALS['log']->warn("CaseUpdatesHook: sendCreationEmail template is empty"); return false; } $emailSettings = getPortalEmailSettings(); $text = $this->populateTemplate($email_template, $bean, $contact); $mailer->Subject = $text['subject']; $mailer->Body = $text['body']; $mailer->IsHTML(true); $mailer->AltBody = $text['body_alt']; $mailer->From = $emailSettings['from_address']; $mailer->FromName = $emailSettings['from_name']; $email = $contact->emailAddress->getPrimaryAddress($contact); if (empty($email) && !empty($contact->email1)) { $email = $contact->email1; } $mailer->AddAddress($email); if (!$mailer->Send()) { $GLOBALS['log']->info("CaseUpdatesHook: Could not send email: " . $mailer->ErrorInfo); return false; } else { $this->logEmail($email, $mailer, $bean->id); return true; } }