From 88c6d9a0dd6ba02eb5817153ea4671fdc2016fa2 Mon Sep 17 00:00:00 2001 From: jacob Date: Wed, 3 Nov 2010 20:59:03 +0000 Subject: [PATCH] Further updates in migrating to conference id --- admin/donations.php | 175 ----------------------------- admin/donors.php | 47 ++++---- admin/fundraising_main.inc.php | 88 --------------- admin/fundraising_setup.php | 6 +- admin/fundraising_sponsorship.php | 153 ------------------------- register_participants.php | 4 +- register_participants_mentor.php | 4 +- register_participants_students.php | 6 +- register_participants_tours.php | 4 +- 9 files changed, 37 insertions(+), 450 deletions(-) delete mode 100644 admin/donations.php delete mode 100644 admin/fundraising_main.inc.php delete mode 100644 admin/fundraising_sponsorship.php diff --git a/admin/donations.php b/admin/donations.php deleted file mode 100644 index 9521aaa..0000000 --- a/admin/donations.php +++ /dev/null @@ -1,175 +0,0 @@ - - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ -?> - 'committee_main.php', - 'Administration' => 'admin/index.php', - 'Fundraising' => 'admin/fundraising.php'), - "fundraising" - ); - -?> - -type','".mysql_real_escape_string($r->name)."','".mysql_real_escape_string($r->description)."','$r->system','$r->goal','".$config['FAIRYEAR']."')"); - } - } - -echo "
"; -echo "
"; - - echo "
\n"; - echo "
\n"; - echo "Manage Donation Levels\n"; - echo "
\n"; - echo "Manage Donors\n"; - echo "
\n"; - -?> -
" id="sponsorship_editor"> -
-
-
-
" id="fund_editor"> -
-
-
- diff --git a/admin/donors.php b/admin/donors.php index 0890039..38e1017 100644 --- a/admin/donors.php +++ b/admin/donors.php @@ -41,7 +41,7 @@ switch($_GET['action']) { case 'organizationinfo_save': $id=intval($_POST['sponsor_id']); if($id==-1) { - $q=mysql_query("INSERT INTO sponsors (year) VALUES ('".$config['FAIRYEAR']."')"); + $q=mysql_query("INSERT INTO sponsors (conferences_id) VALUES ('".$conference['id']."')"); $id=mysql_insert_id(); echo json_encode(array("id"=>$id)); save_activityinfo("Created donor/sponsor", $id, $_SESSION['users_uid'],"System"); @@ -215,7 +215,7 @@ switch($_GET['action']) { echo i18n("Appeal").":"; echo ""; $query = mysql_query( - "SELECT accounts.id as acc_id, users.id as usr_id, users.deleted, MAX(users.year) FROM accounts JOIN users ON" . + "SELECT accounts.id as acc_id, users.id as usr_id, users.deleted, MAX(users.id) FROM accounts JOIN users ON" . " users.accounts_id = accounts.id" . " WHERE users.sponsors_id = '$id'" . " AND types LIKE '%sponsor%'" . @@ -351,7 +351,7 @@ switch($_GET['action']) { case 'newcontactsearch': if($_POST['email']) - $q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'"); + $q=mysql_query("SELECT *, MAX(id) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'"); if($r=mysql_fetch_object($q)) { echo i18n("There is an exact email address match for %1",array($_POST['email'])); @@ -380,7 +380,7 @@ switch($_GET['action']) { if($_POST['email']) $searchstr.=" AND email LIKE '%".$_POST['email']."%'"; - $q=mysql_query("SELECT *,MAX(year) FROM users WHERE $searchstr GROUP BY accounts_id HAVING deleted='no'"); + $q=mysql_query("SELECT *, MAX(id) FROM users WHERE $searchstr GROUP BY accounts_id HAVING deleted='no'"); $num=mysql_num_rows($q); if($num==0) { echo i18n("No existing users match, will create a new user"); @@ -497,7 +497,7 @@ function save_contact(){ if($_POST['recordtype'] == 'new'){ if($_POST['email']) { - $q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'"); + $q=mysql_query("SELECT *,MAX(id) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'"); if(mysql_num_rows($q)) { error_("A user with that email address already exists"); exit; @@ -525,14 +525,16 @@ function save_contact(){ $p = ($_POST['primary']=='yes')?'yes':'no'; if($p == 'no') { /* Make sure this sponsor ($sponsor_id) has a primary */ - $query = "SELECT users_id - FROM users_sponsor, users + $query = "SELECT users.id + FROM users + JOIN user_roles ON users_roles.users_id = users.id + JOIN roles ON roles.id = user_roles.id WHERE - users_sponsor.users_id=users.id - AND sponsors_id='$sponsor_id' - AND `primary`='yes' - AND year='".$config['FAIRYEAR']."' - AND users_id!='$id'"; + roles.type = 'sponsor' + AND users.sponsors_id='$sponsor_id' + AND users.`primary`='yes' + AND users.conferences_id = '{$conference['id']}' + AND users.id != '$id'"; $q = mysql_query($query); if(mysql_num_rows($q) == 0) { /* This has to be the primary since there isn't one already */ @@ -602,17 +604,18 @@ function draw_contactsinfo_form($contact = null){ // start our accordion echo "
\n"; - // loop through each contact and draw a form with their data in it. - - $q = "SELECT * , MAX( year ) - FROM users - WHERE sponsors_id = '" . $sponsor_id . "' - AND TYPES LIKE '%sponsor%' - GROUP BY accounts_id - HAVING deleted = 'no' - ORDER BY `primary` DESC , lastname, firstname"; - $query = mysql_query($q); + $query = mysql_query(" + SELECT *, MAX(conferences_id) + FROM users + JOIN user_roles ON user_roles.users_id = users.id + JOIN roles ON roles.id = user_roles.id + WHERE roles.type = 'sponsor' + AND users.sponsors_id = '" . $sponsor_id . "' + GROUP BY conferences_id + HAVING deleted = 'no' + ORDER BY `primary` DESC , lastname, firstname + "); while($contact = mysql_fetch_array($query)){ // draw a header for this user diff --git a/admin/fundraising_main.inc.php b/admin/fundraising_main.inc.php deleted file mode 100644 index 8b1587e..0000000 --- a/admin/fundraising_main.inc.php +++ /dev/null @@ -1,88 +0,0 @@ -"; - - while($r=mysql_fetch_object($q)) { - echo ""; - echo "id')\" href=\"#\">"; - if($r->system=="no") { - //echo "id\">"; - echo "id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">"; - // echo ""; - } - - echo "\n"; - echo "".i18n($r->name)."\n"; - echo "".format_money($r->budget)."\n"; - echo "\n"; - - if($r->type=="general") - $orsql.="OR fundraising_type IS NULL"; - - $typetotal=0; - $typeprobtotal=0; - $sq=mysql_query(" - 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 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 - "); - echo mysql_error(); - while($sr=mysql_fetch_object($sq)) { - echo "id\" class=\"fundraising{$sr->status}\">"; - echo ""; - echo "id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">"; - echo ""; - echo "id&fundraising_type=$r->type')\">"; - echo "$sr->name\n"; - echo "$sr->status"; - echo ""; - if($sr->status=="pending") { - echo "$sr->probability%"; - echo ""; - echo "".format_money($sr->value).""; - } - else - echo "\n"; - - $probval=$sr->probability/100*$sr->value; - echo "".format_money($probval).""; - echo "\n"; - echo "\n"; - $typeprobtotal+=$probval; - $typetotal+=$sr->value; - } - echo ""; - echo "type')\" href=\"#\">add"; - echo "".i18n("%1 Total",array($r->name),array("Fundraising type total, eg) Award Sponsorship Total"))."\n"; - echo "".format_money($typetotal)."\n"; - echo "".format_money($typeprobtotal)."\n"; - $typediff=$typeprobtotal-$r->goal; - echo "".format_money($typediff)."\n"; - echo "\n"; - - $totalgoal+=$r->goal; - $totaldiff+=$typediff; - echo " \n"; - } - echo ""; - echo "add fund type"; - echo "".i18n("Total Net Position")."".format_money($totaldiff)."\n"; - echo "\n"; - exit; -} - diff --git a/admin/fundraising_setup.php b/admin/fundraising_setup.php index fd267b0..7fb9406 100644 --- a/admin/fundraising_setup.php +++ b/admin/fundraising_setup.php @@ -299,9 +299,9 @@ case "setup_save": $fye=sprintf("%02d-%02d",intval($_POST['fiscalendmonth']),intval($_POST['fiscalendday'])); - mysql_query("UPDATE config SET val='$fye' WHERE var='fiscal_yearend' AND year='{$config['FAIRYEAR']}'"); - mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['registeredcharity'])."' WHERE var='registered_charity' AND year='{$config['FAIRYEAR']}'"); - mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['charitynumber'])."' WHERE var='charity_number' AND year='{$config['FAIRYEAR']}'"); + mysql_query("UPDATE config SET val='$fye' WHERE var='fiscal_yearend' AND conferences_id='{$conference['id']}'"); + mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['registeredcharity'])."' WHERE var='registered_charity' AND conferences_id='{$conference['id']}'"); + mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['charitynumber'])."' WHERE var='charity_number' AND conferences_id='{$conference['id']}'"); happy_("Fundraising module setup saved"); exit; break; diff --git a/admin/fundraising_sponsorship.php b/admin/fundraising_sponsorship.php deleted file mode 100644 index 0cb6a43..0000000 --- a/admin/fundraising_sponsorship.php +++ /dev/null @@ -1,153 +0,0 @@ - - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, version 2. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ -?> - - -"; - echo ""; - echo ""; - echo ""; - - if($formaction=="sponsorshipadd") { - echo ""; - echo "\n"; - - echo ""; - echo ""; - echo "\n"; - - echo ""; - echo "\n"; - - echo ""; - echo "\n"; - echo "\n"; - - echo ""; - echo "\n"; - - echo ""; - echo "\n"; - - echo "
".i18n("Donor Type").""; - echo " ".i18n("Organization"); - echo " "; echo " "; echo " "; - echo " ".i18n("Individual"); - echo "
".i18n("Donor").""; - - $q=mysql_query("SELECT * FROM sponsors ORDER BY organization"); - echo mysql_error(); - echo ""; - echo " ".i18n("Add")."\n"; - echo ""; - - - $q=mysql_query("SELECT users.*, MAX(year) AS year FROM users WHERE (firstname!='' AND lastname!='') GROUP BY uid HAVING deleted='no' ORDER BY lastname,firstname"); - echo mysql_error(); - echo ""; - echo "
".i18n("Donor Type").""; - if($sponsorship->sponsors_id) echo i18n("Organization"); - else echo i18n("Individual"); - echo "
".i18n("Donor").""; - echo $sponsorship->organization; - } - echo "
".i18n("Donation Allocation").""; - $q=mysql_query("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY name"); - echo mysql_error(); - echo "\n"; - echo "
".i18n("Amount")."value\">
".i18n("Status").""; - echo "\n"; - echo "
".i18n("Probability").""; - echo "\n"; - echo "
\n"; - echo "\n"; - -?> diff --git a/register_participants.php b/register_participants.php index 05278d2..abfd5de 100644 --- a/register_participants.php +++ b/register_participants.php @@ -340,9 +340,9 @@ //this will return 1 if its between the dates, 0 otherwise. if($datecheck->datecheck==0) { if($datecheck->datecheckbefore) - echo notice(i18n("Registration for the %1 %2 is not open yet. Registration will open on %3.",array($config['FAIRYEAR'],$config['fairname'],format_datetime($config['dates']['regopen'])),array("fair year","fair name","registration open date"))); + echo notice(i18n("Registration for %1 is not open yet. Registration will open on %2.",array($conference['name'],format_datetime($config['dates']['regopen'])),array("conference name","registration open date"))); else if($datecheck->datecheckafter) { - echo notice(i18n("Registration for the %1 %2 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($config['FAIRYEAR'],$config['fairname']),array("fair year","fair name"))); + echo notice(i18n("Registration for %1 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($conference['name']),array("conference name"))); echo i18n("Please enter your email address to login"); } echo "
"; diff --git a/register_participants_mentor.php b/register_participants_mentor.php index 2c046ea..86402f5 100644 --- a/register_participants_mentor.php +++ b/register_participants_mentor.php @@ -82,7 +82,7 @@ if($_POST['action']=="save") if($_POST['lastname'][$x]) { //INSERT new record - mysql_query("INSERT INTO mentors (registrations_id,firstname,lastname,email,phone,organization,position,description,year) VALUES (". + mysql_query("INSERT INTO mentors (registrations_id,firstname,lastname,email,phone,organization,position,description,conferences_id) VALUES (". "'".$_SESSION['registration_id']."', ". "'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ". @@ -91,7 +91,7 @@ if($_POST['action']=="save") "'".mysql_escape_string(stripslashes($_POST['organization'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['position'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['description'][$x]))."', ". - "'".$config['FAIRYEAR']."')"); + "'".$conference['id']."')"); echo mysql_error(); echo notice(i18n("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x]))); diff --git a/register_participants_students.php b/register_participants_students.php index 9f4e608..3d2859d 100644 --- a/register_participants_students.php +++ b/register_participants_students.php @@ -351,9 +351,9 @@ if($config['participant_student_personal']=="yes") echo "\n"; //the year selector should be based on the min/max ages possible (as set in $config) - // FIXME - this should be converted to use the year in which the conference occurs - $minyearselect = $config['FAIRYEAR'] - $config['maxage']; - $maxyearselect = $config['FAIRYEAR'] - $config['minage']; + $fairYear = substr($config['dates']['fairdate'], 0, 4); + $minyearselect = $fairYear - $config['maxage']; + $maxyearselect = $fairYear - $config['minage']; emit_year_selector("year[$x]",$year,$minyearselect,$maxyearselect); echo "".REQUIREDFIELD."\n"; echo "\n"; diff --git a/register_participants_tours.php b/register_participants_tours.php index 54f5f02..afc5e4c 100644 --- a/register_participants_tours.php +++ b/register_participants_tours.php @@ -116,11 +116,11 @@ echo mysql_error(); if($_POST['action']=="volunteer") { $vname = mysql_escape_string(stripslashes($_POST['vname'])); $vemail = mysql_escape_string(stripslashes($_POST['vemail'])); - mysql_query("INSERT INTO tours_volunteers (registrations_id,name,email,year) VALUES (". + mysql_query("INSERT INTO tours_volunteers (registrations_id,name,email,conferences_id) VALUES (". "'".$_SESSION['registration_id']."', ". "'".$vname."', ". "'".$vemail."', ". - "'".$config['FAIRYEAR']."'); "); + "'".$conference['id']."'); "); echo happy(i18n("Tour volunteer added. They will be contacted soon.")); }