function _salesforce_log_user in Salesforce Suite 5
handle logging of user errors
3 calls to _salesforce_log_user()
- salesforce_contact in includes/
salesforce_api.inc - handle contacts in salesforce
- salesforce_event in includes/
salesforce_api.inc - handle events (history) in salesforce
- salesforce_lead in includes/
salesforce_api.inc - handle leads in salesforce
File
- ./
salesforce.module, line 560 - Original Creator, Maintainer & Developer: Steve McKenzie (http://drupal.org/user/45890) Drupal and Salesforce.com (mainly only working with contacts / leads but can be extended to do anything the salesforce API version 6 can do) Current…
Code
function _salesforce_log_user($type, $message = NULL, $account = NULL, $status = 1, $data = NULL) {
$account = _salesforce_select_account($account);
if (!$message) {
$message = t('the connection to salesforce was probably lost');
}
$sql = "SELECT type_id FROM {salesforce_log} WHERE type_id = %d AND type = '%s'";
/*
if ($data) {
$sql .= " AND data = '%s'";
}
*/
$result = db_query($sql, $account->uid, $type, $data);
if ((int) db_num_rows($result) == 0) {
$cols = array(
'type',
'type_id',
'message',
'status',
);
$keys = array(
"'%s'",
"'%s'",
"'%s'",
'%d',
);
/*
if ($data) {
$cols[] = 'data';
$keys[] = "'%s'";
}
*/
db_query("INSERT INTO {salesforce_log} (" . implode(', ', $cols) . ") VALUES (" . implode(', ', $keys) . ")", $type, $account->uid, $message, $status, $data);
watchdog('salesforce', t('%message - for the user %user', array(
'%message' => $message,
'%account' => $account,
)));
}
}