diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index 38ce659..4ee4198 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -92,6 +92,7 @@ public class ConferenceService extends BaseService { conferenceDto.setName(conferenceDto.getTitle()); filterEmptyDeadlines(conferenceDto); checkEmptyFieldsOfDeadline(conferenceDto, errors); + checkEmptyFieldsOfDates(conferenceDto, errors); checkUniqueName(conferenceDto, errors, conferenceDto.getId(), @@ -301,6 +302,12 @@ public class ConferenceService extends BaseService { } } + private void checkEmptyFieldsOfDates(ConferenceDto conferenceDto, Errors errors) { + if (conferenceDto.getBeginDate() == null || conferenceDto.getEndDate() == null) { + errors.rejectValue("beginDate", "errorCode", "Даты должны быть заполнены"); + } + } + public void filterEmptyDeadlines(ConferenceDto conferenceDto) { conferenceDto.setDeadlines(conferenceDto.getDeadlines().stream() .filter(dto -> dto.getDate() != null || !org.springframework.util.StringUtils.isEmpty(dto.getDescription())) diff --git a/src/main/resources/templates/conferences/conference.html b/src/main/resources/templates/conferences/conference.html index d629d4e..201aa01 100644 --- a/src/main/resources/templates/conferences/conference.html +++ b/src/main/resources/templates/conferences/conference.html @@ -42,12 +42,20 @@ placeholder="http://"/> +

Incorrect description

+

+
+

Incorrect description

+

+
@@ -65,6 +73,7 @@
+

Incorrect title

@@ -94,6 +103,10 @@ +

Incorrect date

+

@@ -123,7 +136,6 @@
-