From 10b63cf6452deb4c9587d45d03cbf6abdf08b291 Mon Sep 17 00:00:00 2001 From: tomolimo Date: Mon, 11 Jul 2016 19:26:01 +0200 Subject: [PATCH] Updated to reflect fix https://github.com/glpi-project/glpi/issues/801 Updated to reflect commit https://github.com/tomolimo/glpi/commit/0e2cf1365534ca7a926929215aafec16f5b5e3ba --- inc/showtabitem.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/showtabitem.class.php b/inc/showtabitem.class.php index ac88975..b59e574 100644 --- a/inc/showtabitem.class.php +++ b/inc/showtabitem.class.php @@ -128,6 +128,7 @@ class PluginExampleShowtabitem { * @param array $params is an array like following * array( 'item', 'options') * where 'item' is the object to show (like 'Ticket', 'TicketTask', ...), + * BEWARE that sometimes it can be an array of data and not an object (ex: for solution item) * and 'options' are options like following * if item is a main object like a ticket, change, problem, ... then it contains * array( 'id' ) @@ -140,6 +141,7 @@ class PluginExampleShowtabitem { * Note: you may pass datas to post_show_item using the $param['options'] array */ static function pre_show_item($params) { + if(!is_array($params['item'])) { switch( $params['item']->getType() ) { case 'Ticket': //echo 'test' ; @@ -151,6 +153,9 @@ class PluginExampleShowtabitem { //echo 'test' ; break; } + } else { + // here we are going to view a Solution + } } /** @@ -170,6 +175,7 @@ class PluginExampleShowtabitem { * Note: you may get datas from pre_show_item using the $param['options'] array */ static function post_show_item($params) { + if(!is_array($params['item'])) { switch( $params['item']->getType() ) { case 'Ticket': //echo 'test' ; @@ -181,6 +187,9 @@ class PluginExampleShowtabitem { //echo 'test' ; break; } + } else { + // here we are going to view a Solution + } } -} \ No newline at end of file +}