forked from science-ation/science-ation
Properly upload the project and update the reg email
This commit is contained in:
parent
c8087c54c3
commit
9f9f2053df
14
remote.php
14
remote.php
@ -194,6 +194,7 @@ function award_upload_school(&$student, &$school, $year, &$response)
|
||||
|
||||
function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
||||
{
|
||||
$reg_email_needs_update = false;
|
||||
/* Copied from admin/award_upload.php, this is the
|
||||
* transport name => sql name mapping */
|
||||
$student_fields = array('firstname'=>'firstname',
|
||||
@ -245,11 +246,12 @@ function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
||||
'".mysql_real_escape_string($project['projectnumber'])."',
|
||||
'$year', '{$fair['id']}');");
|
||||
$pid = mysql_insert_id();
|
||||
$reg_email_needs_update = true;
|
||||
}
|
||||
/* Update the project in case anythign changed */
|
||||
mysql_query("UPDATE projects SET title='".mysql_real_escape_string($project['title'])."',
|
||||
summary='".mysql_real_escape_string($project['abstract'])."'
|
||||
projectcategories_id='".intval($project['projectcategories_id'])."'
|
||||
summary='".mysql_real_escape_string($project['abstract'])."',
|
||||
projectcategories_id='".intval($project['projectcategories_id'])."',
|
||||
projectdivisions_id='".intval($project['projectdivisions_id'])."'
|
||||
WHERE id='$pid'");
|
||||
|
||||
@ -274,6 +276,13 @@ function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
||||
/* Note lack of comma before $keys, we added it above for both keys and values */
|
||||
mysql_query("INSERT INTO students (`registrations_id`,`fairs_id`, `schools_id`,`year` $keys)
|
||||
VALUES('$registrations_id','{$fair['id']}','$schools_id','$year' $values )");
|
||||
|
||||
/* Update the registration email */
|
||||
if($reg_email_needs_update) {
|
||||
mysql_query("UPDATE registrations SET email='".mysql_real_escape_string($student['email'])."'
|
||||
WHERE id='$registrations_id'");
|
||||
$reg_email_needs_update = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -344,6 +353,7 @@ function handle_get_divisions(&$u, &$fair, &$data, &$response)
|
||||
$div[$r->id] = array('division' => $r->division);
|
||||
}
|
||||
$response['divisions'] = $div;
|
||||
$response['tmp'] = $data;
|
||||
$response['error'] = 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user