FR [ 1797687 ] Find Form: boolean is not working ok
http://sourceforge.net/tracker/index.php?func=detail&aid=1797687&group_id=176962&atid=879332
This commit is contained in:
parent
fa784a467b
commit
604f134059
|
@ -38,6 +38,9 @@ import org.compiere.util.*;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: Find.java,v 1.3 2006/07/30 00:51:27 jjanke Exp $
|
* @version $Id: Find.java,v 1.3 2006/07/30 00:51:27 jjanke Exp $
|
||||||
|
*
|
||||||
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||||
|
* <li>FR [ 1797687 ] Find Form: boolean is not working ok
|
||||||
*/
|
*/
|
||||||
public final class Find extends CDialog
|
public final class Find extends CDialog
|
||||||
implements ActionListener, ChangeListener, DataStatusListener
|
implements ActionListener, ChangeListener, DataStatusListener
|
||||||
|
@ -725,12 +728,10 @@ public final class Find extends CDialog
|
||||||
|
|
||||||
// Value ******
|
// Value ******
|
||||||
Object value = advancedTable.getValueAt(row, INDEX_VALUE);
|
Object value = advancedTable.getValueAt(row, INDEX_VALUE);
|
||||||
if (value == null)
|
|
||||||
continue;
|
|
||||||
Object parsedValue = parseValue(field, value);
|
Object parsedValue = parseValue(field, value);
|
||||||
if (parsedValue == null)
|
if (parsedValue == null)
|
||||||
continue;
|
continue;
|
||||||
String infoDisplay = value.toString();
|
String infoDisplay = value != null ? value.toString() : parsedValue.toString();
|
||||||
if (field.isLookup())
|
if (field.isLookup())
|
||||||
infoDisplay = field.getLookup().getDisplay(value);
|
infoDisplay = field.getLookup().getDisplay(value);
|
||||||
else if (field.getDisplayType() == DisplayType.YesNo)
|
else if (field.getDisplayType() == DisplayType.YesNo)
|
||||||
|
@ -739,12 +740,10 @@ public final class Find extends CDialog
|
||||||
if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].equals(op))
|
if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].equals(op))
|
||||||
{
|
{
|
||||||
Object value2 = advancedTable.getValueAt(row, INDEX_VALUE2);
|
Object value2 = advancedTable.getValueAt(row, INDEX_VALUE2);
|
||||||
if (value2 == null)
|
|
||||||
continue;
|
|
||||||
Object parsedValue2 = parseValue(field, value2);
|
Object parsedValue2 = parseValue(field, value2);
|
||||||
String infoDisplay_to = value2.toString();
|
|
||||||
if (parsedValue2 == null)
|
if (parsedValue2 == null)
|
||||||
continue;
|
continue;
|
||||||
|
String infoDisplay_to = value2 != null ? value2.toString() : parsedValue2.toString();
|
||||||
m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2,
|
m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2,
|
||||||
infoName, infoDisplay, infoDisplay_to);
|
infoName, infoDisplay, infoDisplay_to);
|
||||||
}
|
}
|
||||||
|
@ -752,9 +751,7 @@ public final class Find extends CDialog
|
||||||
if (!(parsedValue instanceof Integer)) {
|
if (!(parsedValue instanceof Integer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_query
|
m_query.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
||||||
|
|
||||||
.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
|
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
|
||||||
|
@ -868,8 +865,6 @@ public final class Find extends CDialog
|
||||||
*/
|
*/
|
||||||
private Object parseValue (GridField field, Object in)
|
private Object parseValue (GridField field, Object in)
|
||||||
{
|
{
|
||||||
if (in == null)
|
|
||||||
return null;
|
|
||||||
int dt = field.getDisplayType();
|
int dt = field.getDisplayType();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -877,6 +872,8 @@ public final class Find extends CDialog
|
||||||
if (dt == DisplayType.Integer
|
if (dt == DisplayType.Integer
|
||||||
|| (DisplayType.isID(dt) && field.getColumnName().endsWith("_ID")))
|
|| (DisplayType.isID(dt) && field.getColumnName().endsWith("_ID")))
|
||||||
{
|
{
|
||||||
|
if (in == null)
|
||||||
|
return null;
|
||||||
if (in instanceof Integer)
|
if (in instanceof Integer)
|
||||||
return in;
|
return in;
|
||||||
int i = Integer.parseInt(in.toString());
|
int i = Integer.parseInt(in.toString());
|
||||||
|
@ -885,6 +882,8 @@ public final class Find extends CDialog
|
||||||
// Return BigDecimal
|
// Return BigDecimal
|
||||||
else if (DisplayType.isNumeric(dt))
|
else if (DisplayType.isNumeric(dt))
|
||||||
{
|
{
|
||||||
|
if (in == null)
|
||||||
|
return null;
|
||||||
if (in instanceof BigDecimal)
|
if (in instanceof BigDecimal)
|
||||||
return in;
|
return in;
|
||||||
return DisplayType.getNumberFormat(dt).parse(in.toString());
|
return DisplayType.getNumberFormat(dt).parse(in.toString());
|
||||||
|
@ -892,6 +891,8 @@ public final class Find extends CDialog
|
||||||
// Return Timestamp
|
// Return Timestamp
|
||||||
else if (DisplayType.isDate(dt))
|
else if (DisplayType.isDate(dt))
|
||||||
{
|
{
|
||||||
|
if (in == null)
|
||||||
|
return null;
|
||||||
if (in instanceof Timestamp)
|
if (in instanceof Timestamp)
|
||||||
return in;
|
return in;
|
||||||
long time = 0;
|
long time = 0;
|
||||||
|
@ -908,8 +909,13 @@ public final class Find extends CDialog
|
||||||
return new Timestamp(time);
|
return new Timestamp(time);
|
||||||
}
|
}
|
||||||
// Return Y/N for Boolean
|
// Return Y/N for Boolean
|
||||||
else if (in instanceof Boolean)
|
else if (DisplayType.YesNo == dt)
|
||||||
return ((Boolean)in).booleanValue() ? "Y" : "N";
|
{
|
||||||
|
if (in == null)
|
||||||
|
return "N";
|
||||||
|
else if (in instanceof Boolean)
|
||||||
|
return ((Boolean)in).booleanValue() ? "Y" : "N";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue