/** * Formats a field for the Sugar API * @param array $data * @param SugarBean $bean * @param array $args * @param string $fieldName * @param array $properties */ public function apiFormatField(array &$data, SugarBean $bean, array $args, $fieldName, $properties) { global $current_user; $value = SugarFieldWorklogHelpers::decodeJsonValue($bean->{$fieldName}, $current_user, true); $data[$fieldName . "_history"] = $value; $data[$fieldName] = ''; }
function smarty_function_convert_worklog($params, &$smarty) { if (empty($params['log'])) { $smarty->trigger_error("Worklog: missing 'log' parameter"); } global $current_user; return SugarFieldWorklogHelpers::decodeJsonValue(trim(html_entity_decode($params['log'], ENT_QUOTES)), $current_user, true); }
/** * Format the activity description * @param $description * @return string */ private function formatDescription($description) { //handle worklog fields if (SugarAutoLoader::fileExists('custom/include/SugarFields/Fields/Worklog/SugarFieldWorklogHelpers.php') && SugarFieldWorklogHelpers::isJson($description)) { $description = SugarFieldWorklogHelpers::decodeJsonValue($description); } $description = htmlspecialchars($description, ENT_QUOTES); $description = nl2br($description); return $description; }