forked from science-ation/science-ation
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:
parent
6e8883b4a2
commit
431c8d9036
@ -120,11 +120,14 @@ function emergencycontactStatus($reg_id="")
|
|||||||
function projectStatus($reg_id="")
|
function projectStatus($reg_id="")
|
||||||
{
|
{
|
||||||
global $config;
|
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')
|
if($config['participant_short_title_enable'] == 'yes')
|
||||||
$required_fields[] = 'shorttitle';
|
$required_fields[] = 'shorttitle';
|
||||||
|
|
||||||
|
if($config['participant_project_summary_wordmin'] > 0)
|
||||||
|
$required_fields[] = 'summary';
|
||||||
|
|
||||||
if($reg_id) $rid=$reg_id;
|
if($reg_id) $rid=$reg_id;
|
||||||
else $rid=$_SESSION['registration_id'];
|
else $rid=$_SESSION['registration_id'];
|
||||||
|
|
||||||
@ -138,11 +141,7 @@ function projectStatus($reg_id="")
|
|||||||
{
|
{
|
||||||
foreach ($required_fields AS $req)
|
foreach ($required_fields AS $req)
|
||||||
{
|
{
|
||||||
if($req == 'summary') {
|
if(!$r->$req) {
|
||||||
$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) {
|
|
||||||
return "incomplete";
|
return "incomplete";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user