BF [ 1797687 ] Find Form: boolean is not working ok
Revert rev. 3376
This commit is contained in:
parent
ea00e8044e
commit
fadbae72f0
|
@ -38,9 +38,6 @@ 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
|
||||||
|
@ -728,10 +725,12 @@ 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 != null ? value.toString() : parsedValue.toString();
|
String infoDisplay = value.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)
|
||||||
|
@ -740,10 +739,12 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -751,7 +752,9 @@ public final class Find extends CDialog
|
||||||
if (!(parsedValue instanceof Integer)) {
|
if (!(parsedValue instanceof Integer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_query.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
m_query
|
||||||
|
|
||||||
|
.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
|
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
|
||||||
|
@ -865,6 +868,8 @@ 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
|
||||||
{
|
{
|
||||||
|
@ -872,8 +877,6 @@ 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());
|
||||||
|
@ -882,8 +885,6 @@ 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());
|
||||||
|
@ -891,8 +892,6 @@ 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;
|
||||||
|
@ -909,13 +908,8 @@ 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 (DisplayType.YesNo == dt)
|
else if (in instanceof Boolean)
|
||||||
{
|
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