Skip to content

Commit

Permalink
To fix #801 (#806)
Browse files Browse the repository at this point in the history
* To fix #801

Added a test to be sure that we are going to view an existing class.
When not viewing a class, then will pass an array to the show_item hooks.

* Simplified code
Added '&' to permit modification of passed parameter to hooks
  • Loading branch information
tomolimo authored and orthagh committed Jul 18, 2016
1 parent 00749ab commit c39f6a3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions inc/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -6288,11 +6288,18 @@ function showTimeline($rand) {
$options = array( 'parent' => $this,
'rand' => $rand
) ;
$obj = new $item['type'] ;
$obj->fields = $item['item'] ;
Plugin::doHook('pre_show_item', array('item' => $obj, 'options' => &$options));
if( $obj = getItemForItemtype($item['type']) ){
$obj->fields = $item['item'] ;
} else {
$obj = $item ;
}
Plugin::doHook('pre_show_item', array('item' => &$obj, 'options' => &$options));

$item_i = $obj->fields;
if( is_array( $obj ) ){
$item_i = $obj['item'];
} else {
$item_i = $obj->fields;
}

$date = "";
if (isset($item_i['date'])) {
Expand Down

0 comments on commit c39f6a3

Please sign in to comment.