Gossamer Forum
Home : Products : DBMan : Customization :

Re: Email notificaion on modify_success

Quote Reply
Re: Email notificaion on modify_success In reply to
No that code I posted printed all fields regardless of whether a field value had changed. I have since used your code and it printed out just the changed field that has the comparison, so many thanks for that. :) BUT......

I then added a second routine for another field and a third and it now sends three emails regardless of what field is changed. So I put it back to just email comparison but it still sends an email if I change a field that is not compared. Here is the code I now have:

if ($auth_user_field >= 0 and (!$per_admin or !$in{$db_cols[$auth_user_field]})) {
$in{$db_cols[$auth_user_field]} = $data[$auth_user_field];
}

# Email support if email is changed
if ($rec{'Email address'} ne $in{'Email address'}) {
open (MAIL, "$mailprog") or &cgierr("unable to open mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: Database Server\n";
print MAIL "Subject: Live Email Record Update at $html_title\n\n";
print MAIL "The record at $html_title was modified by $in{'First name'} $in{'Surname'} .\n\n";
print MAIL "It has been modified to: $in{'Email address'}\n\n";
print MAIL "Userid is: $in{'UserID'}\n\n";
print MAIL "Update was done at: " , scalar localtime(), ".\n";
print MAIL "\n\n";
close MAIL;
}
if ($rec{'Account number'} ne $in{'Account number'}) {
open (MAIL, "$mailprog") or &cgierr("unable to open mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: Database Server\n";
print MAIL "Subject: Live User Bank Record Update at $html_title\n\n";
print MAIL "The record at $html_title was modified by $in{'First name'} $in{'Surname'} .\n\n";
print MAIL "Account Number has been modified to: $in{'Account number'}\n\n";
print MAIL "Sort Code has been modified to: $in{'Bank sortcode'}\n\n";
print MAIL "Account name has been modified to: $in{'Branch account name'}\n\n";
print MAIL "Userid is: $in{'UserID'}\n\n";
print MAIL "Update was done at: " , scalar localtime(), ".\n";
print MAIL "\n\n";
close MAIL;
}
if ($rec{'Home address'} ne $in{'Home address'}) {
open (MAIL, "$mailprog") or &cgierr("unable to open mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: Parasol Database Server\n";
print MAIL "Subject: Live User Address Record Update at $html_title\n\n";
print MAIL "The record at $html_title was modified by $in{'First name'} $in{'Surname'} .\n\n";
print MAIL "Address has been modified to: $in{'Home address'}\n\n";
print MAIL "Post code has been modified to: $in{'Home postcode'}\n\n";
print MAIL "Userid is: $in{'UserID'}\n\n";
print MAIL "Update was done at: " , scalar localtime(), ".\n";
print MAIL "\n\n";
close MAIL;
}


$output .= &join_encode(%in);
$found = 1;
}
Subject Author Views Date
Thread Email notificaion on modify_success rcrossland 5287 May 29, 2001, 12:30 PM
Thread Re: Email notificaion on modify_success
LoisC 5157 May 30, 2001, 10:08 PM
Thread Re: Email notificaion on modify_success
rcrossland 5198 Jun 1, 2001, 4:43 AM
Thread Re: Email notificaion on modify_success
vampy 5282 Jun 1, 2001, 8:57 AM
Thread Re: Email notificaion on modify_success
Paul 5231 Jun 1, 2001, 9:11 AM
Thread Re: Email notificaion on modify_success
vampy 5174 Jun 1, 2001, 9:17 AM
Thread Re: Email notificaion on modify_success
Paul 5233 Jun 1, 2001, 9:20 AM
Post Re: Email notificaion on modify_success
vampy 5184 Jun 1, 2001, 10:01 AM
Thread Re: Email notificaion on modify_success
rcrossland 5139 Jun 4, 2001, 1:11 PM
Thread Re: Email notificaion on modify_success
vampy 5131 Jun 5, 2001, 1:49 AM
Thread Re: Email notificaion on modify_success
rcrossland 5114 Jun 7, 2001, 5:15 AM
Thread Re: Email notificaion on modify_success
vampy 5139 Jun 7, 2001, 9:38 AM
Thread Re: Email notificaion on modify_success
rcrossland 5088 Jun 7, 2001, 12:58 PM
Thread Re: Email notificaion on modify_success
vampy 5088 Jun 10, 2001, 11:34 PM
Thread Re: Email notificaion on modify_success
rcrossland 5086 Jun 11, 2001, 4:51 AM
Post Re: Email notificaion on modify_success
vampy 5055 Jun 12, 2001, 11:43 PM