From 9fbd9844724cdf312b914de65621594a686b6b4e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 6 Jun 2018 13:32:21 +0200 Subject: [PATCH 01/33] IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values / reviewing this further - the filter was not allowing multiple accounting schemas - changing filter to allow that --- .../i5.1/oracle/201806061330_IDEMPIERE-3651.sql | 12 ++++++++++++ .../i5.1/postgresql/201806061330_IDEMPIERE-3651.sql | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql create mode 100644 migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql diff --git a/migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql b/migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql new file mode 100644 index 0000000000..05a769502f --- /dev/null +++ b/migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql @@ -0,0 +1,12 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values +-- Jun 6, 2018 1:29:52 PM CEST +UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN +(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_DATE('2018-06-06 13:29:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258 +; + +SELECT register_migration_script('201806061330_IDEMPIERE-3651.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql b/migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql new file mode 100644 index 0000000000..855cd3992d --- /dev/null +++ b/migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql @@ -0,0 +1,9 @@ +-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values +-- Jun 6, 2018 1:29:52 PM CEST +UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN +(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_TIMESTAMP('2018-06-06 13:29:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258 +; + +SELECT register_migration_script('201806061330_IDEMPIERE-3651.sql') FROM dual +; + From 5768442cfedcd4afc916c8dc0db1d93a3ab32fa6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 7 Jun 2018 08:39:42 +0200 Subject: [PATCH 02/33] IDEMPIERE-3727 Report Cube creates data for all client in fact_acc_summary table / integrate patch from Pritesh Shah --- org.adempiere.base/src/org/compiere/model/MReportCube.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MReportCube.java b/org.adempiere.base/src/org/compiere/model/MReportCube.java index 3e2df3b789..870972820b 100644 --- a/org.adempiere.base/src/org/compiere/model/MReportCube.java +++ b/org.adempiere.base/src/org/compiere/model/MReportCube.java @@ -133,7 +133,7 @@ public class MReportCube extends X_PA_ReportCube { " INNER JOIN C_Period p ON ( f.DateAcct BETWEEN p.StartDate AND p.EndDate ) " + " INNER JOIN C_Year y ON ( p.C_Year_ID = y.C_Year_ID ) " + " WHERE p.PeriodType = 'S' " + - " AND y.C_Calendar_ID = ? "; + " AND y.C_Calendar_ID = ? AND f.AD_Client_ID = ? "; if ( getLastRecalculated() != null && !reset ) from += "AND p.C_Period_ID IN " + periods; @@ -190,7 +190,7 @@ public class MReportCube extends X_PA_ReportCube { String sql = insert.append(select.toString()).append(from).append(groups.toString()).toString(); if (log.isLoggable(Level.FINE))log.log(Level.FINE, sql); - Object[] params = new Object[] { getPA_ReportCube_ID(), getC_Calendar_ID() }; + Object[] params = new Object[] { getPA_ReportCube_ID(), getC_Calendar_ID(), getAD_Client_ID() }; start = System.currentTimeMillis(); int rows = DB.executeUpdateEx(sql, params, get_TrxName()); From 667875b709144ee3261ac740a4e177f5e97b6585 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 7 Jun 2018 09:20:03 +0200 Subject: [PATCH 03/33] IDEMPIERE-3728 Cannot report adjustment periods with Report Cube --- .../src/org/compiere/model/MReportCube.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MReportCube.java b/org.adempiere.base/src/org/compiere/model/MReportCube.java index 870972820b..70c91e379d 100644 --- a/org.adempiere.base/src/org/compiere/model/MReportCube.java +++ b/org.adempiere.base/src/org/compiere/model/MReportCube.java @@ -63,8 +63,7 @@ public class MReportCube extends X_PA_ReportCube { "INNER JOIN Fact_Acct fact ON (fact.dateacct between p.startdate and p.enddate " + " and fact.ad_client_id = c.ad_client_id) " + "WHERE c.PA_ReportCube_ID = ? " + - "AND fact.updated > c.LastRecalculated " + - "AND p.periodtype='S' "; + "AND fact.updated > c.LastRecalculated"; log.log (Level.FINE, sql); @@ -130,10 +129,9 @@ public class MReportCube extends X_PA_ReportCube { "p.c_period_id, p.StartDate, COALESCE(SUM(AmtAcctDr),0), COALESCE(SUM(AmtAcctCr),0), " + "COALESCE(SUM(Qty),0)"); String from = " FROM fact_acct f " + - " INNER JOIN C_Period p ON ( f.DateAcct BETWEEN p.StartDate AND p.EndDate ) " + + " INNER JOIN C_Period p ON ( f.C_Period_ID = p.C_Period_ID ) " + " INNER JOIN C_Year y ON ( p.C_Year_ID = y.C_Year_ID ) " + - " WHERE p.PeriodType = 'S' " + - " AND y.C_Calendar_ID = ? AND f.AD_Client_ID = ? "; + " WHERE y.C_Calendar_ID = ? AND f.AD_Client_ID = ? "; if ( getLastRecalculated() != null && !reset ) from += "AND p.C_Period_ID IN " + periods; From 18017938e65a2b77e0daf785dc56b543c1989d81 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 7 Jun 2018 10:34:08 +0200 Subject: [PATCH 04/33] IDEMPIERE-3169 recent item do a lot query / implement cache for the label of recent items --- .../src/org/compiere/model/MRecentItem.java | 66 +++++++++++++++---- .../src/org/compiere/model/PO.java | 5 +- 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRecentItem.java b/org.adempiere.base/src/org/compiere/model/MRecentItem.java index 74ed76f9f0..818acce052 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecentItem.java +++ b/org.adempiere.base/src/org/compiere/model/MRecentItem.java @@ -16,11 +16,13 @@ package org.compiere.model; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.logging.Level; import org.adempiere.base.Service; import org.adempiere.base.event.EventManager; @@ -42,18 +44,20 @@ import org.osgi.service.event.Event; public class MRecentItem extends X_AD_RecentItem { /** - * + * */ - private static final long serialVersionUID = 6899554875745832L; + private static final long serialVersionUID = -311416268128338337L; public static final String ON_RECENT_ITEM_CHANGED_TOPIC = "onRecentItemChanged"; /** Recent Item Cache */ - private static CCache s_cache = new CCache(Table_Name, 10); + private static CCache s_cache = new CCache(Table_Name, 10); /** Logger */ - @SuppressWarnings("unused") private static CLogger s_log = CLogger.getCLogger(MRecentItem.class); + /* Recent Item cached Label */ + private String m_label; + /************************************************************************** * Standard Constructor * @param ctx context @@ -65,13 +69,17 @@ public class MRecentItem extends X_AD_RecentItem super (ctx, AD_RecentItem_ID, trxName); if (AD_RecentItem_ID > 0) { synchronized (MRecentItem.class) { - Integer key = new Integer (AD_RecentItem_ID); + String key = getCacheKey(AD_RecentItem_ID, ctx); if (!s_cache.containsKey(key)) s_cache.put (key, this); } } } // MRecentItem + private static String getCacheKey(int AD_RecentItem_ID, Properties ctx) { + return AD_RecentItem_ID + "|" + Env.getAD_Language(ctx); + } + /** * Load Constructor * @param ctx ctx @@ -81,9 +89,9 @@ public class MRecentItem extends X_AD_RecentItem public MRecentItem (Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); - Integer key = null; + String key = null; try { - key = new Integer (rs.getInt("AD_RecentItem_ID")); + key = getCacheKey(rs.getInt("AD_RecentItem_ID"), ctx); } catch (SQLException e) { throw new AdempiereException(e); } @@ -101,7 +109,7 @@ public class MRecentItem extends X_AD_RecentItem */ public static synchronized MRecentItem get (Properties ctx, int AD_RecentItem_ID) { - Integer ii = new Integer (AD_RecentItem_ID); + String ii = getCacheKey(AD_RecentItem_ID, ctx); MRecentItem ri = (MRecentItem)s_cache.get(ii); if (ri == null) ri = new MRecentItem (ctx, AD_RecentItem_ID, null); @@ -123,7 +131,8 @@ public class MRecentItem extends X_AD_RecentItem MRecentItem retValue = it.next(); if (retValue.getAD_Table_ID() == AD_Table_ID && retValue.getRecord_ID() == Record_ID - && retValue.getCtx() == ctx + && retValue.getAD_User_ID() == AD_User_ID + && Env.getAD_Language(ctx).equals(Env.getAD_Language(retValue.getCtx())) ) { return retValue; @@ -155,7 +164,7 @@ public class MRecentItem extends X_AD_RecentItem if (retValue != null) { - Integer key = new Integer (retValue.getAD_RecentItem_ID()); + String key = getCacheKey(retValue.getAD_RecentItem_ID(), ctx); s_cache.put (key, retValue); } return retValue; @@ -265,7 +274,7 @@ public class MRecentItem extends X_AD_RecentItem @Override public boolean delete(boolean force) { - Integer ii = new Integer (getAD_RecentItem_ID()); + String ii = getCacheKey(getAD_RecentItem_ID(), getCtx()); synchronized (MRecentItem.class) { s_cache.remove(ii); } @@ -273,16 +282,23 @@ public class MRecentItem extends X_AD_RecentItem } public static List getFromUser(Properties ctx, int AD_User_ID) { - List ris = new Query(ctx, MRecentItem.Table_Name, "NVL(AD_User_ID,0)=?", null) + int[] ids = new Query(ctx, MRecentItem.Table_Name, "NVL(AD_User_ID,0)=?", null) .setOnlyActiveRecords(true) .setClient_ID() .setParameters(AD_User_ID) .setOrderBy("Updated DESC") - .list(); + .getIDs(); + List ris = new ArrayList(); + for (int id : ids) { + ris.add(MRecentItem.get(ctx, id)); + } return ris; } public String getLabel() { + if (m_label != null) { + return m_label; + } String windowName; MWindow win = MWindow.get(getCtx(), getAD_Window_ID()); MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID()); @@ -322,7 +338,29 @@ public class MRecentItem extends X_AD_RecentItem if (recordIdentifier.length() == 0) recordIdentifier.append(" [no identifier]"); } - return windowName + ": " + recordIdentifier.substring(1); + m_label = windowName + ": " + recordIdentifier.substring(1); + if (s_log.isLoggable(Level.INFO)) s_log.info(m_label); + return m_label; + } + + public static void clearLabel(int AD_Table_ID, int Record_ID) { + Iterator it = s_cache.values().iterator(); + while (it.hasNext()) { + MRecentItem retValue = it.next(); + if (retValue.getAD_Table_ID() == AD_Table_ID && retValue.getRecord_ID() == Record_ID) { + retValue.clearLabel(); + } + } + } + + private void clearLabel() { + m_label = null; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("MRecentItem[").append(get_ID()).append("]=").append(getLabel()); + return sb.toString(); } } // MRecentItem diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index cee29fd67e..9496ab6025 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -2341,9 +2341,10 @@ public abstract class PO m_newValues = new Object[size]; m_createNew = false; } - if (!newRecord) + if (!newRecord) { CacheMgt.get().reset(p_info.getTableName()); - else if (get_ID() > 0 && success) + MRecentItem.clearLabel(p_info.getAD_Table_ID(), get_ID()); + } else if (get_ID() > 0 && success) CacheMgt.get().newRecord(p_info.getTableName(), get_ID()); return success; From 10ad4064d8f30fae63e901f5bcaf36c4fbdd830f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 13 Jun 2018 14:33:31 +0200 Subject: [PATCH 05/33] IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values / add IsActive validation --- .../i5.1/oracle/201806131433_IDEMPIERE-3651.sql | 12 ++++++++++++ .../i5.1/postgresql/201806131433_IDEMPIERE-3651.sql | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql create mode 100644 migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql diff --git a/migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql b/migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql new file mode 100644 index 0000000000..439eb5d228 --- /dev/null +++ b/migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql @@ -0,0 +1,12 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values +-- Jun 13, 2018 2:32:06 PM CEST +UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN +(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_DATE('2018-06-13 14:32:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258 +; + +SELECT register_migration_script('201806131433_IDEMPIERE-3651.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql b/migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql new file mode 100644 index 0000000000..f113b121ef --- /dev/null +++ b/migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql @@ -0,0 +1,9 @@ +-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values +-- Jun 13, 2018 2:32:06 PM CEST +UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN +(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_TIMESTAMP('2018-06-13 14:32:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258 +; + +SELECT register_migration_script('201806131433_IDEMPIERE-3651.sql') FROM dual +; + From 9f9249869af613af62ccc98b811e1271f03ff1e4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 14 Jun 2018 16:13:15 +0200 Subject: [PATCH 06/33] IDEMPIERE-3169 recent item do a lot query / IDEMPIERE-3622 MRecentItem is not thread safe --- org.adempiere.base/src/org/compiere/model/MRecentItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRecentItem.java b/org.adempiere.base/src/org/compiere/model/MRecentItem.java index 818acce052..2a84f6056c 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecentItem.java +++ b/org.adempiere.base/src/org/compiere/model/MRecentItem.java @@ -343,7 +343,7 @@ public class MRecentItem extends X_AD_RecentItem return m_label; } - public static void clearLabel(int AD_Table_ID, int Record_ID) { + public static synchronized void clearLabel(int AD_Table_ID, int Record_ID) { Iterator it = s_cache.values().iterator(); while (it.hasNext()) { MRecentItem retValue = it.next(); From d527b6279fd787c3eb4a48864882f0cedbb0f6b3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 18 Jun 2018 11:36:40 +0200 Subject: [PATCH 07/33] Detected that when the server crashes because of Out Of Memory the init.d scripts are not able to terminate it properly / fix to look for the server using org.adempiere.server.application instead of the IDEMPIERE_HOME --- .../unix/DebianInstaller/etc/init.d/idempiere | 12 ++++++------ .../utils.unix/unix/idempiere_Debian.sh | 12 ++++++------ .../utils.unix/unix/idempiere_RedHat.sh | 18 +++++++++--------- .../utils.unix/unix/idempiere_Suse.sh | 17 +++++++---------- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere b/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere index 565bfd0b41..d79728fc31 100755 --- a/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere +++ b/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere @@ -39,7 +39,7 @@ esac # adjust these variables to your environment IDEMPIERE_USER=idempiere IDEMPIERE_HOME=/opt/idempiere-server -JAVA_HOME=`ls -r /usr/lib/jvm/java-[678]-openjdk*/bin/javac /usr/lib/jvm/java-[8]-oracle*/bin/javac | head -1` +JAVA_HOME=`ls -r /usr/lib/jvm/java-[6789]-openjdk*/bin/javac /usr/lib/jvm/java-[89]-oracle*/bin/javac | head -1` JAVA_HOME=`dirname $JAVA_HOME` JAVA_HOME=`dirname $JAVA_HOME` SU=su @@ -533,8 +533,8 @@ Enter postgres password:" } getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep ${IDEMPIERE_HOME}) - echo $IDEMPIERESTATUSSTRING | grep -q ${IDEMPIERE_HOME} + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -626,14 +626,14 @@ stop () { log_success_msg "Service stopped with OSGi shutdown" else log_warning_msg "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then log_success_msg "Service stopped with kill -15" else log_warning_msg "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -664,7 +664,7 @@ dostatus () { if [ $IDEMPIERESTATUS -eq 0 ] ; then echo echo "iDempiere is running:" - ps ax | grep -v grep | grep ${IDEMPIERE_HOME} | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else echo "iDempiere is stopped" diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh index b516ac781f..760b307d6d 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh @@ -32,8 +32,8 @@ IDEMPIERESTATUS= MAXITERATIONS=60 getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME) - echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -96,14 +96,14 @@ stop () { log_success_msg "Service stopped with OSGi shutdown" else log_warning_msg "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then log_success_msg "Service stopped with kill -15" else log_warning_msg "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -118,7 +118,7 @@ stop () { restart () { stop - sleep 1 + sleep 2 start } @@ -134,7 +134,7 @@ status () { if [ $IDEMPIERESTATUS -eq 0 ] ; then echo echo "iDempiere is running:" - ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else echo "iDempiere is stopped" diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh index ae6d4637a0..4e96fd83f7 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh @@ -25,11 +25,11 @@ IDEMPIEREUSER=idempiere RETVAL=0 IDEMPIERESTATUS= -MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes) +MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME) - echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -78,7 +78,7 @@ start () { stop () { getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then - echo "idempiere is already stopped" + echo "iDempiere is already stopped" return 1 fi echo -n "Stopping iDempiere ERP: " @@ -92,14 +92,14 @@ stop () { echo_success else echo "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then echo_success else echo "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -130,11 +130,11 @@ status () { getidempierestatus if [ $IDEMPIERESTATUS -eq 0 ] ; then echo - echo "idempiere is running:" - ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + echo "iDempiere is running:" + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else - echo "idempiere is stopped" + echo "iDempiere is stopped" fi } diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh index 063dca949b..a999dc31d4 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh @@ -57,8 +57,8 @@ IDEMPIERESTATUS= MAXITERATIONS=60 getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME) - echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -123,14 +123,14 @@ stop () { echo "Service stopped with OSGi shutdown" else echo "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then echo "Service stopped with kill -15" else echo "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -146,7 +146,7 @@ stop () { restart () { stop - sleep 1 + sleep 2 start rc_status } @@ -166,7 +166,7 @@ status () { if [ $IDEMPIERESTATUS -eq 0 ] ; then echo echo "iDempiere is running:" - ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else echo "iDempiere is stopped" @@ -182,9 +182,6 @@ case "$1" in stop) stop ;; - reload) - restart - ;; restart) restart ;; @@ -195,7 +192,7 @@ case "$1" in status ;; *) - echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}" + echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac From 2822f54412c86f8873a774ba4d4c94d210755995 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 18 Jun 2018 21:14:26 +0200 Subject: [PATCH 08/33] Backed out changeset b7cf7fc7d33e IDEMPIERE-3702 --- .../src/org/compiere/acct/Doc_Payment.java | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java index 558d5d8071..2d598d3b17 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java @@ -171,22 +171,20 @@ public class Doc_Payment extends Doc // Avoid usage of clearing accounts // If both accounts and orgs are the same then remove the posting - if (dr != null && cr != null) { - MAccount acct_dr = dr.getAccount(); - MAccount acct_cr = cr.getAccount(); - int org_dr = dr.getAD_Org_ID(); - int org_cr = cr.getAD_Org_ID(); - if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) { + MAccount acct_dr = dr.getAccount(); + MAccount acct_cr = cr.getAccount(); + int org_dr = dr.getAD_Org_ID(); + int org_cr = cr.getAD_Org_ID(); + if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) { - BigDecimal debit = dr.getAmtSourceDr(); - BigDecimal credit = cr.getAmtSourceCr(); - - if (debit.compareTo(credit) == 0) { - fact.remove(dr); - fact.remove(cr); - } + BigDecimal debit = dr.getAmtSourceDr(); + BigDecimal credit = cr.getAmtSourceCr(); + if (debit.compareTo(credit) == 0) { + fact.remove(dr); + fact.remove(cr); } + } // End Avoid usage of clearing accounts // From e15bab7005557eb6bdd921c905219f75ad64e62f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 18 Jun 2018 21:14:43 +0200 Subject: [PATCH 09/33] Backed out changeset 0c817684f795 IDEMPIERE-3702 --- .../src/org/compiere/acct/Doc_Payment.java | 45 +++++-------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java index 2d598d3b17..c888349eac 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java @@ -116,16 +116,14 @@ public class Doc_Payment extends Doc return facts; } - FactLine dr = null; - FactLine cr = null; int AD_Org_ID = getBank_Org_ID(); // Bank Account Org if (getDocumentType().equals(DOCTYPE_ARReceipt)) { // Asset - dr = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as), + FactLine fl = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as), getC_Currency_ID(), getAmount(), null); - if (dr != null && AD_Org_ID != 0) - dr.setAD_Org_ID(AD_Org_ID); + if (fl != null && AD_Org_ID != 0) + fl.setAD_Org_ID(AD_Org_ID); // MAccount acct = null; if (getC_Charge_ID() != 0) @@ -134,11 +132,11 @@ public class Doc_Payment extends Doc acct = getAccount(Doc.ACCTTYPE_C_Prepayment, as); else acct = getAccount(Doc.ACCTTYPE_UnallocatedCash, as); - cr = fact.createLine(null, acct, + fl = fact.createLine(null, acct, getC_Currency_ID(), null, getAmount()); - if (cr != null && AD_Org_ID != 0 + if (fl != null && AD_Org_ID != 0 && getC_Charge_ID() == 0) // don't overwrite charge - cr.setAD_Org_ID(AD_Org_ID); + fl.setAD_Org_ID(AD_Org_ID); } // APP else if (getDocumentType().equals(DOCTYPE_APPayment)) @@ -150,17 +148,17 @@ public class Doc_Payment extends Doc acct = getAccount(Doc.ACCTTYPE_V_Prepayment, as); else acct = getAccount(Doc.ACCTTYPE_PaymentSelect, as); - dr = fact.createLine(null, acct, + FactLine fl = fact.createLine(null, acct, getC_Currency_ID(), getAmount(), null); - if (dr != null && AD_Org_ID != 0 + if (fl != null && AD_Org_ID != 0 && getC_Charge_ID() == 0) // don't overwrite charge - dr.setAD_Org_ID(AD_Org_ID); + fl.setAD_Org_ID(AD_Org_ID); // Asset - cr = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as), + fl = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as), getC_Currency_ID(), null, getAmount()); - if (cr != null && AD_Org_ID != 0) - cr.setAD_Org_ID(AD_Org_ID); + if (fl != null && AD_Org_ID != 0) + fl.setAD_Org_ID(AD_Org_ID); } else { @@ -168,25 +166,6 @@ public class Doc_Payment extends Doc log.log(Level.SEVERE, p_Error); fact = null; } - - // Avoid usage of clearing accounts - // If both accounts and orgs are the same then remove the posting - MAccount acct_dr = dr.getAccount(); - MAccount acct_cr = cr.getAccount(); - int org_dr = dr.getAD_Org_ID(); - int org_cr = cr.getAD_Org_ID(); - if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) { - - BigDecimal debit = dr.getAmtSourceDr(); - BigDecimal credit = cr.getAmtSourceCr(); - - if (debit.compareTo(credit) == 0) { - fact.remove(dr); - fact.remove(cr); - } - - } - // End Avoid usage of clearing accounts // ArrayList facts = new ArrayList(); facts.add(fact); From 36985e7096074fb759c1fb6e97eb601a46009a17 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 Jun 2018 22:04:16 +0200 Subject: [PATCH 10/33] IDEMPIERE-3618 Support OFX 2 in org.compiere.impexp.OFXFileBankStatementLoader / integrate partially patch from David Podhola --- .../impexp/OFXBankStatementHandler.java | 93 ++++++++++++++++++- 1 file changed, 88 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java b/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java index 9fdd19966f..a2df756ddd 100644 --- a/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java +++ b/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java @@ -23,7 +23,11 @@ import java.io.InputStreamReader; import java.math.BigDecimal; import java.sql.Timestamp; import java.text.ParseException; -import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.StringTokenizer; +import java.util.TimeZone; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; @@ -216,7 +220,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler try { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - reader.mark(HEADER_SIZE + 100); + reader.mark(HEADER_SIZE + 20000); StringBuilder header = new StringBuilder(); for (int i = 0; i < HEADER_SIZE; i++) { @@ -748,6 +752,87 @@ public abstract class OFXBankStatementHandler extends DefaultHandler } // endElement + /* + * Copyright 2008 Web Cohesion + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * source: https://github.com/stoicflame/ofx4j/blob/a604e4f6ffefea61403434cf853bbd1b20740386/src/main/java/com/webcohesion/ofx4j/io/DefaultStringConversion.java + * + */ + /** + * Parse the timezone offset of the form [HOURS_OFF_GMT:TZ_ID] + * + * @param tzoffset The offset pattern. + * @return The timezone. + */ + protected TimeZone parseTimeZone(String tzoffset) { + StringTokenizer tokenizer = new StringTokenizer(tzoffset, "[]:"); + TimeZone tz = GMT_TIME_ZONE; + if (tokenizer.hasMoreTokens()) { + String hoursOff = tokenizer.nextToken(); + tz = TimeZone.getTimeZone("GMT" + hoursOff); + } + + return tz; + } + + public static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT"); + public static final int DATE_FORMAT_LENGTH = "yyyyMMddHHmmss.SSS".length(); + public static final int TIME_FORMAT_LENGTH = "HHmmss.SSS".length(); + + /** + * Parses a date according to OFX. + * + * @param value The value of the date. + * @return The date value. + */ + protected Date parseDate(String value) { + char[] parseableDate = new char[DATE_FORMAT_LENGTH]; + Arrays.fill(parseableDate, '0'); + parseableDate[parseableDate.length - 4] = '.'; + char[] valueChars = value.toCharArray(); + int index = 0; + while (index < valueChars.length && valueChars[index] != '[') { + if (index < DATE_FORMAT_LENGTH) { + parseableDate[index] = valueChars[index]; + } + + index++; + } + + int year = Integer.parseInt(new String(parseableDate, 0, 4)); + int month = Integer.parseInt(new String(parseableDate, 4, 2)) - 1; //java month numberss are zero-based + int day = Integer.parseInt(new String(parseableDate, 6, 2)); + int hour = Integer.parseInt(new String(parseableDate, 8, 2)); + int minute = Integer.parseInt(new String(parseableDate, 10, 2)); + int second = Integer.parseInt(new String(parseableDate, 12, 2)); + int milli = Integer.parseInt(new String(parseableDate, 15, 3)); + + //set up a new calendar at zero, then set all the fields. + GregorianCalendar calendar = new GregorianCalendar(year, month, day, hour, minute, second); + if (index < valueChars.length && valueChars[index] == '[') { + String tzoffset = value.substring(index); + calendar.setTimeZone(parseTimeZone(tzoffset)); + } + else { + calendar.setTimeZone(GMT_TIME_ZONE); + } + calendar.add(GregorianCalendar.MILLISECOND, milli); + + return calendar.getTime(); + } + /** * Method parseOfxDate * @param value String @@ -758,9 +843,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler { try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - sdf.setLenient(false); - return new Timestamp (sdf.parse(value).getTime()); + return new Timestamp (parseDate(value).getTime()); } catch(Exception e) { From 2cf832fc43eee95bbd10ab0a0d9a1c28917a823a Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Thu, 21 Jun 2018 10:50:27 +0200 Subject: [PATCH 11/33] IDEMPIERE-3618 Support OFX 2 in org.compiere.impexp.OFXFileBankStatementLoader --- .../compiere/impexp/OFXBankStatementHandler.java | 16 ++++++++++++++++ .../impexp/OFXFileBankStatementLoader.java | 11 +++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java b/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java index a2df756ddd..513f2ba67f 100644 --- a/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java +++ b/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java @@ -202,6 +202,10 @@ public abstract class OFXBankStatementHandler extends DefaultHandler m_errorMessage = new StringBuffer("ErrorInitializingParser"); m_errorDescription = new StringBuffer("Unable to initialize SAX parser: ").append(e.getMessage()); } + + if (!result) + closeBufferedReader(); + return result; } // init @@ -256,6 +260,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler { m_errorMessage = new StringBuffer("ErrorReadingData"); m_errorDescription = new StringBuffer(e.getMessage()); + closeBufferedReader(); return result; } @@ -322,11 +327,22 @@ public abstract class OFXBankStatementHandler extends DefaultHandler { m_errorMessage = new StringBuffer("ErrorReadingData"); m_errorDescription = new StringBuffer(e.getMessage()); + } finally { + closeBufferedReader(); } return result; } // loadLines + private void closeBufferedReader() { + if (m_reader != null) + try { + m_reader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + /** * Method getDateLastRun * @return Timestamp diff --git a/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java b/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java index 7f2b1aedf4..96e3221e9e 100644 --- a/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java +++ b/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java @@ -17,7 +17,6 @@ package org.compiere.impexp; import java.io.FileInputStream; -import java.io.IOException; import org.compiere.model.MBankStatementLoader; import org.xml.sax.SAXException; @@ -38,6 +37,9 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im * @return boolean * @see org.compiere.impexp.BankStatementLoaderInterface#init(MBankStatementLoader) */ + //m_stream is not closed because the BufferedReader in the parent class is closed and according to the Java docs: + //Calling close() on the BufferedReader closes the underlying stream by default implementation + @SuppressWarnings("resource") public boolean init(MBankStatementLoader controller) { boolean result = false; @@ -72,13 +74,6 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im { m_errorMessage = new StringBuffer("ErrorReadingData"); m_errorDescription = new StringBuffer(); - }finally{ - if (m_stream != null) - try { - m_stream.close(); - } catch (IOException e) { - e.printStackTrace(); - } } return result; From 6fbb57307d5ab60b8f0b88462e78458c5e44bda8 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 4 Jul 2018 16:16:19 +0200 Subject: [PATCH 12/33] IDEMPIERE-3738 Reference Color broken --- .../src/org/compiere/model/MColumn.java | 2 -- .../src/org/compiere/util/DisplayType.java | 11 +++-------- .../src/org/compiere/db/DB_Oracle.java | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index 9e848670ee..c00434657b 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -743,8 +743,6 @@ public class MColumn extends X_AD_Column foreignTable = "S_ResourceAssignment"; } else if (DisplayType.Image == refid) { foreignTable = "AD_Image"; - } else if (DisplayType.Color == refid) { - foreignTable = "AD_Color"; } else if (DisplayType.Chart == refid) { foreignTable = "AD_Chart"; } diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index fb7ac27013..e78f1c2fbb 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -199,7 +199,7 @@ public final class DisplayType if (displayType == ID || displayType == Table || displayType == TableDir || displayType == Search || displayType == Location || displayType == Locator || displayType == Account || displayType == Assignment || displayType == PAttribute - || displayType == Image || displayType == Chart || displayType == Color) + || displayType == Image || displayType == Chart) return true; List factoryList = Service.locator().list(IDisplayTypeFactory.class).getServices(); @@ -622,13 +622,8 @@ public final class DisplayType else return "VARCHAR2(" + fieldLength + ")"; } - if (displayType == DisplayType.Color) // this condition is never reached - filtered above in isID - { - if (columnName.endsWith("_ID")) - return "NUMBER(10)"; - else - return "CHAR(" + fieldLength + ")"; - } + if (displayType == DisplayType.Color) + return "VARCHAR2(" + fieldLength + ")"; if (displayType == DisplayType.Button) { if (columnName.endsWith("_ID")) diff --git a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java index 8da0b11fc1..b589e1ebb0 100644 --- a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java +++ b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java @@ -925,7 +925,6 @@ public class DB_Oracle implements AdempiereDatabase // IDs case DisplayType.Account: case DisplayType.Assignment: - case DisplayType.Color: case DisplayType.ID: case DisplayType.Location: case DisplayType.Locator: @@ -979,6 +978,7 @@ public class DB_Oracle implements AdempiereDatabase break; // NVARCHAR + case DisplayType.Color: case DisplayType.Memo: case DisplayType.String: case DisplayType.Text: From a96208dd2a0c70c1923b6844d88b4d6528cbf6da Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 4 Jul 2018 16:17:28 +0200 Subject: [PATCH 13/33] IDEMPIERE-3738 Reference Color broken --- .../oracle/201807041616_IDEMPIERE-3738.sql | 135 ++++++++++++++++++ .../201807041616_IDEMPIERE-3738.sql | 132 +++++++++++++++++ 2 files changed, 267 insertions(+) create mode 100644 migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql create mode 100644 migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql diff --git a/migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql b/migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql new file mode 100644 index 0000000000..41fab20a29 --- /dev/null +++ b/migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql @@ -0,0 +1,135 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3738 Reference Color broken +-- Jul 4, 2018 4:02:49 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203229,0,0,'Y',TO_DATE('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,'Color','Color',NULL,NULL,'Color','D','c43cfcc2-2c92-4e91-88b8-88947297184d') +; + +-- Jul 4, 2018 4:03:02 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (213570,0,'Color',135,'Color',7,'N','N','N','N','N',0,'N',27,0,0,'Y',TO_DATE('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,203229,'Y','N','D','N','N','N','Y','46472ac6-1648-48d8-b0bd-aef0d61a447f','Y',0,'N','N') +; + +-- Jul 4, 2018 4:03:03 PM CEST +ALTER TABLE Test ADD Color VARCHAR2(7) DEFAULT NULL +; + +-- Jul 4, 2018 4:03:17 PM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (205590,'Color',152,213570,'Y',7,260,'N','N','N','N',0,0,'Y',TO_DATE('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','dc447e1a-b62a-4a90-92db-17203eb7d6ac','Y',260,2) +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=10, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=415 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=20, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2024 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=30, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=417 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=418 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=419 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=420 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=423 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=424 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=90, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=421 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=422 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3059 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3062 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=425 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=426 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_FieldGroup_ID=200016, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3209 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3902 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3210 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4251 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3057 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3056 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_FieldGroup_ID=123, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205590 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=416 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205058 +; + +-- Jul 4, 2018 4:08:25 PM CEST +UPDATE Test SET Color='#bfca3f',Updated=TO_DATE('2018-07-04 16:08:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE Test_ID=103 +; + +-- Jul 4, 2018 4:09:13 PM CEST +UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2018-07-04 16:09:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=294 +; + +-- Jul 4, 2018 4:09:21 PM CEST +UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2018-07-04 16:09:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=225 +; + +-- Jul 4, 2018 4:13:03 PM CEST +UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:13:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202518 +; + +-- Jul 4, 2018 4:13:12 PM CEST +UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:13:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202519 +; + +SELECT register_migration_script('201807041616_IDEMPIERE-3738.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql b/migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql new file mode 100644 index 0000000000..03c3a059b9 --- /dev/null +++ b/migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql @@ -0,0 +1,132 @@ +-- IDEMPIERE-3738 Reference Color broken +-- Jul 4, 2018 4:02:49 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203229,0,0,'Y',TO_TIMESTAMP('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,'Color','Color',NULL,NULL,'Color','D','c43cfcc2-2c92-4e91-88b8-88947297184d') +; + +-- Jul 4, 2018 4:03:02 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (213570,0,'Color',135,'Color',7,'N','N','N','N','N',0,'N',27,0,0,'Y',TO_TIMESTAMP('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,203229,'Y','N','D','N','N','N','Y','46472ac6-1648-48d8-b0bd-aef0d61a447f','Y',0,'N','N') +; + +-- Jul 4, 2018 4:03:03 PM CEST +ALTER TABLE Test ADD COLUMN Color VARCHAR(7) DEFAULT NULL +; + +-- Jul 4, 2018 4:03:17 PM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (205590,'Color',152,213570,'Y',7,260,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','dc447e1a-b62a-4a90-92db-17203eb7d6ac','Y',260,2) +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=10, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=415 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=20, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2024 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=30, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=417 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=418 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=419 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=420 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=423 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=424 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=90, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=421 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=422 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3059 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3062 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=425 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=426 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_FieldGroup_ID=200016, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3209 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3902 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3210 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4251 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3057 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3056 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_FieldGroup_ID=123, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205590 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=416 +; + +-- Jul 4, 2018 4:07:48 PM CEST +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205058 +; + +-- Jul 4, 2018 4:08:25 PM CEST +UPDATE Test SET Color='#bfca3f',Updated=TO_TIMESTAMP('2018-07-04 16:08:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE Test_ID=103 +; + +-- Jul 4, 2018 4:09:13 PM CEST +UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2018-07-04 16:09:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=294 +; + +-- Jul 4, 2018 4:09:21 PM CEST +UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2018-07-04 16:09:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=225 +; + +-- Jul 4, 2018 4:13:03 PM CEST +UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:13:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202518 +; + +-- Jul 4, 2018 4:13:12 PM CEST +UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:13:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202519 +; + +SELECT register_migration_script('201807041616_IDEMPIERE-3738.sql') FROM dual +; + From a293cb6a05e68c1b90a416931b6c131c6e7aabed Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 5 Jul 2018 16:32:33 +0200 Subject: [PATCH 14/33] IDEMPIERE-3739 Create lines from on Invoice is wrongly pointing to Ship BP instead of Bill BP --- .../src/org/compiere/grid/CreateFrom.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java b/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java index 455f886440..0b951fe694 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java @@ -99,14 +99,19 @@ public abstract class CreateFrom implements ICreateFrom .append(DB.TO_CHAR("o.GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx()))); // String column = "ol.QtyDelivered"; + String colBP = "o.C_BPartner_ID"; if (forInvoice) + { column = "ol.QtyInvoiced"; - StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,").append(display) - .append(" FROM C_Order o " - + "WHERE o.C_BPartner_ID=? AND o.IsSOTrx=? AND o.DocStatus IN ('CL','CO')" - + " AND o.C_Order_ID IN " - + "(SELECT ol.C_Order_ID FROM C_OrderLine ol" - + " WHERE ol.QtyOrdered - ").append(column).append(" != 0) "); + colBP = "o.Bill_BPartner_ID"; + } + StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,") + .append(display) + .append(" FROM C_Order o WHERE ") + .append(colBP) + .append("=? AND o.IsSOTrx=? AND o.DocStatus IN ('CL','CO') AND o.C_Order_ID IN (SELECT ol.C_Order_ID FROM C_OrderLine ol WHERE ol.QtyOrdered-") + .append(column) + .append("!=0) "); if(sameWarehouseOnly) { sql = sql.append(" AND o.M_Warehouse_ID=? "); From 31e1dead2cc3b51a01d56bcf435851d575cd26ea Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 9 Jul 2018 10:38:24 +0200 Subject: [PATCH 15/33] IDEMPIERE-3736 We can edit completed Document under specific condition. --- org.adempiere.base/src/org/compiere/model/GridTable.java | 5 +++-- .../adempiere/webui/adwindow/AbstractADWindowContent.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index f5a69abd89..d858349f12 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -104,11 +104,12 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = -4651516342985623070L; + private static final long serialVersionUID = -1022887214226173483L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; public static final String DATA_UPDATE_COPIED_MESSAGE = "UpdateCopied"; public static final String DATA_INSERTED_MESSAGE = "Inserted"; + public static final String DATA_IGNORED_MESSAGE = "Ignored"; /** * JDBC Based Buffered Table @@ -2858,7 +2859,7 @@ public class GridTable extends AbstractTableModel // fireTableRowsUpdated(m_rowChanged, m_rowChanged); >> messes up display?? (clearSelection) } m_newRow = -1; - fireDataStatusIEvent("Ignored", ""); + fireDataStatusIEvent(DATA_IGNORED_MESSAGE, ""); } // dataIgnore diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 010d9d49ed..ab9a29e3a2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -807,7 +807,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements @Override public void onCallback(Boolean result) { if (result) { - adTabbox.getSelectedGridTab().navigate(0); + adTabbox.getSelectedGridTab().navigate(-1); // not zero because of IDEMPIERE-3736 focusToActivePanel(); } } @@ -1398,6 +1398,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements || GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo) || GridTable.DATA_REFRESH_MESSAGE.equals(adInfo) || GridTable.DATA_INSERTED_MESSAGE.equals(adInfo) + || GridTable.DATA_IGNORED_MESSAGE.equals(adInfo) || GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo) ) { From 3f1026519f6219b4e04ad48c42112e8c5ad207a8 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 9 Jul 2018 14:43:18 +0200 Subject: [PATCH 16/33] IDEMPIERE-2944 Preserve iDempiere session between sucessive webservice calls / fix Context Lost issue --- org.adempiere.base/src/org/compiere/util/Login.java | 4 ++++ .../org/idempiere/adinterface/CompiereService.java | 12 +++++++++--- .../src/org/idempiere/adinterface/CompiereUtil.java | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index ffb0efe452..37b99a26d2 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -1324,6 +1324,7 @@ public class Login user.setIsLocked(false); user.setDateAccountLocked(null); user.setFailedLoginCount(0); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to unlock user account"); } @@ -1337,6 +1338,7 @@ public class Login { user.setIsLocked(true); user.setDateAccountLocked(new Timestamp(now)); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to lock user account"); } @@ -1441,6 +1443,7 @@ public class Login { user.setFailedLoginCount(0); user.setDateLastLogin(new Timestamp(now)); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to update user record with date last login (" + user.getName() + " / clientID = " + user.getAD_Client_ID() + ")"); } @@ -1490,6 +1493,7 @@ public class Login user.setFailedLoginCount(count); user.setIsLocked(reachMaxAttempt); user.setDateAccountLocked(user.isLocked() ? new Timestamp(now) : null); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to update user record with increase failed login count"); } diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java index 1b32318e58..826b5c6b35 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java @@ -159,6 +159,7 @@ public class CompiereService { Properties savedCache = new Properties(); savedCache.putAll(Env.getCtx()); ctxMap.put(key.toString(), savedCache); + if (log.isLoggable(Level.INFO)) log.info("Saving " + this + " in cache"); } } } @@ -201,15 +202,16 @@ public class CompiereService { String loginInfo = null; // Verify existence of User/Client/Org/Role and User's acces to Client & Org String sql = "SELECT u.Name || '@' || c.Name || '.' || o.Name AS Text " - + "FROM AD_User u, AD_Client c, AD_Org o, AD_User_Roles ur " + + "FROM AD_User u, AD_Client c, AD_Org o, AD_User_Roles ur, AD_Role r " + "WHERE u.AD_User_ID=?" // #1 + " AND c.AD_Client_ID=?" // #2 + " AND o.AD_Org_ID=?" // #3 + " AND ur.AD_Role_ID=?" // #4 + " AND ur.AD_User_ID=u.AD_User_ID" + + " AND ur.AD_Role_ID=r.AD_Role_ID" + " AND (o.AD_Client_ID = 0 OR o.AD_Client_ID=c.AD_Client_ID)" - + " AND c.AD_Client_ID IN (SELECT AD_Client_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)" - + " AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)"; + + " AND (r.IsAccessAllOrgs='Y' OR (c.AD_Client_ID IN (SELECT AD_Client_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)" + + " AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)))"; PreparedStatement pstmt = null; ResultSet rs = null; try @@ -406,10 +408,13 @@ public class CompiereService { l_cs = csMap.get(key); if (l_cs != null) { if (l_cs.isExpired()) { + csMap.remove(key); + ctxMap.remove(key); l_cs = null; } else { Properties cachedCtx = ctxMap.get(key); Env.getCtx().putAll(cachedCtx); + if (log.isLoggable(Level.INFO)) log.info("Reusing " + l_cs); } } } @@ -445,6 +450,7 @@ public class CompiereService { ); if (m_connected && expired) { + if (log.isLoggable(Level.INFO)) log.info("Closing expired/invalid " + this); Env.logout(); ServerContext.dispose(); m_loggedin = false; diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java index a08d624ea2..f99cdd2a9e 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java @@ -35,6 +35,7 @@ public class CompiereUtil { try { + if (log.isLoggable(Level.INFO)) log.info("Starting webservices iDempiere session"); s_initOK = Adempiere.startup(false); } catch (Exception ex) From 3b1bf465428c42d2189b06c4092c9b1239d0c11b Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Mon, 9 Jul 2018 19:24:07 +0200 Subject: [PATCH 17/33] IDEMPIERE-3631 InfoWindow : Reference Date+Time only displays Date in grid --- .../webui/component/WListItemRenderer.java | 13 ++++++++++--- .../src/org/adempiere/webui/component/WListbox.java | 10 +++++++--- .../org/adempiere/webui/component/WTableColumn.java | 10 ++++++++++ .../src/org/adempiere/webui/info/InfoWindow.java | 1 + .../src/org/compiere/minigrid/ColumnInfo.java | 9 +++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index e8e9931174..82c49fdc5d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -294,8 +294,11 @@ public class WListItemRenderer implements ListitemRenderer, EventListene } else if (field instanceof Timestamp) { - SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, AEnv.getLanguage(Env.getCtx())); + + if (m_tableColumns.get(columnIndex).getAD_Reference_ID()==DisplayType.DateTime) { + dateFormat = DisplayType.getDateFormat(DisplayType.DateTime, AEnv.getLanguage(Env.getCtx()),"dd/M/yyyy hh:mm"); + } listcell.setValue(dateFormat.format((Timestamp)field)); if (isCellEditable) { @@ -396,7 +399,10 @@ public class WListItemRenderer implements ListitemRenderer, EventListene { addColumn(header, null); } - + public void addColumn(String header, String description) + { + addColumn(header, description, 0); + } /** * Add Table Column. * after adding a column, you need to set the column classes again @@ -405,13 +411,14 @@ public class WListItemRenderer implements ListitemRenderer, EventListene * @param header The header text for the column * @param description */ - public void addColumn(String header, String description) + public void addColumn(String header, String description, int AD_Reference_ID) { WTableColumn tableColumn; tableColumn = new WTableColumn(); tableColumn.setHeaderValue(Util.cleanAmp(header)); tableColumn.setTooltipText(description); + tableColumn.setAD_Reference_ID(AD_Reference_ID); m_tableColumns.add(tableColumn); return; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java index ef04eaffbc..7969600657 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java @@ -371,7 +371,7 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis } // add to model - addColumn(layout[columnIndex].getColHeader(), layout[columnIndex].getColDescription()); + addColumn(layout[columnIndex].getColHeader(), layout[columnIndex].getColDescription(), layout[columnIndex].getAD_Reference_ID()); // set the colour column if (layout[columnIndex].isColorColumn()) @@ -438,16 +438,20 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis addColumn(header, null); } + public void addColumn (String header, String description) + { + addColumn(header, description, 0); + } /** * Add Table Column and specify the column header. * * @param header name of column header * @param description */ - public void addColumn (String header, String description) + public void addColumn (String header, String description, int AD_Reference_ID) { WListItemRenderer renderer = (WListItemRenderer)getItemRenderer(); - renderer.addColumn(Util.cleanAmp(header), description); + renderer.addColumn(Util.cleanAmp(header), description, AD_Reference_ID); getModel().addColumn(); return; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java index 05a34d4289..24b6753a9a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java @@ -45,6 +45,8 @@ public class WTableColumn protected String tooltipText; + private int AD_Reference_ID; + /** * Cover method, using a default width of 75 * @see #WTableColumn(int) @@ -288,4 +290,12 @@ public class WTableColumn public void setTooltipText(String tooltipText) { this.tooltipText = tooltipText; } + + public int getAD_Reference_ID() { + return AD_Reference_ID; + } + + public void setAD_Reference_ID(int AD_Reference_ID) { + this.AD_Reference_ID=AD_Reference_ID; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index ba93dd4d12..b2a8b53bb2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -710,6 +710,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true)); } columnInfo.setColDescription(infoColumn.get_Translation("Description")); + columnInfo.setAD_Reference_ID(infoColumn.getAD_Reference_ID()); columnInfo.setGridField(gridFields.get(i)); list.add(columnInfo); diff --git a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java index ec416b191d..9fd98b7d42 100644 --- a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java +++ b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java @@ -82,6 +82,7 @@ public class ColumnInfo private GridField m_gridField; private String colDescription; + private int AD_Reference_ID; /** * Get Col Class @@ -214,4 +215,12 @@ public class ColumnInfo public void setColDescription(String colDescription) { this.colDescription = colDescription; } + + public int getAD_Reference_ID() { + return AD_Reference_ID; + } + + public void setAD_Reference_ID(int AD_Reference_ID) { + this.AD_Reference_ID = AD_Reference_ID; + } } // infoColumn From 7f2ae83d53e837c8fdfe9f373728740df2e97ca0 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 9 Jul 2018 19:24:52 +0200 Subject: [PATCH 18/33] IDEMPIERE-3631 InfoWindow : Reference Date+Time only displays Date in grid / peer review --- .../org/adempiere/webui/component/WListItemRenderer.java | 9 ++++----- .../src/org/adempiere/webui/component/WListbox.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index 82c49fdc5d..538f9c4c1e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -294,11 +294,10 @@ public class WListItemRenderer implements ListitemRenderer, EventListene } else if (field instanceof Timestamp) { - SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, AEnv.getLanguage(Env.getCtx())); - - if (m_tableColumns.get(columnIndex).getAD_Reference_ID()==DisplayType.DateTime) { - dateFormat = DisplayType.getDateFormat(DisplayType.DateTime, AEnv.getLanguage(Env.getCtx()),"dd/M/yyyy hh:mm"); - } + int refId = m_tableColumns.get(columnIndex).getAD_Reference_ID(); + if (refId == 0) + refId = DisplayType.Date; + SimpleDateFormat dateFormat = DisplayType.getDateFormat(refId, AEnv.getLanguage(Env.getCtx())); listcell.setValue(dateFormat.format((Timestamp)field)); if (isCellEditable) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java index 7969600657..7d59ed67f7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java @@ -59,7 +59,7 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis /** * */ - private static final long serialVersionUID = -706774424788688953L; + private static final long serialVersionUID = -5501893389366975849L; /** Logger. */ private static CLogger logger = CLogger.getCLogger(WListbox.class); From ada02cdea559064dc642517884d389f27984f378 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 9 Jul 2018 20:26:15 +0200 Subject: [PATCH 19/33] IDEMPIERE-3735 Import Business Partner gives a 'Null Pointer Exception' / IDEMPIERE-3512 --- .../src/org/adempiere/impexp/GridTabCSVImporter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 811669430e..81193e7a82 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -1485,6 +1485,7 @@ public class GridTabCSVImporter implements IGridTabImporter StringBuilder postSelect = new StringBuilder(" FROM ") .append(foreignTable).append(" WHERE ") .append(foreignColumn).append("=? AND IsActive='Y' AND AD_Client_ID=?"); + if (field != null ) { if (!Util.isEmpty(field.getVO().ValidationCode)) { String dynamicValid = Env.parseContext(Env.getCtx(), field.getWindowNo(), field.getGridTab().getTabNo(), field.getVO().ValidationCode, false); if (Util.isEmpty(dynamicValid)) { @@ -1509,6 +1510,7 @@ public class GridTabCSVImporter implements IGridTabImporter } } } + } StringBuilder selectCount = new StringBuilder("SELECT COUNT(*)").append(postSelect); StringBuilder selectId = new StringBuilder("SELECT ").append(foreignTable).append("_ID").append(postSelect); int count = DB.getSQLValueEx(trxName, selectCount.toString(), value, thisClientId); From b2a629155c127049ad6d83b3e013b25ef29550a1 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Wed, 13 Jun 2018 06:14:41 -0400 Subject: [PATCH 20/33] #IDEMPIERE-3733 : Advanced Search - Deleting other then last line cause ID space issue --- .../WEB-INF/src/org/adempiere/webui/window/FindWindow.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 6fb8ca3fc3..df7ae65c4c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -232,6 +232,8 @@ public class FindWindow extends Window implements EventListener, ValueCha private Properties m_simpleCtx; private Properties m_advanceCtx; + private int rowCount; + private static final String ON_POST_VISIBLE_ATTR = "onPostVisible.Event.Posted"; /** @@ -831,7 +833,7 @@ public class FindWindow extends Window implements EventListener, ValueCha if (null!=fields && fields.length>=1 && fields[0].contains(HISTORY_SEPARATOR)) return; ListItem listItem = new ListItem(); - listItem.setId("Row"+advancedPanel.getItemCount()); + listItem.setId("Row"+ rowCount++); Listbox listColumn = new Listbox(); listColumn.setId("listColumn"+listItem.getId()); From 91882dcb44a64cd4bfb6bc2c1c7c514174be43ab Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 9 Jul 2018 21:19:34 +0200 Subject: [PATCH 21/33] IDEMPIERE-3719 Add display name when sending emails --- .../src/org/compiere/util/EMail.java | 29 +++++++++++++++---- .../adempiere/webui/window/WEMailDialog.java | 4 +-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 0acd0d8c43..4d8a9c7f4c 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -72,7 +72,7 @@ public final class EMail implements Serializable /** * */ - private static final long serialVersionUID = -2489441683920482601L; + private static final long serialVersionUID = 5355436165040508855L; //use in server bean public final static String HTML_MAIL_MARKER = "ContentType=text/html;"; @@ -602,7 +602,7 @@ public final class EMail implements Serializable } try { - m_from = new InternetAddress (newFrom, true); + m_from = createInternetAddress(newFrom); if (MSysConfig.getBooleanValue(MSysConfig.MAIL_SEND_BCC_TO_FROM, false, Env.getAD_Client_ID(Env.getCtx()))) addBcc(newFrom); } @@ -628,7 +628,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (newTo, true); + ia = createInternetAddress(newTo); } catch (Exception e) { @@ -679,7 +679,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (newCc, true); + ia = createInternetAddress(newCc); } catch (Exception e) { @@ -719,7 +719,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (bccAddress, true); + ia = createInternetAddress(bccAddress); } catch (Exception e) { @@ -758,7 +758,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (newTo, true); + ia = createInternetAddress(newTo); } catch (Exception e) { @@ -1221,4 +1221,21 @@ public final class EMail implements Serializable additionalHeaders.add(new ValueNamePair(value, name)); } + /** + * Create an internet address with personal if the email address is formatted as "Personal " + * @param email + * @return internet address with personal if defined + * @throws Exception + */ + public static InternetAddress createInternetAddress(String email) throws Exception { + InternetAddress ia = new InternetAddress (email, true); + if (email.contains("<") && email.contains(">")) { + int idx = email.lastIndexOf("<"); + String personal = email.substring(0, idx).trim(); + if (! personal.isEmpty()) + ia.setPersonal(personal); + } + return ia; + } + } // EMail diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java index be27e656c5..54b4ea28d5 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java @@ -524,7 +524,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC return; } - StringTokenizer st = new StringTokenizer(getTo(), " ,;", false); + StringTokenizer st = new StringTokenizer(getTo(), ",;", false); String to = st.nextToken(); EMail email = m_client.createEMail(getFrom(), to, getSubject(), replaceBASE64Img(getMessage()), true); String status = "Check Setup"; @@ -533,7 +533,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC while (st.hasMoreTokens()) email.addTo(st.nextToken()); // cc - StringTokenizer stcc = new StringTokenizer(getCc(), " ,;", false); + StringTokenizer stcc = new StringTokenizer(getCc(), ",;", false); while (stcc.hasMoreTokens()) { String cc = stcc.nextToken(); From a9eb35a4c2da8acabda0b0d711d09937235ae469 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 9 Jul 2018 21:33:18 +0200 Subject: [PATCH 22/33] IDEMPIERE-2857 Improve transaction names for deletes / integrate peer reviewed patch from Nicolas Micoud (nmicoud) / IDEMPIERE-3416 --- org.adempiere.base/src/org/compiere/model/PO.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 9496ab6025..f1de8670b8 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -2069,7 +2069,10 @@ public abstract class PO l_trxname.setLength(23); m_trxName = Trx.createTrxName(l_trxname.toString()); localTrx = Trx.get(m_trxName, true); - localTrx.setDisplayName(getClass().getName()+"_save"); + if (newRecord) + localTrx.setDisplayName(getClass().getName() + "_insert"); + else + localTrx.setDisplayName(getClass().getName() + "_update_ID" + get_ID()); localTrx.getConnection(); } else @@ -3216,7 +3219,7 @@ public abstract class PO { localTrxName = Trx.createTrxName("POdel"); localTrx = Trx.get(localTrxName, true); - localTrx.setDisplayName(getClass().getName()+"_delete"); + localTrx.setDisplayName(getClass().getName()+ "_delete_ID" + get_ID()); localTrx.getConnection(); m_trxName = localTrxName; } From 975e7d7c87018eb4fed55541e10555801a860c62 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Tue, 10 Jul 2018 09:40:57 +0200 Subject: [PATCH 23/33] IDEMPIERE-3713 When updating a location, the related tab needs save --- .../src/org/adempiere/webui/editor/WLocationEditor.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java index e9a116ecb3..59688e6031 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java @@ -174,6 +174,7 @@ public class WLocationEditor extends WEditor implements EventListener, Pr { if (log.isLoggable(Level.CONFIG)) log.config( "actionPerformed - " + m_value); final WLocationDialog ld = new WLocationDialog(Msg.getMsg(Env.getCtx(), "Location"), m_value, gridField); + final int oldValue = m_value == null ? 0 : m_value.getC_Location_ID(); ld.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override @@ -189,10 +190,8 @@ public class WLocationEditor extends WEditor implements EventListener, Pr if (m_value != null) C_Location_ID = m_value.getC_Location_ID(); Integer ii = new Integer(C_Location_ID); - // force Change - user does not realize that embedded object is already saved. - ValueChangeEvent valuechange = new ValueChangeEvent(WLocationEditor.this,getColumnName(),null,null); - fireValueChange(valuechange); // resets m_mLocation - if (C_Location_ID != 0) + + if (C_Location_ID != 0 && oldValue == 0) { ValueChangeEvent vc = new ValueChangeEvent(WLocationEditor.this,getColumnName(),null,ii); fireValueChange(vc); From ab5c5817fa63dd2c48982f5b638a49dccb0f48bc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jul 2018 13:34:43 +0200 Subject: [PATCH 24/33] IDEMPIERE-3743 Changing price list does not change currency when entering an invoice/order (AP2-383) --- .../src/org/compiere/model/CalloutOrder.java | 65 ++++++------------- .../src/org/compiere/model/MPriceList.java | 2 +- 2 files changed, 20 insertions(+), 47 deletions(-) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 617ac5698f..9776dff0ef 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -651,58 +651,31 @@ public class CalloutOrder extends CalloutEngine Integer M_PriceList_ID = (Integer) mTab.getValue("M_PriceList_ID"); if (M_PriceList_ID == null || M_PriceList_ID.intValue()== 0) return ""; - if (steps) log.warning("init"); - PreparedStatement pstmt = null; - ResultSet rs = null; - String sql = "SELECT pl.IsTaxIncluded,pl.EnforcePriceLimit,pl.C_Currency_ID,c.StdPrecision," - + "plv.M_PriceList_Version_ID,plv.ValidFrom " - + "FROM M_PriceList pl,C_Currency c,M_PriceList_Version plv " - + "WHERE pl.C_Currency_ID=c.C_Currency_ID" - + " AND pl.M_PriceList_ID=plv.M_PriceList_ID" - + " AND pl.M_PriceList_ID=? " // 1 - + " AND plv.ValidFrom <= ? " - + "ORDER BY plv.ValidFrom DESC"; - // Use newest price list - may not be future - try - { - pstmt = DB.prepareStatement(sql, null); - pstmt.setInt(1, M_PriceList_ID.intValue()); - Timestamp date = new Timestamp(System.currentTimeMillis()); + + MPriceList pl = MPriceList.get(ctx, M_PriceList_ID, null); + if (pl != null && pl.getM_PriceList_ID() == M_PriceList_ID) { + if (!readonly) { + // Tax Included + mTab.setValue("IsTaxIncluded", pl.isTaxIncluded()); + // Currency + mTab.setValue("C_Currency_ID", pl.getC_Currency_ID()); + } + // Price Limit Enforce + Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pl.isEnforcePriceLimit()); + + // PriceList Version + Timestamp date = null; if (mTab.getAD_Table_ID() == I_C_Order.Table_ID) date = Env.getContextAsDate(ctx, WindowNo, "DateOrdered"); else if (mTab.getAD_Table_ID() == I_C_Invoice.Table_ID) date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced"); - pstmt.setTimestamp(2, date); - - rs = pstmt.executeQuery(); - if (rs.next()) - { - // Tax Included - if (!readonly) { - mTab.setValue("IsTaxIncluded", new Boolean("Y".equals(rs.getString(1)))); - } - // Price Limit Enforce - Env.setContext(ctx, WindowNo, "EnforcePriceLimit", rs.getString(2)); - // Currency - if (!readonly) { - Integer ii = new Integer(rs.getInt(3)); - mTab.setValue("C_Currency_ID", ii); - } - // PriceList Version - Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", rs.getInt(5)); + MPriceListVersion plv = pl.getPriceListVersion(date); + if (plv != null && plv.getM_PriceList_Version_ID() > 0) { + Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", plv.getM_PriceList_Version_ID()); + } else { + Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", (String) null); } } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - return e.getLocalizedMessage(); - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } - if (steps) log.warning("fini"); return ""; } // priceListFill diff --git a/org.adempiere.base/src/org/compiere/model/MPriceList.java b/org.adempiere.base/src/org/compiere/model/MPriceList.java index f569d2b6f9..b06188c463 100644 --- a/org.adempiere.base/src/org/compiere/model/MPriceList.java +++ b/org.adempiere.base/src/org/compiere/model/MPriceList.java @@ -248,7 +248,7 @@ public class MPriceList extends X_M_PriceList .setOrderBy("ValidFrom DESC") .first(); if (m_plv == null) - log.warning("None found M_PriceList_ID=" + getM_PriceList_ID() + " - " + valid); + if (log.isLoggable(Level.INFO)) log.info("None found M_PriceList_ID=" + getM_PriceList_ID() + " - " + valid); else if (log.isLoggable(Level.FINE)) log.fine(m_plv.toString()); return m_plv; From c55c7d7c9e230cedbfcd95fd87cc4eced75eb5e5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jul 2018 16:22:14 +0200 Subject: [PATCH 25/33] IDEMPIERE-2085 Labels in the dialog Create new request is not translated! / IDEMPIERE-699 --- .../org/adempiere/webui/apps/FeedbackRequestWindow.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java index 0f915c1812..8984e55d86 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java @@ -114,10 +114,10 @@ public class FeedbackRequestWindow extends Window implements EventListener Date: Wed, 11 Jul 2018 16:26:41 +0200 Subject: [PATCH 26/33] IDEMPIERE-1421 Tax Group field is enabled in the window Customer --- migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql | 11 +++++++++++ .../i5.1/postgresql/201807111626_IDEMPIERE-1421.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql create mode 100644 migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql diff --git a/migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql b/migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql new file mode 100644 index 0000000000..9abfa8e9c4 --- /dev/null +++ b/migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1421 Tax Group field is enabled in the window Customer +-- Jul 11, 2018 4:25:37 PM CEST +UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-11 16:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62773 +; + +SELECT register_migration_script('201807111626_IDEMPIERE-1421.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql b/migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql new file mode 100644 index 0000000000..c8146664c5 --- /dev/null +++ b/migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-1421 Tax Group field is enabled in the window Customer +-- Jul 11, 2018 4:25:37 PM CEST +UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-11 16:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62773 +; + +SELECT register_migration_script('201807111626_IDEMPIERE-1421.sql') FROM dual +; + From 8466e356d392c45b20b0fe1d9fd1cdefcfcff26f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jul 2018 16:49:27 +0200 Subject: [PATCH 27/33] IDEMPIERE-1341 Wrong label in the Record Info dialog --- .../src/org/compiere/model/GridTable.java | 4 ++-- .../src/org/adempiere/webui/window/WRecordInfo.java | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index d858349f12..144304b5ac 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -104,7 +104,7 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = -1022887214226173483L; + private static final long serialVersionUID = -2741647620577906242L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; public static final String DATA_UPDATE_COPIED_MESSAGE = "UpdateCopied"; @@ -550,7 +550,7 @@ public class GridTable extends AbstractTableModel * @param index index * @return GridField */ - protected GridField getField (int index) + public GridField getField (int index) { if (index < 0 || index >= m_fields.size()) return null; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java index f0452474c7..bde7e1c6b1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java @@ -35,6 +35,7 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.model.DataStatusEvent; +import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.model.GridTable; import org.compiere.model.MChangeLog; @@ -248,14 +249,19 @@ public class WRecordInfo extends Window implements EventListener //get uuid GridTable gridTable = null; + String tabName = null; if (dse.getSource() instanceof GridTab) { GridTab gridTab = (GridTab) dse.getSource(); gridTable = gridTab.getTableModel(); + tabName = gridTab.getName(); } else if (dse.getSource() instanceof GridTable) { - gridTable = (GridTable) dse.getSource(); + gridTable = (GridTable) dse.getSource(); + GridField firstField = gridTable.getField(0); + if (firstField != null && firstField.getGridTab() != null) + tabName = firstField.getGridTab().getName(); } if (gridTable != null && dse.getCurrentRow() >= 0 && dse.getCurrentRow() < gridTable.getRowCount()) { @@ -271,11 +277,12 @@ public class WRecordInfo extends Window implements EventListener } // Title - if (dse.AD_Table_ID != 0) + if (tabName == null && dse.AD_Table_ID != 0) { MTable table1 = MTable.get (Env.getCtx(), dse.AD_Table_ID); - setTitle(title + " - " + table1.getName()); + tabName = table1.getName(); } + setTitle(title + " - " + tabName); // Only Client Preference can view Change Log if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType())) From 9332613bf1fca29ec257bed1f0afed80e0fed5d7 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jul 2018 17:19:37 +0200 Subject: [PATCH 28/33] IDEMPIERE-1177 Record Info not showing UUID for zero ID records --- .../adempiere/webui/window/WRecordInfo.java | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java index bde7e1c6b1..89c9fc55ec 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java @@ -263,12 +263,37 @@ public class WRecordInfo extends Window implements EventListener if (firstField != null && firstField.getGridTab() != null) tabName = firstField.getGridTab().getName(); } + + int Record_ID = -1; + if (dse.Record_ID instanceof Integer) + Record_ID = ((Integer)dse.Record_ID).intValue(); + else + log.info("dynInit - Invalid Record_ID=" + dse.Record_ID); + + MTable dbtable = null; + if (dse.AD_Table_ID != 0) + dbtable = MTable.get(Env.getCtx(), dse.AD_Table_ID); + if (gridTable != null && dse.getCurrentRow() >= 0 && dse.getCurrentRow() < gridTable.getRowCount()) { PO po = gridTable.getPO(dse.getCurrentRow()); if (po != null) { String uuidcol = po.getUUIDColumnName(); - String uuid = po.get_ValueAsString(uuidcol); + String uuid = null; + if (po.is_new()) { + if (Record_ID == 0 && MTable.isZeroIDTable(dbtable.getTableName())) { + StringBuilder sql = new StringBuilder("SELECT ") + .append(uuidcol) + .append(" FROM ") + .append(dbtable.getTableName()) + .append(" WHERE ") + .append(dbtable.getTableName()) + .append("_ID=0"); + uuid = DB.getSQLValueString(null, sql.toString()); + } + } else { + uuid = po.get_ValueAsString(uuidcol); + } if (!Util.isEmpty(uuid)) m_info.append("\n ").append(uuidcol).append("=").append(uuid); m_permalink.setHref(AEnv.getZoomUrlTableID(po)); @@ -279,8 +304,7 @@ public class WRecordInfo extends Window implements EventListener // Title if (tabName == null && dse.AD_Table_ID != 0) { - MTable table1 = MTable.get (Env.getCtx(), dse.AD_Table_ID); - tabName = table1.getName(); + tabName = dbtable.getName(); } setTitle(title + " - " + tabName); @@ -288,12 +312,7 @@ public class WRecordInfo extends Window implements EventListener if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType())) return false; - int Record_ID = 0; - if (dse.Record_ID instanceof Integer) - Record_ID = ((Integer)dse.Record_ID).intValue(); - else - log.info("dynInit - Invalid Record_ID=" + dse.Record_ID); - if (Record_ID == 0) + if (Record_ID <= 0) return false; // Data From 6bbd9da27531a88ba0d8437a4d65ba0522bd55e7 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jul 2018 18:05:19 +0200 Subject: [PATCH 29/33] IDEMPIERE-1328 Change tab name dynamically / * mark is not being shown when not autosave --- .../org/adempiere/webui/adwindow/AbstractADWindowContent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index ab9a29e3a2..484883a67b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -1403,7 +1403,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements ) { String prefix = null; - if (dbInfo.contains("*")) + if (dbInfo.contains("*") || dbInfo.contains("?")) // ? used when not-autosave prefix = "*"; String titleLogic = null; From cce8a172486107afeb4f6cdbc5c9b089f39c59f7 Mon Sep 17 00:00:00 2001 From: Murilo Habermann Torquato Date: Wed, 11 Jul 2018 18:21:03 +0200 Subject: [PATCH 30/33] IDEMPIERE-1643 Adding a status bar for FindWindow --- .../adempiere/webui/window/FindWindow.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index df7ae65c4c..5d0a29ae95 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -71,6 +71,7 @@ import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.factory.ButtonFactory; +import org.adempiere.webui.panel.StatusBarPanel; import org.adempiere.webui.part.MultiTabPart; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; @@ -236,6 +237,10 @@ public class FindWindow extends Window implements EventListener, ValueCha private static final String ON_POST_VISIBLE_ATTR = "onPostVisible.Event.Posted"; + /** START DEVCOFFEE **/ + private StatusBarPanel statusBar = new StatusBarPanel(); + /** END DEVCOFFEE **/ + /** * FindPanel Constructor * @param targetWindowNo targetWindowNo @@ -622,6 +627,9 @@ public class FindWindow extends Window implements EventListener, ValueCha winMain.addTab(tabPanel, Msg.getMsg(Env.getCtx(), "Advanced").replaceAll("&", ""), false, false); initSimple(); initAdvanced(); + /** START DEVCOFFEE **/ + layout.appendChild(statusBar); + /** START DEVCOFFEE **/ } // initPanel @@ -801,6 +809,11 @@ public class FindWindow extends Window implements EventListener, ValueCha gridFieldList = null; m_total = getNoOfRecords(null, false); + /** START DEVCOFFEE **/ + // Get Total + setStatusDB (m_total); + statusBar.setStatusLine(""); + /** END DEVCOFFEE **/ } // initFind /** @@ -2568,6 +2581,18 @@ public class FindWindow extends Window implements EventListener, ValueCha public boolean isValid() { return isvalid; - } - + } + + /** START DEVCOFFEE **/ + /** + * Display current count + * @param currentCount String representation of current/total + */ + private void setStatusDB (int currentCount) + { + StringBuilder text = new StringBuilder(" ").append(currentCount).append(" / ").append(m_total).append(" "); + statusBar.setStatusDB(text.toString()); + } // setDtatusDB + /** END DEVCOFFEE **/ + } // FindPanel \ No newline at end of file From 1ff8e68438e080f828ef3b9efd27926b52f08b73 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 11 Jul 2018 19:11:29 +0200 Subject: [PATCH 31/33] IDEMPIERE-1703 improve search panel --- .../adempiere/webui/window/FindWindow.java | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 5d0a29ae95..515ac989e2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -94,7 +94,6 @@ import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; -import org.compiere.util.SecureEngine; import org.compiere.util.Util; import org.compiere.util.ValueNamePair; import org.zkoss.zk.au.out.AuFocus; @@ -351,6 +350,10 @@ public class FindWindow extends Window implements EventListener, ValueCha btnNew.setId("btnNew"); btnNew.addEventListener(Events.ON_CLICK,this); + Button btnClear = ButtonFactory.createNamedButton(ConfirmPanel.A_RESET); + btnClear.setId("btnReset"); + btnClear.addEventListener(Events.ON_CLICK,this); + Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK); btnOk.setName("btnOkSimple"); btnOk.setId("btnOk"); @@ -361,6 +364,7 @@ public class FindWindow extends Window implements EventListener, ValueCha btnCancel.addEventListener(Events.ON_CLICK,this); Panel pnlButtonRight = new Panel(); + pnlButtonRight.appendChild(btnClear); pnlButtonRight.appendChild(btnOk); pnlButtonRight.appendChild(btnCancel); pnlButtonRight.setStyle("text-align:right"); @@ -671,7 +675,7 @@ public class FindWindow extends Window implements EventListener, ValueCha mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended mField.getVO().DisplayLength = mField.getVO().FieldLength; } - if (mField.getVO().displayType == DisplayType.YesNo) { + if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted()) { // Make Yes-No searchable as list GridFieldVO vo = mField.getVO(); GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); @@ -1136,7 +1140,8 @@ public class FindWindow extends Window implements EventListener, ValueCha editor.addValueChangeListener(this); Label label = editor.getLabel(); Component fieldEditor = editor.getComponent(); - + //Fix miss lable of checkbox + label.setValue(mField.getHeader()); // if (displayLength > 0) // set it back mField.setDisplayLength(displayLength); @@ -1359,6 +1364,21 @@ public class FindWindow extends Window implements EventListener, ValueCha m_isCancel = false; dispose(); } + else if ("btnReset".equals(btn.getName())){ + for (WEditor clearField : m_sEditors){ + clearField.setValue(null); + } + + for (WEditor clearField : m_sEditorsTo){ + if (clearField != null){ + clearField.setValue(null); + clearField.setVisible(false); + + ToolBarButton moreButtor = m_sEditorsFlag.get(m_sEditorsTo.indexOf(clearField)); + moreButtor.setChecked(false); + } + } + } } } else if (Events.ON_OK.equals(event.getName())) @@ -1789,13 +1809,22 @@ public class FindWindow extends Window implements EventListener, ValueCha // globalqss - Carlos Ruiz - 20060711 // fix a bug with virtualColumn + isSelectionColumn not yielding results GridField field = getTargetMField(ColumnName); - // add encryption here if the field is encrypted. - if (field.isEncryptedColumn()) { - value = SecureEngine.encrypt(value, Env.getAD_Client_ID(Env.getCtx())); - } boolean isProductCategoryField = isProductCategoryField(field.getColumnName()); StringBuilder ColumnSQL = new StringBuilder(field.getColumnSQL(false)); + + // add encryption here if the field is encrypted. + if (field.isEncrypted()) { + String Operator = MQuery.NULL; + if ("Y".equals(value)){ + Operator = MQuery.NOT_NULL; + } + m_query.addRestriction(ColumnSQL.toString(), Operator, null, + ColumnName, wed.getDisplay()); + appendCode(code, ColumnName, Operator, "", "", "AND", "", ""); + continue; + } + // // Be more permissive for String columns if (isSearchLike(field)) From 72e7e21d2883d82e8e6809a6e8a0662eeeb61022 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jul 2018 19:38:30 +0200 Subject: [PATCH 32/33] IDEMPIERE-1703 improve search panel / peer review --- .../src/org/compiere/model/MQuery.java | 13 ++++++++++--- .../src/org/adempiere/webui/window/FindWindow.java | 11 +++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MQuery.java b/org.adempiere.base/src/org/compiere/model/MQuery.java index 6547eb66df..99d34788ff 100644 --- a/org.adempiere.base/src/org/compiere/model/MQuery.java +++ b/org.adempiere.base/src/org/compiere/model/MQuery.java @@ -45,6 +45,11 @@ import org.compiere.util.ValueNamePair; */ public class MQuery implements Serializable { + /** + * + */ + private static final long serialVersionUID = 481623650333512326L; + /** * Get Query from Parameter * @param ctx context (to determine language) @@ -357,9 +362,6 @@ public class MQuery implements Serializable m_TableName = MTable.getTableName (Env.getCtx(), AD_Table_ID); } // MQuery - /** Serialization Info **/ - private static final long serialVersionUID = 4883859385509199306L; - /** Table Name */ private String m_TableName = ""; /** PInstance */ @@ -448,6 +450,11 @@ public class MQuery implements Serializable new ValueNamePair (NULL, " NULL "), new ValueNamePair (NOT_NULL, " !NULL ") }; + /** Operators for encrypted fields */ + public static final ValueNamePair[] OPERATORS_ENCRYPTED = new ValueNamePair[] { + new ValueNamePair (NULL, " NULL "), + new ValueNamePair (NOT_NULL, " !NULL ") + }; /** Operators for Numbers, Dates, Integers */ public static final ValueNamePair[] OPERATORS_NUMBERS = new ValueNamePair[] { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 515ac989e2..86330bc8c0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -675,7 +675,7 @@ public class FindWindow extends Window implements EventListener, ValueCha mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended mField.getVO().DisplayLength = mField.getVO().FieldLength; } - if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted()) { + if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted() || mField.isEncryptedColumn()) { // Make Yes-No searchable as list GridFieldVO vo = mField.getVO(); GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); @@ -1965,12 +1965,19 @@ public class FindWindow extends Window implements EventListener, ValueCha { String columnName = column.getValue().toString(); int referenceType = -1; + boolean isEncrypted = false; if (columnName != null) { MTable table = MTable.get(Env.getCtx(), m_tableName); MColumn col = table.getColumn(columnName); referenceType = col.getAD_Reference_ID(); + GridField field = getTargetMField(columnName); + isEncrypted = (col.isEncrypted() || field.isEncrypted()); } - if (DisplayType.isLookup(referenceType) + if (isEncrypted) + { + addOperators(MQuery.OPERATORS_ENCRYPTED, listOperator); + } + else if (DisplayType.isLookup(referenceType) || DisplayType.YesNo == referenceType || DisplayType.Button == referenceType) { From 6e62f45845239d7072e01cb0b891f302830f77cd Mon Sep 17 00:00:00 2001 From: hieplq Date: Sat, 14 Jul 2018 22:34:31 +0700 Subject: [PATCH 33/33] IDEMPIERE-3631: InfoWindow : Reference Date+Time only displays Date in grid java.lang.IndexOutOfBoundsException --- .../org/adempiere/webui/component/WListItemRenderer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index 538f9c4c1e..14f988f807 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -294,7 +294,11 @@ public class WListItemRenderer implements ListitemRenderer, EventListene } else if (field instanceof Timestamp) { - int refId = m_tableColumns.get(columnIndex).getAD_Reference_ID(); + int refId = 0; + if (m_tableColumns != null && columnIndex < m_tableColumns.size()) { + refId = m_tableColumns.get(columnIndex).getAD_Reference_ID(); + } + if (refId == 0) refId = DisplayType.Date; SimpleDateFormat dateFormat = DisplayType.getDateFormat(refId, AEnv.getLanguage(Env.getCtx()));