salesagility / SuiteCRM

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

7.14.x/7.12.x Dropdown default value overwrites saved value in editview #10174

Open gunnicom opened 1 year ago

gunnicom commented 1 year ago

Issue

If a dropdown ist defined with '' (empty) as possible value, and a default value that is any other value following happens: Save an object with value of ''. In Detailview you will see the value saved correctly. Open in Detailview and you will not see the saved '' but the default value. If you save now, you save the default value.

I think it is critical, because you may not have the field in your view, leading to change a value without knowing to a value that is not intended. For me it is nessecary to save an empty value sometimes, and it seems unlogical that you can define an empty value and then it gets overwritten.

Expected Behavior

Do not change empty values to default value in editview

Actual Behavior

Suite changes value to default value.

Steps to Reproduce

  1. Define a field as dropdown with one choice being blank '', and some other choices, in Studio or modulebuilder and deploy. Example:
    $app_list_strings['test_list']=array(
    '' => '',
    'a1' => 'a1',
    'b2' => 'b2',
    'c3' => 'c3',
    );
  2. Chose b2 as default
  3. save an object with dropdown value choosen is ''
  4. View in Detailview: '' gets shown correctly
  5. Go to EditView or InlineEdit field, field gets value 'b2'

Context

I think it is critical to change data with possible not even knowing it gets changed. For me it is a legitimate scenario to save '' in an dropdown although the default may be different.

Your Environment

timo-ecm2 commented 1 year ago

Yes I can confirm this with Version 7.12.12 -Sugar Version 6.5.25 (Build 344) in combination wth Chrome - Version 116.0.5845.180 (Officiële build) (64-bits). If you do not pay attention to saving it will mess everything up.