Fix the -1 for the god damn last time

This commit is contained in:
james 2011-03-04 19:56:15 +00:00
parent af47f30aeb
commit c6ba56f57a

View File

@ -356,20 +356,21 @@ function saveProjectData($data,$registrations_id=null){
$awards=array(); $awards=array();
foreach($data['specialawards'] AS $sa) { foreach($data['specialawards'] AS $sa) {
//If all they've selected is they don't want to self nominate, then erase all other selections //If all they've selected is they don't want to self nominate, then erase all other selections
if($sa['id']==-1) { if($sa['id']==-1 && $sa['selected']) {
//reset the array //reset the array
unset($awards); unset($awards);
$awards=array(); $awards=array();
$awards[]=$sa; $awards[]=$sa;
//and stop looping
break; break;
} }
else { else {
if($sa['selected'] && in_array($sa['id'],$eligibleAwardsList)) { if($sa['selected'] && in_array($sa['id'],$eligibleAwardsList)) {
echo "id {$sa['id']} is selected AND eligible\n";
$awards[]=$sa; $awards[]=$sa;
} }
} }
} }
$idx=0; $idx=0;
foreach($awards AS $sa) { 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']}')"; $qstr="INSERT INTO project_specialawards_link (award_awards_id,projects_id,conferences_id) VALUES ('".intval($sa['id'])."','".intval($data['project_id'])."','{$conference['id']}')";