Пример #1
0
  public void validate() {
    String actionName = "";
    if (parameters.get(ACTION_NAME) != null && parameters.get(ACTION_NAME)[0] != null)
      actionName = parameters.get(ACTION_NAME)[0];

    if (!(actionName.equalsIgnoreCase(REJECT_ACTION)
        || actionName.equalsIgnoreCase(CANCEL_ACTION))) {
      if (voucherHeader.getVoucherDate() == null)
        addFieldError("voucherDate", getText("arf.payment.voucherdate.required"));
      if (!DateUtils.compareDates(
          voucherHeader.getVoucherDate(), advanceRequisition.getAdvanceRequisitionDate()))
        addFieldError(
            "advanceRequisitionDate",
            getText("arf.payment.voucherdate.lessthan.advancerequisitiondate"));
      if (!DateUtils.compareDates(new Date(), voucherHeader.getVoucherDate()))
        addFieldError(
            "advanceRequisitionDate",
            getText("arf.validate.payment.voucherdate.greaterthan.currentDate"));

      if (StringUtils.isBlank(commonBean.getBankId()) || commonBean.getBankId().equals("-1"))
        addFieldError("commonBean.bankId", getText("arf.bankbranch.required"));

      if (StringUtils.isBlank(commonBean.getAccountNumberId())
          || commonBean.getAccountNumberId().equals("-1"))
        addFieldError("commonBean.accountNumberId", getText("arf.accountnumber.required"));
      if (StringUtils.isBlank(commonBean.getModeOfPayment()))
        addFieldError("commonBean.modeOfPayment", getText("arf.modeOfPayment.required"));
    }
  }
  public String searchList() {
    getPersistenceService().getSession().setDefaultReadOnly(true);
    getPersistenceService().getSession().setFlushMode(FlushMode.MANUAL);
    boolean isError = false;
    if (fromDate != null && toDate == null) {
      addFieldError("enddate", getText("search.endDate.null"));
      isError = true;
    }
    if (toDate != null && fromDate == null) {
      addFieldError("startdate", getText("search.startDate.null"));
      isError = true;
    }

    if (!DateUtils.compareDates(toDate, fromDate)) {
      addFieldError("enddate", getText("greaterthan.endDate.fromDate"));
      isError = true;
    }

    if (isError) {
      return "search";
    }

    setPageSize(WorksConstants.PAGE_SIZE);
    super.search();

    if (searchResult != null
        && searchResult.getList() != null
        && !searchResult.getList().isEmpty()) {
      setTenderType();
    }
    return "search";
  }