Skip to content

Conversation

@accognet
Copy link
Contributor

@accognet accognet commented Dec 4, 2025

internal

@accognet accognet self-assigned this Dec 4, 2025
@accognet accognet added the internal Work made by Combodo label Dec 4, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #6327 by fixing how Enum, Date, and FinalClass attributes are displayed in complementary names. The change switches from using Get() to GetAsCSV() to obtain user-friendly, localized values for attributes used in complementary names.

Changes:

  • Modified complementary name generation to use GetAsCSV() instead of Get() for proper localization of Enum, Date, and FinalClass attributes
  • Updated complementary_name_attcode from ['finalclass', 'complement'] to ['finalclass', 'target_class'] across all Trigger classes
  • Enhanced dictionary entries for Class:Trigger/ComplementaryName to include descriptive labels like "class restriction:" in multiple languages

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sources/Service/Base/ObjectRepository.php Changed to use GetAsCSV() for complementary name attributes to get formatted, user-friendly values
core/valuesetdef.class.inc.php Updated autocomplete value loading to use GetAsCSV() for proper attribute formatting
application/ui.extkeywidget.class.inc.php Modified external key widget to use GetAsCSV() for displaying additional fields with proper formatting
core/trigger.class.inc.php Updated complementary_name_attcode to use 'target_class' directly instead of 'complement' for all Trigger subclasses
datamodels/2.x/itop-attachments/src/Trigger/*.php Updated attachment trigger classes to use 'target_class' in complementary_name_attcode
dictionaries/*.dictionary.itop.core.php Updated ComplementaryName format strings to include descriptive text for class restriction in multiple languages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"key_type" => "autoincrement",
"name_attcode" => "description",
"complementary_name_attcode" => ['finalclass', 'complement'],
"complementary_name_attcode" => ['finalclass', 'target_class'],
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'target_class' attribute (AttributeClass type) doesn't localize class names in its GetAsCSV() method. Unlike AttributeEnum, AttributeDateTime, and AttributeFinalClass which properly localize/format values in GetAsCSV(), AttributeClass only inherits the base AttributeString implementation which doesn't localize. This means when GetAsCSV() is called on 'target_class' in ObjectRepository::ComputeOthersData() and other locations, users will see raw class names like "UserRequest" instead of localized names like "User Request" or their translated equivalents. AttributeClass should override GetAsCSV() similar to how AttributeFinalClass does (see sources/Core/AttributeDefinition/AttributeFinalClass.php:150) to call MetaModel::GetName() when $bLocalize is true.

Suggested change
"complementary_name_attcode" => ['finalclass', 'target_class'],
"complementary_name_attcode" => ['finalclass'],

Copilot uses AI. Check for mistakes.
$aArguments = [];
foreach ($aComplementAttributeSpec[1] as $sAdditionalField) {
$aArguments[] = $oDbObject->Get($sAdditionalField);
//getAsCSV to have user friendly value in text format
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with the rest of the codebase. Comments should typically start with // (space after slashes) and begin with a capital letter, following the pattern seen elsewhere in the file. For example: // GetAsCSV to have user friendly value in text format

Suggested change
//getAsCSV to have user friendly value in text format
// GetAsCSV to have user friendly value in text format

Copilot uses AI. Check for mistakes.
$aArguments = [];
foreach ($aAdditionalField as $sAdditionalField) {
array_push($aArguments, $oObject->Get($sAdditionalField));
//getAsCSV to have user friendly value in text format
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with the rest of the codebase. Comments should typically start with // (space after slashes) and begin with a capital letter, following the pattern seen elsewhere in the file. For example: // GetAsCSV to have user friendly value in text format

Suggested change
//getAsCSV to have user friendly value in text format
// GetAsCSV to have user friendly value in text format

Copilot uses AI. Check for mistakes.
$aArguments = [];
foreach ($aAdditionalField as $sAdditionalField) {
array_push($aArguments, $oObj->Get($sAdditionalField));
//getAsCSV to have user friendly value in text format
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment style is inconsistent with the rest of the codebase. Comments should typically start with // (space after slashes) and begin with a capital letter, following the pattern seen elsewhere in the file. For example: // GetAsCSV to have user friendly value in text format

Suggested change
//getAsCSV to have user friendly value in text format
// GetAsCSV to have user friendly value in text format

Copilot uses AI. Check for mistakes.
foreach ($aComplementAttributeSpec[1] as $sAdditionalField) {
$aArguments[] = $oDbObject->Get($sAdditionalField);
//getAsCSV to have user friendly value in text format
$aArguments[] = $oDbObject->GetAsCSV($sAdditionalField,' ','');
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after comma in parameter list. Should be GetAsCSV($sAdditionalField, ' ', '') for consistency with PHP coding standards (PSR-12) and with application/ui.extkeywidget.class.inc.php:288 where the same change was made.

Suggested change
$aArguments[] = $oDbObject->GetAsCSV($sAdditionalField,' ','');
$aArguments[] = $oDbObject->GetAsCSV($sAdditionalField, ' ', '');

Copilot uses AI. Check for mistakes.
foreach ($aAdditionalField as $sAdditionalField) {
array_push($aArguments, $oObject->Get($sAdditionalField));
//getAsCSV to have user friendly value in text format
array_push($aArguments, $oObject->GetAsCSV($sAdditionalField,' ',''));
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after comma in parameter list. Should be GetAsCSV($sAdditionalField, ' ', '') for consistency with PHP coding standards (PSR-12) and with application/ui.extkeywidget.class.inc.php:288 where the same change was made with proper spacing.

Suggested change
array_push($aArguments, $oObject->GetAsCSV($sAdditionalField,' ',''));
array_push($aArguments, $oObject->GetAsCSV($sAdditionalField, ' ', ''));

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants