Merge remote-tracking branch 'origin/develop' into feature/uninstallation

This commit is contained in:
Benjamin DALSASS
2026-04-29 11:08:03 +02:00
27 changed files with 397 additions and 167 deletions

View File

@@ -27,9 +27,9 @@ use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory;
use Combodo\iTop\Application\UI\Base\iUIBlock;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\WebPage\WebPage;
use Combodo\iTop\Controller\AjaxRenderController;
use DBObjectSet;
use DeprecatedCallsLog;
use Dict;
use DisplayBlock;
use IssueLog;
@@ -38,7 +38,6 @@ use MenuBlock;
use MetaModel;
use UserRights;
use utils;
use Combodo\iTop\Application\WebPage\WebPage;
/**
* Class DataTableUIBlockFactory
@@ -556,7 +555,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
'object_class' => $sClassName,
'class_alias' => $sClassAlias,
'attribute_code' => $sAttCode,
'attribute_type' => $sAttDefClass,
'attribute_type' => $oAttDef->GetType(),
'attribute_label' => $sAttLabel,
'render' => $oAttDef->GetRenderForDataTable($sClassAlias),
];
@@ -738,7 +737,7 @@ JS;
'object_class' => $sClassName,
'class_alias' => $sClassAlias,
'attribute_code' => $sAttCode,
'attribute_type' => $sAttDefClass,
'attribute_type' => $oAttDef->GetType(),
'attribute_label' => $sAttLabel,
];
$aColumnDefinition["data"] = $sClassAlias."/".$sAttCode;

View File

@@ -11,6 +11,7 @@ use CMDBChangeOpSetAttributeScalar;
use Combodo\iTop\Form\Field\SelectField;
use DBObject;
use Dict;
use ReflectionClass;
/**
* Map a boolean column to an attribute
@@ -80,11 +81,13 @@ class AttributeBoolean extends AttributeInteger
public function GetValueLabel($bValue)
{
$oClass = new ReflectionClass(get_class($this));
if (is_null($bValue)) {
$sLabel = Dict::S('Core:'.get_class($this).'/Value:null');
$sLabel = Dict::S('Core:'.$oClass->getShortName().'/Value:null');
} else {
$sValue = $bValue ? 'yes' : 'no';
$sDefault = Dict::S('Core:'.get_class($this).'/Value:'.$sValue);
$sDefault = Dict::S('Core:'.$oClass->getShortName().'/Value:'.$sValue);
$sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'/Value:'.$sValue, $sDefault, true /*user lang*/);
}
@@ -93,11 +96,13 @@ class AttributeBoolean extends AttributeInteger
public function GetValueDescription($bValue)
{
$oClass = new ReflectionClass(get_class($this));
if (is_null($bValue)) {
$sDescription = Dict::S('Core:'.get_class($this).'/Value:null+');
$sDescription = Dict::S('Core:'.$oClass->getShortName().'/Value:null+');
} else {
$sValue = $bValue ? 'yes' : 'no';
$sDefault = Dict::S('Core:'.get_class($this).'/Value:'.$sValue.'+');
$sDefault = Dict::S('Core:'.$oClass->getShortName().'/Value:'.$sValue.'+');
$sDescription = $this->SearchLabel(
'/Attribute:'.$this->m_sCode.'/Value:'.$sValue.'+',
$sDefault,

View File

@@ -19,6 +19,7 @@ use Exception;
use Expression;
use FieldExpression;
use MetaModel;
use ReflectionClass;
use Str;
use utils;
use VariableExpression;
@@ -131,12 +132,30 @@ abstract class AttributeDefinition
public function GetType()
{
return Dict::S('Core:'.get_class($this));
$oClass = new ReflectionClass(get_class($this));
return Dict::S('Core:'.$oClass->getShortName());
}
public function GetTypeDesc()
{
return Dict::S('Core:'.get_class($this).'+');
$oClass = new ReflectionClass(get_class($this));
return Dict::S('Core:'.$oClass->getShortName().'+');
}
/**
* Return type information.
*
* @since 3.3
* @return array
*/
public function GetTypeInformation(): array
{
$oClass = new ReflectionClass(get_class($this));
return [
'classShortName' => $oClass->getShortName(),
'label' => Dict::S('Core:'.$oClass->getShortName()),
'description' => Dict::S('Core:'.$oClass->getShortName().'+'),
];
}
abstract public function GetEditClass();
@@ -1076,7 +1095,7 @@ abstract class AttributeDefinition
// Metadata
$oFormField->AddMetadata('attribute-code', $this->GetCode());
$oFormField->AddMetadata('attribute-type', get_class($this));
$oFormField->AddMetadata('attribute-type', $this->GetType());
$oFormField->AddMetadata('attribute-label', $this->GetLabel());
// - Attribute flags
$aPossibleAttFlags = MetaModel::EnumPossibleAttributeFlags();

View File

@@ -852,7 +852,7 @@ JS
'object_class' => $sClass,
'object_id' => $oItem->GetKey(),
'attribute_code' => $sAttCode,
'attribute_type' => get_class($oAttDef),
'attribute_type' => $oAttDef->GetType(),
];
// - Value raw
// For simple fields, we get the raw (stored) value as well