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,12 +28,20 @@ class App.WidgetOrganization extends App.Controller
if nameNew of organization if nameNew of organization
name = nameNew name = nameNew
# add to show if value exists # do not show name since it's already shown via diplayName()
if ( organization[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown continue if name is 'name'
# do not show firstname and lastname / already show via diplayName() # do not show if configured to be not shown
if name isnt 'name' && organization[name] isnt '' continue if !attributeConfig.shown
organizationData.push attributeConfig
# 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 # insert userData
@html App.view('widget/organization')( @html App.view('widget/organization')(

View file

@ -30,12 +30,20 @@ class App.WidgetUser extends App.Controller
if nameNew of user if nameNew of user
name = nameNew name = nameNew
# add to show if value exists # do not show firstname and lastname since they are already shown via diplayName()
if ( user[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown continue if name is 'firstname' || name is 'lastname' || name is 'organization'
# do not show firstname and lastname / already show via displayName() # do not show if configured to be not shown
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization' && user[name] isnt '' continue if !attributeConfig.shown
userData.push attributeConfig
# 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 if user.preferences
items = [] items = []

View file

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