Properly fix the summary required field for wordmin=0 (summary simply becomes a non-required field)

Fixes the problem reported by waterloo, where the preg to count words was not counting words the same as the real word counter (602 vs 598 in the one i was looking at)
This commit is contained in:
james 2008-03-16 19:32:30 +00:00
parent 6e8883b4a2
commit 431c8d9036

View File

@ -120,11 +120,14 @@ function emergencycontactStatus($reg_id="")
function projectStatus($reg_id="")
{
global $config;
$required_fields=array("title","projectcategories_id","projectdivisions_id","summary","language","req_table","req_electricity","summarycountok");
$required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok");
if($config['participant_short_title_enable'] == 'yes')
$required_fields[] = 'shorttitle';
if($config['participant_project_summary_wordmin'] > 0)
$required_fields[] = 'summary';
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
@ -138,11 +141,7 @@ function projectStatus($reg_id="")
{
foreach ($required_fields AS $req)
{
if($req == 'summary') {
$words = count(preg_split('/[ .,]+/', $r->$req));
if($words < $config['participant_project_summary_wordmin']) return 'incomplete';
if($words > $config['participant_project_summary_wordmax']) return 'incomplete';
} else if(!$r->$req) {
if(!$r->$req) {
return "incomplete";
}
}