Ejemplo n.º 1
0
  private String[] validateSearchCriteria() {
    ArrayList<String> listOfErrors = new ArrayList<String>();
    SurgicalOPNotesFilterVo sonf = populateSearchDataFromScreen();

    if (sonf.countFieldsWithValue() == 0) {
      listOfErrors.add("Please fill in at least one search field");
    } else {
      Date today = new Date();
      if (today.isLessThan(sonf.getDateFrom())) {
        listOfErrors.add("'Date From' cannot be set to a date in the future."); // WDEV-18762
      }
      if (today.isLessThan(sonf.getDateTo())) {
        listOfErrors.add("'Date To' cannot be set to a date in the future."); // WDEV-18762
      }
      if (sonf.getDateToIsNotNull()
          && sonf.getDateFromIsNotNull()
          && sonf.getDateFrom().isGreaterThan(sonf.getDateTo())) {

        listOfErrors.add("'Date From' cannot be later than 'Date To'."); // WDEV-18762
      }
    }
    if (listOfErrors.size() == 0) return null;
    String[] errors = new String[listOfErrors.size()];
    errors = listOfErrors.toArray(errors);
    return errors;
  }