AnsweredAssumed Answered

Unable to Disable ConvertLead button via JavaScript

Question asked by nigel_john nigel_john on Mar 1, 2014
Latest reply on Mar 3, 2014 by nigel_john nigel_john
Hi,

Wanted help on disabling ConvertLead (in Leads -> EditView) based on roles.

I've got the ACL roles part working via this

custom/modules/Leads/views/view.detail.php
================================================================
require_once('include/MVC/View/views/view.detail.php');

class LeadsViewDetail extends ViewDetail
{
    function display()
    {
        parent::display();
       
        require_once("modules/ACLRoles/ACLRole.php");
       
        global $current_user;
       
        $role_to_check = "USER";
        $acl_role_obj = new ACLRole();
        $user_roles = $acl_role_obj->getUserRoles($current_user->id);
       
        if ( in_array($role_to_check,$user_roles) )
            echo <<<EOHTML
<script type="text/javascript">
document.getElementById('form').convert.style.display='none';
</script>
EOHTML;
        }
    }
}
================================================================


But the JAVA part ain't working

================================================================
        if ( in_array($role_to_check,$user_roles) )
            echo <<<EOHTML
<script type="text/javascript">
document.getElementById('form').convert.style.display='none';
</script>
EOHTML;
=================================================================

I don't want to use unset function since it clears the cache every-time for EditView

I'm on CE Version 6.5.16

Thanx in advance


Outcomes