Prevent ProfileField fieldNames from containing spaces. They cause problems with JS in some kinds of form fields. Fixes bug #11371.
This commit is contained in:
parent
138eb3140c
commit
077f29fff0
4 changed files with 16 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue