AnsweredAssumed Answered

Creating Sugarfield in 6.5

Question asked by Mike Solomon on Sep 22, 2015
I have created a custom Sugarfield to display a decimal time as Hours & Minutes in  Detail & List Views

So 4.5 will display as 04:30

The only way I could get it working was to embed some php in the smarty template

I tried to create a new class by extending SugarFieldBase but couldn't make it work

my template code for DetailView is 

{assign var="hm" value={{sugarvar key='value' string=true}} }
{php}
$hm = $this->get_template_vars('hm');

require_once 'custom/include/reportutils.php';
$utils = new report_utils;
$hm = $utils->ConvHM($hm);
$this->assign('hm',$hm);
{/php}

<span class="sugar_field" id="{{sugarvar key='name'}}">{$hm}</span>
{{if !empty($displayParams.enableConnectors)}}
{if !empty($value)}
{{sugarvar_connector view='DetailView'}}
{/if}
{{/if}}

What's the best way todo this?

Outcomes