diff --git a/admin/donors.php b/admin/donors.php
index 1d2c776..048e9da 100644
--- a/admin/donors.php
+++ b/admin/donors.php
@@ -43,10 +43,14 @@ switch($_GET['action']) {
$q=mysql_query("INSERT INTO sponsors (year) VALUES ('".$config['FAIRYEAR']."')");
$id=mysql_insert_id();
echo json_encode(array("id"=>$id));
+ save_activityinfo("Created donor/sponsor", $id, $_SESSION['users_uid'],"System");
+ $createnew=true;
}
+ else $createnew=false;
if($id) {
$exec="UPDATE sponsors SET ".
+ "donortype='".mysql_escape_string(stripslashes($_POST['donortype']))."', ".
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
"address='".mysql_escape_string(stripslashes($_POST['address']))."', ".
"address2='".mysql_escape_string(stripslashes($_POST['address2']))."', ".
@@ -61,16 +65,17 @@ switch($_GET['action']) {
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
"donationpolicyurl='".mysql_escape_string(stripslashes($_POST['donationpolicyurl']))."', ".
"fundingselectiondate='".mysql_escape_string(stripslashes($_POST['fundingselectiondate']))."', ".
- "waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."', ".
- "taxreceiptrequired='".mysql_escape_string(stripslashes($_POST['taxreceiptrequired']))."' ".
+ "waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."' ".
"WHERE id='$id'";
mysql_query($exec);
//FIXME accept the logo
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
//($comment , $donorId, $userId, $type, $campaign_id=null){
- save_activityinfo("Updated donor/sponsor details", $id, $_SESSION['users_uid'],"System");
- happy_("Donor/Sponsor Details saved");
+ if(!$createnew) {
+ save_activityinfo("Updated donor/sponsor details", $id, $_SESSION['users_uid'],"System");
+ happy_("Donor/Sponsor Details saved");
+ }
}
exit;
break;
@@ -319,7 +324,7 @@ function delete_contact(){
$data = mysql_query("SELECT CONCAT_WS(' ', users.firstname, users.lastname) AS name FROM users WHERE id=" . $uid);
$namedata = mysql_fetch_array($data);
$name = trim($namedata['name']);
- user_delete($uid);
+ user_delete($uid,"sponsor");
happy_("Deleted contact %1", array($name));
//($comment , $donorId, $userId, $type, $campaign_id=null){
@@ -332,12 +337,13 @@ function addexisting_contact() {
$sponsors_id=intval($_POST['id']);
echo "Linking uid=$uid to sponsors_id=$sponsors_id
";
- $u=user_load_by_uid($uid);
echo "uid $uid has users.id {$u['id']}";
+ $u=user_load_by_uid($uid);
$u['sponsors_id']=$sponsors_id;
$u['types'][]="sponsor";
user_save($u);
+
save_activityinfo("Existing user (".$u['firstname']." ".$u['lastname'].") linked to donor/sponsor",$sponsors_id,$_SESSION['users_uid'],'System');
happy_("Added existing user to donor/sponsor");
@@ -454,6 +460,7 @@ function draw_contactsinfo_form($contact = null){
$query = mysql_query("SELECT *,MAX(year) FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
WHERE
sponsors_id='" . $sponsor_id . "'
+ AND types LIKE '%sponsor%'
GROUP BY uid
HAVING deleted='no'
ORDER BY users_sponsor.primary DESC,lastname,firstname
@@ -476,6 +483,8 @@ function draw_contactsinfo_form($contact = null){
echo "