Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FINERACT-618 Allow for Submitted On Date to be Edited for Groups #494

Merged
merged 1 commit into from Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -345,6 +345,18 @@ public Map<String, Object> update(final JsonCommand command) {
this.accountNumber = StringUtils.defaultIfEmpty(newValue, null);
}

if (command.isChangeInLocalDateParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName, getSubmittedOnDate())) {
final String valueAsInput = command.stringValueOfParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName);
actualChanges.put(GroupingTypesApiConstants.submittedOnDateParamName, valueAsInput);
actualChanges.put(GroupingTypesApiConstants.dateFormatParamName, dateFormatAsInput);
actualChanges.put(GroupingTypesApiConstants.localeParamName, localeAsInput);

final LocalDate newValue = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName);
if (newValue != null) {
this.submittedOnDate = newValue.toDate();
}
}

return actualChanges;
}

Expand Down
Expand Up @@ -374,6 +374,12 @@ public void validateForUpdateGroup(final JsonCommand command) {
}
}

if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element)) {
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(
GroupingTypesApiConstants.submittedOnDateParamName, element);
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
}

throwExceptionIfValidationWarningsExist(dataValidationErrors);
}

Expand Down