diff --git a/inc/commonglpi.class.php b/inc/commonglpi.class.php index f9baa80e0f8..45ff3e68838 100644 --- a/inc/commonglpi.class.php +++ b/inc/commonglpi.class.php @@ -441,7 +441,7 @@ static function displayStandardTab(CommonGLPI $item, $tab, $withtemplate=0, $opt foreach ($ong as $key => $val) { if ($key != 'empty') { echo "
$val
"; - self::displayStandardTab($item, $key, $withtemplate); + self::displayStandardTab($item, $key, $withtemplate, $options); } } } @@ -459,14 +459,24 @@ static function displayStandardTab(CommonGLPI $item, $tab, $withtemplate=0, $opt if (isset($data[1])) { $tabnum = $data[1]; } + + $options['withtemplate'] = $withtemplate; + if ($tabnum == 'main') { - $options['withtemplate'] = $withtemplate; - return $item->showForm($item->getID(), $options); + Plugin::doHook('pre_show_item', array('item' => $item, 'options' => &$options)); + $ret = $item->showForm($item->getID(), $options); + Plugin::doHook('post_show_item', array('item' => $item, 'options' => $options)); + return $ret; } if (!is_integer($itemtype) && ($itemtype != 'empty') && ($obj = getItemForItemtype($itemtype))) { - return $obj->displayTabContentForItem($item, $tabnum, $withtemplate); + $options['tabnum'] = $tabnum; + $options['itemtype'] = $itemtype; + Plugin::doHook('pre_show_tab', array( 'item' => $item, 'options' => &$options)); + $ret = $obj->displayTabContentForItem($item, $tabnum, $withtemplate); + Plugin::doHook('post_show_tab', array('item' => $item, 'options' => $options)); + return $ret; } break; } @@ -612,7 +622,9 @@ function showPrimaryForm($options=array()) { } echo "
"; echo "
"; + Plugin::doHook('pre_show_item', array('item' => $this, 'options' => &$options)); $this->showForm($options['id'], $options); + Plugin::doHook('post_show_item', array('item' => $this, 'options' => $options)); echo "
"; echo "
"; } diff --git a/inc/commonitiltask.class.php b/inc/commonitiltask.class.php index dd0dd932549..68378904bb1 100644 --- a/inc/commonitiltask.class.php +++ b/inc/commonitiltask.class.php @@ -1543,7 +1543,12 @@ function showSummary(CommonITILObject $item) { while ($data = $DB->fetch_assoc($result)) { if ($this->getFromDB($data['id'])) { + $options = array( 'parent' => $item, + 'rand' => $rand, + 'showprivate' => $showprivate ) ; + Plugin::doHook('pre_show_item', array('item' => $this, 'options' => &$options)); $this->showInObjectSumnary($item, $rand, $showprivate); + Plugin::doHook('post_show_item', array('item' => $this, 'options' => $options)); } } echo $header; diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 876dcce687a..a990fa71526 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -6281,7 +6281,14 @@ function showTimeline($rand) { $timeline_index = 0; foreach ($timeline as $item) { - $item_i = $item['item']; + $options = array( 'parent' => $this, + 'rand' => $rand + ) ; + $obj = new $item['type'] ; + $obj->fields = $item['item'] ; + Plugin::doHook('pre_show_item', array('item' => $obj, 'options' => &$options)); + + $item_i = $obj->fields; $date = ""; if (isset($item_i['date'])) { @@ -6480,6 +6487,9 @@ function showTimeline($rand) { echo ""; //end h_info $timeline_index++; + + Plugin::doHook('post_show_item', array('item' => $obj, 'options' => $options)); + } // end foreach timeline echo "
"; diff --git a/inc/ticketfollowup.class.php b/inc/ticketfollowup.class.php index 5f725821a4f..893402d60ae 100644 --- a/inc/ticketfollowup.class.php +++ b/inc/ticketfollowup.class.php @@ -910,6 +910,12 @@ function showSummary($ticket) { while ($data = $DB->fetch_assoc($result)) { $this->getFromDB($data['id']); + $options = array( 'parent' => $ticket, + 'rand' => $rand + ); + Plugin::doHook('pre_show_item', array('item' => $this, 'options' => &$options)); + $data = array_merge( $data, $this->fields ); + $candelete = $this->canPurge() && $this->canPurgeItem(); $canedit = $this->canUpdate() && $this->canUpdateItem(); @@ -1004,6 +1010,7 @@ function showSummary($ticket) { echo "};"; echo "\n"; } + Plugin::doHook('post_show_item', array('item' => $this, 'options' => $options)); } } }