mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
N°1872 Regression when editing query phrasebook entries. Fixed.
This commit is contained in:
@@ -139,37 +139,39 @@ class QueryOQL extends Query
|
||||
return $aFieldsMap;
|
||||
}
|
||||
|
||||
public function ComputeValues()
|
||||
{
|
||||
parent::ComputeValues();
|
||||
|
||||
// Remove unwanted attribute codes
|
||||
$aChanges = $this->ListChanges();
|
||||
if (isset($aChanges['fields']))
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($this), 'fields');
|
||||
$aArgs = array('this' => $this);
|
||||
$aAllowedValues = $oAttDef->GetAllowedValues($aArgs);
|
||||
|
||||
/** @var \ormSet $oValue */
|
||||
$oValue = $this->Get('fields');
|
||||
$aValues = $oValue->GetValues();
|
||||
$bChanged = false;
|
||||
foreach($aValues as $key => $sValue)
|
||||
{
|
||||
if (!isset($aAllowedValues[$sValue]))
|
||||
{
|
||||
unset($aValues[$key]);
|
||||
$bChanged = true;
|
||||
}
|
||||
}
|
||||
if ($bChanged)
|
||||
{
|
||||
$oValue->SetValues($aValues);
|
||||
$this->Set('fields', $oValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Rolled back until 'fields' can be properly managed by AttributeQueryAttCodeSet
|
||||
//
|
||||
// public function ComputeValues()
|
||||
// {
|
||||
// parent::ComputeValues();
|
||||
//
|
||||
// // Remove unwanted attribute codes
|
||||
// $aChanges = $this->ListChanges();
|
||||
// if (isset($aChanges['fields']))
|
||||
// {
|
||||
// $oAttDef = MetaModel::GetAttributeDef(get_class($this), 'fields');
|
||||
// $aArgs = array('this' => $this);
|
||||
// $aAllowedValues = $oAttDef->GetAllowedValues($aArgs);
|
||||
//
|
||||
// /** @var \ormSet $oValue */
|
||||
// $oValue = $this->Get('fields');
|
||||
// $aValues = $oValue->GetValues();
|
||||
// $bChanged = false;
|
||||
// foreach($aValues as $key => $sValue)
|
||||
// {
|
||||
// if (!isset($aAllowedValues[$sValue]))
|
||||
// {
|
||||
// unset($aValues[$key]);
|
||||
// $bChanged = true;
|
||||
// }
|
||||
// }
|
||||
// if ($bChanged)
|
||||
// {
|
||||
// $oValue->SetValues($aValues);
|
||||
// $this->Set('fields', $oValue);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user