Is there something like Logic Hook firing for details view, not for ListView?
Is there a possibility to change in someway something in the way the particular field is displayed, or its contents?
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}',
),
Amigo, buena tarde, intente hacerlo tal cual me lo dices en el post pero no me funciono. mi suitecrm 7.11.7 la tengo instalada en equipo local con XAMPP, no tengo la carpeta custom/modules/Contacts/views/, debo entonces crearla?, como dije, lo hice en la carpeta modules/contact y no funciono. agradezco su atención.