forked from science-ation/science-ation
Update winners entry and award_downloader for award_sponsors->sponsors conversion
This commit is contained in:
parent
27a3a273d7
commit
e5e863e3f7
@ -119,18 +119,18 @@
|
||||
|
||||
|
||||
//check if the sponsor exists, if not, add them
|
||||
$sponsorq=mysql_query("SELECT * FROM award_sponsors WHERE organization='".mysql_escape_string($award['sponsor'][0])."'");
|
||||
$sponsorq=mysql_query("SELECT * FROM sponsors WHERE organization='".mysql_escape_string($award['sponsor'][0])."'");
|
||||
if($sponsorr=mysql_fetch_object($sponsorq)) {
|
||||
$sponsor_id=$sponsorr->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("INSERT INTO award_sponsors (organization,year,notes,confirmed) VALUES ('".mysql_escape_string($award['sponsor'][0])."','$year','".mysql_escape_string("Imported from external source: $r->name")."','yes')");
|
||||
mysql_query("INSERT INTO sponsors (organization,year,notes,confirmed) VALUES ('".mysql_escape_string($award['sponsor'][0])."','$year','".mysql_escape_string("Imported from external source: $r->name")."','yes')");
|
||||
$sponsor_id=mysql_insert_id();
|
||||
}
|
||||
|
||||
mysql_query("UPDATE award_awards SET
|
||||
award_sponsors_id='$sponsor_id',
|
||||
sponsors_id='$sponsor_id',
|
||||
name='".mysql_escape_string($award['name_en'][0])."',
|
||||
criteria='".mysql_escape_string($award['criteria_en'][0])."',
|
||||
external_postback='".mysql_escape_string($postback)."'
|
||||
@ -210,20 +210,20 @@ echo mysql_error();
|
||||
}
|
||||
else {
|
||||
//check if the sponsor exists, if not, add them
|
||||
$sponsorq=mysql_query("SELECT * FROM award_sponsors WHERE organization='".mysql_escape_string($award['sponsor'][0])."'");
|
||||
$sponsorq=mysql_query("SELECT * FROM sponsors WHERE organization='".mysql_escape_string($award['sponsor'][0])."'");
|
||||
if($sponsorr=mysql_fetch_object($sponsorq)) {
|
||||
$sponsor_id=$sponsorr->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("INSERT INTO award_sponsors (organization,year,notes,confirmed) VALUES ('".mysql_escape_string($award['sponsor'][0])."','$year','".mysql_escape_string("Imported from external source: $r->name")."','yes')");
|
||||
mysql_query("INSERT INTO sponsors (organization,year,notes,confirmed) VALUES ('".mysql_escape_string($award['sponsor'][0])."','$year','".mysql_escape_string("Imported from external source: $r->name")."','yes')");
|
||||
$sponsor_id=mysql_insert_id();
|
||||
}
|
||||
|
||||
echo i18n("Award does not exists, adding...")."<br />";
|
||||
mysql_query("INSERT INTO award_awards (
|
||||
award_types_id,
|
||||
award_sponsors_id,
|
||||
sponsors_id,
|
||||
name,
|
||||
criteria,
|
||||
year,
|
||||
|
@ -28,8 +28,8 @@
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
|
||||
if($_GET['award_sponsors_id']) $award_sponsors_id=$_GET['award_sponsors_id'];
|
||||
else if($_POST['award_sponsors_id']) $award_sponsors_id=$_POST['award_sponsors_id'];
|
||||
if($_GET['sponsors_id']) $sponsors_id=$_GET['sponsors_id'];
|
||||
else if($_POST['sponsors_id']) $sponsors_id=$_POST['sponsors_id'];
|
||||
|
||||
if($_GET['award_types_id']) $award_types_id=$_GET['award_types_id'];
|
||||
else if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id'];
|
||||
@ -274,16 +274,16 @@ else
|
||||
award_awards.name,
|
||||
award_awards.order AS awards_order,
|
||||
award_types.type,
|
||||
award_sponsors.organization
|
||||
sponsors.organization
|
||||
FROM
|
||||
award_awards,
|
||||
award_types,
|
||||
award_sponsors
|
||||
sponsors
|
||||
WHERE
|
||||
award_awards.year='".$config['FAIRYEAR']."'
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
AND award_types.year='".$config['FAIRYEAR']."'
|
||||
AND award_awards.award_sponsors_id=award_sponsors.id
|
||||
AND award_awards.sponsors_id=sponsors.id
|
||||
ORDER BY awards_order");
|
||||
|
||||
echo mysql_error();
|
||||
|
Loading…
x
Reference in New Issue
Block a user