FR [ 1828521 ] Centralized ID management
changed Official dictionary default to Y - project default to N for projects don't update if the current sequence is greater (help to manage sequences for project independent from customer)
This commit is contained in:
parent
072a31b274
commit
5e735aeb8e
|
@ -156,8 +156,8 @@ public class MSequence extends X_AD_Sequence
|
|||
// If maintaining official dictionary try to get the ID from http official server
|
||||
if (adempiereSys) {
|
||||
|
||||
String isUseCentralizedID = MSysConfig.getValue("DICTIONARY_ID_USE_CENTRALIZED_ID"); // "Y"
|
||||
if (isUseCentralizedID != null && isUseCentralizedID.equals("Y")) {
|
||||
String isUseCentralizedID = MSysConfig.getValue("DICTIONARY_ID_USE_CENTRALIZED_ID", "Y"); // defaults to Y
|
||||
if (! isUseCentralizedID.equals("N")) {
|
||||
// get ID from http site
|
||||
retValue = getNextOfficialID_HTTP(TableName);
|
||||
if (retValue > 0) {
|
||||
|
@ -176,13 +176,13 @@ public class MSequence extends X_AD_Sequence
|
|||
// If not official dictionary try to get the ID from http custom server - if configured
|
||||
if (hasEntityType && ! adempiereSys) {
|
||||
|
||||
String isUseProjectCentralizedID = MSysConfig.getValue("PROJECT_ID_USE_CENTRALIZED_ID"); // "Y"
|
||||
if (isUseProjectCentralizedID != null && isUseProjectCentralizedID.equals("Y")) {
|
||||
String isUseProjectCentralizedID = MSysConfig.getValue("PROJECT_ID_USE_CENTRALIZED_ID", "N"); // defaults to N
|
||||
if (isUseProjectCentralizedID.equals("Y")) {
|
||||
// get ID from http site
|
||||
retValue = getNextProjectID_HTTP(TableName);
|
||||
if (retValue > 0) {
|
||||
PreparedStatement updateSQL;
|
||||
updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNext = ? + 1 WHERE AD_Sequence_ID = ?");
|
||||
updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNext = GREATEST(CurrentNext, ? + 1) WHERE AD_Sequence_ID = ?");
|
||||
updateSQL.setInt(1, retValue);
|
||||
updateSQL.setInt(2, AD_Sequence_ID);
|
||||
updateSQL.executeUpdate();
|
||||
|
|
|
@ -58,9 +58,10 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
/**
|
||||
* Get system configuration property of type string
|
||||
* @param Name
|
||||
* @param defaultValue
|
||||
* @return String
|
||||
*/
|
||||
public static String getValue(String Name)
|
||||
public static String getValue(String Name, String defaultValue)
|
||||
{
|
||||
String str = null;
|
||||
String sql = "SELECT Value FROM AD_SysConfig WHERE Name=? and IsActive='Y'";
|
||||
|
@ -79,10 +80,20 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
s_log.log(Level.SEVERE, "getValue", e);
|
||||
}
|
||||
if (str == null)
|
||||
return null;
|
||||
return defaultValue;
|
||||
return (str.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system configuration property of type string
|
||||
* @param Name
|
||||
* @return String
|
||||
*/
|
||||
public static String getValue(String Name)
|
||||
{
|
||||
return (getValue(Name, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system configuration property of type int
|
||||
* @param Name
|
||||
|
|
Loading…
Reference in New Issue