Bug fix: protect against a non existing Contact class (a rather drastic iTop customization!)

SVN:trunk[4559]
This commit is contained in:
Denis Flaven
2017-02-24 14:09:44 +00:00
parent b4534f455a
commit fcc5342775
2 changed files with 7 additions and 3 deletions

View File

@@ -1438,8 +1438,12 @@ class RunTimeIconSelectionField extends DesignerIconSelectionField
public function GetDefaultValue($sClass = 'Contact')
{
$sIconPath = MetaModel::GetClassIcon($sClass, false);
$sIcon = str_replace(utils::GetAbsoluteUrlModulesRoot(), '', $sIconPath);
$sIcon = '';
if (MetaModel::IsValidClass($sClass))
{
$sIconPath = MetaModel::GetClassIcon($sClass, false);
$sIcon = str_replace(utils::GetAbsoluteUrlModulesRoot(), '', $sIconPath);
}
return $sIcon;
}
}

View File

@@ -245,7 +245,7 @@ abstract class User extends cmdbAbstractObject
{
if (is_null($this->oContactObject))
{
if ($this->Get('contactid') != 0)
if (MetaModel::IsValidAttCode(get_class($this), 'contactid') && ($this->Get('contactid') != 0))
{
$this->oContactObject = MetaModel::GetObject('Contact', $this->Get('contactid'));
}