From 431c8d9036fcb3bc6b750bac8854c84d0657e8cf Mon Sep 17 00:00:00 2001 From: james Date: Sun, 16 Mar 2008 19:32:30 +0000 Subject: [PATCH] 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) --- register_participants.inc.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/register_participants.inc.php b/register_participants.inc.php index 3ec06d72..9b8cf05b 100644 --- a/register_participants.inc.php +++ b/register_participants.inc.php @@ -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"; } }