fixed profile bugs

This commit is contained in:
JT Smith 2003-05-26 01:24:27 +00:00
parent c8f8f40757
commit 0752423448
2 changed files with 16 additions and 4 deletions

View file

@ -87,7 +87,10 @@ sub _logLogin {
sub _validateProfileData {
my (%data, $error, $a, %field);
tie %field, 'Tie::CPHash';
$a = WebGUI::SQL->read("select dataType,fieldName,fieldLabel,required from userProfileField");
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory
where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
and userProfileCategory.editable=1 and userProfileField.editable=1
order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
while (%field = $a->hash) {
$data{$field{fieldName}} = WebGUI::FormProcessor::process($field{fieldName},$field{dataType});
if ($field{required} && $data{$field{fieldName}} eq "") {

View file

@ -410,7 +410,7 @@ sub www_editUserProfile {
$values = eval $data{dataValues};
$method = $data{dataType};
$label = eval $data{fieldLabel};
if ($method eq "select") {
if ($method eq "selectList" || $method eq "checkList" || $method eq "radioList") {
# note: this big if statement doesn't look elegant, but doing regular
# ORs caused problems with the array reference.
if ($session{form}{$data{fieldName}}) {
@ -420,7 +420,12 @@ sub www_editUserProfile {
} else {
$default = eval $data{dataDefault};
}
$f->select($data{fieldName},$values,$label,$default);
$f->$method(
-name=>$data{fieldName},
-options=>$values,
-label=>$label,
-value=>$default
);
} elsif ($method) {
if ($session{form}{$data{fieldName}}) {
$default = $session{form}{$data{fieldName}};
@ -429,7 +434,11 @@ sub www_editUserProfile {
} else {
$default = eval $data{dataDefault};
}
$f->$method($data{fieldName},$label,$default);
$f->$method(
-name=>$data{fieldName},
-label=>$label,
-value=>$default
);
}
$previousCategory = $category;
}