From 17c3e4a7329598876c0335cbc32ffa0233b88d0b Mon Sep 17 00:00:00 2001 From: james Date: Fri, 18 Sep 2009 15:57:35 +0000 Subject: [PATCH] Start fixing hte sponsor queries, add some debugging so we can see who's in the lists, commit so i can get daves help :) --- admin/communication.inc.php | 36 ++++++++++++++++++++++++++++++++++-- admin/communication.php | 13 +++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/admin/communication.inc.php b/admin/communication.inc.php index 8a9bf3b..40233fa 100644 --- a/admin/communication.inc.php +++ b/admin/communication.inc.php @@ -45,14 +45,46 @@ "participants_complete_allyears"=>array("name"=>"Participants complete all years","query"=> "SELECT DISTINCT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), - "special_award_sponsors_confirmed"=>array("name"=>"Special award sponsors (confirmed only)","query"=> - "SELECT DISTINCT(award_sponsors.id), organization, firstname, lastname, award_contacts.email FROM award_sponsors, award_awards, award_contacts WHERE award_awards.award_sponsors_id=award_sponsors.id AND award_contacts.award_sponsors_id=award_sponsors.id AND award_sponsors.confirmed='yes' AND award_awards.award_types_id='2' AND award_contacts.year='".$config['FAIRYEAR']."'"), + "sponsors"=>array("name"=>"Organization sponsors","query"=> + "SELECT id, organization, email FROM sponsors WHERE email!='' ORDER BY email"), + "sponsors_primarycontacts"=>array("name"=>"Organization sponsors (primary contacts)","query"=> + "SELECT uid, MAX(users.year) AS year, sponsors.organization, users.firstname, users.lastname, users.email, deleted, users_sponsor.primary + FROM sponsors, + users_sponsor, + users + WHERE + users.id=users_sponsor.users_id + AND users_sponsor.sponsors_id=sponsors.id + AND users.types LIKE '%sponsor%' + AND users.email!='' + GROUP BY uid + HAVING deleted='no' AND users_sponsor.primary='yes' + ORDER BY users.email + "), + + "sponsors_allcontacts"=>array("name"=>"Organization sponsors (all contacts)","query"=> + "SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email + FROM sponsors, + users_sponsor, + users + WHERE + users.id=users_sponsor.users_id + AND users_sponsor.sponsors_id=sponsors.id + AND users.types LIKE '%sponsor%' + AND users.deleted='no' + AND users.email!='' + ORDER BY users.email + "), + +/* "special_award_sponsors_unconfirmed"=>array("name"=>"Special award sponsors (unconfirmed only)","query"=> "SELECT DISTINCT(award_sponsors.id), organization, firstname, lastname, award_contacts.email FROM award_sponsors, award_awards, award_contacts WHERE award_awards.award_sponsors_id=award_sponsors.id AND award_contacts.award_sponsors_id=award_sponsors.id AND award_sponsors.confirmed='no' AND award_awards.award_types_id='2' AND award_contacts.year='".$config['FAIRYEAR']."'"), "special_award_sponsors_all"=>array("name"=>"Special award sponsors (all)","query"=> "SELECT DISTINCT(award_sponsors.id), organization, firstname, lastname, award_contacts.email FROM award_sponsors, award_awards, award_contacts WHERE award_awards.award_sponsors_id=award_sponsors.id AND award_contacts.award_sponsors_id=award_sponsors.id AND award_awards.award_types_id='2' AND award_contacts.year='".$config['FAIRYEAR']."'"), + +*/ "school_principals"=>array("name"=>"School principals","query"=> "SELECT school, principal AS firstname, schoolemail AS email FROM schools WHERE schools.year='".$config['FAIRYEAR']."' AND schoolemail!=''"), "school_scienceheads"=>array("name"=>"School science heads","query"=> diff --git a/admin/communication.php b/admin/communication.php index bbcdd20..4e9ce01 100644 --- a/admin/communication.php +++ b/admin/communication.php @@ -115,10 +115,20 @@ echo "To:"; echo ""; @@ -149,6 +159,7 @@ echo ""; echo ""; } + echo $str; } else if($_GET['action']=="reallysend" && $_GET['reallysend'] && $_GET['to']) { @@ -296,6 +307,8 @@ echo ""; } echo ""; + + } send_footer();