Fixed issue #2277 - note is not shown for customer/organisations if it's empty (fixes #2277)

This commit is contained in:
Billy Zhou 2018-10-16 10:57:58 +02:00
parent 22b2f44ba0
commit ea12b0f676
3 changed files with 36 additions and 10 deletions

View file

@ -28,11 +28,19 @@ class App.WidgetOrganization extends App.Controller
if nameNew of organization
name = nameNew
# add to show if value exists
if ( organization[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
# do not show name since it's already shown via diplayName()
continue if name is 'name'
# do not show firstname and lastname / already show via diplayName()
if name isnt 'name' && organization[name] isnt ''
# do not show if configured to be not shown
continue if !attributeConfig.shown
# Fix for issue #2277 - note is not shown for customer/organisations if it's empty
# Always show for these two conditions:
# 1. the attribute exists and is not empty
# 2. it is a richtext note field
continue if ( !organization[name]? || organization[name] is '' ) && attributeConfig.tag isnt 'richtext'
# add to show if all checks passed
organizationData.push attributeConfig
# insert userData

View file

@ -30,11 +30,19 @@ class App.WidgetUser extends App.Controller
if nameNew of user
name = nameNew
# add to show if value exists
if ( user[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
# do not show firstname and lastname since they are already shown via diplayName()
continue if name is 'firstname' || name is 'lastname' || name is 'organization'
# do not show firstname and lastname / already show via displayName()
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization' && user[name] isnt ''
# do not show if configured to be not shown
continue if !attributeConfig.shown
# Fix for issue #2277 - note is not shown for customer/organisations if it's empty
# Always show for these two conditions:
# 1. the attribute exists and is not empty
# 2. it is a richtext note field
continue if ( !user[name]? || user[name] is '' ) && attributeConfig.tag isnt 'richtext'
# add to show if all checks passed
userData.push attributeConfig
if user.preferences

View file

@ -776,6 +776,7 @@ class AdminObjectManagerTest < TestCase
end
# verify fix for issue #2233 - Boolean object set to false is not visible
# verify fix for issue #2277 - Note is not shown for customer / organisations if it's empty
def test_false_boolean_attributes_gets_displayed_for_organizations
@browser = browser_instance
login(
@ -830,6 +831,10 @@ class AdminObjectManagerTest < TestCase
css: '.content.active .sidebar[data-tab="organization"] .sidebar-content',
value: 'text_test',
)
match(
css: '.content.active .sidebar[data-tab="organization"] .sidebar-content',
value: 'note',
)
object_manager_attribute_delete(
data: {
@ -847,6 +852,7 @@ class AdminObjectManagerTest < TestCase
end
# verify fix for issue #2233 - Boolean object set to false is not visible
# verify fix for issue #2277 - Note is not shown for customer / organisations if it's empty
def test_false_boolean_attributes_gets_displayed_for_users
@browser = browser_instance
login(
@ -901,6 +907,10 @@ class AdminObjectManagerTest < TestCase
css: '.content.active .sidebar[data-tab="customer"] .sidebar-content',
value: 'text_test',
)
match(
css: '.content.active .sidebar[data-tab="customer"] .sidebar-content',
value: 'note',
)
object_manager_attribute_delete(
data: {