Add language to populate_fake

Add a bit of sanity checks to assignprojectnumbers -- make sure it assigns them all, or error out if it doesnt
This commit is contained in:
james 2006-01-26 23:10:39 +00:00
parent eaa1444082
commit 7272288c64
2 changed files with 16 additions and 4 deletions

View File

@ -24,7 +24,7 @@
<?
include "../common.inc.php";
$projq=mysql_query("SELECT id FROM registrations WHERE status='complete' AND year='2006'");
$projq=mysql_query("SELECT id FROM registrations WHERE status='complete' OR status='paymentpending' AND year='2006'");
while($projr=mysql_fetch_object($projq))
{
$reg_id=$projr->id;
@ -75,8 +75,17 @@ include "../common.inc.php";
$projectnumber=str_replace('N',$Nnum,$projectnumber);
mysql_query("UPDATE projects SET projectnumber='$projectnumber' WHERE registrations_id='$reg_id' AND year='".$config['FAIRYEAR']."'");
echo "Assigned new project number $projectnumber\n";
if($projectnumber)
{
echo "Assigned new project number $projectnumber\n";
}
else
{
echo "Eeek! couldnt assign project number for $reg_id";
exit;
}
$assigned++;
}
echo "assigned=$assigned";
?>

View File

@ -86,8 +86,11 @@ for($x=0;$x<$numprojects;$x++)
$req_tnum=rand(1,30);
if($req_tnum==1) $req_t="no"; else $req_t="yes";
$langnum=rand(1,10);
if($langnum<4) $lang="fr"; else $lang="en";
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,projectdivisions_id,title,year,req_electricity,req_table) VALUES ('$id','$cat','$div','$title',2006,'$req_e','$req_t')");
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,projectdivisions_id,title,year,req_electricity,req_table,language) VALUES ('$id','$cat','$div','$title',2006,'$req_e','$req_t','$lang')");
}
}