if (request.getParameter("timeslip") != null) {
if (request.getParameter("timeslip").equalsIgnoreCase("support")) {
if ((String)get("description") == null
|| ((String)get("description")).trim().length() <= 0) {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
"error.general.requiredField", "Description"));
}
}
} else {
String project = (String)get("project");
if (project != null && (!project.equals(""))) {
if ((String)get("reference") == null || ((String)get("reference")).trim().length() <= 0) {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
"error.general.requiredField", "Reference"));
}
if ((String)get("task") == null || ((String)get("task")).trim().length() <= 0) {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
"error.general.requiredField", "Task"));
}
}
if ((String)get("description") == null || ((String)get("description")).trim().length() <= 0) {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
"error.general.requiredField", "Description"));
}
}
int startHrs = 0, startMins = 0, endHrs = 0, endMins = 0;
if (((String)get("startTime")) != null && !(((String)get("startTime")).equals(""))) {
int[] startTime = CVUtility.convertTimeTo24HrsFormat((String)get("startTime"));
startHrs = startTime[0];
startMins = startTime[1];
}
if (((String)get("endTime")) != null && !(((String)get("endTime")).equals(""))) {
int[] endTime = CVUtility.convertTimeTo24HrsFormat((String)get("endTime"));
endHrs = endTime[0];
endMins = endTime[1];
}
if (startHrs > endHrs) {
ActionMessage error = new ActionMessage("error.application.timecomparison", "EndTime",
"StartTime");
errors.add("error.application.timecomparison", error);
} else if (startHrs == endHrs && startMins > endMins) {
ActionMessage error = new ActionMessage("error.application.timecomparison", "EndTime",
"StartTime");
errors.add("error.application.timecomparison", error);
}
fBreakHrs = Float.parseFloat((String)get("breakHours"));
fBreakMins = Float.parseFloat((String)get("breakMinutes"));
fBreakTime = 0;
if (fBreakMins != 0) {
fBreakTime = fBreakHrs + fBreakMins / 60;
} else {
fBreakTime = fBreakHrs;
}
float remMin = 0;
if (startMins != 0 && endMins != 0) {
if (endMins > startMins) {
remMin = 60 / (endMins - startMins);
} else {
remMin = 60 / (startMins - endMins);
}
}
Float Duration = new Float((endHrs - startHrs) + remMin - fBreakTime);
if (Duration.floatValue() <= 0.0) {
ActionMessage error = new ActionMessage("error.projects.timeslip.totaltimediff",
"Start and End Time difference", "BreakTime");
errors.add("error.projects.timeslip.totaltimediff", error);
}
} catch (Exception e) {
logger.error("[validate]: Exception", e);