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.

This commit is contained in:
Elaine Tan 2013-10-25 17:49:21 +08:00
parent 58eda8b794
commit fae720a6dd
7 changed files with 32 additions and 18 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -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());
}

View File

@ -33,7 +33,7 @@ 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<MAddressValidation> list = new ArrayList<MAddressValidation>();
@ -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));
@ -100,9 +96,9 @@ public class MAddressValidation extends X_C_AddressValidation {
}
//
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;

View File

@ -42,7 +42,7 @@ 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";
@ -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

View File

@ -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);

View File

@ -418,7 +418,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
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);