mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 16:48:42 +02:00
N°2508 - Include Obsolescence icon within list and autocomplete - case of search filters
This commit is contained in:
@@ -1114,13 +1114,13 @@ abstract class AttributeDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aArgs
|
||||
* @param string $sContains
|
||||
*
|
||||
* @return array|null
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
* @param array $aArgs
|
||||
* @param string $sContains
|
||||
*
|
||||
* @return array|null
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function GetAllowedValues($aArgs = array(), $sContains = '')
|
||||
{
|
||||
$oValSetDef = $this->GetValuesDef();
|
||||
@@ -1132,6 +1132,20 @@ abstract class AttributeDefinition
|
||||
return $oValSetDef->GetValues($aArgs, $sContains);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetAllowedValuesForSelect is the same as GetAllowedValues except for field with obsolescence flag
|
||||
* @param array $aArgs
|
||||
* @param string $sContains
|
||||
*
|
||||
* @return array|null
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function GetAllowedValuesForSelect($aArgs = array(), $sContains = '')
|
||||
{
|
||||
return $this->GetAllowedValues($aArgs, $sContains);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explain the change of the attribute (history)
|
||||
*
|
||||
@@ -6643,6 +6657,14 @@ class AttributeExternalKey extends AttributeDBFieldVoid
|
||||
}
|
||||
}
|
||||
|
||||
public function GetAllowedValuesForSelect($aArgs = array(), $sContains = '')
|
||||
{
|
||||
//$this->GetValuesDef();
|
||||
$oValSetDef = new ValueSetObjects('SELECT '.$this->GetTargetClass());
|
||||
return $oValSetDef->GetValuesForAutocomplete($aArgs, $sContains);
|
||||
}
|
||||
|
||||
|
||||
public function GetAllowedValuesAsObjectSet($aArgs = array(), $sContains = '', $iAdditionalValue = null)
|
||||
{
|
||||
$oValSetDef = $this->GetValuesDef();
|
||||
|
||||
@@ -226,7 +226,8 @@ $(function()
|
||||
{
|
||||
var sValCode = aSortedValues[i][0];
|
||||
var sValLabel = aSortedValues[i][1];
|
||||
var oValueElem = this._makeListItemElement(sValLabel, sValCode);
|
||||
//_makeListItemElement: function(sLabel, sValue, bInitChecked, bInitHidden,bObsolete, sAdditionalField)
|
||||
var oValueElem = this._makeListItemElement(sValLabel, sValCode, false, false, aSortedValues[i][2], aSortedValues[i][3]);
|
||||
oValueElem.appendTo(oDynamicListElem);
|
||||
|
||||
if (this._isSelectedValues(sValCode))
|
||||
@@ -895,16 +896,20 @@ $(function()
|
||||
// eg. {2: "IT Department", 3: "Demo"} in regular mode
|
||||
else
|
||||
{
|
||||
aSortable.push([sKey, oSource[sKey]]);
|
||||
if(oSource[sKey]["label"]) {
|
||||
aSortable.push([sKey, oSource[sKey]["label"], oSource[sKey]["obsolescence_flag"], oSource[sKey]["additional_field"]]);
|
||||
} else {
|
||||
aSortable.push([sKey, oSource[sKey]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aSortable.sort(function(a, b) {
|
||||
if(a[1] < b[1])
|
||||
if(a[1].toLowerCase() < b[1].toLowerCase())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if(a[1] > b[1])
|
||||
else if(a[1].toLowerCase() > b[1].toLowerCase())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ class SearchForm
|
||||
$aAllowedValues = array();
|
||||
while ($oObject = $oSet->Fetch())
|
||||
{
|
||||
$aAllowedValues[$oObject->GetKey()] = $oObject->GetName();
|
||||
$aAllowedValues[] = ["value"=>$oObject->GetKey(), "label" => $oObject->GetName(), "obsolescence_flag"=>$oObject->IsObsolete()?"1":"0", "additional_field" => "je sais pas"];
|
||||
}
|
||||
return array('values' => $aAllowedValues);
|
||||
}
|
||||
@@ -522,8 +522,7 @@ class SearchForm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aAllowedValues = $oAttrDef->GetAllowedValues();
|
||||
$aAllowedValues = $oAttrDef->GetAllowedValuesForSelect();
|
||||
|
||||
return array('values' => $aAllowedValues);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user