Index: branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php =================================================================== diff -u -r7036 -r7043 --- branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php (.../application.php) (revision 7036) +++ branches/unlabeled/unlabeled-1.166.4/core/kernel/application.php (.../application.php) (revision 7043) @@ -2104,19 +2104,31 @@ } /** - * Returns main prefix for subtable prefix passes + * Returns genealogical main prefix for subtable prefix passes + * OR prefix, that has been found in REQUEST and some how is parent of passed subtable prefix * * @param string $current_prefix * @return string * @access public - * @author Kostja + * @author Kostja / Alex */ function GetTopmostPrefix($current_prefix) { - while ( $parent_prefix = $this->getUnitOption($current_prefix, 'ParentPrefix') ) - { + // 1. get genealogical tree of $current_prefix + $prefixes = Array ($current_prefix); + while ( $parent_prefix = $this->getUnitOption($current_prefix, 'ParentPrefix') ) { $current_prefix = $parent_prefix; + array_unshift($prefixes, $current_prefix); } + + // 2. find what if parent is passed + $passed = explode(',', $this->GetVar('passed')); + foreach ($prefixes as $current_prefix) { + if (in_array($current_prefix, $passed)) { + break; + } + } + return $current_prefix; }