How to remove rowactions buttons ?

I want to remove this button and add another, but the issue here is even when I remove all buttons from the rowactions array still down 2 items appears  

code example:

 'rowactions' => array(
        'actions' => array(
            array(
                'type' => 'button',
                'css_class' => 'btn show-filter',
                'events' => [
                    'click' => 'list:showFilters:fire'
                ],
                'tooltip' => 'LBL_FILTER',
                'icon' => 'sicon-filter',
                'acl_action' => 'view',

            ),
            array(
                'type' => 'button',
                'css_class' => 'btn show-download',
                'events' => [
                    'click' => 'list:download:fire'
                ],
                'tooltip' => 'LBL_FILTER',
                'icon' => 'sicon-download',
                'acl_action' => 'view',
            ),
        ),
    ),

Parents
  • Premise: I've been exploring the code on v12 Ent to see if I could find an answer to your question - I have not used this version yet and did not have Doc Merge available until now - so this is a brainstorm, not an answer.

    Similarly to PDF Manager I suspected that that these Doc Merge actions are not technically rowactions and are dynamically added to any module where Doc Merge is active (which may be all of them?)... PDF Manager had a corresponding rowaction in the view but Doc Merge looks like a plugin at the controller level instead.

    It also seems that access to DocMerge is Role based, though this may not be what you are looking for unless you are looking to restrict access to all Doc Merge capability regardless of module/view.

    https://support.sugarcrm.com/documentation/sugar_versions/12.0/sell/application_guide/user_interface/doc_merge/#Restricting_Access_to_Doc_Merge

    I've been digging into the code a bit to reverse-engineer it (I like a challenge) and it looks like the Document Merge Actions are defined as plugins:

    include/javascript/sugar7/plugins/DocumentMergeActions.js

    and if you look at the Subpanel List view controller:

    clients/base/views/subpanel-list/subpanel-list.js

    The plugin is included in the view:

    ({
        extendsFrom: 'RecordlistView',
        fallbackFieldTemplate: 'list',
        plugins: [
            'SugarLogic',
            'ResizableColumns',
            'ReorderableColumns',
            'ListColumnEllipsis',
            'ErrorDecoration',
            'Editable',
            'Pagination',
            'MassCollection',
            'ActionButton',
            'DocumentMerge',
        ],

    just for fun I tried commenting out that plugin from subpanel-list view controller and it did remove the Doc Merge options from all subpanels but not from the record view, as expected.

    Looking at the plugins there is a modulesDenyList which would remove the DocMerge per module:

    include/javascript/sugar7/plugins/DocumentMerge.js

    (function(app) {
        app.events.on('app:init', function() {
            app.plugins.register('DocumentMerge', ['view'], {
    
                /**
                 * Modules where the merging buttons should not appear
                 *
                 * @var array
                 */
                modulesDenyList: ['Calendar', 'DocuSignEnvelopes',],

    maybe there is a way, within the Extension Framework, to extend that deny list for the module/s that you don't want to have Doc Merge.

    And finally the _addDocumentMergeButtons function in that same plugin adds two rowactions:

                        {
                            'type': 'rowaction',
                            'event': 'button:merge_template:click',
                            'name': 'merge_template',
                            'label': 'LBL_MERGE_TEMPLATE_BUTTON_LABEL',
                            'acl_action': 'view',
                        },
                        {
                            'type': 'rowaction',
                            'event': 'button:merge_template_pdf:click',
                            'name': 'merge_template_pdf',
                            'label': 'LBL_MERGE_TEMPLATE_PDF_BUTTON_LABEL',
                            'acl_action': 'view',
                        },
    

    So you could try to capture those events in your subpanel list view and just alert the user that the action is not allowed (this is not the cleanes way because why let me click if I can't use it), or perhaps override the view to remove them after it has rendered... but I'm not sure if that's possible...

    So, from this limited exploration, I would say you have a couple of options, depending on your use case:

    - By Role: Use the settings out of the box on Roles to control who can use Doc Merge (will affect ALL use of Doc Merge for that set of users)

    - All Subpanels: Extend the core subpanel-list view and override the plugins to remove DocumentMerge (affects ALL Subpanels for everyone)

    - A given Subpanel: Extend the module's subpanel-list view for that particular subpanel and override the plugins to remove the DocumentMerge from just that subpanel.

    - By Module: Maybe, find a way to add the module you want to exclude from DocMerge to the modulesDenyList on the plugin definition....(I don't know how, or if, it can be done within the extension framework)

    - By view: unsetting the rowaction after the view has rendered and added the rowaction (but I'm not sure when the rowaction is added)

    - By annoying your users: Finally, you could try catching the click event in the view controller and stopping its execution. 



    I will be interested in seeing what you find, though I doubt we will ever use Doc Merge since it involves privacy issues... there is a reason we chose to deploy Sugar OnSite and sending data to a service is a problem for me.

    support.sugarcrm.com/.../

    good luck! I hope this little brainstorm helps :)

    FrancescaS

  •   to keep it short, i've paused the project for now. 

    Rodrigo Manara

    Sr. Developer

  • I'll keep this in mind when I get to 12 (I'm still on 11Pro Frowning2) because I will likely have to remove Doc Merge, we would not want to send out information to another server.

Reply Children
No Data