when viewing sub-entries (action=sp) partents are displayed immediatly before first occurence of a child, for a single parent, always display it as first entry (linked entries to parent could get sorted in front)

This commit is contained in:
Ralf Becker 2013-06-06 13:15:02 +00:00
parent 14b9b8ca51
commit 914e70a1b4

View File

@ -395,6 +395,8 @@ class infolog_ui
// Check to see if we need to remove description
$et = new ReflectionClass('etemplate');
$is_et2 = ($et->isSubclassOf(new ReflectionClass('etemplate_widget')));
$parent_first = count($parents) == 1;
$parent_index = 0;
foreach($infos as $id => $info)
{
if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']);
@ -411,7 +413,8 @@ class infolog_ui
}
}
// for subs view ('sp') add parent(s) in front of subs once(!)
if ($parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false &&
if ($parent_first && ($main = $this->bo->read($query['action_id'])) ||
$parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false &&
($main = $this->bo->read($info['info_id_parent'])))
{
$main = $this->get_info($main, $readonlys);
@ -432,6 +435,7 @@ class infolog_ui
}
}
}
$parent_first = false;
array_splice($rows, $id, 0, array($main));
unset($parents[$parent_index]);
// et2 nextmatch listens to total, and only displays that many rows