Skip to content

Commit

Permalink
Birthdate month does not show "Empty" instead of "confidential" when …
Browse files Browse the repository at this point in the history
…restrictions apply #13179
  • Loading branch information
SergiuPacurariu committed Nov 6, 2024
1 parent 247e01f commit edd72b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ public class PersonDto extends PseudonymizableDto implements IsPerson {
@SensitiveData
private Integer birthdateDD;
@Outbreaks
@PersonalData
@SensitiveData
private Integer birthdateMM;
@Outbreaks
private Integer birthdateYYYY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,13 @@ protected void addFields() {
ComboBox birthDateMonth = addField(PersonDto.BIRTH_DATE_MM, ComboBox.class);
// @TODO: Done for nullselection Bug, fixed in Vaadin 7.7.3
birthDateMonth.setNullSelectionAllowed(true);
birthDateMonth.addItems(DateHelper.getMonthsInYear());
birthDateMonth.setPageLength(12);
// birthDateMonth.addItems(DateHelper.getMonthsInYear());
// birthDateMonth.setPageLength(12);
birthDateMonth.setInputPrompt(I18nProperties.getString(Strings.month));
birthDateMonth.setCaption("");
DateHelper.getMonthsInYear()
.forEach(month -> birthDateMonth.setItemCaption(month, de.symeda.sormas.api.Month.values()[month - 1].toString()));
setItemCaptionsForMonths(birthDateMonth);
// DateHelper.getMonthsInYear()
// .forEach(month -> birthDateMonth.setItemCaption(month, de.symeda.sormas.api.Month.values()[month - 1].toString()));
// setItemCaptionsForMonths(birthDateMonth);
ComboBox birthDateYear = addField(PersonDto.BIRTH_DATE_YYYY, ComboBox.class);
birthDateYear.setCaption(I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, PersonDto.BIRTH_DATE));
// @TODO: Done for nullselection Bug, fixed in Vaadin 7.7.3
Expand Down Expand Up @@ -446,6 +446,13 @@ protected void addFields() {
initializeVisibilitiesAndAllowedVisibilities();
initializeAccessAndAllowedAccesses();

if (isEditableAllowed(PersonDto.BIRTH_DATE_MM)) {
birthDateMonth.addItems(DateHelper.getMonthsInYear());
birthDateMonth.setPageLength(13);
DateHelper.getMonthsInYear()
.forEach(month -> birthDateMonth.setItemCaption(month, de.symeda.sormas.api.Month.values()[month - 1].toString()));
}

if (!getField(PersonDto.OCCUPATION_TYPE).isVisible()
&& !getField(PersonDto.ARMED_FORCES_RELATION_TYPE).isVisible()
&& !getField(PersonDto.EDUCATION_TYPE).isVisible())
Expand Down

0 comments on commit edd72b4

Please sign in to comment.