salesagility / SuiteCRM-Core

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

Fix #563 - rewrote runAll() of FieldLogicDisplayManager class #564

Open xkrdudrlf opened 4 weeks ago

xkrdudrlf commented 4 weeks ago

Description

This PR will close #563

Motivation and Context

Currently, "field.display" value is always set to 'none' if any of display mode logic holds(or 'active') no matter what is set in 'targetDisplayType' for the display mode logic. Also, it does not handle a scenario where there are multiple display mode logics for a field.

How To Test This

  1. Try setting multiple displayLogics for any field as follows:
    $dictionary['Lead']['fields']['status']['displayLogic'] = [
    'readonly_when_converted' => [
        'key' => 'displayType',
        'modes' => ['edit'],
        'params' => [
            'fieldDependencies' => [
                'title'
            ],
            'targetDisplayType' => 'show',
            'activeOnFields' =>  [
                'title' => [ 'Converted' ]
            ]
        ]
    ],
    'readonly_when_dead' => [
        'key' => 'displayType',
        'modes' => ['edit'],
        'params' => [
            'fieldDependencies' => [
                'title'
            ],
            'targetDisplayType' => 'none',
            'activeOnFields' =>  [
                'title' => [ 'Dead' ]
            ]
        ] 
    ]
    ];
  2. Test whether a field is shown correctly in the page according to the display type set in displayLogics For example, in the above case, 'status' field should be shown when 'title' field value is 'Converted' and should be hidden when 'title' field value is 'Dead'

Types of changes

Final checklist