salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.27k stars 2.03k forks source link

Dynamic Fields Mass Update Issue #10404

Open ojs87 opened 2 months ago

ojs87 commented 2 months ago

Issue

If a Mass Update is performed on a module containing dynamic fields with underscores in parent field keys, the child field's default value is always set, regardless if a change has been made to the dynamic parent field. This issue is closely related to https://github.com/salesagility/SuiteCRM/issues/8209 however the proposed fix in https://github.com/salesagility/SuiteCRM/pull/10340 does not fix this issue if a custom dynamic dropdown is still in the Cases module and this can happen with no change to the dynamic dropdowns.

examples of dynamic dropdown options that would be affected:

parent dropdown keys: 
health_and_safety

child option keys:
health_and_safety_fire
health_and_safety_power_cut
health_and_safety_volcano

Expected Behavior

Mass Update should not change dynamic dropdown child values if no change has been made to the parent field.

Actual Behavior

In the above example, health_and_safety_fire compares "health" to "health and safety" and assumes it is a different parent value. This is because the Mass Update function checks for the underscore delimiter regardless of the key values.

Possible Fix

check that health_and_safety_fire contains health_and_safety at strpos 0 to see if the child field should be set to the default value.

Steps to Reproduce

  1. Add a dynamic dropdown with keys containing underscores to a module
  2. Create a record and set the child value to non-default(not the first value)
  3. Perform a mass update on the record, with no changes to the dynamic dropdowns
  4. The dynamic dropdown child field will be set to the default value.

Context

Your Environment