Skip to content

N°6327 - Enum, Date, FinalClass in Complementary Name not labelized#783

Open
accognet wants to merge 3 commits into
developfrom
feature/6327-Enum-Date-FinalClass_in_Complementary_Name
Open

N°6327 - Enum, Date, FinalClass in Complementary Name not labelized#783
accognet wants to merge 3 commits into
developfrom
feature/6327-Enum-Date-FinalClass_in_Complementary_Name

Conversation

@accognet

@accognet accognet commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

internal

@accognet accognet self-assigned this Dec 4, 2025
@accognet accognet added the internal Work made by Combodo label Dec 4, 2025
Comment thread dictionaries/nl.dictionary.itop.core.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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'],

Copilot AI Jan 28, 2026

Copy link

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.
Comment thread sources/Service/Base/ObjectRepository.php Outdated
Comment thread core/valuesetdef.class.inc.php Outdated
Comment thread application/ui.extkeywidget.class.inc.php Outdated
Comment thread sources/Service/Base/ObjectRepository.php Outdated
Comment thread core/valuesetdef.class.inc.php Outdated
foreach ($aAdditionalField as $sAdditionalField) {
array_push($aArguments, $oObj->Get($sAdditionalField));
//getAsCSV to have user friendly value in text format
array_push($aArguments, $oObj->GetAsCSV($sAdditionalField, ' ', ''));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why use GetAsCSV here ?? It as nothing to do with a CSV. Do we really want double quotes around the value if there are spaces in it ??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GetAsCSV returns the value in the correct format, which is why I'm using it here even though it's not a CSV.

@accognet accognet force-pushed the feature/6327-Enum-Date-FinalClass_in_Complementary_Name branch from 3a3519c to c5a6b34 Compare June 22, 2026 13:04
Comment thread dictionaries/nl.dictionary.itop.core.php Outdated
@accognet accognet requested a review from dflaven June 22, 2026 15:08
@accognet accognet force-pushed the feature/6327-Enum-Date-FinalClass_in_Complementary_Name branch from 10a08b1 to 81e9ef8 Compare June 22, 2026 15:38
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.

5 participants