mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 14:58:43 +02:00
advanced search: ShorthandExpansion TODOs list
SVN:b1312[5765]
This commit is contained in:
@@ -1134,6 +1134,14 @@ class DBObjectSearch extends DBSearch
|
||||
return $this->m_oSearchCondition->ApplyParameters(array_merge($this->m_aParams, $aArgs));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @todo: check if the clone is mandatory or optional. (the performance would be better without cloning)
|
||||
*
|
||||
* @param bool $bClone
|
||||
*
|
||||
* @return DBObjectSearch|DBSearch
|
||||
*/
|
||||
public function ShorthandExpansion($bClone = false)
|
||||
{
|
||||
if ($bClone)
|
||||
@@ -1222,7 +1230,7 @@ class DBObjectSearch extends DBSearch
|
||||
$this->m_oSearchCondition->Browse($callback);
|
||||
|
||||
//replace the ExternalFieldExpression by a FieldExpression (based on last ExternalFieldExpression::$aFields)
|
||||
$this->m_oSearchCondition->Translate(array(), false, false);
|
||||
$this->m_oSearchCondition->Translate(array(), false, false);//TODO: check if this call is correct
|
||||
|
||||
return $oDbObject;
|
||||
}
|
||||
|
||||
@@ -841,6 +841,13 @@ class FalseExpression extends ScalarExpression
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class ExternalFieldExpression
|
||||
*
|
||||
* @todo verify if all required methods are implemented (ie: at first I missed the `Render` method, so DBObjectSearch::toOQL() result was wrong)
|
||||
*
|
||||
*/
|
||||
class ExternalFieldExpression extends UnaryExpression
|
||||
{
|
||||
/**
|
||||
@@ -869,14 +876,21 @@ class ExternalFieldExpression extends UnaryExpression
|
||||
return $this->m_aFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* used by DBObjectSearch::ShorthandExpansion(). it result in the ExternalFieldExpression being replaced by a FieldExpression mathching the final entry in self::$m_aFields
|
||||
*
|
||||
* @param array $aTranslationData
|
||||
* @param bool $bMatchAll
|
||||
* @param bool $bMarkFieldsAsResolved
|
||||
*
|
||||
* @return Expression|FieldExpression|UnaryExpression
|
||||
*/
|
||||
public function Translate($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true)
|
||||
{
|
||||
$aFields = $this->GetFields();
|
||||
$aLastField = end($aFields);
|
||||
|
||||
|
||||
$oRet = new FieldExpression($aLastField['sAttCode'], $aLastField['sAlias']);
|
||||
// $oRet->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved);
|
||||
|
||||
return $oRet;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user