Updated the activity log tab. Now in working order.

This commit is contained in:
jacob 2009-10-06 14:44:27 +00:00
parent e3633a3cf4
commit 1da21bea9e

View File

@ -131,15 +131,12 @@ function save_contact(){
$successMessage = i18n("Contact created successfully");
$u = user_create("sponsor", $_POST['email']);
$id = $u['id'];
}else if($_POST['recordtype'] == 'existing'){
// this is an existing record being updated. Load the user.
$successMessage = i18n("Contact updated successfully");
$u = user_load($_POST['userid']);
$id = intval($_POST['userid']);
}
$sponsor_id = $_POST['sponsor_id'];
@ -331,7 +328,7 @@ function draw_activityinfo_form(){
</tr></thead>
<tbody>
<?php
$query = "SELECT (users.firstname && \" \" && users.lastname) AS name, fdl.dt, fdl.log
$query = "SELECT CONCAT_WS('&nbsp;', users.firstname, users.lastname) AS name, fdl.dt, fdl.log
FROM fundraising_donor_logs AS fdl
JOIN users ON fdl.users_id=users.id
WHERE sponsors_id=" . $sponsorid;
@ -340,9 +337,9 @@ function draw_activityinfo_form(){
$row = mysql_fetch_array($results);
if($row){
do{
echo "<tr><td>" . $results["dt"];
echo "<tr><td>" . $results["name"];
echo "</td><td>" . $results["log"];
echo "<tr><td>" . $row["dt"];
echo "</td><td>" . $row["name"];
echo "</td><td>" . $row["log"];
echo "</td></tr>\n";
}while($row = mysql_fetch_array($results));
}else{
@ -359,12 +356,15 @@ function draw_activityinfo_form(){
<?php
}
// Save the activity info that was submitted
function save_activityinfo(){
happy_("foo!");
$query = "INSERT INTO fundraising_donor_logs (sponsors_id, dt, users_id, log)";
$query .= "VALUES (" . $_GET['id'] . ", NOW())";
echo $query;
$query .= "VALUES (" . $_GET['id'] . ",NOW(), " . $_SESSION['users_id'] . ",'" . $_POST['comment'] . "')";
if(mysql_query($query)){
happy_(i18n("Note Added"));
}else{
error_(i18n("Error Inserting Record"));
}
}
@ -540,7 +540,10 @@ function update_activityinfo()
function activityinfo_save() {
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save&id="+id, $("#activityinfo").serializeArray());
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=activityinfo_save&id="+id, $("#activityinfo").serializeArray(),
function(){
update_activityinfo();
});
return false;
}