Example #1
0
 function updateUser($bean, $event, $arguments)
 {
     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);
     }
 }
 private function populateTemplate(EmailTemplate $template, aCase $bean, $contact)
 {
     global $app_strings, $sugar_config;
     //Order of beans seems to matter here so we place contact first.
     $beans = array("Contacts" => $contact->id, "Cases" => $bean->id, "Users" => $bean->assigned_user_id);
     $ret = array();
     $ret['subject'] = from_html(aop_parse_template($template->subject, $beans));
     $ret['body'] = from_html($app_strings['LBL_AOP_EMAIL_REPLY_DELIMITER'] . aop_parse_template(str_replace("\$sugarurl", $sugar_config['site_url'], $template->body_html), $beans));
     $ret['body_alt'] = strip_tags(from_html(aop_parse_template(str_replace("\$sugarurl", $sugar_config['site_url'], $template->body), $beans)));
     return $ret;
 }
Example #3
0
 private function populateTemplate(EmailTemplate $template, $addDelimiter = true, $contactId = null)
 {
     global $app_strings, $sugar_config;
     //Order of beans seems to matter here so we place contact first.
     $userId = '';
     $user = $this->getUpdateUser();
     if (!$user) {
         $this->getUser();
     }
     $beans = array("Contacts" => $contactId, "Cases" => $this->getCase()->id, "Users" => $user->id, "AOP_Case_Updates" => $this->id);
     $ret = array();
     $ret['subject'] = from_html(aop_parse_template($template->subject, $beans));
     $body = aop_parse_template(str_replace("\$sugarurl", $sugar_config['site_url'], $template->body_html), $beans);
     $bodyAlt = aop_parse_template(str_replace("\$sugarurl", $sugar_config['site_url'], $template->body), $beans);
     if ($addDelimiter) {
         $body = $app_strings['LBL_AOP_EMAIL_REPLY_DELIMITER'] . $body;
         $bodyAlt = $app_strings['LBL_AOP_EMAIL_REPLY_DELIMITER'] . $bodyAlt;
     }
     $ret['body'] = from_html($body);
     $ret['body_alt'] = strip_tags(from_html($bodyAlt));
     return $ret;
 }