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:
Denis Flaven
2011-07-31 08:54:59 +00:00
parent ca8ea8dd02
commit 5baa213e6a
3 changed files with 41 additions and 17 deletions

View File

@@ -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');