diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9a462d68a..2d955f9a6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,6 +1,7 @@ 7.8.11 - fixed #11362: Unable to checkout with ITransact plugin - fixed #11364: Notify About Low Stock workflow activity email is not user friendly + - fixed #11371: Spaces in the names of custom profile fields 7.8.10 - fixed #11332: Pagination in webgui.org forum urls diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index 59dc0d36e..9e5cbcc9e 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -150,6 +150,7 @@ sub create { $properties->{fieldType} ||= "ReadOnly"; return undef if $class->exists($session,$fieldName); return undef if $class->isReservedFieldName($fieldName); + return undef if $fieldName =~ m{\s}; ### Data okay, create the field # Add the record diff --git a/lib/WebGUI/i18n/English/WebGUIProfile.pm b/lib/WebGUI/i18n/English/WebGUIProfile.pm index 42e73ae46..8e1668037 100644 --- a/lib/WebGUI/i18n/English/WebGUIProfile.pm +++ b/lib/WebGUI/i18n/English/WebGUIProfile.pm @@ -57,10 +57,10 @@ our $I18N = { lastUpdated => 1036964807 }, - '475 description' => { - message => q|The name of the field, used internally in the database.|, - lastUpdated => 1122316558, - }, + '475 description' => { + message => q|The name of the field, used internally in the database. Field names may not contain spaces. Certain field names are reserved, such as "op", "func", "username", "shop", "karma", "status", "lastUpdated", "dateCreated".|, + lastUpdated => 1264448486, + }, '472 description' => { message => q|A short, descriptive label displayed to the user. This can be a call to WebGUI's diff --git a/t/ProfileField.t b/t/ProfileField.t index e9b659f03..76fcfc84e 100644 --- a/t/ProfileField.t +++ b/t/ProfileField.t @@ -33,7 +33,7 @@ WebGUI::Test->usersToDelete($newUser); #---------------------------------------------------------------------------- # Tests -plan tests => 47; # Increment this number for each test you create +plan tests => 48; # Increment this number for each test you create #---------------------------------------------------------------------------- # Test the creation of ProfileField @@ -114,6 +114,14 @@ my $newProfileField2 = WebGUI::ProfileField->create($session, 'testField2', { is($newProfileField2->get('fieldType'), 'ReadOnly', 'create: default fieldType is ReadOnly'); is($newProfileField2->get('label'), q|WebGUI::International::get('webgui','WebGUI')|, 'getting raw label'); is($newProfileField2->getLabel, 'WebGUI', 'getLabel will process safeEval calls for i18n'); +$newProfileField->delete; +$newProfileField2->delete; + +$newProfileField = WebGUI::ProfileField->create($session, 'space field', { + fieldType => 'Float', + label => 'Space Field', +}); +is $newProfileField, undef, 'create returns undef if the field name contains white space'; ########################################################### # @@ -174,13 +182,4 @@ is ($newProfileField3->get('required'), 0, '... required = 0'); $newProfileField3->set({ required => 1}); is ($newProfileField3->get('required'), 1, 'set required = 1'); is ($newProfileField3->get('editable'), 1, '... editable = 1'); - -#---------------------------------------------------------------------------- -# Cleanup -END { - $newProfileField->delete; - $newProfileField2->delete; - $newProfileField3->delete; -} - - +$newProfileField3->delete;