From 39affc8346ac8b62455f6a5992e07f6dfcc76730 Mon Sep 17 00:00:00 2001 From: jan thielemann Date: Wed, 19 Mar 2014 12:28:55 -0500 Subject: [PATCH 1/8] IDEMPIERE-1675 When exporting a window, 2Pack export also records from AD_Preference +Patch --- .../src/org/adempiere/pipo2/handler/WindowElementHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java index 1085e8f46d..1708039ae2 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WindowElementHandler.java @@ -190,12 +190,13 @@ public class WindowElementHandler extends AbstractElementHandler { } // Preference Tag - sql = "SELECT AD_Preference_ID FROM AD_PREFERENCE WHERE AD_WINDOW_ID = ?"; + sql = "SELECT AD_Preference_ID FROM AD_PREFERENCE WHERE AD_WINDOW_ID = ? AND AD_CLIENT_ID = ?"; pstmt = null; rs = null; try { pstmt = DB.prepareStatement(sql, getTrxName(ctx)); pstmt.setInt(1, AD_Window_ID); + pstmt.setInt(2, Env.getAD_Client_ID(ctx.ctx)); rs = pstmt.executeQuery(); while (rs.next()) { createPreference(ctx, document, rs.getInt("AD_Preference_ID")); From f821b5fbed1a875ea9a25ee366bb9a6704064c50 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 19 Mar 2014 12:55:26 -0500 Subject: [PATCH 2/8] IDEMPIERE-1831 Missing AD_Preference_UU in some places+Patch / based on patch from Jan Thielemann --- org.adempiere.base/src/org/compiere/model/MSetup.java | 5 +++-- .../src/org/compiere/grid/ed/ValuePreference.java | 5 +++-- .../WEB-INF/src/org/adempiere/webui/ValuePreference.java | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MSetup.java b/org.adempiere.base/src/org/compiere/model/MSetup.java index dafad001f6..10d9097840 100644 --- a/org.adempiere.base/src/org/compiere/model/MSetup.java +++ b/org.adempiere.base/src/org/compiere/model/MSetup.java @@ -25,6 +25,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Properties; +import java.util.UUID; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; @@ -1352,9 +1353,9 @@ public final class MSetup { int AD_Preference_ID = getNextID(getAD_Client_ID(), "AD_Preference"); StringBuilder sqlCmd = new StringBuilder ("INSERT INTO AD_Preference "); - sqlCmd.append("(AD_Preference_ID,").append(m_stdColumns).append(","); + sqlCmd.append("(AD_Preference_ID,").append("AD_Preference_UU,").append(m_stdColumns).append(","); sqlCmd.append("Attribute,Value,AD_Window_ID) VALUES ("); - sqlCmd.append(AD_Preference_ID).append(",").append(m_stdValues).append(","); + sqlCmd.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(m_stdValues).append(","); sqlCmd.append("'").append(Attribute).append("','").append(Value).append("',"); if (AD_Window_ID == 0) sqlCmd.append("NULL)"); diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/ValuePreference.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/ValuePreference.java index 12c51e925a..977582d218 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/ValuePreference.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/ValuePreference.java @@ -25,6 +25,7 @@ import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Properties; +import java.util.UUID; import java.util.logging.Level; import javax.swing.BorderFactory; @@ -494,9 +495,9 @@ public class ValuePreference extends CDialog int AD_Preference_ID = DB.getNextID(m_ctx, "AD_Preference", null); // StringBuilder sql = new StringBuilder ("INSERT INTO AD_Preference (" - + "AD_Preference_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy," + + "AD_Preference_ID, AD_Preference_UU, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy," + "AD_Window_ID, AD_User_ID, Attribute, Value) VALUES ("); - sql.append(AD_Preference_ID).append(",").append(Client_ID).append(",").append(Org_ID) + sql.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(Client_ID).append(",").append(Org_ID) .append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", "); if (cbWindow.isSelected()) sql.append(m_AD_Window_ID).append(","); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/ValuePreference.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/ValuePreference.java index 7cf9b50d55..4f90e4f891 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/ValuePreference.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/ValuePreference.java @@ -17,6 +17,7 @@ package org.adempiere.webui; import java.util.Properties; +import java.util.UUID; import java.util.logging.Level; import org.adempiere.webui.adwindow.ADWindow; @@ -65,7 +66,7 @@ public class ValuePreference extends Window implements EventListener /** * */ - private static final long serialVersionUID = -8490929927886340040L; + private static final long serialVersionUID = 471820722501563271L; /** * Factory @@ -533,9 +534,9 @@ public class ValuePreference extends Window implements EventListener int AD_Preference_ID = DB.getNextID(m_ctx, "AD_Preference", null); // StringBuilder sql = new StringBuilder ("INSERT INTO AD_Preference (" - + "AD_Preference_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy," + + "AD_Preference_ID, AD_Preference_UU, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy," + "AD_Window_ID, AD_User_ID, Attribute, Value) VALUES ("); - sql.append(AD_Preference_ID).append(",").append(Client_ID).append(",").append(Org_ID) + sql.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(Client_ID).append(",").append(Org_ID) .append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", "); if (cbWindow.isChecked()) sql.append(m_AD_Window_ID).append(","); From 37463c57d46855e675f307fc40746183cbb9f556 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 19 Mar 2014 13:30:51 -0500 Subject: [PATCH 3/8] IDEMPIERE-811 Direct inserts not filling _UU columns / initial client setup --- .../src/org/compiere/model/MSetup.java | 97 ++++++++++--------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MSetup.java b/org.adempiere.base/src/org/compiere/model/MSetup.java index 10d9097840..11ba7659c9 100644 --- a/org.adempiere.base/src/org/compiere/model/MSetup.java +++ b/org.adempiere.base/src/org/compiere/model/MSetup.java @@ -346,20 +346,20 @@ public final class MSetup * Create User-Role */ // ClientUser - Admin & User - sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)" - + " VALUES (" + m_stdValues + "," + AD_User_ID + "," + admin.getAD_Role_ID() + ")"; - no = DB.executeUpdate(sql, m_trx.getTrxName()); + sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID,AD_User_Roles_UU)" + + " VALUES (" + m_stdValues + "," + AD_User_ID + "," + admin.getAD_Role_ID() + "," + DB.TO_STRING(UUID.randomUUID().toString()) + ")"; + no = DB.executeUpdateEx(sql, m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "UserRole ClientUser+Admin NOT inserted"); - sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)" - + " VALUES (" + m_stdValues + "," + AD_User_ID + "," + user.getAD_Role_ID() + ")"; - no = DB.executeUpdate(sql, m_trx.getTrxName()); + sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID,AD_User_Roles_UU)" + + " VALUES (" + m_stdValues + "," + AD_User_ID + "," + user.getAD_Role_ID() + "," + DB.TO_STRING(UUID.randomUUID().toString()) + ")"; + no = DB.executeUpdateEx(sql, m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "UserRole ClientUser+User NOT inserted"); // OrgUser - User - sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)" - + " VALUES (" + m_stdValues + "," + AD_User_U_ID + "," + user.getAD_Role_ID() + ")"; - no = DB.executeUpdate(sql, m_trx.getTrxName()); + sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID,AD_User_Roles_UU)" + + " VALUES (" + m_stdValues + "," + AD_User_U_ID + "," + user.getAD_Role_ID() + "," + DB.TO_STRING(UUID.randomUUID().toString()) + ")"; + no = DB.executeUpdateEx(sql, m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "UserRole OrgUser+Org NOT inserted"); @@ -565,11 +565,11 @@ public final class MSetup { sqlCmd = new StringBuffer ("INSERT INTO C_AcctSchema_Element("); sqlCmd.append(m_stdColumns).append(",C_AcctSchema_Element_ID,C_AcctSchema_ID,") - .append("ElementType,Name,SeqNo,IsMandatory,IsBalanced) VALUES ("); + .append("ElementType,Name,SeqNo,IsMandatory,IsBalanced,C_AcctSchema_Element_UU) VALUES ("); sqlCmd.append(m_stdValues).append(",").append(C_AcctSchema_Element_ID).append(",").append(m_as.getC_AcctSchema_ID()).append(",") .append("'").append(ElementType).append("','").append(name).append("',").append(SeqNo).append(",'") - .append(IsMandatory).append("','").append(IsBalanced).append("')"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + .append(IsMandatory).append("','").append(IsBalanced).append("',").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no == 1) m_info.append(Msg.translate(m_lang, "C_AcctSchema_Element_ID")).append("=").append(name).append("\n"); @@ -578,7 +578,7 @@ public final class MSetup { sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET Org_ID="); sqlCmd.append(getAD_Org_ID()).append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "Default Org in AcctSchemaElement NOT updated"); } @@ -587,7 +587,7 @@ public final class MSetup sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET C_ElementValue_ID="); sqlCmd.append(C_ElementValue_ID).append(", C_Element_ID=").append(C_Element_ID); sqlCmd.append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "Default Account in AcctSchemaElement NOT updated"); } @@ -770,7 +770,7 @@ public final class MSetup sqlCmd.append("C_AcctSchema1_ID=").append(m_as.getC_AcctSchema_ID()) .append(", C_Calendar_ID=").append(m_calendar.getC_Calendar_ID()) .append(" WHERE AD_Client_ID=").append(m_client.getAD_Client_ID()); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) { String err = "ClientInfo not updated"; @@ -987,19 +987,19 @@ public final class MSetup int C_Channel_ID = getNextID(getAD_Client_ID(), "C_Channel"); sqlCmd = new StringBuffer("INSERT INTO C_Channel "); sqlCmd.append("(C_Channel_ID,Name,"); - sqlCmd.append(m_stdColumns).append(") VALUES ("); + sqlCmd.append(m_stdColumns).append(",C_Channel_UU) VALUES ("); sqlCmd.append(C_Channel_ID).append(",").append(defaultEntry); - sqlCmd.append(m_stdValues).append(")"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append(m_stdValues).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "Channel NOT inserted"); int C_Campaign_ID = getNextID(getAD_Client_ID(), "C_Campaign"); sqlCmd = new StringBuffer("INSERT INTO C_Campaign "); sqlCmd.append("(C_Campaign_ID,C_Channel_ID,").append(m_stdColumns).append(","); - sqlCmd.append(" Value,Name,Costs) VALUES ("); + sqlCmd.append(" Value,Name,Costs,C_Campaign_UU) VALUES ("); sqlCmd.append(C_Campaign_ID).append(",").append(C_Channel_ID).append(",").append(m_stdValues).append(","); - sqlCmd.append(defaultEntry).append(defaultEntry).append("0)"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append(defaultEntry).append(defaultEntry).append("0").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no == 1) m_info.append(Msg.translate(m_lang, "C_Campaign_ID")).append("=").append(defaultName).append("\n"); else @@ -1011,7 +1011,7 @@ public final class MSetup sqlCmd.append("C_Campaign_ID=").append(C_Campaign_ID); sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID()); sqlCmd.append(" AND ElementType='MC'"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "AcctSchema ELement Campaign NOT updated"); } @@ -1020,10 +1020,10 @@ public final class MSetup int C_SalesRegion_ID = getNextID(getAD_Client_ID(), "C_SalesRegion"); sqlCmd = new StringBuffer ("INSERT INTO C_SalesRegion "); sqlCmd.append("(C_SalesRegion_ID,").append(m_stdColumns).append(","); - sqlCmd.append(" Value,Name,IsSummary) VALUES ("); + sqlCmd.append(" Value,Name,IsSummary,C_SalesRegion_UU) VALUES ("); sqlCmd.append(C_SalesRegion_ID).append(",").append(m_stdValues).append(", "); - sqlCmd.append(defaultEntry).append(defaultEntry).append("'N')"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append(defaultEntry).append(defaultEntry).append("'N'").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no == 1) m_info.append(Msg.translate(m_lang, "C_SalesRegion_ID")).append("=").append(defaultName).append("\n"); else @@ -1035,7 +1035,7 @@ public final class MSetup sqlCmd.append("C_SalesRegion_ID=").append(C_SalesRegion_ID); sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID()); sqlCmd.append(" AND ElementType='SR'"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "AcctSchema ELement SalesRegion NOT updated"); } @@ -1074,7 +1074,7 @@ public final class MSetup sqlCmd.append("C_BPartner_ID=").append(bp.getC_BPartner_ID()); sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID()); sqlCmd.append(" AND ElementType='BP'"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "AcctSchema Element BPartner NOT updated"); createPreference("C_BPartner_ID", String.valueOf(bp.getC_BPartner_ID()), 143); @@ -1099,13 +1099,14 @@ public final class MSetup int C_TaxCategory_ID = getNextID(getAD_Client_ID(), "C_TaxCategory"); sqlCmd = new StringBuffer ("INSERT INTO C_TaxCategory "); sqlCmd.append("(C_TaxCategory_ID,").append(m_stdColumns).append(","); - sqlCmd.append(" Name,IsDefault) VALUES ("); + sqlCmd.append(" Name,IsDefault,C_TaxCategory_UU) VALUES ("); sqlCmd.append(C_TaxCategory_ID).append(",").append(m_stdValues).append(", "); if (C_Country_ID == COUNTRY_US) // US - sqlCmd.append("'Sales Tax','Y')"); + sqlCmd.append("'Sales Tax','Y',"); else - sqlCmd.append(defaultEntry).append("'Y')"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append(defaultEntry).append("'Y',"); + sqlCmd.append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "TaxCategory NOT inserted"); @@ -1113,7 +1114,7 @@ public final class MSetup sqlCmd.append(" SELECT l.AD_Language,t.C_TaxCategory_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_TaxCategory t"); sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_TaxCategory_ID=").append(C_TaxCategory_ID); sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_TaxCategory_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_TaxCategory_ID=t.C_TaxCategory_ID)"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no < 0) log.log(Level.SEVERE, "TaxCategory Translation NOT inserted"); @@ -1142,7 +1143,7 @@ public final class MSetup sqlCmd.append("M_Product_ID=").append(product.getM_Product_ID()); sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID()); sqlCmd.append(" AND ElementType='PR'"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "AcctSchema Element Product NOT updated"); @@ -1156,7 +1157,7 @@ public final class MSetup loc.saveEx(); sqlCmd = new StringBuffer ("UPDATE AD_OrgInfo SET C_Location_ID="); sqlCmd.append(loc.getC_Location_ID()).append(" WHERE AD_Org_ID=").append(getAD_Org_ID()); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "Location NOT inserted"); createPreference("C_Country_ID", String.valueOf(C_Country_ID), 0); @@ -1188,7 +1189,7 @@ public final class MSetup // sqlCmd.append(",C_UOM_Length_ID="); // sqlCmd.append(",C_UOM_Time_ID="); sqlCmd.append(" WHERE AD_Client_ID=").append(getAD_Client_ID()); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) { String err = "ClientInfo not updated"; @@ -1247,7 +1248,7 @@ public final class MSetup // Update User sqlCmd = new StringBuffer ("UPDATE AD_User SET C_BPartner_ID="); sqlCmd.append(bpCU.getC_BPartner_ID()).append(" WHERE AD_User_ID=").append(AD_User_U_ID); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "User of SalesRep (User) NOT updated"); @@ -1273,7 +1274,7 @@ public final class MSetup // Update User sqlCmd = new StringBuffer ("UPDATE AD_User SET C_BPartner_ID="); sqlCmd.append(bpCA.getC_BPartner_ID()).append(" WHERE AD_User_ID=").append(AD_User_ID); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "User of SalesRep (Admin) NOT updated"); @@ -1282,10 +1283,10 @@ public final class MSetup int C_PaymentTerm_ID = getNextID(getAD_Client_ID(), "C_PaymentTerm"); sqlCmd = new StringBuffer ("INSERT INTO C_PaymentTerm "); sqlCmd.append("(C_PaymentTerm_ID,").append(m_stdColumns).append(","); - sqlCmd.append("Value,Name,NetDays,GraceDays,DiscountDays,Discount,DiscountDays2,Discount2,IsDefault) VALUES ("); + sqlCmd.append("Value,Name,NetDays,GraceDays,DiscountDays,Discount,DiscountDays2,Discount2,IsDefault,C_PaymentTerm_UU) VALUES ("); sqlCmd.append(C_PaymentTerm_ID).append(",").append(m_stdValues).append(","); - sqlCmd.append("'Immediate','Immediate',0,0,0,0,0,0,'Y')"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append("'Immediate','Immediate',0,0,0,0,0,0,'Y'").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "PaymentTerm NOT inserted"); @@ -1293,10 +1294,10 @@ public final class MSetup C_Cycle_ID = getNextID(getAD_Client_ID(), "C_Cycle"); sqlCmd = new StringBuffer ("INSERT INTO C_Cycle "); sqlCmd.append("(C_Cycle_ID,").append(m_stdColumns).append(","); - sqlCmd.append(" Name,C_Currency_ID) VALUES ("); + sqlCmd.append(" Name,C_Currency_ID,C_Cycle_UU) VALUES ("); sqlCmd.append(C_Cycle_ID).append(",").append(m_stdValues).append(", "); - sqlCmd.append(defaultEntry).append(C_Currency_ID).append(")"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append(defaultEntry).append(C_Currency_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "Cycle NOT inserted"); @@ -1308,10 +1309,10 @@ public final class MSetup int C_Project_ID = getNextID(getAD_Client_ID(), "C_Project"); sqlCmd = new StringBuffer ("INSERT INTO C_Project "); sqlCmd.append("(C_Project_ID,").append(m_stdColumns).append(","); - sqlCmd.append(" Value,Name,C_Currency_ID,IsSummary) VALUES ("); + sqlCmd.append(" Value,Name,C_Currency_ID,IsSummary,C_Project_UU) VALUES ("); sqlCmd.append(C_Project_ID).append(",").append(m_stdValuesOrg).append(", "); - sqlCmd.append(defaultEntry).append(defaultEntry).append(C_Currency_ID).append(",'N')"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + sqlCmd.append(defaultEntry).append(defaultEntry).append(C_Currency_ID).append(",'N'").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")"); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no == 1) m_info.append(Msg.translate(m_lang, "C_Project_ID")).append("=").append(defaultName).append("\n"); else @@ -1323,7 +1324,7 @@ public final class MSetup sqlCmd.append("C_Project_ID=").append(C_Project_ID); sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID()); sqlCmd.append(" AND ElementType='PJ'"); - no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "AcctSchema ELement Project NOT updated"); } @@ -1361,7 +1362,7 @@ public final class MSetup sqlCmd.append("NULL)"); else sqlCmd.append(AD_Window_ID).append(")"); - int no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName()); + int no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName()); if (no != 1) log.log(Level.SEVERE, "Preference NOT inserted - " + Attribute); } // createPreference From 6e8fbabdfa3944d2769229d28ceba05651efacbf Mon Sep 17 00:00:00 2001 From: Juan David Arboleda Date: Wed, 19 Mar 2014 20:16:56 -0500 Subject: [PATCH 4/8] IDEMPIERE-1548 Error import location when no region --- .../src/org/adempiere/impexp/GridTabCSVImporter.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 6fdcbf3161..99f22194e6 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -810,9 +810,8 @@ public class GridTabCSVImporter implements IGridTabImporter if (header.get(i).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID))) { - //without Region or Country any address would be invalid + //without Country any address would be invalid boolean thereIsCountry = false ; - boolean thereIsRegion = false; boolean isEmptyRow = true; for(int j= i;j< header.size();j++){ if(!header.get(j).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID))) @@ -826,8 +825,6 @@ public class GridTabCSVImporter implements IGridTabImporter String columnName = header.get(j); Object value = tmpRow.get(j); if(value!=null){ - if(columnName.contains("RegionName")||columnName.contains("C_Region_ID")) - thereIsRegion = true; if(columnName.contains("C_Country_ID")) thereIsCountry= true; }else @@ -849,8 +846,8 @@ public class GridTabCSVImporter implements IGridTabImporter isEmptyRow=false; } MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); - if((field.isMandatory(true) || column.isMandatory()) && !isEmptyRow && (!thereIsRegion || !thereIsCountry)) - return new StringBuilder(Msg.getMsg(Env.getCtx(), "FillMandatory")+" "+field.getColumnName()+"["+(thereIsRegion==true?"Region":"C_Country_ID")+"]"); + if((field.isMandatory(true) || column.isMandatory()) && !isEmptyRow && !thereIsCountry) + return new StringBuilder(Msg.getMsg(Env.getCtx(), "FillMandatory")+" "+field.getColumnName()+"["+"C_Country_ID]"); } return null; } From 0543cd86858224d38677c159d62c31807e7eca14 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 19 Mar 2014 20:42:06 -0500 Subject: [PATCH 5/8] IDEMPIERE-1829 Impossible to send reset password email in the user language / based on patch from Nicolas Micoud (nmicoud) --- .../src/org/compiere/model/MMailText.java | 26 ++++++++++++------- .../webui/panel/ResetPasswordPanel.java | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MMailText.java b/org.adempiere.base/src/org/compiere/model/MMailText.java index 53ac18a862..39fe1ea796 100644 --- a/org.adempiere.base/src/org/compiere/model/MMailText.java +++ b/org.adempiere.base/src/org/compiere/model/MMailText.java @@ -27,6 +27,7 @@ import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.Util; /** * Request Mail Template Model. @@ -39,7 +40,7 @@ public class MMailText extends X_R_MailText /** * */ - private static final long serialVersionUID = -9121875595478208460L; + private static final long serialVersionUID = -3278575461023934790L; /** * Standard Constructor @@ -79,6 +80,7 @@ public class MMailText extends X_R_MailText private String m_MailText3 = null; /** Translation Cache */ private static CCache s_cacheTrl = new CCache (Table_Name, 20); + private String m_language = null; /** * Get parsed/translated Mail Text @@ -323,13 +325,19 @@ public class MMailText extends X_R_MailText */ private void translate() { - if (m_bpartner != null && m_bpartner.getAD_Language() != null) + // Default if no Translation + m_MailHeader = super.getMailHeader(); + m_MailText = super.getMailText(); + m_MailText2 = super.getMailText2(); + m_MailText3 = super.getMailText3(); + if ((m_bpartner != null && m_bpartner.getAD_Language() != null) || !Util.isEmpty(m_language)) { - StringBuilder key = new StringBuilder().append(m_bpartner.getAD_Language()).append(get_ID()); + String adLanguage = m_bpartner != null ? m_bpartner.getAD_Language() : m_language; + StringBuilder key = new StringBuilder().append(adLanguage).append(get_ID()); MMailTextTrl trl = s_cacheTrl.get(key.toString()); if (trl == null) { - trl = getTranslation(m_bpartner.getAD_Language()); + trl = getTranslation(adLanguage); if (trl != null) s_cacheTrl.put(key.toString(), trl); } @@ -341,11 +349,6 @@ public class MMailText extends X_R_MailText m_MailText3 = trl.MailText3; } } - // No Translation - m_MailHeader = super.getMailHeader(); - m_MailText = super.getMailText(); - m_MailText2 = super.getMailText2(); - m_MailText3 = super.getMailText3(); } // translate /** @@ -406,4 +409,9 @@ public class MMailText extends X_R_MailText String MailText3 = null; } // MMailTextTrl + public void setLanguage(String language) + { + m_language = language; + } + } // MMailText diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java index 13a620b5c9..d7cfdc1c9b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java @@ -506,6 +506,7 @@ public class ResetPasswordPanel extends Window implements EventListener return false; MMailText mailText = new MMailText(m_ctx, R_MailText_ID, null); + mailText.setLanguage(Env.getContext(m_ctx, "#AD_Language")); to.set_ValueOfColumn("Password", newPassword); // will be hashed and validate on saveEx mailText.setUser(to); String message = mailText.getMailText(true); From 508a0dcb9ba6cb105fc1aa48ff10ec201418a0ba Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 19 Mar 2014 20:52:52 -0500 Subject: [PATCH 6/8] IDEMPIERE-1835 CSV Exporter is exporting fields that are not displayed to the user / based on patch from Juan Arboleda (jarboleda) --- .../src/org/adempiere/impexp/GridTabCSVExporter.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index 6fa6c2e42c..f9f0700b16 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java @@ -104,6 +104,8 @@ public class GridTabCSVExporter implements IGridTabExporter if(DisplayType.Location == field.getDisplayType()){ specialHDispayType = DisplayType.Location; continue; + } else if (! (field.isDisplayed() || field.isDisplayedGrid())) { + continue; } String headName = resolveColumnName(table, column); headArray.add(headName); @@ -525,7 +527,10 @@ public class GridTabCSVExporter implements IGridTabExporter int AD_Field_ID = Integer.parseInt(fieldIdStr); for (GridField gridField : tmpFields) { - if(gridField.isVirtualColumn() || gridField.isEncrypted() || gridField.isEncryptedColumn()) + if ( gridField.isVirtualColumn() + || gridField.isEncrypted() + || gridField.isEncryptedColumn() + || !(gridField.isDisplayed() || gridField.isDisplayedGrid())) continue; if (gridField.getAD_Field_ID() == AD_Field_ID) @@ -549,7 +554,10 @@ public class GridTabCSVExporter implements IGridTabExporter continue; if (DisplayType.Button == MColumn.get(Env.getCtx(),field.getAD_Column_ID()).getAD_Reference_ID()) continue; - if (field.isVirtualColumn() || field.isEncrypted() || field.isEncryptedColumn()) + if ( field.isVirtualColumn() + || field.isEncrypted() + || field.isEncryptedColumn() + || !(field.isDisplayed() || field.isDisplayedGrid())) continue; if (field.isParentValue() || (!field.isReadOnly() && field.isDisplayedGrid())) gridFieldList.add(field); From 25b000ac5d3c629b100e5291fb52ea20021bd308 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 16 Mar 2014 13:30:32 +0700 Subject: [PATCH 7/8] IDEMPIERE-1619:Link on third tab pointing to field on first tab instead of second --- .../i2.0/oracle/201403161604_IDEMPIERE-1619.sql | 13 +++++++++++++ .../i2.0/postgresql/201403161604_IDEMPIERE-1619.sql | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql create mode 100644 migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql diff --git a/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql b/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql new file mode 100644 index 0000000000..e4c340db9c --- /dev/null +++ b/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql @@ -0,0 +1,13 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 16, 2014 1:24:36 PM ICT +-- IDEMPIERE-1619 Link on third tab pointing to field on first tab instead of second +UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_DATE('2014-03-16 13:24:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10426 +; + +-- Mar 16, 2014 1:25:39 PM ICT +UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_DATE('2014-03-16 13:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=304 +; +SELECT register_migration_script('201403161604_IDEMPIERE-1619.sql') FROM dual +; diff --git a/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql b/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql new file mode 100644 index 0000000000..32ffd11ef0 --- /dev/null +++ b/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql @@ -0,0 +1,10 @@ +-- Mar 16, 2014 1:24:36 PM ICT +-- IDEMPIERE-1619 Link on third tab pointing to field on first tab instead of second +UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_TIMESTAMP('2014-03-16 13:24:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10426 +; + +-- Mar 16, 2014 1:25:39 PM ICT +UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_TIMESTAMP('2014-03-16 13:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=304 +; +SELECT register_migration_script('201403161604_IDEMPIERE-1619.sql') FROM dual +; From 94610a51acaf8a3ff565bf842dc22bdd50fe9bab Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 19 Mar 2014 21:49:27 -0500 Subject: [PATCH 8/8] IDEMPIERE-1619:Link on third tab pointing to field on first tab instead of second --- migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql | 4 ++++ migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql | 4 ++++ org.adempiere.base/src/org/compiere/model/GridTab.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql b/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql index e4c340db9c..de73ec9e32 100644 --- a/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql +++ b/migration/i2.0/oracle/201403161604_IDEMPIERE-1619.sql @@ -9,5 +9,9 @@ UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated= -- Mar 16, 2014 1:25:39 PM ICT UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_DATE('2014-03-16 13:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=304 ; + +UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@4|AD_WF_NodeNext_ID@',Updated=TO_DATE('2014-03-20 02:22:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11571 +; + SELECT register_migration_script('201403161604_IDEMPIERE-1619.sql') FROM dual ; diff --git a/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql b/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql index 32ffd11ef0..079a50db2f 100644 --- a/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql +++ b/migration/i2.0/postgresql/201403161604_IDEMPIERE-1619.sql @@ -6,5 +6,9 @@ UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated= -- Mar 16, 2014 1:25:39 PM ICT UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_TIMESTAMP('2014-03-16 13:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=304 ; + +UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@4|AD_WF_NodeNext_ID@',Updated=TO_TIMESTAMP('2014-03-20 02:22:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11571 +; + SELECT register_migration_script('201403161604_IDEMPIERE-1619.sql') FROM dual ; diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 18d4331f46..644632b754 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -1402,7 +1402,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable if (!isDetail()) return true; // Same link column value - String value = Env.getContext(m_vo.ctx, m_vo.WindowNo, getLinkColumnName()); + String value = Env.getContext(m_vo.ctx, m_vo.WindowNo, this.getParentTabNo(), getLinkColumnName()); return m_linkValue.equals(value); } // isCurrent