mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
Fixed issue with 1.x datamodels: dashlets of type "badge" not working (preventing from editing an existing dashboard), since 2.0.2
SVN:trunk[3113]
This commit is contained in:
@@ -5138,6 +5138,12 @@ abstract class MetaModel
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* It is not recommended to use this function: call GetLinkClasses instead
|
||||
* Return classes having at least to external keys (thus too many classes as compared to GetLinkClasses)
|
||||
* The only difference with EnumLinkingClasses is the output format
|
||||
*/
|
||||
public static function EnumLinksClasses()
|
||||
{
|
||||
// Returns a flat array of classes having at least two external keys
|
||||
@@ -5160,6 +5166,11 @@ abstract class MetaModel
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
/**
|
||||
* It is not recommended to use this function: call GetLinkClasses instead
|
||||
* Return classes having at least to external keys (thus too many classes as compared to GetLinkClasses)
|
||||
* The only difference with EnumLinksClasses is the output format
|
||||
*/
|
||||
public static function EnumLinkingClasses($sClass = "")
|
||||
{
|
||||
// N-N links, array of sLinkClass => (array of sAttCode=>sClass)
|
||||
@@ -5196,6 +5207,38 @@ abstract class MetaModel
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function has two siblings that will be soon deprecated:
|
||||
* EnumLinkingClasses and EnumLinkClasses
|
||||
*
|
||||
* Using GetLinkClasses is the recommended way to determine if a class is
|
||||
* actually an N-N relation because it is based on the decision made by the
|
||||
* designer the data model
|
||||
*/
|
||||
public static function GetLinkClasses()
|
||||
{
|
||||
$aRet = array();
|
||||
foreach(self::GetClasses() as $sClass)
|
||||
{
|
||||
if (isset(self::$m_aClassParams[$sClass]["is_link"]))
|
||||
{
|
||||
if (self::$m_aClassParams[$sClass]["is_link"])
|
||||
{
|
||||
$aExtKeys = array();
|
||||
foreach (self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
|
||||
{
|
||||
if ($oAttDef->IsExternalKey())
|
||||
{
|
||||
$aExtKeys[$sAttCode] = $oAttDef->GetTargetClass();
|
||||
}
|
||||
}
|
||||
$aRet[$sClass] = $aExtKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $aRet;
|
||||
}
|
||||
|
||||
public static function GetLinkLabel($sLinkClass, $sAttCode)
|
||||
{
|
||||
self::_check_subclass($sLinkClass);
|
||||
|
||||
@@ -178,7 +178,7 @@ class ModelReflectionRuntime extends ModelReflection
|
||||
$aClasses = MetaModel::GetClasses($sCategories);
|
||||
if ($bExcludeLinks)
|
||||
{
|
||||
$aExcluded = ProfilesConfig::GetLinkClasses(); // table computed at compile time
|
||||
$aExcluded = MetaModel::GetLinkClasses();
|
||||
$aRes = array();
|
||||
foreach ($aClasses as $sClass)
|
||||
{
|
||||
|
||||
@@ -617,7 +617,11 @@ EOF;
|
||||
$aClassParams = array();
|
||||
$aClassParams['category'] = $this->GetPropString($oProperties, 'category', '');
|
||||
$aClassParams['key_type'] = "'autoincrement'";
|
||||
|
||||
if ((bool) $this->GetPropNumber($oProperties, 'is_link', 0))
|
||||
{
|
||||
$aClassParams['is_link'] = 'true';
|
||||
}
|
||||
|
||||
if ($oNaming = $oProperties->GetOptionalElement('naming'))
|
||||
{
|
||||
$oNameAttributes = $oNaming->GetUniqueElement('attributes');
|
||||
@@ -1462,6 +1466,8 @@ class ProfilesConfig
|
||||
|
||||
protected static \$aLINKTOCLASSES = $sLinkToClasses;
|
||||
|
||||
// Now replaced by MetaModel::GetLinkClasses (working with 1.x)
|
||||
// This function could be deprecated
|
||||
public static function GetLinkClasses()
|
||||
{
|
||||
return self::\$aLINKTOCLASSES;
|
||||
|
||||
Reference in New Issue
Block a user