hide remove import menu option

Hi

How can I hide/remove or disable the import feature in code for all modules or certain modules.

1. for all modules

     ?

2. for accounts and opportunities only?

Thank you in advance

Peter

  • Hi Peter,

    Copy file from /modules/{module}/clients/base/menus/header/header.php

    to /custom/modules/{module}/clients/base/menus/header/header.php.

    And comment the code of import menu.Below is code with commented import option for Accounts module.Do the same for modules you want to do.

    <?php
    $moduleName = 'Accounts';
    $viewdefs[$moduleName]['base']['menu']['header'] = array(
        array(
            'label' =>'LNK_NEW_ACCOUNT',
            'acl_action'=>'create',
            'acl_module'=>$moduleName,
            'icon' => 'fa-plus',
            'route'=>'#'.$moduleName.'/create',
        ),
        array(
            'label' => 'LBL_BAL',
            'acl_action' => 'create',
            'acl_module' => $moduleName,
            'icon' => 'fa-plus',
            'route' => '#'.$moduleName.'/layout/dnb-bal',
        ),
        array(
            'route'=>'#'.$moduleName,
            'label' =>'LNK_ACCOUNT_LIST',
            'acl_action'=>'list',
            'acl_module'=>$moduleName,
            'icon' => 'fa-bars',
        ),
        array(
            'route' => '#bwc/index.php?' . http_build_query(
                array(
                    'module' => 'Reports',
                    'action' => 'index',
                    'view' => $moduleName,
                    'query' => 'true',
                    'report_module' => $moduleName,
                )
            ),
            'label' =>'LNK_ACCOUNT_REPORTS',
            'acl_action'=>'list',
            'acl_module'=>$moduleName,
            'icon' => 'fa-bar-chart-o',
        ),
        /*
        array(
            'route' => '#bwc/index.php?' . http_build_query(
                array(
                    'module' => 'Import',
                    'action' => 'Step1',
                    'import_module' => $moduleName,
                )
            ),
            'label' =>'LNK_IMPORT_ACCOUNTS',
            'acl_action'=>'import',
            'acl_module'=>$moduleName,
            'icon' => 'fa-arrow-circle-o-up',
        ),
        */
    );
    
  • Thank you Ajay. This worked.

  • Hello,

    I could manage to achieve it in a more generic way, so you wouldn't need to do it for every module, since you asked to do it for all modules.

    - Create a custom/clients/base/views/module-menu/module-menu.js
    - Extend from original one

    Fullscreen
    1
    extendsFrom: 'ModuleMenuView',
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    - Extend filterByAccess with the following

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    filterByAccess: function(meta) {
    var self = this;
    var temp0 = this._super('filterByAccess', [meta]);
    var temp = [];
    _.each(temp0, function(menuItem) {
    if (menuItem.acl_action != 'import') {
    temp.push(menuItem);
    }
    });
    return temp;
    },
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Juane

  • No Code solution:

    Remove the import rights from the roles. You can set this per module.

    Bests

    Björn

  • Not that easy for our environment, where 27 additional custom modules were created.

    Juane