$focus['showreport'] = 'focus';
require_once('./global.php');
+require_once('./includes/api_user.php');
$bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
if (!$bug)
$message->error_permission();
}
+$lookupfields = array(
+ 'status' => 'status',
+ 'priority' => 'priority',
+ 'secerity' => 'severity',
+ 'resolution' => 'resolution',
+ 'versionid' => 'version',
+ 'version' => 'version',
+ 'productid' => 'product',
+ 'componentid' => 'product'
+);
+$lookupkeys = array_keys($lookupfields);
+
// ###################################################################
$customfields = $db->query("
while ($field = $db->fetch_array($customfields))
{
- $fieldlist["custom_field$field[fieldid]"] = 'custom_field' . $field['fieldid'] . " (\"$field[name]\")";
+ $fieldlist["custom.field$field[fieldid]"] = sprintf($lang->string('Custom Field %1$s (%2$s)'), $field['fieldid'], $field['name']);
}
// ###################################################################
+$logs = array();
$logs_fetch = $db->query("
SELECT history.*, user.userid, user.email, user.displayname, user.showemail
FROM " . TABLE_PREFIX . "history AS history
foreach ($logitems AS $log)
{
+ if ($log['field'] == '.' OR ($log['original'] == '' AND $log['changed'] == ''))
+ {
+ continue;
+ }
+
$funct->exec_swap_bg('', $stylevar['alt_colour']);
$bgcolour = $funct->bgcolour;
- if ($newlog = $fieldlist["$log[field]"])
+ if (preg_match('#^(comment|attachment)\.(.*)#', $log['field'], $matches))
+ {
+ if ($matches[1] == 'comment')
+ {
+ $log['field'] = sprintf($lang->string('Comment #%1$s %2$s'), $log['commentid'], ucwords($matches[2]));
+ }
+ else if ($matches[1] == 'attachment')
+ {
+ $log['field'] = sprintf($lang->string('Attachment #2%1$s %2$s'), $log['attachmentid'], ucwords($matches[2]));
+ }
+ }
+ else if (preg_match('#^custom.field([0-9]+?)#', $log['field'], $matches))
+ {
+ if ($fieldlist["$log[field]"])
+ {
+ $log['field'] = $fieldlist["$log[field]"];
+ }
+ }
+ else if (preg_match('#^\.(.*)#', $log['field'], $matches))
{
- $log['field'] = $newlog;
+ $log['field'] = ucwords($matches[1]);
+
+ if (in_array($matches[1], $lookupkeys))
+ {
+ $log['original'] = $bugsys->datastore[ $lookupfields["$matches[1]"] ]["$log[original]"]["$matches[1]"];
+ $log['changed'] = $bugsys->datastore[ $lookupfields["$matches[1]"] ]["$log[changed]"]["$matches[1]"];
+ }
+ else if ($matches[1] == 'assignto' OR $matches[1] == 'assignedto')
+ {
+ $user = new UserAPI($bugsys);
+ $user->set('userid', $log['original']);
+ $user->set_condition();
+ $user->fetch();
+ $log['original'] = construct_user_display($user->objdata);
+
+ $user = new UserAPI($bugsys);
+ $user->set('userid', $log['changed']);
+ $user->set_condition();
+ $user->fetch();
+ $log['changed'] = construct_user_display($user->objdata);
+ }
}
eval('$history .= "' . $template->fetch('history_bit') . '";');