Update default fundraising goals, and insert defaults if none exist

This commit is contained in:
james 2009-10-06 19:04:45 +00:00
parent 27b2c26c54
commit cf2affcc03
3 changed files with 19 additions and 2 deletions

View File

@ -26,7 +26,7 @@
user_auth_required('committee', 'admin');
//first, insert any defaults
//first, insert any default fundraising donor levels
$q=mysql_query("SELECT * FROM fundraising_donor_levels WHERE fiscalyear='".$config['FISCALYEAR']."'");
if(!mysql_num_rows($q)) {
$q=mysql_query("SELECT * FROM fundraising_donor_levels WHERE fiscalyear='-1'");
@ -40,6 +40,21 @@
}
}
//first, insert any default fundraising goals
$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='".$config['FISCALYEAR']."'");
if(!mysql_num_rows($q)) {
$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='-1'");
while($r=mysql_fetch_object($q)) {
mysql_query("INSERT INTO fundraising_goals (`goal`,`name`,`description`,`system`,`budget`,`fiscalyear`) VALUES (
'".mysql_real_escape_string($r->goal)."',
'".mysql_real_escape_string($r->name)."',
'".mysql_real_escape_string($r->description)."',
'".mysql_real_escape_string($r->system)."',
'".mysql_real_escape_string($r->budget)."',
'".$config['FISCALYEAR']."')");
}
}
switch($_GET['gettab']) {
case "levels":

View File

@ -1 +1 @@
142
143

2
db/db.update.143.sql Normal file
View File

@ -0,0 +1,2 @@
UPDATE `fundraising_goals` SET `goal` = 'sfgeneral', `name` = 'Science Fair - General Funds', `description` = 'General funds donated to the science fair may be allocated as the science fair organizers see fit.' WHERE `goal`='general' AND fiscalyear='-1';
UPDATE `fundraising_goals` SET `goal` = 'sfawards', `name` = 'Science Fair - Awards', `description` = 'Award Sponsorships are provided to allow an sponsor/donor to give a specific award.' WHERE `goal`='awards' AND fiscalyear='-1';