diff --git a/lib/WebGUI/Operation/ProfileSettings.pm b/lib/WebGUI/Operation/ProfileSettings.pm
index c08c96c19..34829a3ab 100644
--- a/lib/WebGUI/Operation/ProfileSettings.pm
+++ b/lib/WebGUI/Operation/ProfileSettings.pm
@@ -116,11 +116,11 @@ sub www_editProfileCategory {
#-------------------------------------------------------------------
sub www_editProfileCategorySave {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
- my %data = {
+ my %data = (
label=>WebGUI::FormProcessor::text("label"),
visible=>WebGUI::FormProcessor::yesNo("visible"),
editable=>WebGUI::FormProcessor::yesNo("editable"),
- };
+ );
if ($session{form}{cid} eq "new") {
my $category = WebGUI::ProfileCategory->create(\%data);
$session{form}{cid} = $category->getId;
@@ -186,7 +186,7 @@ sub www_editProfileField {
-value=>$data->{required}
);
my $fieldType = WebGUI::Form::FieldType->new(
- -name=>"dataType",
+ -name=>"fieldType",
-label=>WebGUI::International::get(486,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('486 description',"WebGUIProfile"),
-value=>ucfirst $data->{fieldType},
@@ -204,7 +204,7 @@ sub www_editProfileField {
$fieldType->{types} = \@profileForms;
$f->raw($fieldType->toHtmlWithWrapper());
$f->textarea(
- -name => "dataValues",
+ -name => "possibleValues",
-label => WebGUI::International::get(487,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('487 description',"WebGUIProfile"),
-value => $data->{possibleValues},
@@ -242,11 +242,14 @@ sub www_editProfileFieldSave {
dataDefault=>WebGUI::FormProcessor::textarea("dataDefault"),
fieldType=>WebGUI::FormProcessor::fieldType("fieldType"),
);
+ my $categoryId = WebGUI::FormProcessor::selectBox("profileCategoryId");
if ($session{form}{new}) {
- my $field = WebGUI::ProfileField->create(WebGUI::FormProcessor::text("fieldName"), \%data, WebGUI::FormProcessor::selectBox("profileCategoryId"));
+ my $field = WebGUI::ProfileField->create(WebGUI::FormProcessor::text("fid"), \%data, $categoryId);
$session{form}{fid} = $field->getId;
} else {
- WebGUI::ProfileField->new($session{form}{fid})->set(\%data);
+ my $field = WebGUI::ProfileField->new($session{form}{fid});
+ $field->set(\%data);
+ $field->setCategory($categoryId);
}
return www_editProfileSettings();
}
@@ -261,7 +264,7 @@ sub www_editProfileSettings {
$output .= moveUpIcon('op=moveProfileCategoryUp;cid='.$category->getId);
$output .= moveDownIcon('op=moveProfileCategoryDown;cid='.$category->getId);
$output .= ' '.$category->getLabel.'
';
- foreach my $field ($category->getFields) {
+ foreach my $field (@{$category->getFields}) {
$output .= ' ';
$output .= deleteIcon('op=deleteProfileFieldConfirm;fid='.$field->getId,'',WebGUI::International::get(467,"WebGUIProfile"));
$output .= editIcon('op=editProfileField;fid='.$field->getId);
diff --git a/lib/WebGUI/ProfileCategory.pm b/lib/WebGUI/ProfileCategory.pm
index 8d8a8b231..3055b6726 100644
--- a/lib/WebGUI/ProfileCategory.pm
+++ b/lib/WebGUI/ProfileCategory.pm
@@ -69,7 +69,7 @@ sub create {
my ($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber) from userProfileCategory");
my $id = WebGUI::SQL->setRow("userProfileCategory","profileCategoryId",{profileCategoryId=>"new", sequenceNumber=>$sequenceNumber+1});
my $self = $class->new($id);
- $self->update($properties);
+ $self->set($properties);
return $self;
}
diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm
index d86840a62..6d0e65cdf 100644
--- a/lib/WebGUI/ProfileField.pm
+++ b/lib/WebGUI/ProfileField.pm
@@ -79,12 +79,12 @@ sub create {
my $class = shift;
my $fieldName = shift;
my $properties = shift;
- my $categoryId = shift;
- my ($fieldName) = WebGUI::SQL->quickArray("select count(*) from userProfileField where fieldName=".quote($fieldName));
- return undef if ($fieldName);
+ my $categoryId = shift || "1";
+ my ($fieldNameExists) = WebGUI::SQL->quickArray("select count(*) from userProfileField where fieldName=".quote($fieldName));
+ return undef if ($fieldNameExists);
my $id = WebGUI::SQL->setRow("userProfileField","fieldName",{fieldName=>"new"},undef,$fieldName);
my $self = $class->new($id);
- $self->setCategory($categoryId || "1");
+ $self->setCategory($categoryId);
$self->set($properties);
return $self;
}