Пример #1
0
  @Override
  public erp.lib.form.SFormValidation formValidate() {
    SFormValidation validation = new SFormValidation();

    for (int i = 0; i < mvFields.size(); i++) {
      if (!((erp.lib.form.SFormField) mvFields.get(i)).validateField()) {
        validation.setIsError(true);
        validation.setComponent(mvFields.get(i).getComponent());
        break;
      }
    }

    if (moExchangeRate == null && !validation.getIsError()) {
      if (moFieldPkCurrencyId.getKeyAsIntArray()[0]
          == miClient.getSessionXXX().getParamsErp().getFkCurrencyId()) {
        validation.setMessage(
            "La moneda del tipo de cambio no puede ser la moneda local del sistema.");
        validation.setComponent(jcbPkCurrencyId);
      } else {
        if (SDataUtilities.callProcedureVal(
                miClient,
                SProcConstants.FIN_EXC_RATE_VAL,
                new Object[] {moFieldPkCurrencyId.getKeyAsIntArray()[0], moFieldPkDateId.getDate()},
                SLibConstants.EXEC_MODE_VERBOSE)
            > 0) {
          validation.setMessage("Ya existe un registro para la moneda y fecha especificadas.");
          validation.setComponent(jftPkDateId);
        }
      }
    }

    return validation;
  }
Пример #2
0
  private void actionOk() {
    SFormValidation validation = formValidate();

    if (validation.getIsError()) {
      if (validation.getComponent() != null) {
        validation.getComponent().requestFocus();
      }
      if (validation.getMessage().length() > 0) {
        miClient.showMsgBoxWarning(validation.getMessage());
      }
    } else {
      mnFormResult = SLibConstants.FORM_RESULT_OK;
      setVisible(false);
    }
  }