Example #1
0
 /**
  *
  * @global Users $current_user
  * @param MailManager_Message_Model $mailrecord
  * @param Integer $linkto
  * @return Array
  */
 public static function associate($mailrecord, $linkto)
 {
     $instance = new self();
     $modulename = getSalesEntityType($linkto);
     $linkfocus = CRMEntity::getInstance($modulename);
     $linkfocus->retrieve_entity_info($linkto, $modulename);
     $linkfocus->id = $linkto;
     $emailid = $instance->__CreateNewEmail($mailrecord, $modulename, $linkfocus);
     if (!empty($emailid)) {
         MailManager::updateMailAssociation($mailrecord->uniqueid(), $emailid, $linkfocus->id);
     }
     $name = getEntityName($modulename, $linkto);
     $detailInformation = self::buildDetailViewLink($modulename, $linkfocus->id, $name[$linkto]);
     return $detailInformation;
 }