Module Loader not updating custom changes

SuiteCRM Version 7.13.3

I have noticed that when I export a Module and then load the modules using the module loader on another instance running the exact same version of SuiteCRM, the customization files do not seem to get updated.

I will focus on one field but this is happening on all fields from what I can tell.
In my dev box where I do the Studio changes I have specifically marked the field bmui_login_c to NO inline editing.
The file custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php contains this

$dictionary['Account']['fields']['bmui_login_c']['inline_edit']='';
$dictionary['Account']['fields']['bmui_login_c']['labelValue']='Portal Login';

I then export the Account module and go over to my demo server and uninstall and delete the existing Accounting Module customizations in the Module Loader. Upload a new version, Install and R&R.

After this I review the file custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php

root:ls -lar _override_sugarfield_bmui_login_c.php
-rw-rw-r-- 1 www-data www-data 110 Aug 25 09:10 _override_sugarfield_bmui_login_c.php

root:cat _override_sugarfield_bmui_login_c.php

<?php
 // created: 2023-08-25 09:10:54
$dictionary['Account']['fields']['bmui_login_c']['inline_edit']=1;

As you can see the file permissions are good and the timestamp in the file shows the time I imported. but the inline_edit value did not change and the labelValue is missing.

Here are relavant lines from the suitecrm.log file.

Fri Aug 25 09:10:24 2023 [27618][1][DEBUG] Unlink custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php
Fri Aug 25 09:10:24 2023 [27618][1][DEBUG] Restoring … upload/upgrades/module/Accounts-restore/custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php to custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php

Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Copying …/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php to custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php
Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Copy cache/upgrades/temp/MMtZj7/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php
Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Backup … custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php to upload/upgrades/module/Accounts2023_08_25_073043-restore/custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php

Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Retrieve FieldsMetaData : SELECT fields_meta_data.* FROM fields_meta_data WHERE fields_meta_data.id = ‘Accountsbmui_login_c’
Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Limit Query:SELECT fields_meta_data.* FROM fields_meta_data WHERE fields_meta_data.id = ‘Accountsbmui_login_c’ Start: 0 count: 1
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query:SELECT fields_meta_data.* FROM fields_meta_data WHERE fields_meta_data.id = ‘Accountsbmui_login_c’ LIMIT 0,1
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query Execution Time:0.00016880035400391
Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Hook called: DynamicFields::after_retrieve
Fri Aug 25 09:10:54 2023 [27543][1][INFO] tableExists: accounts_cstm
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query:SHOW TABLES LIKE ‘accounts_cstm’
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query Execution Time:0.00085783004760742
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query:ALTER TABLE accounts_cstm modify COLUMN bmui_login_c varchar(255) NULL
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query Execution Time:0.00062894821166992
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Formatting correction: DynamicFields->date_modified had formatting automatically corrected.
Fri Aug 25 09:10:54 2023 [27543][1][DEBUG] Hook called: DynamicFields::before_save
Fri Aug 25 09:10:54 2023 [27543][1][INFO] Query:UPDATE fields_meta_data
SET name=‘bmui_login_c’,vname=‘LBL_BMUI_LOGIN’,comments=NULL,help=‘A duplicate check is performed after entering’,custom_module=‘Accounts’,type=‘varchar’,len=255,required=0,date_modified=‘2023-08-25 14:10:53’,audited=1,massupdate=0,duplicate_merge=0,reportable=1,importable=‘true’,ext4=NULL
WHERE fields_meta_data.id = ‘Accountsbmui_login_c’ AND deleted=0

I am trying to figure out why the override files is getting updated but do not contain the right contents. The problem that this is causing is now I have to keep track ever every studio change and then manually go make it happen on other instances.

Does anyone have any idea why this might be happening.

Thank you

Tony

If you do a “find in files” in your entire SuiteCRM directory, what other references do you find to bmui_login_c

I am wondering if some other file is taking precedence.

If that doesn’t clarify the problem, I think the logic you will want to examine is this function.

grep -r inline_edit * | grep bmui

This is the only thing of existance.

custom/modules/Accounts/Ext/Vardefs/vardefs.ext.php:$dictionary[‘Account’][‘fields’][‘bmui_login_c’][‘inline_edit’]=1;
custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php:$dictionary[‘Account’][‘fields’][‘bmui_login_c’][‘inline_edit’]=1;
upload/upgrades/module/Accounts-restore/custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php:$dictionary[‘Account’][‘fields’][‘bmui_login_c’][‘inline_edit’]=1;
upload/upgrades/module/Accounts2023_08_25_073043-restore/custom/Extension/modules/Accounts/Ext/Vardefs/_override_sugarfield_bmui_login_c.php:$dictionary[‘Account’][‘fields’][‘bmui_login_c’][‘inline_edit’]=1;

Is it ok to remove the files Accounts* files in the upload/upgrades/module folder?

You can remove upload/upgrades stuff, but it doesn’t really affect anything, except your ability to uninstall the module.

I would try the grep for everything with bmui_login_c, not just inline_edit, and I would examine each file’s contents, not just that line.

The reason is that sometimes these files start by clearing out the array with something like

$dictionary['Account']['fields']['bmui_login_c'] = Array(); 

so that doesn’t mention inline_edit but could be removing your setting.

Anyway, the mere presence of a file, without references to your field, can be enough to make it ignore your file, if there is some sort of precedence that the internal logic is applying. That’s why it’s worth to debug the code loading the files and merging them together.

I decided to tail the _override_sugarfield_bmui_login_c.php file.

Here is what was printed to the console when I re-installed the customizations.

<?php // created: 2023-08-24 09:39:57 $dictionary['Account']['fields']['bmui_login_c']['inline_edit']=''; $dictionary['Account']['fields']['bmui_login_c']['labelValue']='Portal Login'; ?>tail: _override_sugarfield_bmui_login_c.php: file truncated <?php // created: 2023-08-25 16:39:29 $dictionary['Account']['fields']['bmui_login_c']['inline_edit']=1; ?>

So it is writing to the file during the install process but afterwards it is overwriting it.

I did some digging into this and with some extensive logging along with hours of reviewing said logs I have come to this conclusion.

When uninstalling customizations, on a new installed customization, all of the _override_sugar_fields will be unlinked. If there is no restore file for the installed version, then these files are not unlinked.

Furthermore, when installing customizations, it appears the system will set certain field attributes to a default configuration. In this particular case the inline_edit appears to be hardcoded and defaults to true and overwrites what ever you have in the override_sugarfield* file. It appears that uninstalling a customization, uploading and installing a newer version in studio, expecting updated fields and attributes just won’t work.

I decided to just upload a newer version of customizations on top of the previous uploaded version and it appears the system does the same thing with the _override_sugarfield_bmui_login_c,php file as it did not update it with the exported version, it recreated it with updated timestamp. I also noticed that this Accounts customization’s are not un-installable now after uploading on top of the previous version.

At the end of the day I still don’t feel like I have a good method for updating our demo box and production box. I was relying on uninstalling / re-installing each module as a way to update each module as fixes and new functionality are added.

My method of making changes goes like this, code changes, Studio changes are all made in the development server. Once we have everything ready, in Studio, we export each module separately and then move the code to our demo box for users to test. Once we get a buy in we then upload this code to our production box.

As I have said my primary method of doing this was to uninstall the previous customizations and then install new customized module. It appears everything has been working as the code is getting updated just fine. What brought this to my attention was when I specifically disabled some fields from inline editing and the changes were not getting installed on the demo box. This was the reason for this adventure.

So if I may ask, how do you go about updating your additional boxes / customers with changes you make in code and Studio? I would like to have a reliable process preferably simple as possible without a lot of extra steps.

Tony

I am personally not doing these kinds of projects currently, but to my knowledge what most people do is

  • don’t use Module Builder at all, or use it only as an initial step to start a module, and then abandon Module Builder in favor of manual editing the code
  • use Studio if it saves you work
  • don’t use any of the inbuilt packages/processes to install / uninstall, especially if you have access to the server to do the deployments yourself.
  • instead, do everything from source-control (git). This gives you more control, full visibility of what is happening, ability to back-trace your steps, facilitates merging different sets of changes if you need to, and facilitates keeping separate functionalities/features in separate branches.