Suitecrm: Module Layout: "Tabs" showing as "Panels"

Created on 9 Sep 2017  路  18Comments  路  Source: salesagility/SuiteCRM

Issue

New sections created within a module layout are only shown as panels. Changing the Display Type to "Tab" does not have any effect.

Expected Behavior

Layout section showing as Tab.

Actual Behavior

Layout section showing as Panel.

Possible Fix

Steps to Reproduce

As example we go with the account layout

  1. open Admin > Studio聽>聽Accounts聽>聽Layouts聽>聽EditView
    1.1 select "Sync with deteailed view"
  2. add a new Panel (Section) from the Toolbox
  3. give the Panel a name (it is not possible to select the Display Type yet)
  4. add a field to the Panel
  5. click on save and deploy
  6. now we change the Display Type of the created Panel (Section) to "Tab"
  7. click on saven and deploy
  8. Check the layout in the detailed view

Context

medium priority

Your Environment

  • SuiteCRM Version used: 7.9.5
  • Browser name and version: Edge, Chrome, Firefox
  • Environment name and Version: MariaDB, php 7
  • Operating System and version: Debian 9.1
Critical Fix Proposed Bug

Most helpful comment

The editviewdefs.php file of the Accounts module after having added a new panel(lbl_editview_panel1) in studio and moved the address fields in it looks like this (no manual edits):

<?php
$viewdefs ['Accounts'] = 
array (
  'EditView' => 
  array (
    'templateMeta' => 
    array (
      'form' => 
      array (
        'buttons' => 
        array (
          0 => 'SAVE',
          1 => 'CANCEL',
        ),
      ),
      'maxColumns' => '2',
      'widths' => 
      array (
        0 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
        1 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
      ),
      'includes' => 
      array (
        0 => 
        array (
          'file' => 'modules/Accounts/Account.js',
        ),
      ),
      'useTabs' => true,
      'tabDefs' => 
      array (
        'LBL_ACCOUNT_INFORMATION' => 
        array (
          'newTab' => true,
          'panelDefault' => 'expanded',
        ),
        'LBL_EDITVIEW_PANEL1' => 
        array (
          'newTab' => true,
          'panelDefault' => 'expanded',
        ),
        'LBL_PANEL_ADVANCED' => 
        array (
          'newTab' => true,
          'panelDefault' => 'expanded',
        ),
      ),
    ),
    'panels' => 
    array (
      'lbl_account_information' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'name',
            'label' => 'LBL_NAME',
            'displayParams' => 
            array (
              'required' => true,
            ),
          ),
          1 => 
          array (
            'name' => 'phone_office',
            'label' => 'LBL_PHONE_OFFICE',
          ),
        ),
        1 => 
        array (
          0 => 
          array (
            'name' => 'website',
            'type' => 'link',
            'label' => 'LBL_WEBSITE',
          ),
          1 => 
          array (
            'name' => 'phone_fax',
            'label' => 'LBL_FAX',
          ),
        ),
        2 => 
        array (
          0 => 
          array (
            'name' => 'email1',
            'studio' => 'false',
            'label' => 'LBL_EMAIL',
          ),
        ),
        3 => 
        array (
          0 => 
          array (
            'name' => 'description',
            'label' => 'LBL_DESCRIPTION',
          ),
        ),
        4 => 
        array (
          0 => 
          array (
            'name' => 'assigned_user_name',
            'label' => 'LBL_ASSIGNED_TO',
          ),
        ),
      ),
      'lbl_editview_panel1' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'billing_address_street',
            'hideLabel' => true,
            'type' => 'address',
            'displayParams' => 
            array (
              'key' => 'billing',
              'rows' => 2,
              'cols' => 30,
              'maxlength' => 150,
            ),
          ),
          1 => 
          array (
            'name' => 'shipping_address_street',
            'hideLabel' => true,
            'type' => 'address',
            'displayParams' => 
            array (
              'key' => 'shipping',
              'copy' => 'billing',
              'rows' => 2,
              'cols' => 30,
              'maxlength' => 150,
            ),
          ),
        ),
      ),
      'LBL_PANEL_ADVANCED' => 
      array (
        0 => 
        array (
          0 => 'account_type',
          1 => 'industry',
        ),
        1 => 
        array (
          0 => 'annual_revenue',
          1 => 'employees',
        ),
        2 => 
        array (
          0 => 'parent_name',
        ),
        3 => 
        array (
          0 => 'campaign_name',
        ),
      ),
    ),
  ),
);
$viewdefs['Accounts']['EditView']['templateMeta'] = array (
  'form' => 
  array (
    'buttons' => 
    array (
      0 => 'SAVE',
      1 => 'CANCEL',
    ),
  ),
  'maxColumns' => '2',
  'widths' => 
  array (
    0 => 
    array (
      'label' => '10',
      'field' => '30',
    ),
    1 => 
    array (
      'label' => '10',
      'field' => '30',
    ),
  ),
  'includes' => 
  array (
    0 => 
    array (
      'file' => 'modules/Accounts/Account.js',
    ),
  ),
  'useTabs' => false,
  'tabDefs' => 
  array (
    'LBL_ACCOUNT_INFORMATION' => 
    array (
      'newTab' => false,
      'panelDefault' => 'expanded',
    ),
    'LBL_PANEL_ADVANCED' => 
    array (
      'newTab' => false,
      'panelDefault' => 'expanded',
    ),
  ),
);
?>

You can clearly see that the $viewdefs['Accounts']['EditView']['templateMeta'] is redefined and doing so nullifies your configuration in studio (also because it has: 'useTabs' => false, - this is why you get panels). By removing the second definition block by hand and clearing the cache things work - but as soon as you touch the view in studio again the viewdefs file is rewritten in the same way as before.

Versions 7.9.5 and 7.9.6 are definitely affected.

I'd argue for a High priority on this one because:

  • it was working and now it's broken
  • the entire application is based on the correct working on studio and how viwedefs files are written. (in fact this bug affects all modules configurable through studio)

All 18 comments

@brogsitter on my site same issue

@brogsitter Same Issue Here

FYI the bug does not exist in v. 7.9.2. Maybe this helps.

It looks like a saving issue on the Studio. Because after saving the panels as Tabs, if you reopen the EditView Layout in the Studio, you will see that the panels now again have the "Panel" display type and not "Tabs."

Also, it affects all panels, not just newly created ones. If you go and make any changes to an existing layout that has multiple panels, All those panels will get their display type reverted to Panels.

@thucar +1

The editviewdefs.php file of the Accounts module after having added a new panel(lbl_editview_panel1) in studio and moved the address fields in it looks like this (no manual edits):

<?php
$viewdefs ['Accounts'] = 
array (
  'EditView' => 
  array (
    'templateMeta' => 
    array (
      'form' => 
      array (
        'buttons' => 
        array (
          0 => 'SAVE',
          1 => 'CANCEL',
        ),
      ),
      'maxColumns' => '2',
      'widths' => 
      array (
        0 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
        1 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
      ),
      'includes' => 
      array (
        0 => 
        array (
          'file' => 'modules/Accounts/Account.js',
        ),
      ),
      'useTabs' => true,
      'tabDefs' => 
      array (
        'LBL_ACCOUNT_INFORMATION' => 
        array (
          'newTab' => true,
          'panelDefault' => 'expanded',
        ),
        'LBL_EDITVIEW_PANEL1' => 
        array (
          'newTab' => true,
          'panelDefault' => 'expanded',
        ),
        'LBL_PANEL_ADVANCED' => 
        array (
          'newTab' => true,
          'panelDefault' => 'expanded',
        ),
      ),
    ),
    'panels' => 
    array (
      'lbl_account_information' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'name',
            'label' => 'LBL_NAME',
            'displayParams' => 
            array (
              'required' => true,
            ),
          ),
          1 => 
          array (
            'name' => 'phone_office',
            'label' => 'LBL_PHONE_OFFICE',
          ),
        ),
        1 => 
        array (
          0 => 
          array (
            'name' => 'website',
            'type' => 'link',
            'label' => 'LBL_WEBSITE',
          ),
          1 => 
          array (
            'name' => 'phone_fax',
            'label' => 'LBL_FAX',
          ),
        ),
        2 => 
        array (
          0 => 
          array (
            'name' => 'email1',
            'studio' => 'false',
            'label' => 'LBL_EMAIL',
          ),
        ),
        3 => 
        array (
          0 => 
          array (
            'name' => 'description',
            'label' => 'LBL_DESCRIPTION',
          ),
        ),
        4 => 
        array (
          0 => 
          array (
            'name' => 'assigned_user_name',
            'label' => 'LBL_ASSIGNED_TO',
          ),
        ),
      ),
      'lbl_editview_panel1' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'billing_address_street',
            'hideLabel' => true,
            'type' => 'address',
            'displayParams' => 
            array (
              'key' => 'billing',
              'rows' => 2,
              'cols' => 30,
              'maxlength' => 150,
            ),
          ),
          1 => 
          array (
            'name' => 'shipping_address_street',
            'hideLabel' => true,
            'type' => 'address',
            'displayParams' => 
            array (
              'key' => 'shipping',
              'copy' => 'billing',
              'rows' => 2,
              'cols' => 30,
              'maxlength' => 150,
            ),
          ),
        ),
      ),
      'LBL_PANEL_ADVANCED' => 
      array (
        0 => 
        array (
          0 => 'account_type',
          1 => 'industry',
        ),
        1 => 
        array (
          0 => 'annual_revenue',
          1 => 'employees',
        ),
        2 => 
        array (
          0 => 'parent_name',
        ),
        3 => 
        array (
          0 => 'campaign_name',
        ),
      ),
    ),
  ),
);
$viewdefs['Accounts']['EditView']['templateMeta'] = array (
  'form' => 
  array (
    'buttons' => 
    array (
      0 => 'SAVE',
      1 => 'CANCEL',
    ),
  ),
  'maxColumns' => '2',
  'widths' => 
  array (
    0 => 
    array (
      'label' => '10',
      'field' => '30',
    ),
    1 => 
    array (
      'label' => '10',
      'field' => '30',
    ),
  ),
  'includes' => 
  array (
    0 => 
    array (
      'file' => 'modules/Accounts/Account.js',
    ),
  ),
  'useTabs' => false,
  'tabDefs' => 
  array (
    'LBL_ACCOUNT_INFORMATION' => 
    array (
      'newTab' => false,
      'panelDefault' => 'expanded',
    ),
    'LBL_PANEL_ADVANCED' => 
    array (
      'newTab' => false,
      'panelDefault' => 'expanded',
    ),
  ),
);
?>

You can clearly see that the $viewdefs['Accounts']['EditView']['templateMeta'] is redefined and doing so nullifies your configuration in studio (also because it has: 'useTabs' => false, - this is why you get panels). By removing the second definition block by hand and clearing the cache things work - but as soon as you touch the view in studio again the viewdefs file is rewritten in the same way as before.

Versions 7.9.5 and 7.9.6 are definitely affected.

I'd argue for a High priority on this one because:

  • it was working and now it's broken
  • the entire application is based on the correct working on studio and how viwedefs files are written. (in fact this bug affects all modules configurable through studio)

Hi all
does anyone know if there is any permanent fix about this issue?
Many thanks

+1

+1

@adamjakab For those of us who are new and struggling to figure out a manual fix, can you provide direction and/or code that can correct the missing tabs?

Thanks in advance

@1reason - Hi, sorry to disappoint you but I do not have one - the above code was to indicate a starting point to help out who will be looking into this. But I do not have a solution or the time to come up with one. I also confirm that this is still an issue in v.7.9.7.?
What you can do is every time you make a modification in studio to the edit/detail view definitions, open the corresponding editviewdefs.php or detailviewdefs.php file and manually remove the second

$viewdefs['Accounts']['DetailView']['templateMeta'] = array (...);

or

$viewdefs['Accounts']['EditView']['templateMeta'] = array (...);

block. Obviously not a solution but a workaround that works until you touch the view again in studio.
a\

Follow @adamjakab to remove the second templateMeta.
And need setup
'useTabs' => true
changed the panel which want to use as tab from
'newTab' => false,
to
'newTab' => true,
Then cache cache.

Bug still exists in
Version 7.9.7
Sugar Version 6.5.25 (Build 344)

and thanks for adding the bug... I was going crazy.

Hey guys, can any of you please test the Fix that PedroErnst provided? Thanks!

I can confirm, PedroErnst fix solves the issue. At least in Version 7.9.5

This fixes the issue in 7.9.8 also

Worked for me (twice), albeit it's a little hard to read with the comments.

@1reason sorry, I don't understand what you mean about the comments? If you can post a screenshot or explain, it would help. Thanks

Was this page helpful?
0 / 5 - 0 ratings