Fix - Use dropdown translation in generated ticket content - #25250
Open
erique-souza wants to merge 3 commits into
Open
Fix - Use dropdown translation in generated ticket content#25250erique-souza wants to merge 3 commits into
erique-souza wants to merge 3 commits into
Conversation
fix(form): use dropdown translation in generated ticket content
test(form): cover dropdown translation in formatRawAnswer
fix(form): keep getFriendlyName for non-dropdown items
3 tasks
Contributor
|
Tests are failing, please check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist before requesting a review
Description
QuestionTypeItem::formatRawAnswer()reads the rawcompletename/ friendly nameof the answered item, so the value frozen into the generated ticket content and
title is always in the source language, even when a
DropdownTranslationexistsfor the requester's language.
The ticket content is built once at submission time and stored in
glpi_tickets.content, so the value has to be resolved at that moment — there isno later render that could apply the translation.
The other
fields['completename']read in this file, intransformConditionValueForComparisons(), is deliberately left alone: conditionsmust compare against the source value, otherwise form logic would depend on the
viewer's language.
The breadcrumb half of the issue is already fixed on
11.0/bugfixesby #24678,so it is not included here.
Added
testFormatRawAnswerUsesDropdownTranslationas a non-regression test: itbuilds a
Locationtree, adds anfr_FRtranslation, logs in as a French userand asserts the translated value is returned.
Reproduced and verified on a production instance running 11.0.8,
pt_PTinstallwith
en_GBusers, applied via a bind-mount over the container file.