From 0cea1c7fe15eb93836f3ddc26dd41e07201981f4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 25 Feb 2015 13:44:42 -0500 Subject: [PATCH] IDEMPIERE-2477 Generate boolean in 2Pack as Y/N instead of true/false --- .../pipo2/handler/CommonTranslationHandler.java | 4 ++-- .../adempiere/pipo2/handler/MenuElementHandler.java | 13 ++----------- .../src/org/adempiere/pipo2/PoExporter.java | 4 ++-- .../src/org/adempiere/pipo2/PoFiller.java | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java index 40901fc17f..f347c29475 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java @@ -121,7 +121,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements if(columnName.equalsIgnoreCase("IsActive") || columnName.equalsIgnoreCase("IsTranslated")){ - value = "true".equals(value) ? "Y" : "N"; + value = "true".equals(value) || "Y".equals(value) ? "Y" : "N"; } pstm.setString(i, value); } @@ -161,7 +161,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements if(columnName.equalsIgnoreCase("IsActive") || columnName.equalsIgnoreCase("IsTranslated")){ - value = "true".equals(value) ? "Y" : "N"; + value = "true".equals(value) || "Y".equals(value) ? "Y" : "N"; } pstm.setString(i, value); diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java index fa4cb8d8cb..edbbff4eab 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/MenuElementHandler.java @@ -133,17 +133,8 @@ public class MenuElementHandler extends AbstractElementHandler { int columnID = DB.getSQLValue(getTrxName(ctx), sql, colName, tableID); sql = "SELECT AD_Reference_ID FROM AD_COLUMN WHERE AD_Column_ID = ?"; int referenceID = DB.getSQLValue(getTrxName(ctx), sql, columnID); - if (referenceID == 20 || referenceID == 28) - if (rs.getObject(q).equals("Y")) - colValue = "true"; - else - colValue = "false"; - else - { - Object obj = rs.getObject(q); - colValue = obj == null ? "" : obj.toString(); - } - + Object obj = rs.getObject(q); + colValue = obj == null ? "" : obj.toString(); X_AD_Package_Imp_Backup backup = new X_AD_Package_Imp_Backup(ctx.ctx, 0, getTrxName(ctx)); backup.setAD_Package_Imp_Detail_ID(impDetail.getAD_Package_Imp_Detail_ID()); backup.setAD_Package_Imp_ID(getPackageImpId(ctx.ctx)); diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java index 6cd744c5fd..3325d8118c 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PoExporter.java @@ -90,7 +90,7 @@ public class PoExporter { * @param boolValue */ public void addBoolean(String name, boolean boolValue, AttributesImpl atts){ - addTextElement(name, boolValue == true ? "true" : "false", atts); + addTextElement(name, boolValue == true ? "Y" : "N", atts); } @@ -120,7 +120,7 @@ public class PoExporter { if(value instanceof String){ addTextElement(columnName, (String)value, atts); } else if(value instanceof Boolean) { - addTextElement(columnName, (Boolean)value == true ? "true" : "false", atts); + addTextElement(columnName, (Boolean)value == true ? "Y" : "N", atts); } else if(value instanceof Integer) { addTextElement(columnName, value.toString(), atts); } else if(value instanceof BigDecimal) { diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java index 39f4d16b35..1f7136d27a 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/PoFiller.java @@ -70,7 +70,7 @@ public class PoFiller{ Element e = element.properties.get(columnName); String value = e != null ? e.contents.toString() : null; - boolean bool = "true".equals(value) ? true : false; + boolean bool = "true".equals(value) || "Y".equals(value) ? true : false; if (po.get_Value(columnName) != null && po.get_ValueAsBoolean(columnName) == bool) return;