From fae720a6dd9d77576dee87090cf9d86a973977b7 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Fri, 25 Oct 2013 17:49:21 +0800 Subject: [PATCH] IDEMPIERE-1286 Improve address validation configuration to support external services - Add ADDRESS_SAVE_REQUEST_RESPONSE_LOG system configurator. Revise get address validation list query do not filtered by AD_Org_ID. --- .../oracle/201310251520_IDEMPIERE-1286.sql | 10 ++++++++++ .../201310251520_IDEMPIERE-1286.sql | 7 +++++++ .../event/AddressValidationEventHandler.java | 2 +- .../compiere/model/MAddressValidation.java | 20 ++++++++----------- .../src/org/compiere/model/MSysConfig.java | 7 ++++--- .../org/compiere/grid/ed/VLocationDialog.java | 2 +- .../webui/window/WLocationDialog.java | 2 +- 7 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 migration/i1.0z/oracle/201310251520_IDEMPIERE-1286.sql create mode 100644 migration/i1.0z/postgresql/201310251520_IDEMPIERE-1286.sql diff --git a/migration/i1.0z/oracle/201310251520_IDEMPIERE-1286.sql b/migration/i1.0z/oracle/201310251520_IDEMPIERE-1286.sql new file mode 100644 index 0000000000..90d7ee28ed --- /dev/null +++ b/migration/i1.0z/oracle/201310251520_IDEMPIERE-1286.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Oct 25, 2013 3:18:28 PM SGT +-- IDEMPIERE-1286 Improve address validation configuration to support external services +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200038,'S','N','070c9a65-7c15-4ed5-9239-d47902a78ca4',TO_DATE('2013-10-25 15:18:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-10-25 15:18:26','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ADDRESS_SAVE_REQUEST_RESPONSE_LOG',0,'D') +; + +SELECT register_migration_script('201310251520_IDEMPIERE-1286.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i1.0z/postgresql/201310251520_IDEMPIERE-1286.sql b/migration/i1.0z/postgresql/201310251520_IDEMPIERE-1286.sql new file mode 100644 index 0000000000..25e241a26b --- /dev/null +++ b/migration/i1.0z/postgresql/201310251520_IDEMPIERE-1286.sql @@ -0,0 +1,7 @@ +-- Oct 25, 2013 3:18:28 PM SGT +-- IDEMPIERE-1286 Improve address validation configuration to support external services +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200038,'S','N','070c9a65-7c15-4ed5-9239-d47902a78ca4',TO_TIMESTAMP('2013-10-25 15:18:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-10-25 15:18:26','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ADDRESS_SAVE_REQUEST_RESPONSE_LOG',0,'D') +; + +SELECT register_migration_script('201310251520_IDEMPIERE-1286.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/adempiere/base/event/AddressValidationEventHandler.java b/org.adempiere.base/src/org/adempiere/base/event/AddressValidationEventHandler.java index 1fca0e7b9d..7b8fb7da16 100644 --- a/org.adempiere.base/src/org/adempiere/base/event/AddressValidationEventHandler.java +++ b/org.adempiere.base/src/org/adempiere/base/event/AddressValidationEventHandler.java @@ -62,7 +62,7 @@ public class AddressValidationEventHandler extends AbstractEventHandler { if (location.getC_AddressValidation_ID() > 0) validation = new MAddressValidation(location.getCtx(), location.getC_AddressValidation_ID(), location.get_TrxName()); if (validation == null) - validation = MAddressValidation.getDefaultAddressValidation(location.getCtx(), location.getAD_Client_ID(), location.getAD_Org_ID(), location.get_TrxName()); + validation = MAddressValidation.getDefaultAddressValidation(location.getCtx(), location.getAD_Client_ID(), location.get_TrxName()); if (validation != null) location.processOnline(validation.getC_AddressValidation_ID()); } diff --git a/org.adempiere.base/src/org/compiere/model/MAddressValidation.java b/org.adempiere.base/src/org/compiere/model/MAddressValidation.java index 8f0d0406b3..ba942c61ca 100644 --- a/org.adempiere.base/src/org/compiere/model/MAddressValidation.java +++ b/org.adempiere.base/src/org/compiere/model/MAddressValidation.java @@ -28,12 +28,12 @@ import org.compiere.util.DB; * @author Elaine * */ -public class MAddressValidation extends X_C_AddressValidation { +public class MAddressValidation extends X_C_AddressValidation { /** * */ - private static final long serialVersionUID = -6593449454853401744L; + private static final long serialVersionUID = 8194097022422808757L; /** Static Logger */ private static CLogger s_log = CLogger.getCLogger(MAddressValidation.class); @@ -42,13 +42,12 @@ public class MAddressValidation extends X_C_AddressValidation { * Get default address validation * @param ctx * @param AD_Client_ID - * @param AD_Org_ID * @param trxName * @return address validation */ - public static MAddressValidation getDefaultAddressValidation(Properties ctx, int AD_Client_ID, int AD_Org_ID, String trxName) + public static MAddressValidation getDefaultAddressValidation(Properties ctx, int AD_Client_ID, String trxName) { - MAddressValidation[] validations = getAddressValidation(ctx, AD_Client_ID, AD_Org_ID, trxName); + MAddressValidation[] validations = getAddressValidation(ctx, AD_Client_ID, trxName); if (validations.length == 0) return null; return validations[0]; @@ -58,11 +57,10 @@ public class MAddressValidation extends X_C_AddressValidation { * Get address validations * @param ctx * @param AD_Client_ID - * @param AD_Org_ID * @param trxName * @return array of address validation */ - public static MAddressValidation[] getAddressValidation(Properties ctx, int AD_Client_ID, int AD_Org_ID, String trxName) + public static MAddressValidation[] getAddressValidation(Properties ctx, int AD_Client_ID, String trxName) { ArrayList list = new ArrayList(); @@ -73,7 +71,6 @@ public class MAddressValidation extends X_C_AddressValidation { sql.append("AND tpc.IsActive = 'Y' "); sql.append("AND tp.IsActive = 'Y' "); sql.append("AND tp.AD_Client_ID = ? "); - sql.append("AND tp.AD_Org_ID IN (0, ?) "); sql.append("ORDER BY tp.AD_Org_ID DESC, tp.SeqNo"); // PreparedStatement pstmt = null; @@ -82,7 +79,6 @@ public class MAddressValidation extends X_C_AddressValidation { { pstmt = DB.prepareStatement(sql.toString(), trxName); pstmt.setInt(1, AD_Client_ID); - pstmt.setInt(2, AD_Org_ID); rs = pstmt.executeQuery(); while (rs.next()) list.add(new MAddressValidation(ctx, rs, trxName)); @@ -97,12 +93,12 @@ public class MAddressValidation extends X_C_AddressValidation { DB.close(rs, pstmt); rs = null; pstmt = null; - } + } // if (list.size() == 0) - s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID + ", AD_Org_ID=" + AD_Org_ID); + s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID); else - if (s_log.isLoggable(Level.FINE)) s_log.fine("find - #" + list.size() + " - AD_Client_ID=" + AD_Client_ID + ", AD_Org_ID=" + AD_Org_ID); + if (s_log.isLoggable(Level.FINE)) s_log.fine("find - #" + list.size() + " - AD_Client_ID=" + AD_Client_ID); MAddressValidation[] retValue = new MAddressValidation[list.size()]; list.toArray(retValue); return retValue; diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 4f8e85875f..62f17c2413 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,8 +42,8 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -8929067871181338266L; - + private static final long serialVersionUID = 4741060210080877182L; + public final static String PDF_FONT_DIR = "PDF_FONT_DIR"; public final static String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS"; public static final String ZK_DESKTOP_CLASS = "ZK_DESKTOP_CLASS"; @@ -118,9 +118,10 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_MAX_UPLOAD_SIZE = "ZK_MAX_UPLOAD_SIZE"; public static final String CALENDAR_ALTERNATE_TIMEZONE = "CALENDAR_ALTERNATE_TIMEZONE"; public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE"; - public static final String ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER = "ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER"; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String TAX_SAVE_REQUEST_RESPONSE_LOG = "TAX_SAVE_REQUEST_RESPONSE_LOG"; + public static final String ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER = "ZK_PRINT_SHIPPING_LABEL_SHARED_TEMP_FOLDER"; + public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG"; /** * Standard Constructor diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java index 3076974e23..fa4e7a9db5 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java @@ -422,7 +422,7 @@ public class VLocationDialog extends CDialog { addLine(line++, new CLabel(Msg.getElement(Env.getCtx(), "C_AddressValidation_ID")), lstAddressValidation); - MAddressValidation[] validations = MAddressValidation.getAddressValidation(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()), null); + MAddressValidation[] validations = MAddressValidation.getAddressValidation(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()), null); for (MAddressValidation validation : validations) { lstAddressValidation.addItem(validation); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java index 74495ea74a..5754d031e1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java @@ -418,7 +418,7 @@ public class WLocationDialog extends Window implements EventListener row.appendCellChild(lstAddressValidation, 2); lstAddressValidation.setHflex("1"); - MAddressValidation[] validations = MAddressValidation.getAddressValidation(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()), null); + MAddressValidation[] validations = MAddressValidation.getAddressValidation(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()), null); for (MAddressValidation validation : validations) { ListItem li = lstAddressValidation.appendItem(validation.getName(), validation);