Skip to content

Commit

Permalink
Update history #2233 (#2234)
Browse files Browse the repository at this point in the history
  • Loading branch information
yllen authored and trasher committed Jun 6, 2017
1 parent 8f94d60 commit bcc3226
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions inc/log.class.php
Expand Up @@ -481,6 +481,35 @@ static function getHistoryData(CommonDBTM $item, $start=0, $limit=0, $sqlfilter=
}
$tmp['change'] = sprintf(__('%1$s: %2$s'), __('Add a link with an item'),
$data["new_value"]);

if ($data['itemtype'] == 'Ticket') {
if ($data['itemtype_link'] == 'Group') {
$itemtick = new Group_Ticket();
} else if ($data['itemtype_link'] == 'User') {
$itemtick = new Ticket_User();
} else if ($data['itemtype_link'] == 'Supplier') {
$itemtick = new Supplier_Ticket();
}
$table = $itemtick->getTable();
$key = getForeignKeyFieldForItemType($data['itemtype']);
$itemkey = getForeignKeyFieldForItemType($data['itemtype_link']);
$iditem = trim(substr($data['new_value'], strrpos($data['new_value'], '(')+1,
strrpos($data['new_value'], ')')),')');

foreach($DB->request($table, array($key => $data['items_id'],
$itemkey => $iditem)) as $datalink) {
if ($datalink['type'] == CommonITILActor::REQUESTER) {
$as = __('Requester');
} else if ($datalink['type'] == CommonITILActor::ASSIGN) {
$as = __('Assigned to');
} else if ($datalink['type'] == CommonITILActor::OBSERVER) {
$as = __('Watcher');
}
$tmp['change'] = sprintf(__('%1$s: %2$s'), __('Add a link with an item'),
sprintf(__('%1$s (%2$s)'), $data["new_value"],
$as));
}
}
break;

case self::HISTORY_UPDATE_RELATION :
Expand Down Expand Up @@ -678,3 +707,4 @@ function getRights($interface='central') {
}

}

0 comments on commit bcc3226

Please sign in to comment.