Commit 24407640 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1500215: Loop through artefact ancestors in correct order



Go from child to parent to grandparent etc.

behatnotneeded

Change-Id: If30d63483f33a50888a590875ddd979d6900c613
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent edf36355
......@@ -38,7 +38,7 @@ if (!$artefact->in_view_list()) {
// Build the path to the artefact through its parents.
$artefactpath = array();
$ancestors = $artefact->get_item_ancestors();
$ancestors = array_reverse($artefact->get_item_ancestors());
$artefactok = false;
if (artefact_in_view($artefact, $viewid)) {
......@@ -48,6 +48,7 @@ if (artefact_in_view($artefact, $viewid)) {
if (!empty($ancestors)) {
foreach ($ancestors as $ancestor) {
if ($ancestor != $artefactid) {
$pathitem = artefact_instance_from_id($ancestor);
if (artefact_in_view($pathitem, $viewid)) {
$artefactpath[] = array(
......@@ -58,6 +59,7 @@ if (!empty($ancestors)) {
$baseobject = $pathitem;
}
}
}
}
if ($artefactok == false) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment