Skip to content

Commit

Permalink
#675 serialize restricted values also for checkbox and radio
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Aug 30, 2019
1 parent 17987d8 commit 126642a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/alfio/manager/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import alfio.model.PromoCodeDiscount.DiscountType;
import alfio.model.Ticket.TicketStatus;
import alfio.model.TicketFieldConfiguration.Context;
import alfio.model.api.v1.admin.EventCreationRequest;
import alfio.model.modification.*;
import alfio.model.modification.EventModification.AdditionalField;
import alfio.model.result.ErrorCode;
Expand Down Expand Up @@ -239,11 +240,11 @@ private void createAdditionalFields(EventAndOrganizationId event, EventModificat
}

private static String toSerializedRestrictedValues(EventModification.WithRestrictedValues f) {
return "select".equals(f.getType()) ? generateJsonForList(f.getRestrictedValuesAsString()) : null;
return EventCreationRequest.WITH_RESTRICTED_VALUES.contains(f.getType()) ? generateJsonForList(f.getRestrictedValuesAsString()) : null;
}

private static String toSerializedDisabledValues(EventModification.WithRestrictedValues f) {
return "select".equals(f.getType()) ? generateJsonForList(f.getDisabledValuesAsString()) : null;
return EventCreationRequest.WITH_RESTRICTED_VALUES.contains(f.getType()) ? generateJsonForList(f.getDisabledValuesAsString()) : null;
}

private static String generateJsonForList(Collection<?> values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ enum AdditionalInfoType {

}

public static Set<String> WITH_RESTRICTED_VALUES = Set.of(AdditionalInfoType.LIST_BOX.code, AdditionalInfoType.CHECKBOX.code, AdditionalInfoType.RADIO.code);

@Getter
@AllArgsConstructor
public static class ContentLengthRequest {
Expand Down

0 comments on commit 126642a

Please sign in to comment.