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 @@