Skip to content

Commit

Permalink
Notifications for new solutions; fixes #4266 (#4272)
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Jul 2, 2018
1 parent 49403a1 commit 67b60f9
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions inc/notificationtargetcommonitilobject.class.php
Expand Up @@ -989,15 +989,31 @@ function getDataForObject(CommonDBTM $item, array $options, $simple = false) {
$data["##$objettype.assigntogroups##"] = implode(', ', $groups);
}

$data["##$objettype.solution.type##"]='';
if ($item->getField('solutiontypes_id')) {
$data["##$objettype.solution.type##"]
= Dropdown::getDropdownName('glpi_solutiontypes',
$item->getField('solutiontypes_id'));
}
$data["##$objettype.solution.type##"] = '';
$data["##$objettype.solution.description##"] = '';

$itilsolution = new ITILSolution();
$solution = $itilsolution->getFromDBByRequest([
'WHERE' => [
'itemtype' => $objettype,
'items_id' => $item->fields['id']
],
'ORDER' => 'date_creation DESC',
'LIMIT' => 1
]);

if ($solution) {
if ($itilsolution->getField('solutiontypes_id')) {
$data["##$objettype.solution.type##"] = Dropdown::getDropdownName(
'glpi_solutiontypes',
$itilsolution->getField('solutiontypes_id')
);
}

$data["##$objettype.solution.description##"]
= Toolbox::unclean_cross_side_scripting_deep($item->getField('solution'));
$data["##$objettype.solution.description##"] = Toolbox::unclean_cross_side_scripting_deep(
$itilsolution->getField('content')
);
}

// Complex mode
if (!$simple) {
Expand Down

0 comments on commit 67b60f9

Please sign in to comment.