mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 00:02:17 +02:00
Fix regression on hierarchical keys
SVN:trunk[1496]
This commit is contained in:
@@ -2440,14 +2440,14 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
|
|||||||
|
|
||||||
// Note: there is no search condition in $oExtFilter, because normalization did merge the condition onto the top of the filter tree
|
// Note: there is no search condition in $oExtFilter, because normalization did merge the condition onto the top of the filter tree
|
||||||
|
|
||||||
if ($iOperatorCode == TREE_OPERATOR_EQUALS)
|
|
||||||
{
|
|
||||||
// Specify expected attributes for the target class query
|
|
||||||
// ... and use the current alias !
|
|
||||||
$aTranslateNow = array(); // Translation for external fields - must be performed before the join is done (recursion...)
|
|
||||||
//echo "MAKEQUERY-array_key_exists($sTableClass, \$aExtKeys)<br/>\n";
|
//echo "MAKEQUERY-array_key_exists($sTableClass, \$aExtKeys)<br/>\n";
|
||||||
if (array_key_exists($sTableClass, $aExtKeys) && array_key_exists($sKeyAttCode, $aExtKeys[$sTableClass]))
|
if (array_key_exists($sTableClass, $aExtKeys) && array_key_exists($sKeyAttCode, $aExtKeys[$sTableClass]))
|
||||||
|
{
|
||||||
|
if ($iOperatorCode == TREE_OPERATOR_EQUALS)
|
||||||
{
|
{
|
||||||
|
// Specify expected attributes for the target class query
|
||||||
|
// ... and use the current alias !
|
||||||
|
$aTranslateNow = array(); // Translation for external fields - must be performed before the join is done (recursion...)
|
||||||
foreach($aExtKeys[$sTableClass][$sKeyAttCode] as $sAttCode => $oAtt)
|
foreach($aExtKeys[$sTableClass][$sKeyAttCode] as $sAttCode => $oAtt)
|
||||||
{
|
{
|
||||||
//echo "MAKEQUERY aExtKeys[$sTableClass][$sKeyAttCode] => $sAttCode-oAtt: <pre>".print_r($oAtt, true)."</pre><br/>\n";
|
//echo "MAKEQUERY aExtKeys[$sTableClass][$sKeyAttCode] => $sAttCode-oAtt: <pre>".print_r($oAtt, true)."</pre><br/>\n";
|
||||||
@@ -2500,23 +2500,23 @@ if (!array_key_exists($sAttCode, self::$m_aAttribDefs[$sClass]))
|
|||||||
$oSelectBase->AddInnerJoin($oSelectExtKey, $sLocalKeyField, $sExternalKeyField, $sExternalKeyTable);
|
$oSelectBase->AddInnerJoin($oSelectExtKey, $sLocalKeyField, $sExternalKeyField, $sExternalKeyTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
$oQBExpr->PushJoinField(new FieldExpression($sKeyAttCode, $sKeyClassAlias));
|
||||||
$oQBExpr->PushJoinField(new FieldExpression($sKeyAttCode, $sKeyClassAlias));
|
$oSelectExtKey = self::MakeQuery($aSelectedClasses, $oQBExpr, $aClassAliases, $aTableAliases, $oExtFilter);
|
||||||
$oSelectExtKey = self::MakeQuery($aSelectedClasses, $oQBExpr, $aClassAliases, $aTableAliases, $oExtFilter);
|
$oJoinExpr = $oQBExpr->PopJoinField();
|
||||||
$oJoinExpr = $oQBExpr->PopJoinField();
|
|
||||||
//echo "MAKEQUERY-PopJoinField pour $sKeyAttCode, $sKeyClassAlias: <pre>".print_r($oJoinExpr, true)."</pre><br/>\n";
|
//echo "MAKEQUERY-PopJoinField pour $sKeyAttCode, $sKeyClassAlias: <pre>".print_r($oJoinExpr, true)."</pre><br/>\n";
|
||||||
$sExternalKeyTable = $oJoinExpr->GetParent();
|
$sExternalKeyTable = $oJoinExpr->GetParent();
|
||||||
$sExternalKeyField = $oJoinExpr->GetName();
|
$sExternalKeyField = $oJoinExpr->GetName();
|
||||||
$sLeftIndex = $sExternalKeyField.'_left'; // TODO use GetSQLLeft()
|
$sLeftIndex = $sExternalKeyField.'_left'; // TODO use GetSQLLeft()
|
||||||
$sRightIndex = $sExternalKeyField.'_right'; // TODO use GetSQLRight()
|
$sRightIndex = $sExternalKeyField.'_right'; // TODO use GetSQLRight()
|
||||||
|
|
||||||
$LocalKeyLeft = $oKeyAttDef->GetSQLLeft();
|
$LocalKeyLeft = $oKeyAttDef->GetSQLLeft();
|
||||||
$LocalKeyRight = $oKeyAttDef->GetSQLRight();
|
$LocalKeyRight = $oKeyAttDef->GetSQLRight();
|
||||||
//echo "MAKEQUERY-LocalKeyLeft pour $sKeyAttCode => $LocalKeyLeft<br/>\n";
|
//echo "MAKEQUERY-LocalKeyLeft pour $sKeyAttCode => $LocalKeyLeft<br/>\n";
|
||||||
|
|
||||||
$oSelectBase->AddInnerJoinTree($oSelectExtKey, $LocalKeyLeft, $LocalKeyRight, $sLeftIndex, $sRightIndex, $sExternalKeyTable, $iOperatorCode);
|
$oSelectBase->AddInnerJoinTree($oSelectExtKey, $LocalKeyLeft, $LocalKeyRight, $sLeftIndex, $sRightIndex, $sExternalKeyTable, $iOperatorCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user