Merge pull request 'fixes bug#AL-2649' (!175) from AL-2649 into master

Reviewed-on: adm/VentaBoletosAdm#175
Reviewed-by: Lucas Taiã <lucas@rjconsultores.com.br>
master 1.6.6
Gleison da Cruz 2023-05-30 20:29:44 +00:00
commit 1bd1cf0cce
3 changed files with 49 additions and 5 deletions

View File

@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId> <artifactId>ventaboletosadm</artifactId>
<version>1.6.5</version> <version>1.6.6</version>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<modelWeb.version>1.5.1</modelWeb.version> <modelWeb.version>1.5.1</modelWeb.version>
<flyway.version>1.3.6</flyway.version> <flyway.version>1.3.7</flyway.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties> </properties>

View File

@ -0,0 +1,44 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.utilerias;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Locale;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.TypeConverter;
/**
*
* @author Administrador
*/
public class StringDecimalToDecimalConverterScale5 implements TypeConverter {
private static final String FORMAT = "#####0.00000";
public Object coerceToUi(Object val, Component comp) {
if (val != null) {
String format = (String) comp.getAttribute("format");
if (format == null) {
format = FORMAT;
}
DecimalFormat df = new DecimalFormat(format, new java.text.DecimalFormatSymbols(new Locale("pt", "BR")));
return df.format(val);
}
return null;
}
public Object coerceToBean(Object val, Component cmpnt) {
if (val == null) {
return null;
}
if (val instanceof String) {
return (val.toString().trim().isEmpty()) ? (BigDecimal) null : new BigDecimal(val.toString().replace(".", "").replace(",", "."));
}
return null;
}
}

View File

@ -54,10 +54,10 @@
value="${c:l('busquedaCotacaoController.valor.label')}" /> value="${c:l('busquedaCotacaoController.valor.label')}" />
<textbox id="txtValor" width="100%" mold="rounded" <textbox id="txtValor" width="100%" mold="rounded"
constraint="no empty, no zero, no negative, /([0-9]+(\,[0-9][0-9]?)?)?/" constraint="no empty, no zero, no negative"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal" use="com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal"
value="@{winEditarCotacao$composer.cotacao.valor,converter=com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter}" value="@{winEditarCotacao$composer.cotacao.valor,converter=com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverterScale5}"
precision="10" scale="2" /> precision="10" scale="5" />
</row> </row>