diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php
index 649a208..0faf7a7 100644
--- a/admin/fundraising_campaigns.php
+++ b/admin/fundraising_campaigns.php
@@ -211,8 +211,98 @@ switch($_GET['action']){
case "manage_tab_prospects":
+ $donationhistorylist=array("never"=>"Never donated/sponsored", "past"=>"Donated/sponsored in the past", "lastyear"=>"Donated/sponsored last year", "thisyear"=>"Donated/sponosred this year");
+ $emailaddresslist=array("available"=>"Available", "notavaialble"=>"Not Available");
+
+ $rolelist=array(
+ "judge"=>"Judge",
+ "teacher"=>"Teacher",
+ "sciencehead"=>"School Science Head",
+ "principal"=>"School Principal",
+ "parent"=>"Parent",
+ "committee"=>"Committee",
+ "volunteer"=>"Volunteer",
+ "alumni"=>"Alumni (not implemented)",
+ "mentor"=>"Mentor (not implemented)",
+ );
$campaign_id=intval($_GET['id']);
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'");
+ $campaign=mysql_fetch_object($q);
+ if($campaign->filterparameters) {
+ echo "
".i18n("User List")."
\n";
+ $params=unserialize($campaign->filterparameters);
+ echo "";
+ echo "".i18n("Donor Type")." | ".i18n(ucfirst($params['donortype']))." |
\n";
+ if(is_array($params['donationhistory'])) {
+ echo "".i18n("Donation History")." | ";
+ foreach($params['donationhistory'] AS $d) {
+ echo i18n($donationhistorylist[$d])." \n";
+ }
+ echo " |
\n";
+ }
+// echo "".i18n("Donation Level")." | ";
+// echo " |
\n";
+ if(is_array($params['emailaddress'])) {
+ echo "".i18n("Email Address")." | ";
+ foreach($params['emailaddress'] AS $e) {
+ echo i18n($emailaddresslist[$e])." \n";
+ }
+ echo " |
\n";
+ }
+ if($params['donortype']=="individual" && is_array($params['individual_type'])) {
+ echo "".i18n("Role")." | ";
+ foreach($params['individual_type'] AS $e) {
+ echo i18n($rolelist[$e])." \n";
+ }
+ echo " |
\n";
+ } else if( is_array($params['contacttype'])) {
+ echo "".i18n("Role")." | ";
+ foreach($params['contacttype'] AS $e) {
+ echo i18n(ucfirst($e))." ";
+ }
+ echo " |
\n";
+ }
+
+ echo "
\n";
+ //params: individual/org
+ // donation history
+ // donation level
+ // email address
+ // role ind
+ // role org
+
+ echo "
";
+ echo "
+ }
exit;
break;
@@ -290,6 +382,33 @@ switch($_GET['action']){
exit;
break;
+ case "prospect_removeselected":
+ $campaignid=intval($_POST['fundraising_campaigns_id']);
+ print_r($_POST);
+ if(is_array($_POST['prospectremovefromlist'])) {
+ $uidlist=implode(",",$_POST['prospectremovefromlist']);
+ $query="DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid' AND users_uid IN ($uidlist)";
+ mysql_query($query);
+ echo mysql_error();
+ }
+ //if theres nobody left in the list we need to reset the filter params as well
+ $q=mysql_query("SELECT COUNT(*) AS num FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid'");
+ $r=mysql_fetch_object($q);
+ if($r->num==0) {
+ mysql_query("UPDATE fundraising_campaigns SET filterparameters=NULL WHERE id='$campaignid'");
+ }
+
+ happy_("Selected users removed from list");
+ exit;
+ break;
+
+ case "prospect_removeall":
+ $campaignid=intval($_POST['fundraising_campaigns_id']);
+ mysql_query("DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid'");
+ mysql_query("UPDATE fundraising_campaigns SET filterparameters=NULL WHERE id='$campaignid'");
+ happy_("All users removed from list");
+ exit;
+ break;
}
@@ -442,7 +561,23 @@ function prospect_search() {
}
function prospect_generatelist() {
- $("#prospectsearchresults").load("fundraising_campaigns_prospecting.php?generatelist=true",$("#prospectform").serializeArray());
+ $("#prospectsearchresults").load("fundraising_campaigns_prospecting.php?generatelist=true",$("#prospectform").serializeArray(), function() {
+ update_tab_prospects();
+ });
+ return false;
+}
+
+function prospect_removeselected() {
+ $("#debug").load("fundraising_campaigns.php?action=prospect_removeselected",$("#prospectremoveform").serializeArray(),function() {
+ update_tab_prospects();
+ });
+ return false;
+}
+
+function prospect_removeall() {
+ $("#debug").load("fundraising_campaigns.php?action=prospect_removeall",$("#prospectremoveform").serializeArray(),function() {
+ update_tab_prospects();
+ });
return false;
}
diff --git a/admin/fundraising_campaigns_prospecting.php b/admin/fundraising_campaigns_prospecting.php
index 6cfd6c9..fabf027 100644
--- a/admin/fundraising_campaigns_prospecting.php
+++ b/admin/fundraising_campaigns_prospecting.php
@@ -61,8 +61,8 @@ if($_POST['donortype']=="organization") {
echo mysql_error();
while($cr=mysql_fetch_object($cq)) {
- if(!$userslist[$cr->users_id])
- $userslist[$cr->users_id]=user_load($cr->users_id);
+ if(!$userslist[$cr->uid])
+ $userslist[$cr->uid]=user_load($cr->users_id);
}
}
}
diff --git a/theme/default/sfiab.css b/theme/default/sfiab.css
index b3da046..0302ea4 100644
--- a/theme/default/sfiab.css
+++ b/theme/default/sfiab.css
@@ -354,7 +354,7 @@ div.notice_area div.happy {
}
.date {
- width: 80px;
+ width: 100px;
}
diff --git a/user.inc.php b/user.inc.php
index 55fa268..dd618c8 100644
--- a/user.inc.php
+++ b/user.inc.php
@@ -125,11 +125,15 @@ function user_load_volunteer(&$u)
return true;
}
-function user_load_sponsor($u)
+function user_load_sponsor(&$u)
{
$u['sponsors_id'] = intval($u['sponsors_id']);
$u['sponsor_complete'] = ($u['sponsor_complete'] == 'yes') ? 'yes' : 'no';
$u['sponsor_active'] = ($u['sponsor_active'] == 'yes') ? 'yes' : 'no';
+ if($u['sponsors_id']) {
+ $q=mysql_query("SELECT * FROM sponsors WHERE id='{$u['sponsors_id']}'");
+ $u['sponsor']=mysql_fetch_assoc($q);
+ }
return true;
}