/** * This function is used to merge the Template Details with the email description * @param string $description -body of the mail(ie template) * @param integer $tid - Id of the entity * @param string $parent_type - module of the entity * return string $description - Returns description, merged with the input template. */ function getMergedDescription($description, $id, $parent_type) { global $adb, $log; $log->debug("Entering getMergedDescription ..."); $token_data_pair = explode('$', $description); global $current_user; $emailTemplate = new EmailTemplate($parent_type, $description, $id, $current_user); $description = $emailTemplate->getProcessedDescription(); $templateVariablePair = explode('$', $description); $tokenDataPair = explode('$', $description); $fields = array(); for ($i = 1; $i < count($token_data_pair); $i += 2) { $module = explode('-', $tokenDataPair[$i]); $fields[$module[0]][] = $module[1]; } if (is_array($fields['custom']) && count($fields['custom']) > 0) { //Puneeth : Added for custom date & time fields $description = getMergedDescriptionCustomVars($fields, $description); } $log->debug("Exiting from getMergedDescription ..."); return $description; }
static function getMergedDescription($description, $id, $parent_type) { $current_user = vglobal('current_user'); $token_data_pair = explode('$', $description); $emailTemplate = new EmailTemplate($parent_type, $description, $id, $current_user); $description = $emailTemplate->getProcessedDescription(); $tokenDataPair = explode('$', $description); $fields = array(); for ($i = 1; $i < count($token_data_pair); $i += 2) { $module = explode('-', $tokenDataPair[$i]); $fields[$module[0]][] = $module[1]; } if (is_array($fields['custom']) && count($fields['custom']) > 0) { $description = self::getMergedDescriptionCustomVars($fields, $description); } return $description; }
/** * This function is used to merge the Template Details with the email description * @param string $description -body of the mail(ie template) * @param integer $tid - Id of the entity * @param string $parent_type - module of the entity * return string $description - Returns description, merged with the input template. */ function getMergedDescription($description, $id, $parent_type) { global $adb, $log; $log->debug("Entering getMergedDescription ..."); $token_data_pair = explode('$', $description); global $current_user; if ($parent_type != 'Users') { $emailTemplate = new EmailTemplate($parent_type, $description, $id, $current_user); $description = $emailTemplate->getProcessedDescription(); } $templateVariablePair = explode('$', $description); $tokenDataPair = explode('$', $description); $fields = array(); for ($i = 1; $i < count($token_data_pair); $i += 2) { $module = explode('-', $tokenDataPair[$i]); $fields[$module[0]][] = $module[1]; } if (is_array($fields['custom']) && count($fields['custom']) > 0) { //Puneeth : Added for custom date & time fields $description = getMergedDescriptionCustomVars($fields, $description); } if ($parent_type == 'Users' && is_array($fields["users"])) { $columnfields = implode(',', $fields["users"]); $query = "select {$columnfields} from vtiger_users where id=?"; $result = $adb->pquery($query, array($id)); foreach ($fields["users"] as $columnname) { $token_data = '$users-' . $columnname . '$'; $description = str_replace($token_data, $adb->query_result($result, 0, $columnname), $description); } } $log->debug("Exiting from getMergedDescription ..."); return $description; }