Notes Module - Change Log

I just need to make sure that I have not overlooked something simple - is there no Change Log capability in the Notes module even though you can switch the Audit field on for fields in the module ?

Regards

Greg

Parents Reply
  • Hi Greg Barrass 

    Athough Activities modules don't have Change Log feature by default, you can implement it with a bit of simple coding:

    1. vardefs

    Create an extended vardefs for each Activities modules and set the attribute " 'audited' => true, " dictionary of the module and for each field you want to make audited.

    The file should be something like that:

    <?PHP

    $dictionary['Note']['audited'] = true;

    $dictionary['Note']['fields']['name']['audited'] = true;

    $dictionary['Note']['fields']['filename']['audited'] = true;

    $dictionary['Note']['fields']['parent_type']['audited'] = true;

    $dictionary['Note']['fields']['parent_id']['audited'] = true;

    2. viewdefs

    Add the button for View Change Log into buttons array of actiondropdown at custom record.php of each Activities modules. Just copy from Accounts record view the item whose name is 'auit_button'

    3. Run QRR

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
  • Andre beat me to the description of how to enable auditing for core modules that do not have it enabled by default!

    However, at least in Sugar 6.x you do not necessarily need his step 2 to enable the View Change Log button - it will be rendered automatically for any module that has auditing enabled - unless there is an explicit [DetailView][templateMeta][form][buttons] array defined in detailviewdefs.php.

    You can modify this "on the fly" in a custom view.detail.php with something along the lines of the following:

    public function display() {
        $userrole = getEffectiveRole();

        // Show only the Edit and Delete buttons by default
        $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DELETE');
        switch ($userrole) {
            case 'Admin':
                // Only Admin users get the "Change Log" button.
                $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DELETE','AUDIT');
                break;
            case 'User':
                // ... your logic here
                break;
            default:
                // ... your logic here
                break;
        }
        $this->dv->process();
        echo $this->dv->display();   
    }