implemented activity logging in a few spots

This commit is contained in:
jacob 2009-10-06 16:22:41 +00:00
parent 0283036dc2
commit 6396ca85f3

View File

@ -65,7 +65,7 @@ switch($_GET['action']) {
//FIXME accept the logo //FIXME accept the logo
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ". //"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
save_activityinfo("Updated organization info for " . mysql_escape_string(stripslashes($_POST['organization'])), $id);
} }
exit; exit;
break; break;
@ -101,9 +101,9 @@ switch($_GET['action']) {
break; break;
case 'activityinfo_save': case 'activityinfo_save':
if(save_activityinfo()){ if(save_activityinfo()){
happy_(i18n("Activity Logged")); happy_("Activity Logged");
}else{ }else{
error_(i18n("Unable to save activity log")); error_("Unable to save activity log");
} }
exit; exit;
break; break;
@ -119,8 +119,13 @@ send_header("Donor/Sponsor Management",
function delete_contact(){ function delete_contact(){
if(array_key_exists('userid', $_POST)){ if(array_key_exists('userid', $_POST)){
$uid = $_POST['userid']; $uid = $_POST['userid'];
$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);
happy_("User with ID #" . $uid . " deleted"); happy_("Deleted contact %1", array($name));
save_activityinfo("Deleted contact \"" . $name . "\"");
} }
} }
@ -133,11 +138,13 @@ function save_contact(){
if($_POST['recordtype'] == 'new'){ if($_POST['recordtype'] == 'new'){
// this is a new record being submitted. Create the user. // this is a new record being submitted. Create the user.
$successMessage = i18n("Contact created successfully"); $successMessage = i18n("Contact created successfully");
$successLog = "Added contact ";
$u = user_create("sponsor", $_POST['email']); $u = user_create("sponsor", $_POST['email']);
$id = $u['id']; $id = $u['id'];
}else if($_POST['recordtype'] == 'existing'){ }else if($_POST['recordtype'] == 'existing'){
// this is an existing record being updated. Load the user. // this is an existing record being updated. Load the user.
$successMessage = i18n("Contact updated successfully"); $successMessage = i18n("Contact updated successfully");
$successLog = "Updated contact ";
$u = user_load($_POST['userid']); $u = user_load($_POST['userid']);
$id = intval($_POST['userid']); $id = intval($_POST['userid']);
@ -181,7 +188,8 @@ function save_contact(){
$u['notes']=$_POST['notes']; $u['notes']=$_POST['notes'];
$u['sponsors_id']=$sponsor_id; $u['sponsors_id']=$sponsor_id;
user_save($u); user_save($u);
$name = trim($u['firstname'] . ' ' . $u['lastname']);
save_activityinfo($successLog . '"' . $name . '"');
happy_($successMessage); happy_($successMessage);
}else{ }else{
// something's wrong with the user data submitted. Should flag the fields where // something's wrong with the user data submitted. Should flag the fields where