mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Better initialization of objects from the "Context" values:
- map the parameters (for example for Provider Contract) - set the default values when creating a "secondary" object via the (+) button SVN:trunk[1391]
This commit is contained in:
17
pages/UI.php
17
pages/UI.php
@@ -1087,22 +1087,7 @@ EOF
|
||||
$oObjToClone = MetaModel::NewObject($sRealClass);
|
||||
|
||||
// 1st - set context values
|
||||
$aContext = $oAppContext->GetAsHash();
|
||||
foreach($oAppContext->GetNames() as $key)
|
||||
{
|
||||
if (MetaModel::IsValidAttCode($sRealClass, $key))
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef($sRealClass, $key);
|
||||
if ($oAttDef->IsWritable())
|
||||
{
|
||||
$value = $oAppContext->GetCurrentValue($key, null);
|
||||
if (!is_null($value))
|
||||
{
|
||||
$oObjToClone->Set($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$oAppContext->InitObjectFromContext($oObjToClone);
|
||||
|
||||
// 2nd - set values from the page argument 'default'
|
||||
$oObjToClone->UpdateObjectFromArg('default');
|
||||
|
||||
Reference in New Issue
Block a user