We want to remove item Mass Actions Menu

Hello,

We want to remove Merge, Doc Merge, and Doc Merge to PDF from the Mass Actions Menu. Can anyone provide a solution for this? We have tried the following solution, but it didn’t work:

<?php
$viewdefs['EDoc_Email_Documents']['base']['view']['recordlist']['selection']['actions'] = array(
    // Keeping only the mass PDF merge button
    array(
        'name' => 'mass_update',
        'type' => 'massupdate',
        'label' => 'LBL_MASS_UPDATE',
        'acl_action' => 'massupdate',
        'type' => 'button',
    ),
    array(
        'name' => 'mass_pdf_merge_button',
        'label' => 'LBL_MASS_PDF_MERGE_BUTTON',
        'type' => 'button',
        'primary' => true,
        'events' => array(
            'click' => 'list:masspdfmergebutton:fire'
        ),
        'acl_action' => 'massupdate'
    ),
    array(
        'name' => 'mass_delete',
        'type' => 'massdelete', // Define the type for the delete action
        'label' => 'LBL_DELETE_BUTTON_LABEL', // Label for the delete button
        'acl_action' => 'delete', // ACL action for delete permission
        'type' => 'button',
    ),
    // Removed actions
    // array(
    //     'name' => 'merge',
    //     'type' => 'merge',
    //     'label' => 'LBL_MERGE',
    //     'acl_action' => 'merge',
    // ),
    // array(
    //     'name' => 'doc_merge',
    //     'type' => 'doc_merge',
    //     'label' => 'LBL_DOC_MERGE',
    //     'acl_action' => 'doc_merge',
    // ),
    // array(
    //     'name' => 'doc_merge_to_pdf',
    //     'type' => 'doc_merge_to_pdf',
    //     'label' => 'LBL_DOC_MERGE_TO_PDF',
    //     'acl_action' => 'doc_merge_to_pdf',
    // ),
);
  • I disabled the Merge option for everyone except Admins in v12 Ent by 

    Modifying the css class for the merge action from the Find Duplicates Action so no action can be taken once you have found the duplicates other than preview.

    In custom/clients/base/views/find-duplicates-headerpane/find-duplicates-headerpane.php

    $viewdefs['base']['view']['find-duplicates-headerpane']['buttons']= array(
            array(
                'name'    => 'cancel_button',
                'type'    => 'button',
                'label'   => 'LBL_CANCEL_BUTTON_LABEL',
                'css_class' => 'btn-invisible btn-link',
            ),
            array(
                'name'    => 'merge_duplicates_button',
                'type'    => 'button',
                'label'   => 'LBL_MERGE_DUPLICATES',
                'css_class' => 'btn-primary disabled',
                'acl_action' => 'admin',
            ),
            array(
                'name' => 'sidebar_toggle',
                'type' => 'sidebartoggle',
            ),
    );

    I also hid the merge button from the recordlist (the dropdown you are showing) for everyone except Admins by modifying the RecordlistView controller to hide the button altogether for anyone who is not an admin.

    custom/clients/base/views/recordlist/recordlist.js

    ({
        extendsFrom: 'RecordlistView',
        initialize: function (options) {
            this._super('initialize', [options]);
        },
       render: function()
       {
          this._super('render');
          this.hideActions();
        },
        hideActions: function(){
          user_type = app.user.get('type');
          //disable duplicate merge for non-admin
          if(user_type != 'admin'){
             $('[name="merge_button"]').hide();
          }
          $('[name="mass_email_button"]').hide();
        }
    });
    

    Seems to work well so far.

    You could extend this to the other actions you want to hide.

    FrancescaS