From c87223e5c9b54fa7ea323ec424c4b78647813efb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 5 Feb 2020 22:38:02 +0100 Subject: [PATCH] IDEMPIERE-4167 Can't use Copy Info Window columns process with an Order By clause --- .../compiere/process/CopyInfoWindowColumns.java | 6 +++--- .../src/org/compiere/model/MInfoColumn.java | 13 ++++++++++--- .../src/org/compiere/model/MInfoWindow.java | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java b/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java index c1242cc8af..3a0734de25 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java +++ b/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java @@ -90,19 +90,19 @@ public class CopyInfoWindowColumns extends SvrProcess MInfoWindow sourceInfoWindow = new MInfoWindow(getCtx(), p_source_AD_InfoWindow_ID, get_TrxName()); MInfoColumn[] sourceColumns = sourceInfoWindow.getInfoColumns(); + targetInfoWindow.setIsValidateEachColumn(false); for (int i = 0; i < sourceColumns.length; i++) { - MInfoColumn colTarget = new MInfoColumn(getCtx(),0, get_TrxName()); + MInfoColumn colTarget = new MInfoColumn(targetInfoWindow); PO.copyValues(sourceColumns[i], colTarget); colTarget.setAD_InfoWindow_ID (targetInfoWindow.getAD_InfoWindow_ID()); - colTarget.setAD_Org_ID(targetInfoWindow.getAD_Org_ID()); colTarget.setEntityType(targetInfoWindow.getEntityType()); colTarget.setIsActive(sourceColumns[i].isActive()); colTarget.saveEx(get_TrxName()); m_count++; } - + targetInfoWindow.validate(); // return "#" + m_count; } // doIt diff --git a/org.adempiere.base/src/org/compiere/model/MInfoColumn.java b/org.adempiere.base/src/org/compiere/model/MInfoColumn.java index 92f42b6a1a..b309d119b4 100644 --- a/org.adempiere.base/src/org/compiere/model/MInfoColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MInfoColumn.java @@ -41,7 +41,7 @@ public class MInfoColumn extends X_AD_InfoColumn implements IInfoColumn /** * */ - private static final long serialVersionUID = 9198213211937136870L; + private static final long serialVersionUID = -6313260451237775302L; /** * Stanfard Constructor @@ -65,6 +65,13 @@ public class MInfoColumn extends X_AD_InfoColumn implements IInfoColumn super (ctx, rs, trxName); } // MInfoColumn + public MInfoColumn(MInfoWindow targetInfoWindow) { + this(targetInfoWindow.getCtx(), 0, targetInfoWindow.get_TrxName()); + m_parent = targetInfoWindow; + this.setAD_InfoWindow_ID (targetInfoWindow.getAD_InfoWindow_ID()); + this.setEntityType(targetInfoWindow.getEntityType()); + } + /** Parent */ private MInfoWindow m_parent = null; @@ -172,9 +179,9 @@ public class MInfoColumn extends X_AD_InfoColumn implements IInfoColumn return success; // evaluate need valid - boolean isNeedValid = newRecord || is_ValueChanged (MInfoColumn.COLUMNNAME_SelectClause); + boolean isNeedValid = getParent().isValidateEachColumn() && (newRecord || is_ValueChanged (MInfoColumn.COLUMNNAME_SelectClause)); - // call valid of parrent + // call valid of parent if (isNeedValid){ getParent().validate(); getParent().saveEx(get_TrxName()); diff --git a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java index 04b00c79e3..41179d2bc0 100644 --- a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java @@ -43,7 +43,7 @@ public class MInfoWindow extends X_AD_InfoWindow /** * */ - private static final long serialVersionUID = -3627504150648422756L; + private static final long serialVersionUID = -1619434756919905441L; /** * Standard Constructor @@ -455,5 +455,19 @@ public class MInfoWindow extends X_AD_InfoWindow // valid state this.setIsValid(true); } + + /** + * IDEMPIERE-4167 + **/ + private boolean m_validateEachColumn = true; + + public void setIsValidateEachColumn (boolean validateEachColumn) { + m_validateEachColumn= validateEachColumn; + } + + boolean isValidateEachColumn() { + return m_validateEachColumn; + } + } // MInfoWindow