RED-8762: do not update addToDictionaryAction for dossier dictionaries when updating dossier template dictionary ONLY if dossierDictionaryOnly

This commit is contained in:
Ali Oezyetimoglu 2024-04-15 13:49:20 +02:00
parent 77db059a2e
commit a86be93177

View File

@ -129,7 +129,7 @@ public class DictionaryService {
updateType(dossierTemplateId, toTypeId(type, dossierTemplateId), typeValue);
var dossierTypes = dictionaryPersistenceService.getAllDossierTypesForDossierTemplateAndType(dossierTemplateId, type, false);
dossierTypes.forEach(t -> this.updateDossierType(t.getType(), dossierTemplateId, typeValue, t.getDossierId()));
dossierTypes.forEach(t -> this.updateDossierType(t.getType(), dossierTemplateId, typeValue, t.getDossierId(), t));
}
@ -155,11 +155,12 @@ public class DictionaryService {
@PreAuthorize("hasAuthority('" + ADD_UPDATE_DOSSIER_DICTIONARY_TYPE + "')")
public void updateDossierType(String type, String dossierTemplateId, UpdateTypeValue typeValue, String dossierId) {
public void updateDossierType(String type, String dossierTemplateId, UpdateTypeValue typeValue, String dossierId, TypeEntity typeEntity) {
accessControlService.verifyUserIsDossierOwner(dossierId);
// we do not set the flag addToDictionaryAction when updating the global type
dictionaryManagementService.updateTypeValue(toTypeId(type, dossierTemplateId, dossierId),
if (typeEntity.isDossierDictionaryOnly()) {
dictionaryManagementService.updateTypeValue(toTypeId(type, dossierTemplateId, dossierId),
Type.builder()
.dossierTemplateId(dossierTemplateId)
.hexColor(typeValue.getHexColor())
@ -170,10 +171,14 @@ public class DictionaryService {
.isCaseInsensitive(typeValue.isCaseInsensitive())
.isRecommendation(typeValue.isRecommendation())
.description(typeValue.getDescription())
.addToDictionaryAction(typeEntity.isAddToDictionaryAction())
.label(typeValue.getLabel())
.hasDictionary(typeValue.isHasDictionary())
.autoHideSkipped(typeValue.isAutoHideSkipped())
.build());
} else {
updateType(dossierTemplateId, toTypeId(type, dossierTemplateId, dossierId), typeValue);
}
}