diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportProduct.java b/org.adempiere.base.process/src/org/compiere/process/ImportProduct.java index 3b2c644945..884b94f9c5 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportProduct.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportProduct.java @@ -75,6 +75,23 @@ public class ImportProduct extends SvrProcess implements ImportProcess m_DateValue = new Timestamp (System.currentTimeMillis()); } // prepare + // Field to copy From Product if Import does not have value + private String[] strFieldsToCopy = new String[] { + "Value", + "Name", + "Description", + "DocumentNote", + "Help", + "UPC", + "SKU", + "Classification", + "ProductType", + "Discontinued", + "DiscontinuedBy", + "DiscontinuedAt", + "ImageURL", + "DescriptionURL" + }; /** * Perform process. @@ -183,20 +200,17 @@ public class ImportProduct extends SvrProcess implements ImportProcess // Copy From Product if Import does not have value - String[] strFields = new String[] {"Value","Name","Description","DocumentNote","Help", - "UPC","SKU","Classification","ProductType", - "Discontinued","DiscontinuedBy","DiscontinuedAt","ImageURL","DescriptionURL"}; - for (int i = 0; i < strFields.length; i++) + for (int i = 0; i < strFieldsToCopy.length; i++) { sql = new StringBuilder ("UPDATE I_Product i ") - .append("SET ").append(strFields[i]).append(" = (SELECT ").append(strFields[i]).append(" FROM M_Product p") + .append("SET ").append(strFieldsToCopy[i]).append(" = (SELECT ").append(strFieldsToCopy[i]).append(" FROM M_Product p") .append(" WHERE i.M_Product_ID=p.M_Product_ID AND i.AD_Client_ID=p.AD_Client_ID) ") .append("WHERE M_Product_ID IS NOT NULL") - .append(" AND ").append(strFields[i]).append(" IS NULL") + .append(" AND ").append(strFieldsToCopy[i]).append(" IS NULL") .append(" AND I_IsImported='N'").append(clientCheck); no = DB.executeUpdate(sql.toString(), get_TrxName()); if (no != 0) - log.fine(strFields[i] + " - default from existing Product=" + no); + log.fine(strFieldsToCopy[i] + " - default from existing Product=" + no); } String[] numFields = new String[] {"C_UOM_ID","M_Product_Category_ID", "Volume","Weight","ShelfWidth","ShelfHeight","ShelfDepth","UnitsPerPallet"}; diff --git a/org.adempiere.base/src/org/compiere/dbPort/Convert.java b/org.adempiere.base/src/org/compiere/dbPort/Convert.java index 349694dd12..6c94b6114a 100644 --- a/org.adempiere.base/src/org/compiere/dbPort/Convert.java +++ b/org.adempiere.base/src/org/compiere/dbPort/Convert.java @@ -477,51 +477,54 @@ public abstract class Convert } } + + private static String [] dontLogTables = new String[] { + "AD_ACCESSLOG", + "AD_ALERTPROCESSORLOG", + "AD_CHANGELOG", + "AD_DOCUMENT_ACTION_ACCESS", + "AD_FORM_ACCESS", + "AD_ISSUE", + "AD_LDAPPROCESSORLOG", + "AD_PACKAGE_IMP", + "AD_PACKAGE_IMP_BACKUP", + "AD_PACKAGE_IMP_DETAIL", + "AD_PACKAGE_IMP_INST", + "AD_PACKAGE_IMP_PROC", + "AD_PINSTANCE", + "AD_PINSTANCE_LOG", + "AD_PINSTANCE_PARA", + "AD_PROCESS_ACCESS", + "AD_RECENTITEM", + "AD_REPLICATION_LOG", + "AD_SCHEDULERLOG", + "AD_SESSION", + "AD_WINDOW_ACCESS", + "AD_WORKFLOW_ACCESS", + "AD_WORKFLOWPROCESSORLOG", + "CM_WEBACCESSLOG", + "C_ACCTPROCESSORLOG", + "K_INDEXLOG", + "R_REQUESTPROCESSORLOG", + "T_AGING", + "T_ALTER_COLUMN", + "T_DISTRIBUTIONRUNDETAIL", + "T_INVENTORYVALUE", + "T_INVOICEGL", + "T_REPLENISH", + "T_REPORT", + "T_REPORTSTATEMENT", + "T_SELECTION", + "T_SELECTION2", + "T_SPOOL", + "T_TRANSACTION", + "T_TRIALBALANCE" + }; + private static boolean dontLog(String statement) { // Do not log *Access records - teo_Sarca BF [ 2782095 ] // IDEMPIERE-323 Migration script log AD_Document_Action_Access (nmicoud / CarlosRuiz_globalqss) - String [] exceptionTables = new String[] { - "AD_ACCESSLOG", - "AD_ALERTPROCESSORLOG", - "AD_CHANGELOG", - "AD_DOCUMENT_ACTION_ACCESS", - "AD_FORM_ACCESS", - "AD_ISSUE", - "AD_LDAPPROCESSORLOG", - "AD_PACKAGE_IMP", - "AD_PACKAGE_IMP_BACKUP", - "AD_PACKAGE_IMP_DETAIL", - "AD_PACKAGE_IMP_INST", - "AD_PACKAGE_IMP_PROC", - "AD_PINSTANCE", - "AD_PINSTANCE_LOG", - "AD_PINSTANCE_PARA", - "AD_PROCESS_ACCESS", - "AD_RECENTITEM", - "AD_REPLICATION_LOG", - "AD_SCHEDULERLOG", - "AD_SESSION", - "AD_WINDOW_ACCESS", - "AD_WORKFLOW_ACCESS", - "AD_WORKFLOWPROCESSORLOG", - "CM_WEBACCESSLOG", - "C_ACCTPROCESSORLOG", - "K_INDEXLOG", - "R_REQUESTPROCESSORLOG", - "T_AGING", - "T_ALTER_COLUMN", - "T_DISTRIBUTIONRUNDETAIL", - "T_INVENTORYVALUE", - "T_INVOICEGL", - "T_REPLENISH", - "T_REPORT", - "T_REPORTSTATEMENT", - "T_SELECTION", - "T_SELECTION2", - "T_SPOOL", - "T_TRANSACTION", - "T_TRIALBALANCE" - }; + String uppStmt = statement.toUpperCase().trim(); // don't log selects if (uppStmt.startsWith("SELECT ")) @@ -532,16 +535,16 @@ public abstract class Convert // Don't log DELETE FROM Some_Table WHERE AD_Table_ID=? AND Record_ID=? if (uppStmt.startsWith("DELETE FROM ") && uppStmt.endsWith(" WHERE AD_TABLE_ID=? AND RECORD_ID=?")) return true; - for (int i = 0; i < exceptionTables.length; i++) { - if (uppStmt.startsWith("INSERT INTO " + exceptionTables[i] + " ")) + for (int i = 0; i < dontLogTables.length; i++) { + if (uppStmt.startsWith("INSERT INTO " + dontLogTables[i] + " ")) return true; - if (uppStmt.startsWith("DELETE FROM " + exceptionTables[i] + " ")) + if (uppStmt.startsWith("DELETE FROM " + dontLogTables[i] + " ")) return true; - if (uppStmt.startsWith("DELETE " + exceptionTables[i] + " ")) + if (uppStmt.startsWith("DELETE " + dontLogTables[i] + " ")) return true; - if (uppStmt.startsWith("UPDATE " + exceptionTables[i] + " ")) + if (uppStmt.startsWith("UPDATE " + dontLogTables[i] + " ")) return true; - if (uppStmt.startsWith("INSERT INTO " + exceptionTables[i] + "(")) + if (uppStmt.startsWith("INSERT INTO " + dontLogTables[i] + "(")) return true; } diff --git a/org.adempiere.base/src/org/compiere/model/MSequence.java b/org.adempiere.base/src/org/compiere/model/MSequence.java index df0ae453ee..96da845401 100644 --- a/org.adempiere.base/src/org/compiere/model/MSequence.java +++ b/org.adempiere.base/src/org/compiere/model/MSequence.java @@ -1310,46 +1310,48 @@ public class MSequence extends X_AD_Sequence return retValue; } + private static String [] dontUseCentralized = new String[] { + "AD_ACCESSLOG", + "AD_ALERTPROCESSORLOG", + "AD_CHANGELOG", + "AD_ISSUE", + "AD_LDAPPROCESSORLOG", + "AD_PACKAGE_IMP", + "AD_PACKAGE_IMP_BACKUP", + "AD_PACKAGE_IMP_DETAIL", + "AD_PACKAGE_IMP_INST", + "AD_PACKAGE_IMP_PROC", + "AD_PINSTANCE", + "AD_PINSTANCE_LOG", + "AD_PINSTANCE_PARA", + "AD_RECENTITEM", + "AD_REPLICATION_LOG", + "AD_SCHEDULERLOG", + "AD_SESSION", + "AD_WORKFLOWPROCESSORLOG", + "CM_WEBACCESSLOG", + "C_ACCTPROCESSORLOG", + "K_INDEXLOG", + "R_REQUESTPROCESSORLOG", + "T_AGING", + "T_ALTER_COLUMN", + "T_DISTRIBUTIONRUNDETAIL", + "T_INVENTORYVALUE", + "T_INVOICEGL", + "T_REPLENISH", + "T_REPORT", + "T_REPORTSTATEMENT", + "T_SELECTION", + "T_SELECTION2", + "T_SPOOL", + "T_TRANSACTION", + "T_TRIALBALANCE" + }; + private static boolean isExceptionCentralized(String tableName) { - String [] exceptionTables = new String[] { - "AD_ACCESSLOG", - "AD_ALERTPROCESSORLOG", - "AD_CHANGELOG", - "AD_ISSUE", - "AD_LDAPPROCESSORLOG", - "AD_PACKAGE_IMP", - "AD_PACKAGE_IMP_BACKUP", - "AD_PACKAGE_IMP_DETAIL", - "AD_PACKAGE_IMP_INST", - "AD_PACKAGE_IMP_PROC", - "AD_PINSTANCE", - "AD_PINSTANCE_LOG", - "AD_PINSTANCE_PARA", - "AD_RECENTITEM", - "AD_REPLICATION_LOG", - "AD_SCHEDULERLOG", - "AD_SESSION", - "AD_WORKFLOWPROCESSORLOG", - "CM_WEBACCESSLOG", - "C_ACCTPROCESSORLOG", - "K_INDEXLOG", - "R_REQUESTPROCESSORLOG", - "T_AGING", - "T_ALTER_COLUMN", - "T_DISTRIBUTIONRUNDETAIL", - "T_INVENTORYVALUE", - "T_INVOICEGL", - "T_REPLENISH", - "T_REPORT", - "T_REPORTSTATEMENT", - "T_SELECTION", - "T_SELECTION2", - "T_SPOOL", - "T_TRANSACTION", - "T_TRIALBALANCE" - }; - for (int i = 0; i < exceptionTables.length; i++) { - if (tableName.equalsIgnoreCase(exceptionTables[i])) + + for (String exceptionTable : dontUseCentralized) { + if (tableName.equalsIgnoreCase(exceptionTable)) return true; }