Suitecrm: Export Customisation shows only "undefined" labels

Created on 10 Feb 2017  路  4Comments  路  Source: salesagility/SuiteCRM

Version 7.8 and up

Issue

When one goes to Studio and clicks on Export Customisation the page that appears shows a list of customisation but all the descriptions are "undefined".

This is a bug that was introduced in the file modules/ModuleBuilder/MB/MBPackage.php when it was rewritten.

There is also another bug at line: 838 where:
$return[$value . ' ' . $mod_strings['LBL_EC_EMPTYCUSTOM']] = '';
should be:
$return[$value][$va] = $mod_strings['LBL_EC_EMPTYCUSTOM']';

Additionally there are missing labels which default to undefined. To repair this second unwanted behaviour we have to:
. edit the file modules/ModuleBuilder/language/en_us.lang.php to add the missing labels in the section "//EXPORT CUSTOMS" found at line 619
. add a few more cases in the switch statement found at line 829 of the file modules/ModuleBuilder/MB/MBPackage.php

All the issues described have been discussed in the SuiteCRM Forum at:
https://suitecrm.com/forum/suitecrm-7-0-discussion/6952-export-customizations#25069
and https://suitecrm.com/forum/suitecrm-7-0-discussion/12950-exporto-studio-customization

Expected Behavior

The correct labels should be displayed informing the users what customisations are available for export.

Actual Behavior

The descriptions of the customisations are shown with an "undefined" label

Possible Fix (already tested)

  1. Correct the bug introduced in the latest versions of SuiteCRM:
    A bug was introduced when the file modules/ModuleBuilder/MB/MBPackage.php was rewritten.
    To correct the bug it is sufficient to edit line 808

from:
(Current, but wrong code at line 808):
if (!$module) {

to:
(Correct code to be inserted at line 808):
if ($module != false) {

  1. Add the missing labels
    a. Edit the file: modules/ModuleBuilder/language/en_us.lang.php
    Go to line 619: (this is the current content found)
    //EXPORT CUSTOMS
    'LBL_EC_TITLE' => 'Export Customizations',
    'LBL_EC_NAME' => 'Package Name:',
    'LBL_EC_AUTHOR' => 'Author:',
    'LBL_EC_DESCRIPTION' => 'Description:',
    'LBL_EC_KEY' => 'Key:',
    'LBL_EC_CHECKERROR' => 'Please select a module.',
    'LBL_EC_CUSTOMFIELD' => 'customized field(s)',
    'LBL_EC_CUSTOMLAYOUT' => 'customized layout(s)',
    'LBL_EC_NOCUSTOM' => 'No modules have been customized.',
    'LBL_EC_EMPTYCUSTOM' => 'has empty customizations.',
    'LBL_EC_EXPORTBTN' => 'Export',
    'LBL_MODULE_DEPLOYED' => 'Module has been deployed.',
    'LBL_UNDEFINED' => 'undefined',

Append the following lines:
'LBL_EC_VIEWS'=>'customized view(s)',
'LBL_EC_SUGARFEEDS'=>'customized SugarFeeds(s)',
'LBL_EC_DASHLETS'=>'customized Dashlets(s)',
'LBL_EC_CSS'=>'customized css(s)',
'LBL_EC_TPLS'=>'customized tpls(s)',
'LBL_EC_IMAGES'=>'customized image(s)',
'LBL_EC_JS'=>'customized js(s)',
'LBL_EC_QTIP'=>'customized qtip(s)',

b. Edit the file: modules/ModuleBuilder/MB/MBPackage.php
Go to line 829
Currently there is the following switch statement:
switch ($va) {
case 'language':
case 'Ext':
$return[$value][$va] = $mod_strings['LBL_EC_CUSTOMFIELD'];
break;
case 'metadata':
$return[$value][$va] = $mod_strings['LBL_EC_CUSTOMLAYOUT'];
break;
case '':
$return[$value . ' ' . $mod_strings['LBL_EC_EMPTYCUSTOM']] = '';
break;
default:
$return[$value][$va] = $mod_strings['LBL_UNDEFINED'];
}

Modify the switch statement to:
switch ($va) {
case 'language':
$return[$value][$va] = $mod_strings['LBL_EC_CUSTOMFIELD'];
break;
case 'metadata':
$return[$value][$va] = $mod_strings['LBL_EC_CUSTOMLAYOUT'];
break;
case 'Ext':
$return[$value][$va] = $mod_strings['LBL_EC_CUSTOMFIELD'];
break;
case '':
$return[$value][$va] = $mod_strings['LBL_EC_EMPTYCUSTOM'];
break;
case 'views':
$return[$value][$va] = $mod_strings['LBL_EC_VIEWS'];
break;
case 'SugarFeeds':
$return[$value][$va] = $mod_strings['LBL_EC_SUGARFEEDS'];
break;
case 'Dashlets':
$return[$value][$va] = $mod_strings['LBL_EC_DASHLETS'];
break;
case 'css':
$return[$value][$va] = $mod_strings['LBL_EC_CSS'];
break;
case 'tpls':
$return[$value][$va] = $mod_strings['LBL_EC_TPLS'];
break;
case 'images':
$return[$value][$va] = $mod_strings['LBL_EC_IMAGES'];
break;
case 'js':
$return[$value][$va] = $mod_strings['LBL_EC_JS'];
break;
case 'qtip':
$return[$value][$va] = $mod_strings['LBL_EC_QTIP'];
break;
default:
$return[$value][$va] = $mod_strings['LBL_UNDEFINED'];
}

Steps to Reproduce

  1. Log in with an Admin user
  2. Go to Admin -> Studio
  3. Click on the button "Export Customisations"
  4. A list of possible things to be exported appears, but the description is "undefined"

Context

Low priority. But, since there is a correction it should be addressed asap to remove it from the list of open issues.

Your Environment

SuiteCRM 7.8
SuiteCRM 7.8.1
Other variables are irrelevant since the bug has been clearly identified.

Moderate Fix Proposed Bug

Most helpful comment

@amariussi Github is not the easiest thing in the world! But sometimes we have to deal with it! I also have to learn to use it (even if I'm a light user)
1- Just fork the SuiteCRM Repository
2- Clone the Master branch on your fork (You can delete the others). This is where you change things.
3- In the end submit to the SuiteCRM Hotfix... before submitting a commit you will see the changes highlighted so you will be able to see if it is safe to make the request.

Rule: For each new idea/Fix you clone again the SuiteCRM Master branch so you can always have the latest code.

Note: Github works better using your own computer but you can also make changes directly on github using web interface: enter a file and edit. It will create a new branch for you on your forked repository.
Then you can change any other file. In the end create a PR to SuiteCRM hotfix (maybe download it to your computer to test!). The down size is you can't change your branch name using web interface (not relevant as after it has been merged you will delete it from your repository!)

All 4 comments

@amariussi This needs a PR!

@horus68
I know but I can't do it right now and I am afraid I would mess things up since I have never done one on gitHub so far.
I will try in the next few days when I will have a little more time.

@amariussi Github is not the easiest thing in the world! But sometimes we have to deal with it! I also have to learn to use it (even if I'm a light user)
1- Just fork the SuiteCRM Repository
2- Clone the Master branch on your fork (You can delete the others). This is where you change things.
3- In the end submit to the SuiteCRM Hotfix... before submitting a commit you will see the changes highlighted so you will be able to see if it is safe to make the request.

Rule: For each new idea/Fix you clone again the SuiteCRM Master branch so you can always have the latest code.

Note: Github works better using your own computer but you can also make changes directly on github using web interface: enter a file and edit. It will create a new branch for you on your forked repository.
Then you can change any other file. In the end create a PR to SuiteCRM hotfix (maybe download it to your computer to test!). The down size is you can't change your branch name using web interface (not relevant as after it has been merged you will delete it from your repository!)

@horus68 Thanks for the instructions.
I followed them and modified the two files but, when I issued the pull request only one of the files was marked as modified.
Now I don't know how to proceed!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mausino picture Mausino  路  3Comments

ArturoBurela picture ArturoBurela  路  3Comments

likhobory picture likhobory  路  3Comments

darouca picture darouca  路  3Comments

dawansv picture dawansv  路  3Comments