From cf2affcc036b7d196555d1446ef734fde2fe6958 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 6 Oct 2009 19:04:45 +0000 Subject: [PATCH] Update default fundraising goals, and insert defaults if none exist --- admin/fundraising_setup.php | 17 ++++++++++++++++- db/db.code.version.txt | 2 +- db/db.update.143.sql | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 db/db.update.143.sql diff --git a/admin/fundraising_setup.php b/admin/fundraising_setup.php index 6ec7b1a..8a65820 100644 --- a/admin/fundraising_setup.php +++ b/admin/fundraising_setup.php @@ -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": diff --git a/db/db.code.version.txt b/db/db.code.version.txt index aaacbe6..fba7ed5 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -142 +143 diff --git a/db/db.update.143.sql b/db/db.update.143.sql new file mode 100644 index 0000000..f9b2b56 --- /dev/null +++ b/db/db.update.143.sql @@ -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';