function casetracker_comment_changes in Case Tracker 5
Displays the changes a comment has made to the case fields.
Parameters
$case_data: An array of both 'old' and 'new' objects that contains the before and after values this comment has changed.
1 call to casetracker_comment_changes()
- casetracker_comment in ./
casetracker.module - Implementation of hook_comment().
File
- ./
casetracker.module, line 1258 - Enables the handling of projects and their cases.
Code
function casetracker_comment_changes($case_data) {
$rows = array();
if ($case_data['new']->pid != $case_data['old']->pid) {
$old_project_title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $case_data['old']->pid));
$new_project_title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $case_data['new']->pid));
$rows[] = array(
t('Project:'),
$old_project_title . ' ' . t('»') . ' ' . $new_project_title,
);
}
if ($case_data['new']->title != $case_data['old']->title) {
$rows[] = array(
t('Title:'),
$case_data['old']->title . ' ' . t('»') . ' ' . $case_data['new']->title,
);
}
if ($case_data['new']->case_status_id != $case_data['old']->case_status_id) {
$rows[] = array(
t('Status:'),
casetracker_case_state_load('status', $case_data['old']->case_status_id) . ' ' . t('»') . ' ' . casetracker_case_state_load('status', $case_data['new']->case_status_id),
);
}
if ($case_data['new']->assign_to != $case_data['old']->assign_to) {
$rows[] = array(
t('Assigned:'),
casetracker_get_name($case_data['old']->assign_to) . ' ' . t('»') . ' ' . casetracker_get_name($case_data['new']->assign_to),
);
}
if ($case_data['new']->case_priority_id != $case_data['old']->case_priority_id) {
$rows[] = array(
t('Priority:'),
casetracker_case_state_load('priority', $case_data['old']->case_priority_id) . ' ' . t('»') . ' ' . casetracker_case_state_load('priority', $case_data['new']->case_priority_id),
);
}
if ($case_data['new']->case_type_id != $case_data['old']->case_type_id) {
$rows[] = array(
t('Type:'),
casetracker_case_state_load('type', $case_data['old']->case_type_id) . ' ' . t('»') . ' ' . casetracker_case_state_load('type', $case_data['new']->case_type_id),
);
}
if (!empty($rows)) {
return theme('table', NULL, $rows, array(
'class' => 'case_changes',
));
}
return '';
}