From fc334c61f21fa7166add7d7c7dbb57aa299c514d Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 23 May 2018 18:49:40 +0000 Subject: [PATCH] Criado uma constraint para o usuario nao inserir o campo valor = null fixes bug#11105 dev:valdevir qua:victor git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@82053 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ConstraintDecimalBoxNumberValid.java | 26 +++++++++++++++++++ web/gui/pricing/editarPricingImporte.zul | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/java/com/rjconsultores/ventaboletos/web/utilerias/ConstraintDecimalBoxNumberValid.java diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/ConstraintDecimalBoxNumberValid.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/ConstraintDecimalBoxNumberValid.java new file mode 100644 index 000000000..0ee6526d1 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/ConstraintDecimalBoxNumberValid.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.web.utilerias; + +import java.math.BigDecimal; +import org.zkoss.util.resource.Labels; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.WrongValueException; +import org.zkoss.zul.Constraint; + +/** + * + * @author Claudio + */ +public class ConstraintDecimalBoxNumberValid implements Constraint { + + public void validate(Component comp, Object value) throws WrongValueException { + try { + new BigDecimal(value.toString().replace(".", "").replace(",", ".")); + } catch (NumberFormatException e) { + throw new WrongValueException(comp, + Labels.getLabel("MSG.CONSTRAINT.DECIMALBOXISNOTANUMBER")); + } catch (NullPointerException e) { + throw new WrongValueException(comp, + Labels.getLabel("MSG.CONSTRAINT.DECIMALBOXISNOTANUMBER")); + } + } +} diff --git a/web/gui/pricing/editarPricingImporte.zul b/web/gui/pricing/editarPricingImporte.zul index 749ec94c8..c0d0fc0a5 100644 --- a/web/gui/pricing/editarPricingImporte.zul +++ b/web/gui/pricing/editarPricingImporte.zul @@ -32,7 +32,7 @@