function workbench_email_save in Workbench Email 7
Same name and namespace in other branches
- 7.3 workbench_email.module \workbench_email_save()
Saves the email into the table.
Parameters
object $transition: The transtion object
int $rid: The role ID
string $subject: The email subject to save
string $message: The email message to save
Return value
db_merge Returns the TRUE or FALSE
3 calls to workbench_email_save()
- workbench_email_features_rebuild in ./
workbench_email.features.inc - Implements COMPONENT_features_rebuild().
- workbench_email_form_submit in ./
workbench_email.admin.inc - Submit function for the form, saves or deletes emails.
- workbench_email_transitions_form_submit in ./
workbench_email.admin.inc - Form submit handler for email transitions.
File
- ./
workbench_email.module, line 439 - Code for the Workbench Email Module.
Code
function workbench_email_save($transition, $rid, $subject = NULL, $message = NULL) {
$query = db_merge('workbench_emails');
$query
->key(array(
'from_name' => $transition->from_name,
'to_name' => $transition->to_name,
'rid' => $rid,
));
$query
->fields(array(
'from_name' => $transition->from_name,
'to_name' => $transition->to_name,
'rid' => $rid,
));
if ($subject) {
$query
->fields(array(
'subject' => $subject,
));
}
if ($message) {
$query
->fields(array(
'message' => $message,
));
}
$query
->execute();
}