}
/* For Form Validation */
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
// cache the form data
convertItemLines();
try {
Validation validation = new Validation();
validation.checkForMaxlength("label.account.expense.description", this
.getExpenseDescription(), "error.application.maxlength", errors, 40);
validation.checkForRequired("label.account.expense.entity", this.getEntity(),
"error.application.required", errors);
validation.checkForRequired("label.account.expense.employee", this.getEmployee(),
"error.application.required", errors);
// validation.checkForRequired("label.account.expense.project",this.getProject(),"error.application.required","",errors);
boolean itemPresent = false;
int counter = 0;
if (this.itemid != null) {
for (int i = 0; i < this.linestatus.length; i++) {
if (this.linestatus[i] != null && this.linestatus[i].equalsIgnoreCase("Deleted")) {
counter++;
}
}
if (this.linestatus.length > 0 && this.linestatus.length != counter) {
itemPresent = true;
}
}
if (itemPresent == false) {
ActionMessage error = new ActionMessage("error.application.required", messages
.getMessage("error.account.expense.itemsrequired"));
errors.add("error.application.required", error);
}
if (errors != null && errors.size() > 0) {
request.setAttribute("TYPEOFSUBMODULE", "ORDER");
request.setAttribute("body", "EDIT");
request.setAttribute("expenseform", this);
}