N°3203 - Fix regression: PHP notice on object with no class icon

This commit is contained in:
Molkobain
2020-11-04 14:25:58 +01:00
parent 8954d02796
commit fa0bb2b466
2 changed files with 8 additions and 4 deletions

View File

@@ -927,7 +927,8 @@ abstract class MetaModel
{
self::_check_subclass($sClass);
return self::$m_aClassParams[$sClass]["image_attcode"];
// image_attcode isn't a mandatory class parameter, so it might not be in the $m_aClassParam array
return isset(self::$m_aClassParams[$sClass]["image_attcode"]) ? self::$m_aClassParams[$sClass]["image_attcode"] : '';
}
/**

View File

@@ -32,8 +32,8 @@ class TitleFactory
$sObjIconUrl = $oObject->GetIcon(false);
// Note: Class icons are a square image with no margin around, so they need to be zoomed out in the medallion
$sIconCoverMethod = Title::ENUM_ICON_COVER_METHOD_ZOOMOUT;
// - Use object image from seantic attribute only if it's not the default image
if(!$oObject->IsNew()){
// - Use object image from semantic attribute only if it's not the default image
if(!$oObject->IsNew() && MetaModel::HasImageAttributeCode($sObjClass)){
$sImageAttCode = MetaModel::GetImageAttributeCode($sObjClass);
if(!empty($sImageAttCode)){
/** @var \ormDocument $oImage */
@@ -47,7 +47,10 @@ class TitleFactory
}
$oTitle = new TitleForObjectDetails($sObjClassName, $sObjName, $sId);
$oTitle->SetIcon($sObjIconUrl, $sIconCoverMethod);
if(!empty($sObjIconUrl)) {
$oTitle->SetIcon($sObjIconUrl, $sIconCoverMethod);
}
$sStatusAttCode = MetaModel::GetStateAttributeCode($sObjClass);
if (!empty($sStatusAttCode)) {