Protect against a non-existent "MapContextParams" function

SVN:trunk[1886]
This commit is contained in:
Denis Flaven
2012-03-09 08:44:06 +00:00
parent 2c49d1f96f
commit 73e715efb4
2 changed files with 17 additions and 14 deletions

View File

@@ -221,17 +221,17 @@ class ApplicationContext
if (is_callable($aCallSpec))
{
$sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter
}
if (MetaModel::IsValidAttCode($sClass, $sAttCode))
{
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if ($oAttDef->IsWritable())
if (MetaModel::IsValidAttCode($sClass, $sAttCode))
{
$value = $this->GetCurrentValue($key, null);
if (!is_null($value))
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if ($oAttDef->IsWritable())
{
$oObj->Set($sAttCode, $value);
$value = $this->GetCurrentValue($key, null);
if (!is_null($value))
{
$oObj->Set($sAttCode, $value);
}
}
}
}

View File

@@ -281,15 +281,18 @@ class DisplayBlock
$sClass = $this->m_oFilter->GetClass();
$aFilterCodes = array_keys(MetaModel::GetClassFilterDefs($sClass));
$aCallSpec = array($sClass, 'MapContextParam');
foreach($oAppContext->GetNames() as $sContextParam)
if (is_callable($aCallSpec))
{
$sParamCode = call_user_func($aCallSpec, $sContextParam); //Map context parameter to the value/filter code depending on the class
if (!is_null($sParamCode))
foreach($oAppContext->GetNames() as $sContextParam)
{
$sParamValue = $oAppContext->GetCurrentValue($sContextParam, null);
if (!is_null($sParamValue))
$sParamCode = call_user_func($aCallSpec, $sContextParam); //Map context parameter to the value/filter code depending on the class
if (!is_null($sParamCode))
{
$aExtraParams[$sParamCode] = $sParamValue;
$sParamValue = $oAppContext->GetCurrentValue($sContextParam, null);
if (!is_null($sParamValue))
{
$aExtraParams[$sParamCode] = $sParamValue;
}
}
}
}