forked from science-ation/science-ation
Properly handle award id = -1 for "i dont want special awards"
This commit is contained in:
parent
c0299dc870
commit
a28ab561eb
@ -352,9 +352,26 @@ function saveProjectData($data,$registrations_id=null){
|
||||
}
|
||||
mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='{$data['project_id']}' AND conferences_id='{$conference['id']}'");
|
||||
|
||||
$idx=0;
|
||||
//now filter the list we've been given, to make sure everything's hunky dory
|
||||
$awards=array();
|
||||
foreach($data['specialawards'] AS $sa) {
|
||||
//If all they've selected is they don't want to self nominate, then erase all other selections
|
||||
if($sa['id']==-1) {
|
||||
//reset the array
|
||||
unset($awards);
|
||||
$awards=array();
|
||||
$awards[]=$sa;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if($sa['selected'] && in_array($sa['id'],$eligibleAwardsList)) {
|
||||
$awards[]=$sa;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$idx=0;
|
||||
foreach($awards AS $sa) {
|
||||
$qstr="INSERT INTO project_specialawards_link (award_awards_id,projects_id,conferences_id) VALUES ('".intval($sa['id'])."','".intval($data['project_id'])."','{$conference['id']}')";
|
||||
mysql_query($qstr);
|
||||
$idx++;
|
||||
@ -363,7 +380,6 @@ function saveProjectData($data,$registrations_id=null){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//and update nummentors in registrations, yea, i know its not in the projects table
|
||||
if(isset($data['nummentors'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user