@Override
protected ActionForward prepareShowDegreeModulesToEnrol(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response, StudentCurricularPlan studentCurricularPlan, ExecutionSemester executionSemester) {
final EnrolmentPreConditionResult result =
StudentCurricularPlanEnrolmentPreConditions.checkPreConditionsToEnrol(studentCurricularPlan, executionSemester);
if (!result.isValid()) {
if (result.getEnrolmentPeriod() != null) {
DateTime now = DateTime.now().withMillisOfSecond(0);
DateTime start = result.getEnrolmentPeriod().getStartDateDateTime();
Period period = new Period(start.getMillis() - now.getMillis());
if (start.toLocalDate().equals(now.toLocalDate())) {
request.setAttribute("now", now);
request.setAttribute("start", start);
request.setAttribute("remaining", FORMATTER.print(period));
}
}
addActionMessage(request, result.message(), result.args());
return mapping.findForward("enrollmentCannotProceed");
}
return super.prepareShowDegreeModulesToEnrol(mapping, form, request, response, studentCurricularPlan, executionSemester);
}