-
Notifications
You must be signed in to change notification settings - Fork 279
N°6327 - Enum, Date, FinalClass in Complementary Name not labelized #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
N°6327 - Enum, Date, FinalClass in Complementary Name not labelized #783
Conversation
Co-authored-by: Thomas Casteleyn <[email protected]>
There was a problem hiding this 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 ofGet()for proper localization of Enum, Date, and FinalClass attributes - Updated
complementary_name_attcodefrom['finalclass', 'complement']to['finalclass', 'target_class']across all Trigger classes - Enhanced dictionary entries for
Class:Trigger/ComplementaryNameto 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'], |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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.
| "complementary_name_attcode" => ['finalclass', 'target_class'], | |
| "complementary_name_attcode" => ['finalclass'], |
| $aArguments = []; | ||
| foreach ($aComplementAttributeSpec[1] as $sAdditionalField) { | ||
| $aArguments[] = $oDbObject->Get($sAdditionalField); | ||
| //getAsCSV to have user friendly value in text format |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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
| //getAsCSV to have user friendly value in text format | |
| // GetAsCSV to have user friendly value in text format |
| $aArguments = []; | ||
| foreach ($aAdditionalField as $sAdditionalField) { | ||
| array_push($aArguments, $oObject->Get($sAdditionalField)); | ||
| //getAsCSV to have user friendly value in text format |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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
| //getAsCSV to have user friendly value in text format | |
| // GetAsCSV to have user friendly value in text format |
| $aArguments = []; | ||
| foreach ($aAdditionalField as $sAdditionalField) { | ||
| array_push($aArguments, $oObj->Get($sAdditionalField)); | ||
| //getAsCSV to have user friendly value in text format |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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
| //getAsCSV to have user friendly value in text format | |
| // GetAsCSV to have user friendly value in text format |
| foreach ($aComplementAttributeSpec[1] as $sAdditionalField) { | ||
| $aArguments[] = $oDbObject->Get($sAdditionalField); | ||
| //getAsCSV to have user friendly value in text format | ||
| $aArguments[] = $oDbObject->GetAsCSV($sAdditionalField,' ',''); |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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.
| $aArguments[] = $oDbObject->GetAsCSV($sAdditionalField,' ',''); | |
| $aArguments[] = $oDbObject->GetAsCSV($sAdditionalField, ' ', ''); |
| 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,' ','')); |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
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.
| array_push($aArguments, $oObject->GetAsCSV($sAdditionalField,' ','')); | |
| array_push($aArguments, $oObject->GetAsCSV($sAdditionalField, ' ', '')); |
internal