diff --git a/admin/donors_search.php b/admin/donors_search.php
index c732992..b28fd6f 100644
--- a/admin/donors_search.php
+++ b/admin/donors_search.php
@@ -61,7 +61,7 @@
$numr=mysql_fetch_object($numq);
$numawards=$numr->num;
- $numq=mysql_query("SELECT COUNT(id) AS num FROM sponsorships WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
+ $numq=mysql_query("SELECT COUNT(id) AS num FROM fundraising_donations WHERE fiscalyear='".$config['FISCALYEAR']."' AND sponsors_id='$r->id'");
$numr=mysql_fetch_object($numq);
$numsponsorships=$numr->num;
diff --git a/admin/fundraising_types_handler.inc.php b/admin/fundraising_goals_handler.inc.php
similarity index 55%
rename from admin/fundraising_types_handler.inc.php
rename to admin/fundraising_goals_handler.inc.php
index a69170c..665ad47 100644
--- a/admin/fundraising_types_handler.inc.php
+++ b/admin/fundraising_goals_handler.inc.php
@@ -2,13 +2,13 @@
if($_POST['action']=="funddelete" && $_POST['delete']) {
//first lookup all the sponsorships inside the fund
$id=intval($_POST['delete']);
- $q=mysql_query("SELECT * FROM fundraising WHERE id='$id' AND year='".$config['FAIRYEAR']."'");
+ $q=mysql_query("SELECT * FROM fundraising_goals WHERE id='$id' AND year='".$config['FISCALYEAR']."'");
$f=mysql_fetch_object($q);
//hold yer horses, no deleting system funds!
if($f) {
if($f->system=="no") {
- mysql_query("DELETE FROM sponsorships WHERE fundraising_type='".mysql_real_escape_string($f->type)."' AND year='".$config['FAIRYEAR']."'");
- mysql_query("DELETE FROM fundraising WHERE id='$id'");
+ mysql_query("DELETE FROM fundraising_donations WHERE fundraising_goal='".mysql_real_escape_string($f->type)."' AND fiscalyear='".$config['FISCALYEAR']."'");
+ mysql_query("DELETE FROM fundraising_goals WHERE id='$id'");
if(mysql_affected_rows())
happy_("Successfully removed fund %1",array($f->name));
}
@@ -21,23 +21,23 @@ if($_POST['action']=="funddelete" && $_POST['delete']) {
if($_POST['action']=="fundedit" || $_POST['action']=="fundadd") {
$fundraising_id=intval($_POST['fundraising_id']);
if($fundraising_id) {
- $q=mysql_query("SELECT * FROM fundraising WHERE id='$fundraising_id'");
+ $q=mysql_query("SELECT * FROM fundraising_goals WHERE id='$fundraising_id'");
$f=mysql_fetch_object($q);
$system=$f->system;
}
$name=mysql_real_escape_string($_POST['name']);
- $type=mysql_real_escape_string($_POST['type']);
+ $goal=mysql_real_escape_string($_POST['goal']);
$description=mysql_real_escape_string($_POST['description']);
- $goal=intval($_POST['goal']);
+ $budget=intval($_POST['budget']);
}
if($_POST['action']=="fundedit") {
- if( ($system=="yes" && $goal) || ($system=="no" && $goal && $type && $name) ) {
+ if( ($system=="yes" && $budget) || ($system=="no" && $budget && $goal && $name) ) {
if($system=="yes") {
- mysql_query("UPDATE fundraising SET goal='$goal', description='$description' WHERE id='$fundraising_id'");
+ mysql_query("UPDATE fundraising SET budget='$budget', description='$description' WHERE id='$fundraising_id'");
}
else {
- mysql_query("UPDATE fundraising SET goal='$goal', description='$description', type='$type', name='$name' WHERE id='$fundraising_id'");
+ mysql_query("UPDATE fundraising SET budget='$budget', description='$description', goal='$goal', name='$name' WHERE id='$fundraising_id'");
}
if(mysql_error())
error_("MySQL Error: %1",array(mysql_error()));
@@ -52,7 +52,7 @@ if($_POST['action']=="fundedit") {
}
if($_POST['action']=="fundadd") {
if( $goal && $type && $name) {
- mysql_query("INSERT INTO fundraising (type,name,description,system,goal,year) VALUES ('$type','$name','$description','no','$goal','{$config['FAIRYEAR']}')");
+ mysql_query("INSERT INTO fundraising_goals (goal,name,description,system,budget,fiscalyear) VALUES ('$goal','$name','$description','no','$budget','{$config['FISCALYEAR']}')");
happy_("Added new fund");
}
else
diff --git a/admin/fundraising_main.inc.php b/admin/fundraising_main.inc.php
index e43d118..8b1587e 100644
--- a/admin/fundraising_main.inc.php
+++ b/admin/fundraising_main.inc.php
@@ -2,7 +2,7 @@
if($_GET['action']=="fundraisingmain") {
//this table is eventually going to be massive, and probably not in a tableview format, it'll show goals as well as all ongoing fund pledges, probabilities, etc as well as over/under, etc, all prettily colour coded.. basically a good overview of the total fundraising status of the fair.
- $q=mysql_query("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY system DESC,type");
+ $q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY system DESC,goal");
echo "
";
while($r=mysql_fetch_object($q)) {
@@ -16,7 +16,7 @@ if($_GET['action']=="fundraisingmain") {
echo "\n";
echo "".i18n($r->name)." | \n";
- echo "".format_money($r->goal)." | \n";
+ echo "".format_money($r->budget)." | \n";
echo "\n";
if($r->type=="general")
@@ -25,19 +25,19 @@ if($_GET['action']=="fundraisingmain") {
$typetotal=0;
$typeprobtotal=0;
$sq=mysql_query("
- SELECT sponsorships.id, sponsors.organization AS name, sponsorships.value, sponsorships.status, sponsorships.probability
- FROM sponsorships
- JOIN sponsors ON sponsorships.sponsors_id=sponsors.id
- WHERE (sponsorships.fundraising_type='$r->type' $orsql)
- AND sponsorships.year='{$config['FAIRYEAR']}'
+ SELECT fundraising_donations.id, sponsors.organization AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
+ FROM fundraising_donations
+ JOIN sponsors ON fundraising_donations.sponsors_id=sponsors.id
+ WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
+ AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
UNION
- SELECT sponsorships.id, CONCAT(users.firstname,' ',users.lastname) AS name, sponsorships.value, sponsorships.status, sponsorships.probability
- FROM sponsorships
- JOIN users ON sponsorships.users_uid=users.uid
- WHERE (sponsorships.fundraising_type='$r->type' $orsql)
- AND sponsorships.year='{$config['FAIRYEAR']}'
+ SELECT fundraising_donations.id, CONCAT(users.firstname,' ',users.lastname) AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
+ FROM fundraising_donations
+ JOIN users ON fundraising_donations.users_uid=users.uid
+ WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
+ AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
ORDER BY status DESC, probability DESC, name
");
diff --git a/admin/fundraising_sponsorship.php b/admin/fundraising_sponsorship.php
index 0fe2146..d0fb039 100644
--- a/admin/fundraising_sponsorship.php
+++ b/admin/fundraising_sponsorship.php
@@ -28,7 +28,7 @@
if($_GET['id']) {
$id=intval($_GET['id']);
- $q=mysql_query("SELECT sponsorships.*, sponsors.organization FROM sponsorships,sponsors WHERE sponsorships.id='$id' AND sponsorships.sponsors_id=sponsors.id");
+ $q=mysql_query("SELECT fundraising_donations.*, sponsors.organization FROM fundraising_donations,sponsors WHERE fundraising_donations.id='$id' AND fundraising_donations.sponsors_id=sponsors.id");
$sponsorship=mysql_fetch_object($q);
$formaction="sponsorshipedit";
}
@@ -55,7 +55,7 @@ function typechange() {
echo "