Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10243 - studio not saving field properties correctly #10538

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from

Conversation

pgorod
Copy link
Contributor

@pgorod pgorod commented Oct 4, 2024

Description

Studio was not saving field properties correctly. This bug has been there for years...

How To Test This

  1. Enter Studio
  2. Enter a module (such as Cases)
  3. Click Fields
  4. Enter a field (such as Description) to see its properties:

image

  1. Change one of the properties,
  2. Save
  3. Exit that screen to the field list
  4. Enter the same field again
  5. Change a different property
  6. Save
  7. Exit and go back in
  8. Both properties should be retained, instead of the first one you changed being reverted to a default.

The bug caused each subsequent save to throw away the previously saved non-default properties. I guess for a long time people work around this by just changing one property, or repeating the saves when they were mysteriously throw away...

During tests, it might be helpful to keep separate terminals watching these two files:

watch -n 1 cat custom/modules/Cases/Ext/Vardefs/vardefs.ext.php
watch -n 1 cat custom/Extension/modules/Cases/Ext/Vardefs/_override_sugarfield_description.php

Note that the Save action already includes a QR&R, so it is not necessary to do it separately. That's why the contents of those two files will appear in sync after each save.

There's a downside to this PR, although it is really not problematic. Some fields that were not changed, and still have their default values will be included in the saved files. This is because it is not trivial to know if a value is at its default - some of these things depend on configurable settings in other places in the system. So the conservative approach is taken: retain the values that were there when saved, even if it is not clear whether they are defaults and some redundancy occurs.

Types of changes

  • [-x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • I have read the How to Contribute guidelines.

@pgorod pgorod changed the title Fix studio not saving field properties correctly Fix #10243 - studio not saving field properties correctly Oct 4, 2024
@serhiisamko091184 serhiisamko091184 added Status: Requires Code Review Needs the core team to code review Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Area: Studio Issues & PRs related to all things regarding studio & module builder Branch:Hotfix PR 4-8 Score given to PRs once assessed labels Oct 14, 2024
@serhiisamko091184
Copy link
Contributor

Hello @pgorod,

thanks for your PR!

Regards,
Serhii

@SuiteBot
Copy link

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/no-vardefs-for-fields-created-by-studio-why/97595/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Studio Issues & PRs related to all things regarding studio & module builder Branch:Hotfix PR 4-8 Score given to PRs once assessed Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Status: Requires Code Review Needs the core team to code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants