Properly detect date of birth 0000-00-00 as being incomplete

If we're collecting personal info, then gender is required
This commit is contained in:
james 2007-12-08 17:52:14 +00:00
parent 5de0bfac48
commit 7f189559a1
2 changed files with 10 additions and 4 deletions

View File

@ -50,7 +50,7 @@ function studentStatus($reg_id="")
{ {
global $config; global $config;
if($config['participant_student_personal']=="yes") if($config['participant_student_personal']=="yes")
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id"); $required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","sex");
else else
$required_fields=array("firstname","lastname","email","grade","schools_id"); $required_fields=array("firstname","lastname","email","grade","schools_id");
@ -70,9 +70,15 @@ function studentStatus($reg_id="")
{ {
foreach ($required_fields AS $req) foreach ($required_fields AS $req)
{ {
if(!$r->$req) if($req=="dateofbirth")
{ {
return "incomplete"; if($r->$req=="0000-00-00" || !$r->$req)
return "incomplete";
}
else
{
if(!$r->$req)
return "incomplete";
} }
} }
} }

View File

@ -285,7 +285,7 @@ if($config['participant_student_personal']=="yes")
echo "<option $sel value=\"male\">".i18n("Male")."</option>\n"; echo "<option $sel value=\"male\">".i18n("Male")."</option>\n";
if($studentinfo->sex=="female") $sel="selected=\"selected\""; else $sel=""; if($studentinfo->sex=="female") $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"female\">".i18n("Female")."</option>\n"; echo "<option $sel value=\"female\">".i18n("Female")."</option>\n";
echo "</select>";//.REQUIREDFIELD; echo "</select>".REQUIREDFIELD;
} }
echo "</td>\n"; echo "</td>\n";
echo " <td></td><td></td>\n"; echo " <td></td><td></td>\n";