It’s not a logic hook, but you can customize the detail view, of course.
The simplest things you can achieve with just a Smarty formula in the vardefs.
For more complicated things… here is an example from a project of mine. It’s meant to show a Contact’s calculated age in place of his birthdate.
In file custom/modules/Contacts/views/view.detail.php
require_once('include/MVC/View/views/view.detail.php');
class CustomContactsViewDetail extends ViewDetail
{
/**
* @see SugarView::display()
*
* We are overridding the display method to manipulate the portal information.
* If portal is not enabled then don't show the portal fields.
*/
public function display(){
global $sugar_config;
global $mod_strings;
if(!empty($this->bean->birthdate)) {
require_once('include/TimeDate.php');
$my_timedate = new TimeDate();
$date_of_birth = $this->bean->birthdate;
$birthdate = $my_timedate->to_db_date($date_of_birth);
$current_age =
$this->bean->birthdate
. ", "
. strtolower($mod_strings['LBL_IDADE'])
." "
. floor( (strtotime(date('Y-m-d')) - strtotime($birthdate)) / 31556926);
$this->ss->assign("CURRENTAGE", $current_age);
// this is then referenced in /custom/modules/Contacts/metadata/detailviewdefs.php
}
$aop_portal_enabled = !empty($sugar_config['aop']['enable_portal']) && !empty($sugar_config['aop']['enable_aop']);
$this->ss->assign("AOP_PORTAL_ENABLED", $aop_portal_enabled);
require_once('modules/AOS_PDF_Templates/formLetter.php');
formLetter::DVPopupHtml('Contacts');
$admin = new Administration();
$admin->retrieveSettings();
if(isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
$this->ss->assign("PORTAL_ENABLED", true);
}
parent::display();
}
}
This matches a section of custom/modules/Contacts/metadata/detailviewdefs.php
1 =>
array (
'name' => 'birthdate',
'comment' => 'The birthdate of the contact',
'label' => 'LBL_BIRTHDATE',
'customCode' => '{$CURRENTAGE}',
),
I hope this is enough to get you going…