Frage

My code :

$GLOBALS['listbutton'] = $this->dv->defs['templateMeta']['form']['buttons'];        
    if ($this->bean->status == 'Converted') {
        unset($this->dv->defs['templateMeta']['form']['buttons'][0]);
    }
    parent::display();

    $GLOBALS['log']->debug("INFOdation log Display");        
    $this->dv->defs['templateMeta']['form']['buttons'] = $GLOBALS['listbutton'];

But when status =='New' , the edit button still hide. Could you help me. I only want edit button hide when status == 'Converted', other status it has to apperance.

War es hilfreich?

Lösung

You could hide the Button with Javascript.

in the detailviewdefs.php include your script

'includes' => 
 array (
  0 => 
  array (
    'file' => 'custom/modules/Leads/button_hide.js',
  ),
 ),

With something like:

SUGAR.util.doWhen("typeof $ != 'undefined'", function(){
    if($(#status).val() == "Converted")$('#delete_button').parent().hide(); 
});

(SUGAR.util.doWhen ist the SugarCrm onload if ajax ist enabled)

if the Field status is not in your view you will need to add a hidden field in detailviewdefs.php and set the value with smarty code like:

<input type="hidden" id="status" value="{$fields.status.value}">
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top