From af9c479b910b57497f16348fdcdcfd3c4adbe61e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 12 Jan 2016 14:37:37 +0100 Subject: [PATCH 01/34] IDEMPIERE-2392 Posted status incorrect when reposting on a period closed / add the case for draft orders --- org.adempiere.base/src/org/compiere/model/MPeriod.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MPeriod.java b/org.adempiere.base/src/org/compiere/model/MPeriod.java index b2e4b35485..bd636a89ce 100644 --- a/org.adempiere.base/src/org/compiere/model/MPeriod.java +++ b/org.adempiere.base/src/org/compiere/model/MPeriod.java @@ -346,6 +346,13 @@ public class MPeriod extends X_C_Period s_log.warning("Could not find C_DocType_ID (null or not Integer) for " + table.getTableName()); return true; } + if (doctypeID == 0 && tableID == MOrder.Table_ID) { + idxdoctype = po.get_ColumnIndex("C_DocTypeTarget_ID"); + objint = po.get_Value(idxdoctype); + if (objint != null && objint instanceof Integer) { + doctypeID = (Integer) objint; + } + } MDocType dt = MDocType.get(ctx, doctypeID); docBaseType = dt.getDocBaseType(); } From 79ff4ff1694cbc88d8561096e39adcaaad13969e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 17 Jan 2016 18:14:45 +0100 Subject: [PATCH 02/34] IDEMPIERE-1140 Copy record uses wrong quantity when used in shipment line / receipt line - fix also UOM in case is different --- .../src/org/compiere/model/CalloutInOut.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java index dba843e84c..a7d2df2b0d 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java @@ -706,6 +706,9 @@ public class CalloutInOut extends CalloutEngine // serialized ASI - force qty yo 1 - IDEMPIERE-1140 mTab.setValue("MovementQty", Env.ONE); mTab.setValue("QtyEntered", Env.ONE); + MProduct product = MProduct.get(ctx, M_Product_ID); + if (product != null) + mTab.setValue("C_UOM_ID", product.getC_UOM_ID()); } return ""; } // asi From 3221fa354162b8325c55214e72bfb006e43cc3ba Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 19 Jan 2016 15:29:17 +0100 Subject: [PATCH 03/34] IDEMPIERE-3006 Reporting on a document window is not respecting the query --- .../webui/panel/action/ReportAction.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index f8e9cb8c40..8889b02057 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -270,19 +270,19 @@ public class ReportAction implements EventListener int Record_ID = 0; int[] RecordIDs = null; MQuery query = new MQuery(gridTab.getTableName()); - String whereClause; + StringBuilder whereClause = new StringBuilder(""); if (currentRowOnly) { Record_ID = gridTab.getRecord_ID(); - whereClause = gridTab.getTableModel().getWhereClause(gridTab.getCurrentRow()); - if (whereClause==null) - whereClause = gridTab.getTableModel().getSelectWhereClause(); + whereClause.append(gridTab.getTableModel().getWhereClause(gridTab.getCurrentRow())); + if (whereClause.length() == 0) + whereClause.append(gridTab.getTableModel().getSelectWhereClause()); } else { - whereClause = gridTab.getTableModel().getSelectWhereClause(); + whereClause.append(gridTab.getTableModel().getSelectWhereClause()); RecordIDs = new int[gridTab.getRowCount()]; for(int i = 0; i < gridTab.getRowCount(); i++) { @@ -290,24 +290,34 @@ public class ReportAction implements EventListener } } - if (whereClause!=null && whereClause.length() > 0) + if (whereClause.length() > 0) { - if (whereClause.indexOf('@') != -1) //replace variables in context + if (whereClause.indexOf("@") != -1) //replace variables in context { - String context = Env.parseContext(Env.getCtx(), panel.getWindowNo(), whereClause, false); + String context = Env.parseContext(Env.getCtx(), panel.getWindowNo(), whereClause.toString(), false); if(context != null && context.trim().length() > 0) { - whereClause = context; + whereClause = new StringBuilder(context); } else { log.log(Level.WARNING, "Failed to parse where clause. whereClause= "+whereClause); - whereClause = ("1 = 2"); + whereClause = new StringBuilder("1 = 2"); } } } - - query.addRestriction(whereClause); + + if (!currentRowOnly && gridTab.isOnlyCurrentRows() && gridTab.getTabNo() == 0) + { + if (whereClause.length() > 0) + whereClause.append(" AND "); + // Show only unprocessed or the one updated within x days + whereClause.append("(").append(gridTab.getTableName()).append(".Processed='N' OR ").append(gridTab.getTableName()).append(".Updated>"); + whereClause.append("SysDate-1"); + whereClause.append(")"); + } + + query.addRestriction(whereClause.toString()); PrintInfo info = new PrintInfo(pf.getName(), pf.getAD_Table_ID(), Record_ID); info.setDescription(query.getInfo()); From 6217046c4dfa9e140b1cffe6b683dcfe636034b9 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 20 Jan 2016 14:55:05 +0100 Subject: [PATCH 04/34] IDEMPIERE-2985 Recurring : implement Payment --- .../oracle/201512231444_IDEMPIERE-2985.sql | 10 ++++++++++ .../201512231444_IDEMPIERE-2985.sql | 7 +++++++ .../src/org/compiere/model/MRecurring.java | 20 +++++++++++++++++++ .../src/org/compiere/model/X_C_Recurring.java | 4 +++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql create mode 100644 migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql diff --git a/migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql b/migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql new file mode 100644 index 0000000000..816a619394 --- /dev/null +++ b/migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2985 : Recurring : implement Payment +-- Dec 23, 2015 2:43:32 PM CET +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200345,'Payment',282,'P',0,0,'Y',TO_DATE('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,'D','b3e77f8d-0d0d-4bf5-bb42-d998fb0c728c') +; + +SELECT register_migration_script('201512231444_IDEMPIERE-2985.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql b/migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql new file mode 100644 index 0000000000..4ecac66161 --- /dev/null +++ b/migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-2985 : Recurring : implement Payment +-- Dec 23, 2015 2:43:32 PM CET +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200345,'Payment',282,'P',0,0,'Y',TO_TIMESTAMP('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,'D','b3e77f8d-0d0d-4bf5-bb42-d998fb0c728c') +; + +SELECT register_migration_script('201512231444_IDEMPIERE-2985.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MRecurring.java b/org.adempiere.base/src/org/compiere/model/MRecurring.java index 1c4e1f14b4..9c22649641 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecurring.java +++ b/org.adempiere.base/src/org/compiere/model/MRecurring.java @@ -128,6 +128,26 @@ public class MRecurring extends X_C_Recurring msg += journal.getDocumentNo(); setLastPO(journal); } + else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Payment)) + { + MPayment from = new MPayment(getCtx(), getC_Payment_ID(), get_TrxName()); + MPayment to = new MPayment(getCtx(), 0, get_TrxName()); + copyValues(from, to); + to.setAD_Org_ID(from.getAD_Org_ID()); + to.setIsReconciled(false); // can't be already on a bank statement + to.setDateAcct(dateDoc); + to.setDateTrx(dateDoc); + to.setDocumentNo(""); + to.setProcessed(false); + to.setPosted(false); + to.setDocStatus(MPayment.DOCSTATUS_Drafted); + to.setDocAction(MPayment.DOCACTION_Complete); + to.saveEx(); + + run.setC_Payment_ID(to.getC_Payment_ID()); + msg += to.getDocumentNo(); + setLastPO(to); + } else return "Invalid @RecurringType@ = " + getRecurringType(); run.saveEx(get_TrxName()); diff --git a/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java b/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java index 676bb50079..d63b05af91 100644 --- a/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java +++ b/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java @@ -31,7 +31,7 @@ public class X_C_Recurring extends PO implements I_C_Recurring, I_Persistent /** * */ - private static final long serialVersionUID = 20151030L; + private static final long serialVersionUID = 20151223L; /** Standard Constructor */ public X_C_Recurring (Properties ctx, int C_Recurring_ID, String trxName) @@ -452,6 +452,8 @@ public class X_C_Recurring extends PO implements I_C_Recurring, I_Persistent public static final String RECURRINGTYPE_GLJournal = "G"; /** Project = J */ public static final String RECURRINGTYPE_Project = "J"; + /** Payment = P */ + public static final String RECURRINGTYPE_Payment = "P"; /** Set Recurring Type. @param RecurringType Type of Recurring Document From 36e41f171bccaae471234c0ff29e87156754c033 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 20 Jan 2016 16:18:05 +0100 Subject: [PATCH 05/34] IDEMPIERE-3008 Store divider of tree panel location for window per user --- .../adempiere/webui/adwindow/ADTabpanel.java | 71 +++++++++++++------ 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 96f479bc4a..fc750ca1f2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -203,6 +203,8 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer public static final String ON_TOGGLE_EVENT = "onToggle"; + private static final String DEFAULT_PANEL_WIDTH = "300px"; + private static enum SouthEvent { SLIDE(), OPEN(), @@ -360,7 +362,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer treePanel = new ADTreePanel(windowNo, gridTab.getTabNo()); West west = new West(); west.appendChild(treePanel); - west.setWidth("300px"); + west.setWidth(widthTreePanel()); west.setCollapsible(true); west.setSplittable(true); west.setAutoscroll(true); @@ -1171,6 +1173,17 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer return height; } + private String widthTreePanel() { + String width = null; + int windowId = getGridTab().getAD_Window_ID(); + int adTabId = getGridTab().getAD_Tab_ID(); + if (windowId > 0 && adTabId > 0) { + width = Env.getPreference(Env.getCtx(), windowId, adTabId+"|TreePanel.Width", false); + } + else + width = DEFAULT_PANEL_WIDTH; + return width; + } private void navigateTo(DefaultTreeNode value) { MTreeNode treeNode = value.getData(); // We Have a TreeNode @@ -1740,31 +1753,43 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer if (formContainer.getSouth() != null) { if (formContainer.getSouth().isVisible() && formContainer.getSouth().isOpen()) { String height = formContainer.getSouth().getHeight(); - if (! Util.isEmpty(height)) { - int windowId = getGridTab().getAD_Window_ID(); - int adTabId = getGridTab().getAD_Tab_ID(); - if (windowId > 0 && adTabId > 0) { - Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_Preference.Table_ID), "AD_Window_ID=? AND Attribute=? AND AD_User_ID=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'", null); - int userId = Env.getAD_User_ID(Env.getCtx()); - MPreference preference = query.setOnlyActiveRecords(true) - .setApplyAccessFilter(true) - .setParameters(windowId, adTabId+"|DetailPane.Height", userId) - .first(); - if (preference == null || preference.getAD_Preference_ID() <= 0) { - preference = new MPreference(Env.getCtx(), 0, null); - preference.setAD_Window_ID(windowId); - preference.set_ValueOfColumn("AD_User_ID", userId); // required set_Value for System=0 user - preference.setAttribute(adTabId+"|DetailPane.Height"); - } - preference.setValue(height); - preference.saveEx(); - //update current context - Env.getCtx().setProperty("P"+windowId+"|"+adTabId+"|DetailPane.Height", height); - } - } + if (! Util.isEmpty(height)) + savePreference("DetailPane.Height", height); } } + + if (treePanel != null && formContainer.getWest() != null) { + if (formContainer.getWest().isVisible() && formContainer.getWest().isOpen()) { + String width = formContainer.getWest().getWidth(); + if (! Util.isEmpty(width)) + savePreference("TreePanel.Width", width); + } + } + super.onPageDetached(page); } + void savePreference(String attribute, String value) + { + int windowId = getGridTab().getAD_Window_ID(); + int adTabId = getGridTab().getAD_Tab_ID(); + if (windowId > 0 && adTabId > 0) { + Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_Preference.Table_ID), "AD_Window_ID=? AND Attribute=? AND AD_User_ID=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'", null); + int userId = Env.getAD_User_ID(Env.getCtx()); + MPreference preference = query.setOnlyActiveRecords(true) + .setApplyAccessFilter(true) + .setParameters(windowId, adTabId+"|"+attribute, userId) + .first(); + if (preference == null || preference.getAD_Preference_ID() <= 0) { + preference = new MPreference(Env.getCtx(), 0, null); + preference.setAD_Window_ID(windowId); + preference.set_ValueOfColumn("AD_User_ID", userId); // required set_Value for System=0 user + preference.setAttribute(adTabId+"|"+attribute); + } + preference.setValue(value); + preference.saveEx(); + //update current context + Env.getCtx().setProperty("P"+windowId+"|"+adTabId+"|"+attribute, value); + } + } } From 3ea996711838a55597950109b7d00766897b4637 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 Jan 2016 16:18:52 +0100 Subject: [PATCH 06/34] iIDEMPIERE-3008 Store divider of tree panel location for window per user / peer review --- .../WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index fc750ca1f2..7f082df202 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -131,7 +131,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer /** * */ - private static final long serialVersionUID = -3728896318124756192L; + private static final long serialVersionUID = -6108216899210485771L; private static final String ON_SAVE_OPEN_PREFERENCE_EVENT = "onSaveOpenPreference"; @@ -1180,8 +1180,9 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer if (windowId > 0 && adTabId > 0) { width = Env.getPreference(Env.getCtx(), windowId, adTabId+"|TreePanel.Width", false); } - else + if (Util.isEmpty(width)) { width = DEFAULT_PANEL_WIDTH; + } return width; } private void navigateTo(DefaultTreeNode value) { From 39ba0fba8f8de6ade957e7c0c7f91e600e29add6 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 20 Jan 2016 22:07:11 +0700 Subject: [PATCH 07/34] IDEMPIERE-3003:Info Window - Reset button should reset grid content --- .../WEB-INF/src/org/adempiere/webui/info/InfoWindow.java | 2 ++ .../WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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 1994010c23..164d519e5f 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 @@ -1646,6 +1646,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL // filter dynamic value dynamicDisplay(null); + + onQueryCallback (null); } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index e4bcb447f5..eb5fea8e16 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -1984,7 +1984,12 @@ public abstract class InfoPanel extends Window implements EventListener, } } m_sqlUserOrder=""; - executeQuery(); + // event == null mean direct call from reset button + if (event == null) + m_count = 0; + else + executeQuery(); + renderItems(); // IDEMPIERE-1334 after refresh, restore prev selected item start // just evaluate display logic of process button when requery by use click requery button From 2d840a2f4dd5147262461386b94102cb6ded03cd Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 20 Jan 2016 17:05:46 +0100 Subject: [PATCH 08/34] IDEMPIERE-2954 Hardcoded messages when an error occurs on converting currencies in invoices --- .../oracle/201601201427_IDEMPIERE-2954.sql | 41 +++++++++++++++++++ .../201601201427_IDEMPIERE-2954.sql | 38 +++++++++++++++++ .../org/compiere/model/MAllocationHdr.java | 37 +++++++---------- .../compiere/model/MConversionRateUtil.java | 10 +++++ .../src/org/compiere/model/MInvoice.java | 10 ++--- .../src/org/compiere/model/MPayment.java | 8 ++-- 6 files changed, 112 insertions(+), 32 deletions(-) create mode 100644 migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql create mode 100644 migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql diff --git a/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql b/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql new file mode 100644 index 0000000000..c001801c92 --- /dev/null +++ b/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql @@ -0,0 +1,41 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jan 20, 2016 2:26:58 PM CET +-- IDEMPIERE-2954 +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200393,'0e4f4eec-17f8-478e-a598-ed833bf5493c',0,TO_DATE('2016-01-20 14:26:57','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert currency {0} to base currency {1}','I',TO_DATE('2016-01-20 14:26:57','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToProjectCurrency') +; + +UPDATE AD_Message SET MsgText='Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}',Updated=TO_DATE('2016-01-20 15:34:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 3:34:28 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - converstion type : {2} / Date : {3}',Updated=TO_DATE('2016-01-20 15:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 3:34:38 PM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') +; + +-- Jan 20, 2016 3:35:50 PM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') +; + +-- Jan 20, 2016 3:36:05 PM CET +UPDATE AD_Message SET EntityType='D', MsgText='Could not convert currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}',Updated=TO_DATE('2016-01-20 15:36:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200394 +; + +-- Jan 20, 2016 3:36:15 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - conversion type : {2} / conversion date : {3}',Updated=TO_DATE('2016-01-20 15:36:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 3:36:20 PM CET +UPDATE AD_Message SET EntityType='D',Updated=TO_DATE('2016-01-20 15:36:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200395 +; + +-- Jan 20, 2016 3:36:59 PM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency') +; + +SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql b/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql new file mode 100644 index 0000000000..e178d3fc60 --- /dev/null +++ b/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql @@ -0,0 +1,38 @@ +-- Jan 20, 2016 2:26:58 PM CET +-- IDEMPIERE-2954 +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200393,'0e4f4eec-17f8-478e-a598-ed833bf5493c',0,TO_TIMESTAMP('2016-01-20 14:26:57','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert currency {0} to base currency {1}','I',TO_TIMESTAMP('2016-01-20 14:26:57','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToProjectCurrency') +; + +UPDATE AD_Message SET MsgText='Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}',Updated=TO_TIMESTAMP('2016-01-20 15:34:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 3:34:28 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - converstion type : {2} / Date : {3}',Updated=TO_TIMESTAMP('2016-01-20 15:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 3:34:38 PM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') +; + +-- Jan 20, 2016 3:35:50 PM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') +; + +-- Jan 20, 2016 3:36:05 PM CET +UPDATE AD_Message SET EntityType='D', MsgText='Could not convert currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}',Updated=TO_TIMESTAMP('2016-01-20 15:36:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200394 +; + +-- Jan 20, 2016 3:36:15 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - conversion type : {2} / conversion date : {3}',Updated=TO_TIMESTAMP('2016-01-20 15:36:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 3:36:20 PM CET +UPDATE AD_Message SET EntityType='D',Updated=TO_TIMESTAMP('2016-01-20 15:36:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200395 +; + +-- Jan 20, 2016 3:36:59 PM CET +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency') +; + +SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java index 0f6232eb00..09825997c2 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java @@ -54,7 +54,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction /** * */ - private static final long serialVersionUID = 8726957992840702609L; + private static final long serialVersionUID = -7787519874581251920L; /** Tolerance Gain and Loss */ private static final BigDecimal TOLERANCE = BigDecimal.valueOf(0.02); @@ -966,9 +966,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction getC_Currency_ID(), paymentDate, convTypeID, getAD_Client_ID(), getAD_Org_ID()); if (amt == null) { - m_processMsg = "Could not convert allocation C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(getCtx()).getC_Currency_ID() + ", C_ConversionType_ID=" + convTypeID - + ", conversion date= " + paymentDate; + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", + getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); return false; } openBalanceDiff = openBalanceDiff.add(amt); @@ -980,9 +979,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction getC_Currency_ID(), paymentDate, convTypeID, getAD_Client_ID(), getAD_Org_ID()); if (amt == null) { - m_processMsg = "Could not convert allocation C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(getCtx()).getC_Currency_ID() + ", C_ConversionType_ID=" + convTypeID - + ", conversion date= " + paymentDate; + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", + getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); return false; } openBalanceDiff = openBalanceDiff.add(amt); @@ -993,9 +991,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction getC_Currency_ID(), getDateAcct(), convTypeID, getAD_Client_ID(), getAD_Org_ID()); if (allocAmtBase == null) { - m_processMsg = "Could not convert allocation C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(getCtx()).getC_Currency_ID() + ", C_ConversionType_ID=" + convTypeID - + ", conversion date= " + getDateAcct(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", + getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, getDateAcct(), get_TrxName()); return false; } @@ -1009,9 +1006,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction getC_Currency_ID(), invoice.getDateAcct(), invoice.getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); if (amt == null) { - m_processMsg = "Could not convert allocation C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(getCtx()).getC_Currency_ID() + ", C_ConversionType_ID=" + invoice.getC_ConversionType_ID() - + ", conversion date= " + invoice.getDateAcct(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", + getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); return false; } openBalanceDiff = openBalanceDiff.add(amt); @@ -1028,9 +1024,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction getC_Currency_ID(), invoice.getC_Currency_ID(), getDateAcct(), invoice.getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); if (allocAmt == null) { - m_processMsg = "Could not convert allocation C_Currency_ID=" + getC_Currency_ID() - + " to invoice C_Currency_ID=" + invoice.getC_Currency_ID() + ", C_ConversionType_ID=" + invoice.getC_ConversionType_ID() - + ", conversion date= " + getDateAcct(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToInvoiceCurrency", + getC_Currency_ID(), invoice.getC_Currency_ID(), invoice.getC_ConversionType_ID(), getDateAcct(), get_TrxName()); return false; } } @@ -1038,9 +1033,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction invoice.getC_Currency_ID(), invoice.getDateAcct(), invoice.getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); if (invAmtAccted == null) { - m_processMsg = "Could not convert invoice C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + invoice.getC_Currency_ID() + ", C_ConversionType_ID=" + invoice.getC_ConversionType_ID() - + ", date= " + invoice.getDateAcct(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingInvoiceCurrencyToBaseCurrency", + getC_Currency_ID(), invoice.getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); return false; } @@ -1048,9 +1042,8 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction invoice.getC_Currency_ID(), getDateAcct(), invoice.getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); if (allocAmtAccted == null) { - m_processMsg = "Could not convert invoice C_Currency_ID=" + invoice.getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(getCtx()).getC_Currency_ID() + ", C_ConversionType_ID=" + invoice.getC_ConversionType_ID() - + ", conversion date= " + getDateAcct(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingInvoiceCurrencyToBaseCurrency", + invoice.getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), getDateAcct(), get_TrxName()); return false; } diff --git a/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java b/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java index 0f76abb32f..5ec016d2cc 100644 --- a/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java +++ b/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java @@ -6,10 +6,12 @@ package org.compiere.model; import java.math.BigDecimal; import java.math.RoundingMode; import java.sql.Timestamp; +import java.util.Properties; import java.util.logging.Level; import org.compiere.util.CLogger; import org.compiere.util.Env; +import org.compiere.util.Msg; import org.idempiere.exceptions.NoCurrencyConversionException; /** @@ -100,4 +102,12 @@ public final class MConversionRateUtil if (s_log.isLoggable(Level.FINE)) s_log.fine("amt=" + sourceAmt + " * " + rate + "=" + amt + ", scale=" + stdPrecision); return amt; } // convert + + /** Return the message to show when no exchange rate is found */ + public static String getErrorMessage(Properties ctx, String adMessage, int currencyFromID, int currencyToID, int convertionTypeID, Timestamp date, String trxName) + { + String retValue = Msg.getMsg(ctx, adMessage, + new Object[] {MCurrency.get(ctx, currencyFromID).getISO_Code(), MCurrency.get(ctx, currencyFromID).getISO_Code(), new MConversionType(ctx, convertionTypeID, trxName).getName(), date}); + return retValue; + } } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 39e5943080..c2fb15342b 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -67,7 +67,7 @@ public class MInvoice extends X_C_Invoice implements DocAction /** * */ - private static final long serialVersionUID = 6262118410996877227L; + private static final long serialVersionUID = -9210893813732918522L; /** * Get Payments Of BPartner @@ -1897,8 +1897,8 @@ public class MInvoice extends X_C_Invoice implements DocAction getC_Currency_ID(), getDateAcct(), getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); if (invAmt == null) { - m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(Env.getCtx()).getC_Currency_ID(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency", + getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); return DocAction.STATUS_Invalid; } // Total Balance @@ -1968,8 +1968,8 @@ public class MInvoice extends X_C_Invoice implements DocAction getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID()); if (amt == null) { - m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID() - + " to Project C_Currency_ID=" + C_CurrencyTo_ID; + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToProjectCurrency", + getC_Currency_ID(), C_CurrencyTo_ID, 0, getDateAcct(), get_TrxName()); return DocAction.STATUS_Invalid; } BigDecimal newAmt = project.getInvoicedAmt(); diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index d9bd87d70a..0982847e0a 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -80,9 +80,7 @@ import org.compiere.util.ValueNamePair; public class MPayment extends X_C_Payment implements DocAction, ProcessCall, PaymentInterface { - /** - * - */ + private static final long serialVersionUID = -7179638016937305380L; /** @@ -1983,8 +1981,8 @@ public class MPayment extends X_C_Payment getC_Currency_ID(), getDateAcct(), getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); if (payAmt == null) { - m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID() - + " to base C_Currency_ID=" + MClient.get(Env.getCtx()).getC_Currency_ID(); + m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency", + getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); return DocAction.STATUS_Invalid; } // Total Balance From 810128a0207d9f980c74a324fd21c214b3d7ce54 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 Jan 2016 17:17:44 +0100 Subject: [PATCH 09/34] IDEMPIERE-2954 Hardcoded messages when an error occurs on converting currencies in invoices / peer review --- .../oracle/201601201427_IDEMPIERE-2954.sql | 18 +++++++++++++++--- .../postgresql/201601201427_IDEMPIERE-2954.sql | 18 +++++++++++++++--- .../src/org/compiere/model/MAllocationHdr.java | 10 +++++----- .../compiere/model/MConversionRateUtil.java | 2 +- .../src/org/compiere/model/MInvoice.java | 2 +- .../src/org/compiere/model/MPayment.java | 2 +- 6 files changed, 38 insertions(+), 14 deletions(-) diff --git a/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql b/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql index c001801c92..b4b4046ec7 100644 --- a/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql +++ b/migration/i3.1/oracle/201601201427_IDEMPIERE-2954.sql @@ -14,11 +14,11 @@ UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currenc ; -- Jan 20, 2016 3:34:38 PM CET -INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') ; -- Jan 20, 2016 3:35:50 PM CET -INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') ; -- Jan 20, 2016 3:36:05 PM CET @@ -37,5 +37,17 @@ UPDATE AD_Message SET EntityType='D',Updated=TO_DATE('2016-01-20 15:36:20','YYYY INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency') ; +-- Jan 20, 2016 4:47:30 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_DATE('2016-01-20 16:47:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200394 +; + +-- Jan 20, 2016 4:47:33 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_DATE('2016-01-20 16:47:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 4:47:37 PM CET +UPDATE AD_Message SET MsgText='Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_DATE('2016-01-20 16:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200396 +; + SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual -; \ No newline at end of file +; diff --git a/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql b/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql index e178d3fc60..d6e78f8742 100644 --- a/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql +++ b/migration/i3.1/postgresql/201601201427_IDEMPIERE-2954.sql @@ -11,11 +11,11 @@ UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currenc ; -- Jan 20, 2016 3:34:38 PM CET -INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') ; -- Jan 20, 2016 3:35:50 PM CET -INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') ; -- Jan 20, 2016 3:36:05 PM CET @@ -34,5 +34,17 @@ UPDATE AD_Message SET EntityType='D',Updated=TO_TIMESTAMP('2016-01-20 15:36:20', INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency') ; +-- Jan 20, 2016 4:47:30 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_TIMESTAMP('2016-01-20 16:47:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200394 +; + +-- Jan 20, 2016 4:47:33 PM CET +UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_TIMESTAMP('2016-01-20 16:47:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200393 +; + +-- Jan 20, 2016 4:47:37 PM CET +UPDATE AD_Message SET MsgText='Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_TIMESTAMP('2016-01-20 16:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200396 +; + SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual -; \ No newline at end of file +; diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java index 09825997c2..775f30908e 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java @@ -967,7 +967,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction if (amt == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", - getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); + getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); return false; } openBalanceDiff = openBalanceDiff.add(amt); @@ -980,7 +980,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction if (amt == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", - getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); + getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); return false; } openBalanceDiff = openBalanceDiff.add(amt); @@ -992,7 +992,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction if (allocAmtBase == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", - getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, getDateAcct(), get_TrxName()); + getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), convTypeID, getDateAcct(), get_TrxName()); return false; } @@ -1007,7 +1007,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction if (amt == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", - getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); + getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); return false; } openBalanceDiff = openBalanceDiff.add(amt); @@ -1034,7 +1034,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction if (invAmtAccted == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingInvoiceCurrencyToBaseCurrency", - getC_Currency_ID(), invoice.getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); + invoice.getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); return false; } diff --git a/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java b/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java index 5ec016d2cc..8e76c0a2d3 100644 --- a/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java +++ b/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java @@ -107,7 +107,7 @@ public final class MConversionRateUtil public static String getErrorMessage(Properties ctx, String adMessage, int currencyFromID, int currencyToID, int convertionTypeID, Timestamp date, String trxName) { String retValue = Msg.getMsg(ctx, adMessage, - new Object[] {MCurrency.get(ctx, currencyFromID).getISO_Code(), MCurrency.get(ctx, currencyFromID).getISO_Code(), new MConversionType(ctx, convertionTypeID, trxName).getName(), date}); + new Object[] {MCurrency.get(ctx, currencyFromID).getISO_Code(), MCurrency.get(ctx, currencyToID).getISO_Code(), new MConversionType(ctx, convertionTypeID, trxName).getName(), date}); return retValue; } } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index c2fb15342b..4a8d068279 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1898,7 +1898,7 @@ public class MInvoice extends X_C_Invoice implements DocAction if (invAmt == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency", - getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); + getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); return DocAction.STATUS_Invalid; } // Total Balance diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 0982847e0a..536b5a55e2 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -1982,7 +1982,7 @@ public class MPayment extends X_C_Payment if (payAmt == null) { m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency", - getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); + getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); return DocAction.STATUS_Invalid; } // Total Balance From 71f8c3c3a923073552d10c0a82574fdc7dfaf8e9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 27 Jan 2016 17:06:25 +0100 Subject: [PATCH 10/34] IDEMPIERE-3015 Wrong AD_Sequence_UU shown in Field record panel --- migration/i3.1/oracle/201601271704_IDEMPIERE-3015.sql | 11 +++++++++++ .../i3.1/postgresql/201601271704_IDEMPIERE-3015.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i3.1/oracle/201601271704_IDEMPIERE-3015.sql create mode 100644 migration/i3.1/postgresql/201601271704_IDEMPIERE-3015.sql diff --git a/migration/i3.1/oracle/201601271704_IDEMPIERE-3015.sql b/migration/i3.1/oracle/201601271704_IDEMPIERE-3015.sql new file mode 100644 index 0000000000..d013abf6c7 --- /dev/null +++ b/migration/i3.1/oracle/201601271704_IDEMPIERE-3015.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3015 +-- Jan 27, 2016 5:03:50 PM CET +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_DATE('2016-01-27 17:03:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=749 +; + +SELECT register_migration_script('201601271704_IDEMPIERE-3015.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201601271704_IDEMPIERE-3015.sql b/migration/i3.1/postgresql/201601271704_IDEMPIERE-3015.sql new file mode 100644 index 0000000000..407bd20472 --- /dev/null +++ b/migration/i3.1/postgresql/201601271704_IDEMPIERE-3015.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-3015 +-- Jan 27, 2016 5:03:50 PM CET +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2016-01-27 17:03:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=749 +; + +SELECT register_migration_script('201601271704_IDEMPIERE-3015.sql') FROM dual +; + From 949c93b2218a985e160e2e4a64589937d510d5e6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 27 Jan 2016 17:17:35 +0100 Subject: [PATCH 11/34] IDEMPIERE-3013 Multi Languages - column not foud (c_order_header_v and c_order_header_vt) --- .../oracle/views/C_ORDER_HEADER_VT.sql | 2 +- .../postgresql/views/C_ORDER_HEADER_VT.sql | 2 +- .../oracle/201601271716_IDEMPIERE-3013.sql | 528 ++++++++++++++++++ .../201601271716_IDEMPIERE-3013.sql | 521 +++++++++++++++++ 4 files changed, 1051 insertions(+), 2 deletions(-) create mode 100644 migration/i3.1/oracle/201601271716_IDEMPIERE-3013.sql create mode 100644 migration/i3.1/postgresql/201601271716_IDEMPIERE-3013.sql diff --git a/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql b/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql index b5b269d0a6..0289d08c98 100644 --- a/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql @@ -353,7 +353,7 @@ AS ubp.numberemployees AS salesrep_bp_numberemployees, ubp.paymentrule AS salesrep_bp_paymentrule, ubp.paymentrulepo AS salesrep_bp_paymentrulepo, - ubp.po_discountschema_id AS salesrep_bp_po_discountsch_id, + ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id, ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id, ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id, ubp.poreference AS salesrep_bp_poreference, diff --git a/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql index b32dbf40f7..aafccd92c7 100644 --- a/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql @@ -351,7 +351,7 @@ SELECT o.ad_client_id, ubp.numberemployees AS salesrep_bp_numberemployees, ubp.paymentrule AS salesrep_bp_paymentrule, ubp.paymentrulepo AS salesrep_bp_paymentrulepo, - ubp.po_discountschema_id AS salesrep_bp_po_discountsch_id, + ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id, ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id, ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id, ubp.poreference AS salesrep_bp_poreference, diff --git a/migration/i3.1/oracle/201601271716_IDEMPIERE-3013.sql b/migration/i3.1/oracle/201601271716_IDEMPIERE-3013.sql new file mode 100644 index 0000000000..299fcf65b9 --- /dev/null +++ b/migration/i3.1/oracle/201601271716_IDEMPIERE-3013.sql @@ -0,0 +1,528 @@ +DROP VIEW c_order_header_vt; + +CREATE OR REPLACE VIEW c_order_header_vt +AS + SELECT o.ad_client_id, + o.ad_org_id, + o.isactive, + o.created, + o.createdby, + o.updated, + o.updatedby, + dt.ad_language, + o.c_order_id, + o.issotrx, + o.documentno, + o.docstatus, + o.c_doctype_id, + o.c_bpartner_id, + bp.value AS bpvalue, + bp.taxid AS bptaxid, + bp.naics, + bp.duns, + oi.c_location_id AS org_location_id, + oi.taxid, + o.m_warehouse_id, + wh.c_location_id AS warehouse_location_id, + dt.printname AS documenttype, + dt.documentnote AS documenttypenote, + o.salesrep_id, + COALESCE(ubp.name, u.name) AS salesrep_name, + o.dateordered, + o.datepromised, + bpgt.greeting AS bpgreeting, + bp.name, + bp.name2, + bpcgt.greeting AS bpcontactgreeting, + bpc.title, + bpc.phone, + NULLIF(bpc.name, bp.name) AS contactname, + bpl.c_location_id, + l.postal + || l.postal_add AS postal, + bp.referenceno, + o.bill_bpartner_id, + o.bill_location_id, + o.bill_user_id, + bbp.value AS bill_bpvalue, + bbp.taxid AS bill_bptaxid, + bbp.name AS bill_name, + bbp.name2 AS bill_name2, + bbpc.title AS bill_title, + bbpc.phone AS bill_phone, + NULLIF(bbpc.name, bbp.name) AS bill_contactname, + bbpl.c_location_id AS bill_c_location_id, + o.description, + o.poreference, + o.c_currency_id, + ptt.name AS paymentterm, + ptt.documentnote AS paymenttermnote, + o.c_charge_id, + o.chargeamt, + o.totallines, + o.grandtotal, + o.grandtotal AS amtinwords, + o.m_pricelist_id, + o.istaxincluded, + o.volume, + o.weight, + o.c_campaign_id, + o.c_project_id, + o.c_activity_id, + o.m_shipper_id, + o.deliveryrule, + o.deliveryviarule, + o.priorityrule, + o.invoicerule, + COALESCE(oi.logo_id, ci.logo_id) AS logo_id, + o.ad_orgtrx_id, + o.ad_user_id, + o.amountrefunded, + o.amounttendered, + o.c_bpartner_location_id, + o.c_cashline_id, + o.c_cashplanline_id, + o.c_conversiontype_id, + o.c_doctypetarget_id, + o.copyfrom, + o.c_payment_id, + o.c_paymentterm_id, + o.c_pos_id, + o.dateacct, + o.dateprinted, + o.docaction, + o.dropship_bpartner_id, + o.dropship_location_id, + o.dropship_user_id, + o.freightamt, + o.freightcostrule, + o.isapproved, + o.iscreditapproved, + o.isdelivered, + o.isdiscountprinted, + o.isdropship, + o.isinvoiced, + o.ispayschedulevalid, + o.isprinted, + o.isselected, + o.isselfservice, + o.istransferred, + o.link_order_id, + o.m_freightcategory_id, + o.ordertype, + o.pay_bpartner_id, + o.pay_location_id, + o.paymentrule, + o.posted, + o.processed, + o.processedon, + o.promotioncode, + o.ref_order_id, + o.sendemail, + o.user1_id, + o.user2_id, + wh.ad_org_id AS m_warehouse_ad_org_id, + wh.description AS m_warehouse_description, + wh.isactive AS m_warehouse_isactive, + wh.isdisallownegativeinv, + wh.isintransit, + wh.m_warehousesource_id, + wh.name AS m_warehouse_name, + wh.replenishmentclass, + wh.separator, + wh.value AS m_warehouse_value, + ptt.ad_org_id AS c_paymentterm_ad_org_id, + pt.afterdelivery, + ptt.description AS c_paymentterm_description, + pt.discount, + pt.discount2, + pt.discountdays, + pt.discountdays2, + pt.fixmonthcutoff, + pt.fixmonthday, + pt.fixmonthoffset, + pt.gracedays, + ptt.isactive AS c_paymentterm_isactive, + pt.isdefault, + pt.isduefixed, + pt.isnextbusinessday, + pt.isvalid, + pt.netday, + pt.netdays, + pt.paymenttermusage, + pt.value AS m_paymentterm_value, + bp.acqusitioncost AS bp_acqusitioncost, + bp.actuallifetimevalue AS bp_actuallifetimevalue, + bp.ad_language AS bp_ad_language, + bp.ad_orgbp_id AS bp_ad_orgbp_id, + bp.ad_org_id AS bp_ad_org_id, + bp.bpartner_parent_id AS bp_bpartner_parent_id, + bp.c_bp_group_id AS bp_c_bp_group_id, + bp.c_dunning_id AS bp_c_dunning_id, + bp.c_greeting_id AS bp_c_greeting_id, + bp.c_invoiceschedule_id AS bp_c_invoiceschedule_id, + bp.c_paymentterm_id AS bp_c_paymentterm_id, + bp.created AS bp_created, + bp.createdby AS bp_createdby, + bp.c_taxgroup_id AS bp_c_taxgroup_id, + bp.deliveryrule AS bp_deliveryrule, + bp.deliveryviarule AS bp_deliveryviarule, + bp.description AS bp_description, + bp.dunninggrace AS bp_dunninggrace, + bp.firstsale AS bp_firstsale, + bp.flatdiscount AS bp_flatdiscount, + bp.freightcostrule AS bp_freightcostrule, + bp.invoicerule AS bp_invoicerule, + bp.isactive AS bp_isactive, + bp.iscustomer AS bp_iscustomer, + bp.isdiscountprinted AS bp_isdiscountprinted, + bp.isemployee AS bp_isemployee, + bp.ismanufacturer AS bp_ismanufacturer, + bp.isonetime AS bp_isonetime, + bp.ispotaxexempt AS bp_ispotaxexempt, + bp.isprospect AS bp_isprospect, + bp.issalesrep AS bp_issalesrep, + bp.issummary AS bp_issummary, + bp.istaxexempt AS bp_istaxexempt, + bp.isvendor AS bp_isvendor, + bp.logo_id AS bp_logo_id, + bp.m_discountschema_id AS bp_m_discountschema_id, + bp.m_pricelist_id AS bp_m_pricelist_id, + bp.numberemployees AS bp_numberemployees, + bp.paymentrule AS bp_paymentrule, + bp.paymentrulepo AS bp_paymentrulepo, + bp.po_discountschema_id AS bp_po_discountschema_id, + bp.po_paymentterm_id AS bp_po_paymentterm_id, + bp.po_pricelist_id AS bp_po_pricelist_id, + bp.poreference AS bp_poreference, + bp.potentiallifetimevalue AS bp_potentiallifetimevalue, + bp.rating AS bp_rating, + bp.salesrep_id AS bp_salesrep_id, + bp.salesvolume AS bp_salesvolume, + bp.sendemail AS bp_sendemail, + bp.shareofcustomer AS bp_shareofcustomer, + bp.shelflifeminpct AS bp_shelflifeminpct, + bp.so_creditlimit AS bp_so_creditlimit, + bp.socreditstatus AS bp_socreditstatus, + bp.so_creditused AS bp_so_creditused, + bp.so_description AS bp_so_description, + bp.totalopenbalance AS bp_totalopenbalance, + bp.updated AS bp_updated, + bp.updatedby AS bp_updatedby, + bp.url AS bp_url, + bpgt.ad_org_id AS c_greeting_ad_org_id, + bpgt.isactive AS c_greeting_isactive, + bpg.isfirstnameonly, + bpgt.name AS c_greeting_name, + bpl.ad_org_id AS bp_location_ad_org_id, + bpl.c_bpartner_id AS bp_location_c_bpartner_id, + bpl.created AS bp_location_created, + bpl.createdby AS bp_location_createdby, + bpl.c_salesregion_id AS bp_location_c_salesregion_id, + bpl.fax AS bp_location_fax, + bpl.isactive AS bp_location_isactive, + bpl.isbillto AS bp_location_isbillto, + bpl.isdn AS bp_location_isdn, + bpl.ispayfrom AS bp_location_ispayfrom, + bpl.isremitto AS bp_location_isremitto, + bpl.isshipto AS bp_location_isshipto, + bpl.name AS bp_location_name, + bpl.phone AS bp_location_phone, + bpl.phone2 AS bp_location_phone2, + bpl.updated AS bp_location_updated, + bpl.updatedby AS bp_location_updatedby, + l.address1, + l.address2, + l.address3, + l.address4, + l.ad_org_id AS c_location_ad_org_id, + l.c_city_id, + l.c_country_id, + l.city, + l.created AS c_location_created, + l.createdby AS c_location_createdby, + l.c_region_id, + l.isactive AS c_location_isactive, + l.regionname, + l.updated AS c_location_updated, + l.updatedby AS c_location_updatedby, + bpc.ad_org_id AS ad_user_ad_org_id, + bpc.ad_orgtrx_id AS ad_user_ad_orgtrx_id, + bpc.birthday AS ad_user_ad_birthday, + bpc.c_bpartner_id AS ad_user_c_bpartner_id, + bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id, + bpc.c_greeting_id AS ad_user_c_greeting_id, + bpc.comments AS ad_user_comments, + bpc.created AS ad_user_created, + bpc.createdby AS ad_user_createdby, + bpc.description AS ad_user_description, + bpc.email AS ad_user_email, + bpc.fax AS ad_user_fax, + bpc.isactive AS ad_user_isactive, + bpc.lastcontact AS ad_user_lastcontact, + bpc.lastresult AS ad_user_lastresult, + bpc.phone2 AS ad_user_phone2, + bpc.supervisor_id AS ad_user_supervisor_id, + bpc.updated AS ad_user_updated, + bpc.updatedby AS ad_user_updatedby, + bpc.value AS ad_user_value, + bpcgt.ad_org_id AS c_user_greeting_ad_org_id, + bpcgt.isactive AS c_user_greeting_isactive, + bpcg.isfirstnameonly AS c_user_greeting_isfnameonly, + bpcgt.name AS c_user_greeting_name, + oi.ad_org_id AS ad_orginfo_ad_org_id, + oi.ad_orgtype_id, + oi.c_calendar_id, + oi.created AS ad_orginfo_created, + oi.createdby AS ad_orginfo_createdby, + oi.dropship_warehouse_id, + oi.duns AS ad_orginfo_duns, + oi.email AS ad_orginfo_email, + oi.fax AS ad_orginfo_fax, + oi.isactive AS ad_orginfo_isactive, + oi.m_warehouse_id AS ad_orginfo_m_warehouse_id, + oi.parent_org_id, + oi.phone AS ad_orginfo_phone, + oi.phone2 AS ad_orginfo_phone2, + oi.receiptfootermsg, + oi.supervisor_id, + oi.updated AS ad_orginfo_updated, + oi.updatedby AS ad_orginfo_updatedby, + u.ad_org_id AS salesrep_ad_org_id, + u.ad_orgtrx_id AS salesrep_ad_orgtrx_id, + u.birthday AS salesrep_ad_birthday, + u.c_bpartner_id AS salesrep_c_bpartner_id, + u.c_bpartner_location_id AS salesrep_c_bp_location_id, + u.c_greeting_id AS salesrep_c_greeting_id, + u.comments AS salesrep_comments, + u.created AS salesrep_created, + u.createdby AS salesrep_createdby, + u.description AS salesrep_description, + u.email AS salesrep_email, + u.fax AS salesrep_fax, + u.isactive AS salesrep_isactive, + u.lastcontact AS salesrep_lastcontact, + u.lastresult AS salesrep_lastresult, + u.phone AS salesrep_phone, + u.phone2 AS salesrep_phone2, + u.supervisor_id AS salesrep_supervisor_id, + u.title AS salesrep_title, + u.updated AS salesrep_updated, + u.updatedby AS salesrep_updatedby, + u.value AS salesrep_value, + ubp.acqusitioncost AS salesrep_bp_acqusitioncost, + ubp.actuallifetimevalue AS salesrep_bp_actuallifetimeval, + ubp.ad_language AS salesrep_bp_ad_language, + ubp.ad_orgbp_id AS salesrep_bp_ad_orgbp_id, + ubp.ad_org_id AS salesrep_bp_ad_org_id, + ubp.bpartner_parent_id AS salesrep_bp_bpartner_parent_id, + ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id, + ubp.c_dunning_id AS salesrep_bp_c_dunning_id, + ubp.c_greeting_id AS salesrep_bp_c_greeting_id, + ubp.c_invoiceschedule_id AS salesrep_bp_c_invoicesched_id, + ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id, + ubp.created AS salesrep_bp_created, + ubp.createdby AS salesrep_bp_createdby, + ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id, + ubp.deliveryrule AS salesrep_bp_deliveryrule, + ubp.deliveryviarule AS salesrep_bp_deliveryviarule, + ubp.description AS salesrep_bp_description, + ubp.dunninggrace AS salesrep_bp_dunninggrace, + ubp.duns AS salesrep_bp_duns, + ubp.firstsale AS salesrep_bp_firstsale, + ubp.flatdiscount AS salesrep_bp_flatdiscount, + ubp.freightcostrule AS salesrep_bp_freightcostrule, + ubp.invoicerule AS salesrep_bp_invoicerule, + ubp.isactive AS salesrep_bp_isactive, + ubp.iscustomer AS salesrep_bp_iscustomer, + ubp.isdiscountprinted AS salesrep_bp_isdiscountprinted, + ubp.isemployee AS salesrep_bp_isemployee, + ubp.ismanufacturer AS salesrep_bp_ismanufacturer, + ubp.isonetime AS salesrep_bp_isonetime, + ubp.ispotaxexempt AS salesrep_bp_ispotaxexempt, + ubp.isprospect AS salesrep_bp_isprospect, + ubp.issalesrep AS salesrep_bp_issalesrep, + ubp.issummary AS salesrep_bp_issummary, + ubp.istaxexempt AS salesrep_bp_istaxexempt, + ubp.isvendor AS salesrep_bp_isvendor, + ubp.logo_id AS salesrep_bp_logo_id, + ubp.m_discountschema_id AS salesrep_bp_m_discountschm_id, + ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id, + ubp.naics AS salesrep_bp_naics, + ubp.name2 AS salesrep_bp_name2, + ubp.numberemployees AS salesrep_bp_numberemployees, + ubp.paymentrule AS salesrep_bp_paymentrule, + ubp.paymentrulepo AS salesrep_bp_paymentrulepo, + ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id, + ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id, + ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id, + ubp.poreference AS salesrep_bp_poreference, + ubp.potentiallifetimevalue AS salesrep_bp_potentiallifetime, + ubp.rating AS salesrep_bp_rating, + ubp.referenceno AS salesrep_bp_referenceno, + ubp.salesrep_id AS salesrep_bp_salesrep_id, + ubp.salesvolume AS salesrep_bp_salesvolume, + ubp.sendemail AS salesrep_bp_sendemail, + ubp.shareofcustomer AS salesrep_bp_shareofcustomer, + ubp.shelflifeminpct AS salesrep_bp_shelflifeminpct, + ubp.so_creditlimit AS salesrep_bp_so_creditlimit, + ubp.socreditstatus AS salesrep_bp_socreditstatus, + ubp.so_creditused AS salesrep_bp_so_creditused, + ubp.so_description AS salesrep_bp_so_description, + ubp.taxid AS salesrep_bp_taxid, + ubp.totalopenbalance AS salesrep_bp_totalopenbalance, + ubp.updated AS salesrep_bp_updated, + ubp.updatedby AS salesrep_bp_updatedby, + ubp.url AS salesrep_bp_url, + ubp.value AS salesrep_bp_value, + bbp.acqusitioncost AS bill_bp_acqusitioncost, + bbp.actuallifetimevalue AS bill_bp_actuallifetimevalue, + bbp.ad_language AS bill_bp_ad_language, + bbp.ad_orgbp_id AS bill_bp_ad_orgbp_id, + bbp.ad_org_id AS bill_bp_ad_org_id, + bbp.bpartner_parent_id AS bill_bp_bpartner_parent_id, + bbp.c_bp_group_id AS bill_bp_c_bp_group_id, + bbp.c_dunning_id AS bill_bp_c_dunning_id, + bbp.c_greeting_id AS bill_bp_c_greeting_id, + bbp.c_invoiceschedule_id AS bill_bp_c_invoiceschedule_id, + bbp.c_paymentterm_id AS bill_bp_c_paymentterm_id, + bbp.created AS bill_bp_created, + bbp.createdby AS bill_bp_createdby, + bbp.c_taxgroup_id AS bill_bp_c_taxgroup_id, + bbp.deliveryrule AS bill_bp_deliveryrule, + bbp.deliveryviarule AS bill_bp_deliveryviarule, + bbp.description AS bill_bp_description, + bbp.dunninggrace AS bill_bp_dunninggrace, + bbp.duns AS bill_bp_duns, + bbp.firstsale AS bill_bp_firstsale, + bbp.flatdiscount AS bill_bp_flatdiscount, + bbp.freightcostrule AS bill_bp_freightcostrule, + bbp.invoicerule AS bill_bp_invoicerule, + bbp.isactive AS bill_bp_isactive, + bbp.iscustomer AS bill_bp_iscustomer, + bbp.isdiscountprinted AS bill_bp_isdiscountprinted, + bbp.isemployee AS bill_bp_isemployee, + bbp.ismanufacturer AS bill_bp_ismanufacturer, + bbp.isonetime AS bill_bp_isonetime, + bbp.ispotaxexempt AS bill_bp_ispotaxexempt, + bbp.isprospect AS bill_bp_isprospect, + bbp.issalesrep AS bill_bp_issalesrep, + bbp.issummary AS bill_bp_issummary, + bbp.istaxexempt AS bill_bp_istaxexempt, + bbp.isvendor AS bill_bp_isvendor, + bbp.logo_id AS bill_bp_logo_id, + bbp.m_discountschema_id AS bill_bp_m_discountschema_id, + bbp.m_pricelist_id AS bill_bp_m_pricelist_id, + bbp.naics AS bill_bp_naics, + bbp.numberemployees AS bill_bp_numberemployees, + bbp.paymentrule AS bill_bp_paymentrule, + bbp.paymentrulepo AS bill_bp_paymentrulepo, + bbp.po_discountschema_id AS bill_bp_po_discountschema_id, + bbp.po_paymentterm_id AS bill_bp_po_paymentterm_id, + bbp.po_pricelist_id AS bill_bp_po_pricelist_id, + bbp.poreference AS bill_bp_poreference, + bbp.potentiallifetimevalue AS bill_bp_potentiallifetimevalue, + bbp.rating AS bill_bp_rating, + bbp.referenceno AS bill_bp_referenceno, + bbp.salesrep_id AS bill_bp_salesrep_id, + bbp.salesvolume AS bill_bp_salesvolume, + bbp.sendemail AS bill_bp_sendemail, + bbp.shareofcustomer AS bill_bp_shareofcustomer, + bbp.shelflifeminpct AS bill_bp_shelflifeminpct, + bbp.so_creditlimit AS bill_bp_so_creditlimit, + bbp.socreditstatus AS bill_bp_socreditstatus, + bbp.so_creditused AS bill_bp_so_creditused, + bbp.so_description AS bill_bp_so_description, + bbp.totalopenbalance AS bill_bp_totalopenbalance, + bbp.updated AS bill_bp_updated, + bbp.updatedby AS bill_bp_updatedby, + bbp.url AS bill_bp_url, + bbpl.ad_org_id AS bill_bp_location_ad_org_id, + bbpl.c_bpartner_id AS bill_bp_location_c_bpartner_id, + bbpl.created AS bill_bp_location_created, + bbpl.createdby AS bill_bp_location_createdby, + bbpl.c_salesregion_id AS bill_bp_location_c_salesreg_id, + bbpl.fax AS bill_bp_location_fax, + bbpl.isactive AS bill_bp_location_isactive, + bbpl.isbillto AS bill_bp_location_isbillto, + bbpl.isdn AS bill_bp_location_isdn, + bbpl.ispayfrom AS bill_bp_location_ispayfrom, + bbpl.isremitto AS bill_bp_location_isremitto, + bbpl.isshipto AS bill_bp_location_isshipto, + bbpl.name AS bill_bp_location_name, + bbpl.phone AS bill_bp_location_phone, + bbpl.phone2 AS bill_bp_location_phone2, + bbpl.updated AS bill_bp_location_updated, + bbpl.updatedby AS bill_bp_location_updatedby, + bbpc.ad_org_id AS bill_user_ad_org_id, + bbpc.ad_orgtrx_id AS bill_user_ad_orgtrx_id, + bbpc.birthday AS bill_user_ad_birthday, + bbpc.c_bpartner_id AS bill_user_c_bpartner_id, + bbpc.c_bpartner_location_id AS bill_user_c_bp_location_id, + bbpc.c_greeting_id AS bill_user_c_greeting_id, + bbpc.comments AS bill_user_comments, + bbpc.created AS bill_user_created, + bbpc.createdby AS bill_user_createdby, + bbpc.description AS bill_user_description, + bbpc.email AS bill_user_email, + bbpc.fax AS bill_user_fax, + bbpc.isactive AS bill_user_isactive, + bbpc.lastcontact AS bill_user_lastcontact, + bbpc.lastresult AS bill_user_lastresult, + bbpc.phone2 AS bill_user_phone2, + bbpc.supervisor_id AS bill_user_supervisor_id, + bbpc.updated AS bill_user_updated, + bbpc.updatedby AS bill_user_updatedby, + bbpc.value AS bill_user_value, + cur.cursymbol, + cur.description AS cur_description + FROM c_order o + JOIN c_doctype_trl dt + ON o.c_doctype_id = dt.c_doctype_id + JOIN m_warehouse wh + ON o.m_warehouse_id = wh.m_warehouse_id + JOIN c_paymentterm pt + ON o.c_paymentterm_id = pt.c_paymentterm_id + JOIN c_paymentterm_trl ptt + ON o.c_paymentterm_id = ptt.c_paymentterm_id + AND dt.ad_language = ptt.ad_language + JOIN c_bpartner bp + ON o.c_bpartner_id = bp.c_bpartner_id + LEFT JOIN c_greeting bpg + ON bp.c_greeting_id = bpg.c_greeting_id + LEFT JOIN c_greeting_trl bpgt + ON bp.c_greeting_id = bpgt.c_greeting_id + AND dt.ad_language = bpgt.ad_language + JOIN c_bpartner_location bpl + ON o.c_bpartner_location_id = bpl.c_bpartner_location_id + JOIN c_location l + ON bpl.c_location_id = l.c_location_id + LEFT JOIN ad_user bpc + ON o.ad_user_id = bpc.ad_user_id + LEFT JOIN c_greeting bpcg + ON bpc.c_greeting_id = bpcg.c_greeting_id + LEFT JOIN c_greeting_trl bpcgt + ON bpc.c_greeting_id = bpcgt.c_greeting_id + AND dt.ad_language = bpcgt.ad_language + JOIN ad_orginfo oi + ON o.ad_org_id = oi.ad_org_id + JOIN ad_clientinfo ci + ON o.ad_client_id = ci.ad_client_id + LEFT JOIN ad_user u + ON o.salesrep_id = u.ad_user_id + LEFT JOIN c_bpartner ubp + ON u.c_bpartner_id = ubp.c_bpartner_id + JOIN c_bpartner bbp + ON o.bill_bpartner_id = bbp.c_bpartner_id + JOIN c_bpartner_location bbpl + ON o.bill_location_id = bbpl.c_bpartner_location_id + LEFT JOIN ad_user bbpc + ON o.bill_user_id = bbpc.ad_user_id + LEFT JOIN c_currency_trl cur + ON o.c_currency_id = cur.c_currency_id + AND dt.ad_language = cur.ad_language +; + +SELECT register_migration_script('201601271716_IDEMPIERE-3013.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201601271716_IDEMPIERE-3013.sql b/migration/i3.1/postgresql/201601271716_IDEMPIERE-3013.sql new file mode 100644 index 0000000000..067aeb6ef8 --- /dev/null +++ b/migration/i3.1/postgresql/201601271716_IDEMPIERE-3013.sql @@ -0,0 +1,521 @@ +DROP VIEW c_order_header_vt; + +CREATE OR REPLACE VIEW c_order_header_vt AS +SELECT o.ad_client_id, + o.ad_org_id, + o.isactive, + o.created, + o.createdby, + o.updated, + o.updatedby, + dt.ad_language, + o.c_order_id, + o.issotrx, + o.documentno, + o.docstatus, + o.c_doctype_id, + o.c_bpartner_id, + bp.value AS bpvalue, + bp.taxid AS bptaxid, + bp.naics, + bp.duns, + oi.c_location_id AS org_location_id, + oi.taxid, + o.m_warehouse_id, + wh.c_location_id AS warehouse_location_id, + dt.printname AS documenttype, + dt.documentnote AS documenttypenote, + o.salesrep_id, + COALESCE(ubp.name, u.name) AS salesrep_name, + o.dateordered, + o.datepromised, + bpgt.greeting AS bpgreeting, + bp.name, + bp.name2, + bpcgt.greeting AS bpcontactgreeting, + bpc.title, + bpc.phone, + NULLIF(bpc.name, bp.name) AS contactname, + bpl.c_location_id, + l.postal || l.postal_add AS postal, + bp.referenceno, + o.bill_bpartner_id, + o.bill_location_id, + o.bill_user_id, + bbp.value AS bill_bpvalue, + bbp.taxid AS bill_bptaxid, + bbp.name AS bill_name, + bbp.name2 AS bill_name2, + bbpc.title AS bill_title, + bbpc.phone AS bill_phone, + NULLIF(bbpc.name, bbp.name) AS bill_contactname, + bbpl.c_location_id AS bill_c_location_id, + o.description, + o.poreference, + o.c_currency_id, + ptt.name AS paymentterm, + ptt.documentnote AS paymenttermnote, + o.c_charge_id, + o.chargeamt, + o.totallines, + o.grandtotal, + o.grandtotal AS amtinwords, + o.m_pricelist_id, + o.istaxincluded, + o.volume, + o.weight, + o.c_campaign_id, + o.c_project_id, + o.c_activity_id, + o.m_shipper_id, + o.deliveryrule, + o.deliveryviarule, + o.priorityrule, + o.invoicerule, + COALESCE(oi.logo_id, ci.logo_id) AS logo_id, + o.ad_orgtrx_id, + o.ad_user_id, + o.amountrefunded, + o.amounttendered, + o.c_bpartner_location_id, + o.c_cashline_id, + o.c_cashplanline_id, + o.c_conversiontype_id, + o.c_doctypetarget_id, + o.copyfrom, + o.c_payment_id, + o.c_paymentterm_id, + o.c_pos_id, + o.dateacct, + o.dateprinted, + o.docaction, + o.dropship_bpartner_id, + o.dropship_location_id, + o.dropship_user_id, + o.freightamt, + o.freightcostrule, + o.isapproved, + o.iscreditapproved, + o.isdelivered, + o.isdiscountprinted, + o.isdropship, + o.isinvoiced, + o.ispayschedulevalid, + o.isprinted, + o.isselected, + o.isselfservice, + o.istransferred, + o.link_order_id, + o.m_freightcategory_id, + o.ordertype, + o.pay_bpartner_id, + o.pay_location_id, + o.paymentrule, + o.posted, + o.processed, + o.processedon, + o.promotioncode, + o.ref_order_id, + o.sendemail, + o.user1_id, + o.user2_id, + wh.ad_org_id AS m_warehouse_ad_org_id, + wh.description AS m_warehouse_description, + wh.isactive AS m_warehouse_isactive, + wh.isdisallownegativeinv, + wh.isintransit, + wh.m_warehousesource_id, + wh.name AS m_warehouse_name, + wh.replenishmentclass, + wh.separator, + wh.value AS m_warehouse_value, + ptt.ad_org_id AS c_paymentterm_ad_org_id, + pt.afterdelivery, + ptt.description AS c_paymentterm_description, + pt.discount, + pt.discount2, + pt.discountdays, + pt.discountdays2, + pt.fixmonthcutoff, + pt.fixmonthday, + pt.fixmonthoffset, + pt.gracedays, + ptt.isactive AS c_paymentterm_isactive, + pt.isdefault, + pt.isduefixed, + pt.isnextbusinessday, + pt.isvalid, + pt.netday, + pt.netdays, + pt.paymenttermusage, + pt.value AS m_paymentterm_value, + bp.acqusitioncost AS bp_acqusitioncost, + bp.actuallifetimevalue AS bp_actuallifetimevalue, + bp.ad_language AS bp_ad_language, + bp.ad_orgbp_id AS bp_ad_orgbp_id, + bp.ad_org_id AS bp_ad_org_id, + bp.bpartner_parent_id AS bp_bpartner_parent_id, + bp.c_bp_group_id AS bp_c_bp_group_id, + bp.c_dunning_id AS bp_c_dunning_id, + bp.c_greeting_id AS bp_c_greeting_id, + bp.c_invoiceschedule_id AS bp_c_invoiceschedule_id, + bp.c_paymentterm_id AS bp_c_paymentterm_id, + bp.created AS bp_created, + bp.createdby AS bp_createdby, + bp.c_taxgroup_id AS bp_c_taxgroup_id, + bp.deliveryrule AS bp_deliveryrule, + bp.deliveryviarule AS bp_deliveryviarule, + bp.description AS bp_description, + bp.dunninggrace AS bp_dunninggrace, + bp.firstsale AS bp_firstsale, + bp.flatdiscount AS bp_flatdiscount, + bp.freightcostrule AS bp_freightcostrule, + bp.invoicerule AS bp_invoicerule, + bp.isactive AS bp_isactive, + bp.iscustomer AS bp_iscustomer, + bp.isdiscountprinted AS bp_isdiscountprinted, + bp.isemployee AS bp_isemployee, + bp.ismanufacturer AS bp_ismanufacturer, + bp.isonetime AS bp_isonetime, + bp.ispotaxexempt AS bp_ispotaxexempt, + bp.isprospect AS bp_isprospect, + bp.issalesrep AS bp_issalesrep, + bp.issummary AS bp_issummary, + bp.istaxexempt AS bp_istaxexempt, + bp.isvendor AS bp_isvendor, + bp.logo_id AS bp_logo_id, + bp.m_discountschema_id AS bp_m_discountschema_id, + bp.m_pricelist_id AS bp_m_pricelist_id, + bp.numberemployees AS bp_numberemployees, + bp.paymentrule AS bp_paymentrule, + bp.paymentrulepo AS bp_paymentrulepo, + bp.po_discountschema_id AS bp_po_discountschema_id, + bp.po_paymentterm_id AS bp_po_paymentterm_id, + bp.po_pricelist_id AS bp_po_pricelist_id, + bp.poreference AS bp_poreference, + bp.potentiallifetimevalue AS bp_potentiallifetimevalue, + bp.rating AS bp_rating, + bp.salesrep_id AS bp_salesrep_id, + bp.salesvolume AS bp_salesvolume, + bp.sendemail AS bp_sendemail, + bp.shareofcustomer AS bp_shareofcustomer, + bp.shelflifeminpct AS bp_shelflifeminpct, + bp.so_creditlimit AS bp_so_creditlimit, + bp.socreditstatus AS bp_socreditstatus, + bp.so_creditused AS bp_so_creditused, + bp.so_description AS bp_so_description, + bp.totalopenbalance AS bp_totalopenbalance, + bp.updated AS bp_updated, + bp.updatedby AS bp_updatedby, + bp.url AS bp_url, + bpgt.ad_org_id AS c_greeting_ad_org_id, + bpgt.isactive AS c_greeting_isactive, + bpg.isfirstnameonly, + bpgt.name AS c_greeting_name, + bpl.ad_org_id AS bp_location_ad_org_id, + bpl.c_bpartner_id AS bp_location_c_bpartner_id, + bpl.created AS bp_location_created, + bpl.createdby AS bp_location_createdby, + bpl.c_salesregion_id AS bp_location_c_salesregion_id, + bpl.fax AS bp_location_fax, + bpl.isactive AS bp_location_isactive, + bpl.isbillto AS bp_location_isbillto, + bpl.isdn AS bp_location_isdn, + bpl.ispayfrom AS bp_location_ispayfrom, + bpl.isremitto AS bp_location_isremitto, + bpl.isshipto AS bp_location_isshipto, + bpl.name AS bp_location_name, + bpl.phone AS bp_location_phone, + bpl.phone2 AS bp_location_phone2, + bpl.updated AS bp_location_updated, + bpl.updatedby AS bp_location_updatedby, + l.address1, + l.address2, + l.address3, + l.address4, + l.ad_org_id AS c_location_ad_org_id, + l.c_city_id, + l.c_country_id, + l.city, + l.created AS c_location_created, + l.createdby AS c_location_createdby, + l.c_region_id, + l.isactive AS c_location_isactive, + l.regionname, + l.updated AS c_location_updated, + l.updatedby AS c_location_updatedby, + bpc.ad_org_id AS ad_user_ad_org_id, + bpc.ad_orgtrx_id AS ad_user_ad_orgtrx_id, + bpc.birthday AS ad_user_ad_birthday, + bpc.c_bpartner_id AS ad_user_c_bpartner_id, + bpc.c_bpartner_location_id AS ad_user_c_bpartner_location_id, + bpc.c_greeting_id AS ad_user_c_greeting_id, + bpc.comments AS ad_user_comments, + bpc.created AS ad_user_created, + bpc.createdby AS ad_user_createdby, + bpc.description AS ad_user_description, + bpc.email AS ad_user_email, + bpc.fax AS ad_user_fax, + bpc.isactive AS ad_user_isactive, + bpc.lastcontact AS ad_user_lastcontact, + bpc.lastresult AS ad_user_lastresult, + bpc.phone2 AS ad_user_phone2, + bpc.supervisor_id AS ad_user_supervisor_id, + bpc.updated AS ad_user_updated, + bpc.updatedby AS ad_user_updatedby, + bpc.value AS ad_user_value, + bpcgt.ad_org_id AS c_user_greeting_ad_org_id, + bpcgt.isactive AS c_user_greeting_isactive, + bpcg.isfirstnameonly AS c_user_greeting_isfnameonly, + bpcgt.name AS c_user_greeting_name, + oi.ad_org_id AS ad_orginfo_ad_org_id, + oi.ad_orgtype_id, + oi.c_calendar_id, + oi.created AS ad_orginfo_created, + oi.createdby AS ad_orginfo_createdby, + oi.dropship_warehouse_id, + oi.duns AS ad_orginfo_duns, + oi.email AS ad_orginfo_email, + oi.fax AS ad_orginfo_fax, + oi.isactive AS ad_orginfo_isactive, + oi.m_warehouse_id AS ad_orginfo_m_warehouse_id, + oi.parent_org_id, + oi.phone AS ad_orginfo_phone, + oi.phone2 AS ad_orginfo_phone2, + oi.receiptfootermsg, + oi.supervisor_id, + oi.updated AS ad_orginfo_updated, + oi.updatedby AS ad_orginfo_updatedby, + u.ad_org_id AS salesrep_ad_org_id, + u.ad_orgtrx_id AS salesrep_ad_orgtrx_id, + u.birthday AS salesrep_ad_birthday, + u.c_bpartner_id AS salesrep_c_bpartner_id, + u.c_bpartner_location_id AS salesrep_c_bp_location_id, + u.c_greeting_id AS salesrep_c_greeting_id, + u.comments AS salesrep_comments, + u.created AS salesrep_created, + u.createdby AS salesrep_createdby, + u.description AS salesrep_description, + u.email AS salesrep_email, + u.fax AS salesrep_fax, + u.isactive AS salesrep_isactive, + u.lastcontact AS salesrep_lastcontact, + u.lastresult AS salesrep_lastresult, + u.phone AS salesrep_phone, + u.phone2 AS salesrep_phone2, + u.supervisor_id AS salesrep_supervisor_id, + u.title AS salesrep_title, + u.updated AS salesrep_updated, + u.updatedby AS salesrep_updatedby, + u.value AS salesrep_value, + ubp.acqusitioncost AS salesrep_bp_acqusitioncost, + ubp.actuallifetimevalue AS salesrep_bp_actuallifetimeval, + ubp.ad_language AS salesrep_bp_ad_language, + ubp.ad_orgbp_id AS salesrep_bp_ad_orgbp_id, + ubp.ad_org_id AS salesrep_bp_ad_org_id, + ubp.bpartner_parent_id AS salesrep_bp_bpartner_parent_id, + ubp.c_bp_group_id AS salesrep_bp_c_bp_group_id, + ubp.c_dunning_id AS salesrep_bp_c_dunning_id, + ubp.c_greeting_id AS salesrep_bp_c_greeting_id, + ubp.c_invoiceschedule_id AS salesrep_bp_c_invoicesched_id, + ubp.c_paymentterm_id AS salesrep_bp_c_paymentterm_id, + ubp.created AS salesrep_bp_created, + ubp.createdby AS salesrep_bp_createdby, + ubp.c_taxgroup_id AS salesrep_bp_c_taxgroup_id, + ubp.deliveryrule AS salesrep_bp_deliveryrule, + ubp.deliveryviarule AS salesrep_bp_deliveryviarule, + ubp.description AS salesrep_bp_description, + ubp.dunninggrace AS salesrep_bp_dunninggrace, + ubp.duns AS salesrep_bp_duns, + ubp.firstsale AS salesrep_bp_firstsale, + ubp.flatdiscount AS salesrep_bp_flatdiscount, + ubp.freightcostrule AS salesrep_bp_freightcostrule, + ubp.invoicerule AS salesrep_bp_invoicerule, + ubp.isactive AS salesrep_bp_isactive, + ubp.iscustomer AS salesrep_bp_iscustomer, + ubp.isdiscountprinted AS salesrep_bp_isdiscountprinted, + ubp.isemployee AS salesrep_bp_isemployee, + ubp.ismanufacturer AS salesrep_bp_ismanufacturer, + ubp.isonetime AS salesrep_bp_isonetime, + ubp.ispotaxexempt AS salesrep_bp_ispotaxexempt, + ubp.isprospect AS salesrep_bp_isprospect, + ubp.issalesrep AS salesrep_bp_issalesrep, + ubp.issummary AS salesrep_bp_issummary, + ubp.istaxexempt AS salesrep_bp_istaxexempt, + ubp.isvendor AS salesrep_bp_isvendor, + ubp.logo_id AS salesrep_bp_logo_id, + ubp.m_discountschema_id AS salesrep_bp_m_discountschm_id, + ubp.m_pricelist_id AS salesrep_bp_m_pricelist_id, + ubp.naics AS salesrep_bp_naics, + ubp.name2 AS salesrep_bp_name2, + ubp.numberemployees AS salesrep_bp_numberemployees, + ubp.paymentrule AS salesrep_bp_paymentrule, + ubp.paymentrulepo AS salesrep_bp_paymentrulepo, + ubp.po_discountschema_id AS salesrep_bp_po_discountschm_id, + ubp.po_paymentterm_id AS salesrep_bp_po_paymentterm_id, + ubp.po_pricelist_id AS salesrep_bp_po_pricelist_id, + ubp.poreference AS salesrep_bp_poreference, + ubp.potentiallifetimevalue AS salesrep_bp_potentiallifetime, + ubp.rating AS salesrep_bp_rating, + ubp.referenceno AS salesrep_bp_referenceno, + ubp.salesrep_id AS salesrep_bp_salesrep_id, + ubp.salesvolume AS salesrep_bp_salesvolume, + ubp.sendemail AS salesrep_bp_sendemail, + ubp.shareofcustomer AS salesrep_bp_shareofcustomer, + ubp.shelflifeminpct AS salesrep_bp_shelflifeminpct, + ubp.so_creditlimit AS salesrep_bp_so_creditlimit, + ubp.socreditstatus AS salesrep_bp_socreditstatus, + ubp.so_creditused AS salesrep_bp_so_creditused, + ubp.so_description AS salesrep_bp_so_description, + ubp.taxid AS salesrep_bp_taxid, + ubp.totalopenbalance AS salesrep_bp_totalopenbalance, + ubp.updated AS salesrep_bp_updated, + ubp.updatedby AS salesrep_bp_updatedby, + ubp.url AS salesrep_bp_url, + ubp.value AS salesrep_bp_value, + bbp.acqusitioncost AS bill_bp_acqusitioncost, + bbp.actuallifetimevalue AS bill_bp_actuallifetimevalue, + bbp.ad_language AS bill_bp_ad_language, + bbp.ad_orgbp_id AS bill_bp_ad_orgbp_id, + bbp.ad_org_id AS bill_bp_ad_org_id, + bbp.bpartner_parent_id AS bill_bp_bpartner_parent_id, + bbp.c_bp_group_id AS bill_bp_c_bp_group_id, + bbp.c_dunning_id AS bill_bp_c_dunning_id, + bbp.c_greeting_id AS bill_bp_c_greeting_id, + bbp.c_invoiceschedule_id AS bill_bp_c_invoiceschedule_id, + bbp.c_paymentterm_id AS bill_bp_c_paymentterm_id, + bbp.created AS bill_bp_created, + bbp.createdby AS bill_bp_createdby, + bbp.c_taxgroup_id AS bill_bp_c_taxgroup_id, + bbp.deliveryrule AS bill_bp_deliveryrule, + bbp.deliveryviarule AS bill_bp_deliveryviarule, + bbp.description AS bill_bp_description, + bbp.dunninggrace AS bill_bp_dunninggrace, + bbp.duns AS bill_bp_duns, + bbp.firstsale AS bill_bp_firstsale, + bbp.flatdiscount AS bill_bp_flatdiscount, + bbp.freightcostrule AS bill_bp_freightcostrule, + bbp.invoicerule AS bill_bp_invoicerule, + bbp.isactive AS bill_bp_isactive, + bbp.iscustomer AS bill_bp_iscustomer, + bbp.isdiscountprinted AS bill_bp_isdiscountprinted, + bbp.isemployee AS bill_bp_isemployee, + bbp.ismanufacturer AS bill_bp_ismanufacturer, + bbp.isonetime AS bill_bp_isonetime, + bbp.ispotaxexempt AS bill_bp_ispotaxexempt, + bbp.isprospect AS bill_bp_isprospect, + bbp.issalesrep AS bill_bp_issalesrep, + bbp.issummary AS bill_bp_issummary, + bbp.istaxexempt AS bill_bp_istaxexempt, + bbp.isvendor AS bill_bp_isvendor, + bbp.logo_id AS bill_bp_logo_id, + bbp.m_discountschema_id AS bill_bp_m_discountschema_id, + bbp.m_pricelist_id AS bill_bp_m_pricelist_id, + bbp.naics AS bill_bp_naics, + bbp.numberemployees AS bill_bp_numberemployees, + bbp.paymentrule AS bill_bp_paymentrule, + bbp.paymentrulepo AS bill_bp_paymentrulepo, + bbp.po_discountschema_id AS bill_bp_po_discountschema_id, + bbp.po_paymentterm_id AS bill_bp_po_paymentterm_id, + bbp.po_pricelist_id AS bill_bp_po_pricelist_id, + bbp.poreference AS bill_bp_poreference, + bbp.potentiallifetimevalue AS bill_bp_potentiallifetimevalue, + bbp.rating AS bill_bp_rating, + bbp.referenceno AS bill_bp_referenceno, + bbp.salesrep_id AS bill_bp_salesrep_id, + bbp.salesvolume AS bill_bp_salesvolume, + bbp.sendemail AS bill_bp_sendemail, + bbp.shareofcustomer AS bill_bp_shareofcustomer, + bbp.shelflifeminpct AS bill_bp_shelflifeminpct, + bbp.so_creditlimit AS bill_bp_so_creditlimit, + bbp.socreditstatus AS bill_bp_socreditstatus, + bbp.so_creditused AS bill_bp_so_creditused, + bbp.so_description AS bill_bp_so_description, + bbp.totalopenbalance AS bill_bp_totalopenbalance, + bbp.updated AS bill_bp_updated, + bbp.updatedby AS bill_bp_updatedby, + bbp.url AS bill_bp_url, + bbpl.ad_org_id AS bill_bp_location_ad_org_id, + bbpl.c_bpartner_id AS bill_bp_location_c_bpartner_id, + bbpl.created AS bill_bp_location_created, + bbpl.createdby AS bill_bp_location_createdby, + bbpl.c_salesregion_id AS bill_bp_location_c_salesreg_id, + bbpl.fax AS bill_bp_location_fax, + bbpl.isactive AS bill_bp_location_isactive, + bbpl.isbillto AS bill_bp_location_isbillto, + bbpl.isdn AS bill_bp_location_isdn, + bbpl.ispayfrom AS bill_bp_location_ispayfrom, + bbpl.isremitto AS bill_bp_location_isremitto, + bbpl.isshipto AS bill_bp_location_isshipto, + bbpl.name AS bill_bp_location_name, + bbpl.phone AS bill_bp_location_phone, + bbpl.phone2 AS bill_bp_location_phone2, + bbpl.updated AS bill_bp_location_updated, + bbpl.updatedby AS bill_bp_location_updatedby, + bbpc.ad_org_id AS bill_user_ad_org_id, + bbpc.ad_orgtrx_id AS bill_user_ad_orgtrx_id, + bbpc.birthday AS bill_user_ad_birthday, + bbpc.c_bpartner_id AS bill_user_c_bpartner_id, + bbpc.c_bpartner_location_id AS bill_user_c_bp_location_id, + bbpc.c_greeting_id AS bill_user_c_greeting_id, + bbpc.comments AS bill_user_comments, + bbpc.created AS bill_user_created, + bbpc.createdby AS bill_user_createdby, + bbpc.description AS bill_user_description, + bbpc.email AS bill_user_email, + bbpc.fax AS bill_user_fax, + bbpc.isactive AS bill_user_isactive, + bbpc.lastcontact AS bill_user_lastcontact, + bbpc.lastresult AS bill_user_lastresult, + bbpc.phone2 AS bill_user_phone2, + bbpc.supervisor_id AS bill_user_supervisor_id, + bbpc.updated AS bill_user_updated, + bbpc.updatedby AS bill_user_updatedby, + bbpc.value AS bill_user_value, + cur.cursymbol, + cur.description AS cur_description +FROM c_order o + JOIN c_doctype_trl dt + ON o.c_doctype_id = dt.c_doctype_id + JOIN m_warehouse wh + ON o.m_warehouse_id = wh.m_warehouse_id + JOIN c_paymentterm pt + ON o.c_paymentterm_id = pt.c_paymentterm_id + JOIN c_paymentterm_trl ptt + ON o.c_paymentterm_id = ptt.c_paymentterm_id AND dt.ad_language = ptt.ad_language + JOIN c_bpartner bp + ON o.c_bpartner_id = bp.c_bpartner_id + LEFT JOIN c_greeting bpg + ON bp.c_greeting_id = bpg.c_greeting_id + LEFT JOIN c_greeting_trl bpgt + ON bp.c_greeting_id = bpgt.c_greeting_id AND dt.ad_language = bpgt.ad_language + JOIN c_bpartner_location bpl + ON o.c_bpartner_location_id = bpl.c_bpartner_location_id + JOIN c_location l + ON bpl.c_location_id = l.c_location_id + LEFT JOIN ad_user bpc + ON o.ad_user_id = bpc.ad_user_id + LEFT JOIN c_greeting bpcg + ON bpc.c_greeting_id = bpcg.c_greeting_id + LEFT JOIN c_greeting_trl bpcgt + ON bpc.c_greeting_id = bpcgt.c_greeting_id AND dt.ad_language = bpcgt.ad_language + JOIN ad_orginfo oi + ON o.ad_org_id = oi.ad_org_id + JOIN ad_clientinfo ci + ON o.ad_client_id = ci.ad_client_id + LEFT JOIN ad_user u + ON o.salesrep_id = u.ad_user_id + LEFT JOIN c_bpartner ubp + ON u.c_bpartner_id = ubp.c_bpartner_id + JOIN c_bpartner bbp + ON o.bill_bpartner_id = bbp.c_bpartner_id + JOIN c_bpartner_location bbpl + ON o.bill_location_id = bbpl.c_bpartner_location_id + LEFT JOIN ad_user bbpc + ON o.bill_user_id = bbpc.ad_user_id + LEFT JOIN c_currency_trl cur + ON o.c_currency_id = cur.c_currency_id AND dt.ad_language = cur.ad_language +; +SELECT register_migration_script('201601271716_IDEMPIERE-3013.sql') FROM dual +; + From 87432dd660b5c198da30c8910e878616b9858cd9 Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Wed, 27 Jan 2016 19:12:47 +0100 Subject: [PATCH 12/34] IDEMPIERE-3004 View Column - View Component require SeqNo --- .../i3.1/oracle/201601161701_IDEMPIERE-3004.sql | 15 +++++++++++++++ .../postgresql/201601161701_IDEMPIERE-3004.sql | 12 ++++++++++++ .../src/org/compiere/model/MTable.java | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 migration/i3.1/oracle/201601161701_IDEMPIERE-3004.sql create mode 100644 migration/i3.1/postgresql/201601161701_IDEMPIERE-3004.sql diff --git a/migration/i3.1/oracle/201601161701_IDEMPIERE-3004.sql b/migration/i3.1/oracle/201601161701_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..af6a70bf3a --- /dev/null +++ b/migration/i3.1/oracle/201601161701_IDEMPIERE-3004.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3004: View Column - View Component require SeqNo +-- Jan 25, 2016 4:42:40 PM CET +UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewComponent WHERE AD_Table_ID=@AD_Table_ID@', IsUpdateable='N',Updated=TO_DATE('2016-01-25 16:42:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210567 +; + +-- Jan 25, 2016 4:49:47 PM CET +UPDATE AD_Field SET SortNo=1.0,Updated=TO_DATE('2016-01-25 16:49:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202233 +; + +SELECT register_migration_script('201601161701_IDEMPIERE-3004.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201601161701_IDEMPIERE-3004.sql b/migration/i3.1/postgresql/201601161701_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..2e6eaadb7c --- /dev/null +++ b/migration/i3.1/postgresql/201601161701_IDEMPIERE-3004.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-3004: View Column - View Component require SeqNo +-- Jan 25, 2016 4:42:40 PM CET +UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewComponent WHERE AD_Table_ID=@AD_Table_ID@', IsUpdateable='N',Updated=TO_TIMESTAMP('2016-01-25 16:42:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210567 +; + +-- Jan 25, 2016 4:49:47 PM CET +UPDATE AD_Field SET SortNo=1.0,Updated=TO_TIMESTAMP('2016-01-25 16:49:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202233 +; + +SELECT register_migration_script('201601161701_IDEMPIERE-3004.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MTable.java b/org.adempiere.base/src/org/compiere/model/MTable.java index a293b73a5c..c00c8b031c 100644 --- a/org.adempiere.base/src/org/compiere/model/MTable.java +++ b/org.adempiere.base/src/org/compiere/model/MTable.java @@ -661,6 +661,7 @@ public class MTable extends X_AD_Table Query query = new Query(getCtx(), MViewComponent.Table_Name, MViewComponent.COLUMNNAME_AD_Table_ID + "=?", get_TrxName()); query.setParameters(getAD_Table_ID()); + query.setOrderBy(MViewComponent.COLUMNNAME_SeqNo); query.setOnlyActiveRecords(true); List list = query.list(); @@ -698,4 +699,4 @@ public class MTable extends X_AD_Table tablename.equals("M_AttributeSetInstance")); } -} // MTable \ No newline at end of file +} // MTable From b248f46cde4356d9e35a341f01e3cffa31b44b19 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 27 Jan 2016 19:53:44 +0100 Subject: [PATCH 13/34] IDEMPIERE-1770 Allowing manual entry from Attributes tab on shipment/MR line -> move validation for mandatory serial from beforeSave to prepareIt on MInventory and MMovement --- .../src/org/compiere/model/MInventory.java | 32 ++++++++++++++++ .../org/compiere/model/MInventoryLine.java | 8 ++-- .../src/org/compiere/model/MMovement.java | 38 ++++++++++++++++++- .../src/org/compiere/model/MMovementLine.java | 12 ++++-- 4 files changed, 82 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index 646760c2d9..b8366dc0ca 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -334,6 +334,38 @@ public class MInventory extends X_M_Inventory implements DocAction return DocAction.STATUS_Invalid; } + // Validate mandatory ASI on lines - IDEMPIERE-1770 - ASI validation must be moved to MInventory.prepareIt + for (MInventoryLine line : lines) { + // Product requires ASI + if (line.getM_AttributeSetInstance_ID() == 0) + { + MProduct product = MProduct.get(getCtx(), line.getM_Product_ID()); + if (product != null && product.isASIMandatory(line.isSOTrx())) + { + if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) { + MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); + String docSubTypeInv = dt.getDocSubTypeInv(); + BigDecimal qtyDiff = line.getQtyInternalUse(); + if (MDocType.DOCSUBTYPEINV_PhysicalInventory.equals(docSubTypeInv)) + qtyDiff = line.getQtyBook().subtract(line.getQtyCount()); + // verify if the ASIs are captured on lineMA + MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), + line.getM_InventoryLine_ID(), get_TrxName()); + BigDecimal qtyma = Env.ZERO; + for (MInventoryLineMA ma : mas) { + if (! ma.isAutoGenerated()) { + qtyma = qtyma.add(ma.getMovementQty()); + } + } + if (qtyma.subtract(qtyDiff).signum() != 0) { + m_processMsg = "@Line@ " + line.getLine() + ": @FillMandatory@ @M_AttributeSetInstance_ID@"; + return DocAction.STATUS_Invalid; + } + } + } + } // No ASI + } + // TODO: Add up Amounts // setApprovalAmt(); diff --git a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java index e6bf530dd9..aff95b4e8b 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java @@ -125,7 +125,7 @@ public class MInventoryLine extends X_M_InventoryLine setQtyCount (QtyCount); if (QtyInternalUse != null && QtyInternalUse.signum() != 0) setQtyInternalUse (QtyInternalUse); - m_isManualEntry = false; + // m_isManualEntry = false; } // MInventoryLine public MInventoryLine (MInventory inventory, @@ -136,7 +136,7 @@ public class MInventoryLine extends X_M_InventoryLine } /** Manually created */ - private boolean m_isManualEntry = true; + // private boolean m_isManualEntry = true; /** Parent */ private MInventory m_parent = null; /** Product */ @@ -260,6 +260,7 @@ public class MInventoryLine extends X_M_InventoryLine log.saveError("ParentComplete", Msg.translate(getCtx(), "M_InventoryLine")); return false; } + /* IDEMPIERE-1770 - ASI validation must be moved to MInventory.prepareIt, saving a line without ASI is ok on draft if (m_isManualEntry) { // Product requires ASI @@ -279,7 +280,8 @@ public class MInventoryLine extends X_M_InventoryLine } } // No ASI } // manual - + */ + // Set Line No if (getLine() == 0) { diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index 1ad6d522e2..1599cb2dc1 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -290,7 +290,43 @@ public class MMovement extends X_M_Movement implements DocAction m_processMsg = "@NoLines@"; return DocAction.STATUS_Invalid; } - + + // Validate mandatory ASI on lines - IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt + for (MMovementLine line : lines) { + // Mandatory Instance + MProduct product = line.getProduct(); + if (line.getM_AttributeSetInstance_ID() == 0) { + if (product != null && product.isASIMandatory(true)) { + if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing + BigDecimal qtyDiff = line.getMovementQty(); + // verify if the ASIs are captured on lineMA + MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), + line.getM_MovementLine_ID(), get_TrxName()); + BigDecimal qtyma = Env.ZERO; + for (MMovementLineMA ma : mas) { + if (! ma.isAutoGenerated()) { + qtyma = qtyma.add(ma.getMovementQty()); + } + } + if (qtyma.subtract(qtyDiff).signum() != 0) { + m_processMsg = "@Line@ " + line.getLine() + ": @FillMandatory@ @M_AttributeSetInstance_ID@"; + return DocAction.STATUS_Invalid; + } + } + } + } + if (line.getM_AttributeSetInstanceTo_ID() == 0) + { + if (product != null && product.isASIMandatory(false) && line.getM_AttributeSetInstanceTo_ID() == 0) + { + if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming + m_processMsg = "@Line@ " + line.getLine() + ": @FillMandatory@ @M_AttributeSetInstanceTo_ID@"; + return DocAction.STATUS_Invalid; + } + } + } // ASI + } + // Confirmation if (dt.isInTransit()) createConfirmation(); diff --git a/org.adempiere.base/src/org/compiere/model/MMovementLine.java b/org.adempiere.base/src/org/compiere/model/MMovementLine.java index 118dac29b3..5c54a07052 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovementLine.java +++ b/org.adempiere.base/src/org/compiere/model/MMovementLine.java @@ -207,8 +207,9 @@ public class MMovementLine extends X_M_MovementLine // Qty Precision if (newRecord || is_ValueChanged(COLUMNNAME_MovementQty)) setMovementQty(getMovementQty()); - + // Mandatory Instance + /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft MProduct product = getProduct(); if (getM_AttributeSetInstance_ID() == 0) { if (product != null && product.isASIMandatory(true)) { @@ -216,12 +217,13 @@ public class MMovementLine extends X_M_MovementLine log.saveError("NoAttributeSet", product.getValue()); return false; } - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true /*outgoing*/)) { + if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID)); return false; } } } + */ if (getM_AttributeSetInstanceTo_ID() == 0) { //instance id default to same for movement between locator @@ -230,18 +232,20 @@ public class MMovementLine extends X_M_MovementLine if (getM_AttributeSetInstance_ID() != 0) //set to from setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID()); } - + + /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0) { if (product.getAttributeSet()==null) { log.saveError("NoAttributeSet", product.getValue()); return false; } - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) { + if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID)); return false; } } + */ } // ASI return true; From 0c28fbc7b6c4f0b68c2e0bdc2bb617f466c8e226 Mon Sep 17 00:00:00 2001 From: Murilo Habermann Torquato Date: Wed, 27 Jan 2016 19:56:24 +0100 Subject: [PATCH 14/34] IDEMPIERE-2811 Each Record should have a primary key - M_ProductPrice / fix constructor --- org.adempiere.base/src/org/compiere/model/MProductPrice.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MProductPrice.java b/org.adempiere.base/src/org/compiere/model/MProductPrice.java index b42302207f..510a975d8a 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPrice.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPrice.java @@ -60,12 +60,12 @@ public class MProductPrice extends X_M_ProductPrice /** * Persistency Constructor * @param ctx context - * @param ignored ignored + * @param M_ProductPrice_ID key * @param trxName transaction */ public MProductPrice (Properties ctx, int M_ProductPrice_ID, String trxName) { - super(ctx, 0, trxName); + super(ctx, M_ProductPrice_ID, trxName); } // MProductPrice /** From 7cbee09a693b3949cb1f6c9297a67a3ebc08c5c6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 29 Jan 2016 03:02:48 +0100 Subject: [PATCH 15/34] IDEMPIERE-3017 CSV Importer leaving open trx (DB locks) --- .../adempiere/impexp/GridTabCSVImporter.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 8d6551dcbc..81d0f909a3 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -238,7 +238,7 @@ public class GridTabCSVImporter implements IGridTabImporter createTrx(gridTab); } - String recordResult = processRecord(importMode, gridTab, indxDetail, isDetail, idx, rowResult); + String recordResult = processRecord(importMode, gridTab, indxDetail, isDetail, idx, rowResult, childs); rowResult.append(recordResult); // write @@ -272,6 +272,13 @@ public class GridTabCSVImporter implements IGridTabImporter } catch (IOException e) { e.printStackTrace(); } + + gridTab.getTableModel().setImportingMode(false,null); + for (GridTab detail : childs) { + detail.getTableModel().setImportingMode(false,null); + } + gridTab.dataRefreshAll(); + } if (logFile != null) return logFile; @@ -521,6 +528,7 @@ public class GridTabCSVImporter implements IGridTabImporter if( trx != null ){ if( isError() ) { + gridTab.dataDelete(); rollbackTrx(); setError(false); }else { @@ -542,6 +550,7 @@ public class GridTabCSVImporter implements IGridTabImporter } if( isError ){ + gridTab.dataDelete(); rollbackTrx(); }else{ commitTrx(); @@ -550,19 +559,7 @@ public class GridTabCSVImporter implements IGridTabImporter commitTrx(); } } - - if( childs != null ){ - if( masterRecord != null ){ - gridTab.query(false); - gridTab.getTableModel().setImportingMode(false,null); - for( GridTab detail : childs ) - if( detail.getTableModel().isOpen() ){ - detail.query(true); - detail.getTableModel().setImportingMode(false,null); - } - } - } - + trx.close(); trx=null; } @@ -597,7 +594,7 @@ public class GridTabCSVImporter implements IGridTabImporter * @param rowResult * @return */ - private String processRecord(String importMode, GridTab gridTab, int indxDetail, boolean isDetail, int idx, StringBuilder rowResult){ + private String processRecord(String importMode, GridTab gridTab, int indxDetail, boolean isDetail, int idx, StringBuilder rowResult, List childs){ String logMsg = null; GridTab currentGridTab = null; @@ -633,6 +630,11 @@ public class GridTabCSVImporter implements IGridTabImporter logMsg = "["+currentGridTab.getName()+"]"+"- Was not able to create a new record!"; }else{ currentGridTab.navigateCurrent(); + if (! isDetail) { + for (GridTab child : childs) { + child.query(false); + } + } } } From 7d437aee5448685a5d1c5ba69c28d3df46b132a7 Mon Sep 17 00:00:00 2001 From: hieplq Date: Mon, 1 Feb 2016 22:42:42 +0700 Subject: [PATCH 16/34] IDEMPIERE-1750:Restore M_ProductionPlan backward compatibility --- .../src/org/compiere/acct/Doc_Production.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java index 71db491f1f..64fbcab5a0 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java @@ -76,11 +76,23 @@ public class Doc_Production extends Doc private DocLine[] loadLines(X_M_Production prod) { ArrayList list = new ArrayList(); - // Production - // -- ProductionLine - the real level - String sqlPL = "SELECT * FROM M_ProductionLine pl " - + "WHERE pl.M_Production_ID=? " - + "ORDER BY pl.Line"; + String sqlPL = null; + if (prod.isUseProductionPlan()){ +// Production + // -- ProductionLine - the real level + sqlPL = "SELECT * FROM " + + " M_ProductionLine pro_line INNER JOIN M_ProductionPlan plan ON pro_line.M_ProductionPlan_id = plan.M_ProductionPlan_id " + + " INNER JOIN M_Production pro ON pro.M_Production_id = plan.M_Production_id " + + " WHERE pro.M_Production_ID=? " + + " ORDER BY pro_line.Line"; + }else{ +// Production + // -- ProductionLine - the real level + sqlPL = "SELECT * FROM M_ProductionLine pl " + + "WHERE pl.M_Production_ID=? " + + "ORDER BY pl.Line"; + } + PreparedStatement pstmtPL = null; ResultSet rsPL = null; try From d37e7661fefc0fb3cfb6988f536fb0957bd0d9a7 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 3 Feb 2016 00:30:57 +0700 Subject: [PATCH 17/34] IDEMPIERE-1750:Restore M_ProductionPlan backward compatibility variance isn't post by can't Identify finished BOM Product --- org.adempiere.base/src/org/compiere/acct/Doc_Production.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java index 64fbcab5a0..334b7e9326 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java @@ -111,7 +111,10 @@ public class Doc_Production extends Doc DocLine docLine = new DocLine (line, this); docLine.setQty (line.getMovementQty(), false); // Identify finished BOM Product - docLine.setProductionBOM(line.getM_Product_ID() == prod.getM_Product_ID()); + if (prod.isUseProductionPlan()) + docLine.setProductionBOM(line.getM_Product_ID() == line.getM_ProductionPlan().getM_Product_ID()); + else + docLine.setProductionBOM(line.getM_Product_ID() == prod.getM_Product_ID()); // if (log.isLoggable(Level.FINE)) log.fine(docLine.toString()); list.add (docLine); From 8b7c5413e338f1bfbf3d021f1d32647ba3809bb8 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 3 Feb 2016 14:09:06 +0700 Subject: [PATCH 18/34] IDEMPIERE-1750:Restore M_ProductionPlan backward compatibility --- .../src/org/compiere/acct/Doc_Production.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java index 334b7e9326..93e2e292e4 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java @@ -84,7 +84,7 @@ public class Doc_Production extends Doc + " M_ProductionLine pro_line INNER JOIN M_ProductionPlan plan ON pro_line.M_ProductionPlan_id = plan.M_ProductionPlan_id " + " INNER JOIN M_Production pro ON pro.M_Production_id = plan.M_Production_id " + " WHERE pro.M_Production_ID=? " - + " ORDER BY pro_line.Line"; + + " ORDER BY plan.M_ProductionPlan_id, pro_line.Line"; }else{ // Production // -- ProductionLine - the real level @@ -164,6 +164,7 @@ public class Doc_Production extends Doc // Line pointer FactLine fl = null; + X_M_Production prod = (X_M_Production)getPO(); for (int i = 0; i < p_lines.length; i++) { DocLine line = p_lines[i]; @@ -181,12 +182,18 @@ public class Doc_Production extends Doc } if (line.isProductionBOM()) { + X_M_ProductionLine endProLine = (X_M_ProductionLine)line.getPO(); + Object parentEndPro = prod.isUseProductionPlan()?endProLine.getM_ProductionPlan_ID():endProLine.getM_Production_ID(); + // Get BOM Cost - Sum of individual lines BigDecimal bomCost = Env.ZERO; for (int ii = 0; ii < p_lines.length; ii++) { DocLine line0 = p_lines[ii]; - if (line0.getM_Production_ID() != line.getM_Production_ID()) + X_M_ProductionLine bomProLine = (X_M_ProductionLine)line0.getPO(); + Object parentBomPro = prod.isUseProductionPlan()?bomProLine.getM_ProductionPlan_ID():bomProLine.getM_Production_ID(); + + if (!parentBomPro.equals(parentEndPro)) continue; //pb changed this 20/10/06 if (!line0.isProductionBOM()) From ec152cb61805d28092981ac8e0251eab8aef0a1a Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Wed, 3 Feb 2016 17:12:09 +0100 Subject: [PATCH 19/34] IDEMPIERE-3005 Copy view and view components --- .../oracle/201602031708_IDEMPIERE-3005.sql | 52 +++++++ .../201602031708_IDEMPIERE-3005.sql | 48 +++++++ .../process/CopyComponentsFromView.java | 133 ++++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql create mode 100644 migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql create mode 100644 org.adempiere.base.process/src/org/compiere/process/CopyComponentsFromView.java diff --git a/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql b/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql new file mode 100644 index 0000000000..f13859bce1 --- /dev/null +++ b/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql @@ -0,0 +1,52 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3005 Copy view and view components +-- Feb 1, 2016 4:04:17 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Target table must not have view components',0,0,'Y',TO_DATE('2016-02-01 16:04:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-01 16:04:16','YYYY-MM-DD HH24:MI:SS'),100,200397,'ErrorCopyView','D','9e9efdf9-cafd-4857-b4d5-37055b0d0786') +; + +-- Feb 1, 2016 4:28:54 PM CET +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202975,0,0,'Y',TO_DATE('2016-02-01 16:28:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-01 16:28:53','YYYY-MM-DD HH24:MI:SS'),100,'CopyComponentsFromView','Copy Components From View','Copy Components From View','D','667adbfe-8e70-450b-9c45-e042c12f518a') +; + +-- Feb 1, 2016 4:30:59 PM CET +INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200086,0,0,'Y',TO_DATE('2016-02-01 16:30:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-01 16:30:59','YYYY-MM-DD HH24:MI:SS'),100,'Copy Components From View','Create dictionary view components for a table taking another as base','N','AD_Table_CopyComponentsFromView','N','org.compiere.process.CopyComponentsFromView','4','D',0,0,'N','N','Y','N','ebc55ee4-a02a-4505-9063-ae687e37ed6c') +; + +-- Feb 1, 2016 4:32:56 PM CET +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200155,0,0,'Y',TO_DATE('2016-02-01 16:32:56','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-01 16:32:56','YYYY-MM-DD HH24:MI:SS'),100,'Table','Database Table information','The Database Table provides the information of the table definition',200086,10,19,'N',0,'Y','AD_Table_ID','Y','D',126,'ce32a1c1-2820-4610-ac00-109ed3ac5b03','N') +; + +-- Feb 1, 2016 4:33:43 PM CET +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,AD_Process_ID,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212637,0,'Copy Components From View',100,'CopyComponentsFromView',1,'N','N','N','N','N',0,'N',28,0,0,'Y',TO_DATE('2016-02-01 16:33:42','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-01 16:33:42','YYYY-MM-DD HH24:MI:SS'),100,202975,'Y',200086,'N','D','N','N','N','Y','c9a6c992-0cac-4559-b3e3-b9981cb5db4f','Y',0,'Y','N') +; + +-- Feb 1, 2016 4:33:49 PM CET +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200004, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200004) +; + +-- Feb 1, 2016 4:33:49 PM CET +ALTER TABLE AD_Table ADD CopyComponentsFromView CHAR(1) DEFAULT NULL +; + +-- Feb 1, 2016 4:34:53 PM CET +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200005, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200005) +; + +-- Feb 1, 2016 4:34:53 PM CET +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,XPosition,ColumnSpan) VALUES (204137,'Copy Components From View',100,212637,'Y',1,220,'N','N','N','N',0,0,'Y',TO_DATE('2016-02-01 16:34:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-01 16:34:53','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','063d15a1-b7df-4f27-8d37-23360fae8f83','Y',190,2,2) +; + +-- Feb 1, 2016 4:35:53 PM CET +UPDATE AD_Field SET DisplayLogic='@IsView@=''Y''',Updated=TO_DATE('2016-02-01 16:35:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204137 +; + +-- Feb 3, 2016 5:06:14 PM CET +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200088,'AD_Table is View','S','AD_Table.IsView=''Y''',0,0,'Y',TO_DATE('2016-02-03 17:06:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-02-03 17:06:14','YYYY-MM-DD HH24:MI:SS'),100,'D','84fba66f-4489-4993-8ea9-84fec646dd42') +; + +-- Feb 3, 2016 5:06:28 PM CET +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200088,Updated=TO_DATE('2016-02-03 17:06:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=50005 +; + diff --git a/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql b/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql new file mode 100644 index 0000000000..3f5f55e355 --- /dev/null +++ b/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql @@ -0,0 +1,48 @@ +-- IDEMPIERE-3005 Copy view and view components +-- Feb 1, 2016 4:04:17 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Target table must not have view components',0,0,'Y',TO_TIMESTAMP('2016-02-01 16:04:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-01 16:04:16','YYYY-MM-DD HH24:MI:SS'),100,200397,'ErrorCopyView','D','9e9efdf9-cafd-4857-b4d5-37055b0d0786') +; + +-- Feb 1, 2016 4:28:54 PM CET +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202975,0,0,'Y',TO_TIMESTAMP('2016-02-01 16:28:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-01 16:28:53','YYYY-MM-DD HH24:MI:SS'),100,'CopyComponentsFromView','Copy Components From View','Copy Components From View','D','667adbfe-8e70-450b-9c45-e042c12f518a') +; + +-- Feb 1, 2016 4:30:59 PM CET +INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200086,0,0,'Y',TO_TIMESTAMP('2016-02-01 16:30:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-01 16:30:59','YYYY-MM-DD HH24:MI:SS'),100,'Copy Components From View','Create dictionary view components for a table taking another as base','N','AD_Table_CopyComponentsFromView','N','org.compiere.process.CopyComponentsFromView','4','D',0,0,'N','N','Y','N','ebc55ee4-a02a-4505-9063-ae687e37ed6c') +; + +-- Feb 1, 2016 4:32:56 PM CET +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200155,0,0,'Y',TO_TIMESTAMP('2016-02-01 16:32:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-01 16:32:56','YYYY-MM-DD HH24:MI:SS'),100,'Table','Database Table information','The Database Table provides the information of the table definition',200086,10,19,'N',0,'Y','AD_Table_ID','Y','D',126,'ce32a1c1-2820-4610-ac00-109ed3ac5b03','N') +; + +-- Feb 1, 2016 4:33:43 PM CET +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,AD_Process_ID,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212637,0,'Copy Components From View',100,'CopyComponentsFromView',1,'N','N','N','N','N',0,'N',28,0,0,'Y',TO_TIMESTAMP('2016-02-01 16:33:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-01 16:33:42','YYYY-MM-DD HH24:MI:SS'),100,202975,'Y',200086,'N','D','N','N','N','Y','c9a6c992-0cac-4559-b3e3-b9981cb5db4f','Y',0,'Y','N') +; + +-- Feb 1, 2016 4:33:49 PM CET +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200004, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200004) +; + +-- Feb 1, 2016 4:33:49 PM CET +ALTER TABLE AD_Table ADD COLUMN CopyComponentsFromView CHAR(1) DEFAULT NULL +; + +-- Feb 1, 2016 4:34:53 PM CET +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200005, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200005) +; + +-- Feb 1, 2016 4:34:53 PM CET +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,XPosition,ColumnSpan) VALUES (204137,'Copy Components From View',100,212637,'Y',1,220,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2016-02-01 16:34:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-01 16:34:53','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','063d15a1-b7df-4f27-8d37-23360fae8f83','Y',190,2,2) +; + +-- Feb 1, 2016 4:35:53 PM CET +UPDATE AD_Field SET DisplayLogic='@IsView@=''Y''',Updated=TO_TIMESTAMP('2016-02-01 16:35:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204137 +; + +-- Feb 3, 2016 5:06:14 PM CET +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200088,'AD_Table is View','S','AD_Table.IsView=''Y''',0,0,'Y',TO_TIMESTAMP('2016-02-03 17:06:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-02-03 17:06:14','YYYY-MM-DD HH24:MI:SS'),100,'D','84fba66f-4489-4993-8ea9-84fec646dd42') +; + +-- Feb 3, 2016 5:06:28 PM CET +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200088,Updated=TO_TIMESTAMP('2016-02-03 17:06:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=50005 + diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyComponentsFromView.java b/org.adempiere.base.process/src/org/compiere/process/CopyComponentsFromView.java new file mode 100644 index 0000000000..fff07dcb41 --- /dev/null +++ b/org.adempiere.base.process/src/org/compiere/process/CopyComponentsFromView.java @@ -0,0 +1,133 @@ +/********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Diego Ruiz * + **********************************************************************/ +package org.compiere.process; + +import java.util.logging.Level; + +import org.compiere.model.MTable; +import org.compiere.model.MViewColumn; +import org.compiere.model.MViewComponent; +import org.compiere.model.PO; +import org.compiere.util.AdempiereSystemError; +import org.compiere.util.Env; +import org.compiere.util.Msg; + +/** + * Copy components from one view to other + * + * @author Diego Ruiz - Bx Service GmbH + * @version $Id: CopyComponentsFromView + */ +public class CopyComponentsFromView extends SvrProcess { + + /** Target Table */ + private int p_target_AD_Table_ID = 0; + /** Source Table */ + private int p_source_AD_Table_ID = 0; + + /** Column Count */ + private int m_count = 0; + + /** + * Prepare - e.g., get Parameters. + */ + protected void prepare () + { + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { + String name = para[i].getParameterName(); + if (para[i].getParameter() == null) + ; + else if (name.equals("AD_Table_ID")) + p_source_AD_Table_ID = para[i].getParameterAsInt(); + else + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + p_target_AD_Table_ID = getRecord_ID(); + } // prepare + + /** + * Process + * @return info + * @throws Exception + */ + protected String doIt () throws Exception + { + if (p_target_AD_Table_ID == 0) + throw new AdempiereSystemError("@NotFound@ @AD_Table_ID@ " + p_target_AD_Table_ID); + if (p_source_AD_Table_ID == 0) + throw new AdempiereSystemError("@NotFound@ @AD_Table_ID@ " + p_source_AD_Table_ID); + if (log.isLoggable(Level.INFO)) log.info("Source AD_Table_ID=" + p_source_AD_Table_ID + + ", Target AD_Table_ID=" + p_target_AD_Table_ID); + + MTable targetTable = new MTable(getCtx(), p_target_AD_Table_ID, get_TrxName()); + MViewComponent[] targetViewComponents = targetTable.getViewComponent(true); + if (targetViewComponents.length > 0) + throw new AdempiereSystemError(Msg.getMsg(Env.getCtx(), "ErrorCopyView")); + + MTable sourceTable = new MTable(getCtx(), p_source_AD_Table_ID, get_TrxName()); + MViewComponent[] sourceViewComponents = sourceTable.getViewComponent(true); + + for (int i = 0; i < sourceViewComponents.length; i++) + { + MViewComponent viewComponentTarget = new MViewComponent(targetTable); + PO.copyValues(sourceViewComponents[i], viewComponentTarget); + viewComponentTarget.setAD_Table_ID (targetTable.getAD_Table_ID()); + viewComponentTarget.setEntityType(targetTable.getEntityType()); + + viewComponentTarget.setIsActive(sourceViewComponents[i].isActive()); + viewComponentTarget.saveEx(get_TrxName()); + + copyViewColumns(sourceViewComponents[i] ,viewComponentTarget); + + m_count++; + } + + // + return "#" + m_count; + } // doIt + + /** + * Copy view columns from one component to another + */ + public void copyViewColumns(MViewComponent sourceComponent, MViewComponent targetComponent) { + + MViewColumn[] sourceColumns = sourceComponent.getColumns(true); + + for (int i = 0; i < sourceColumns.length; i++) + { + MViewColumn columnTarget = new MViewColumn(targetComponent); + PO.copyValues(sourceColumns[i], columnTarget); + columnTarget.setAD_ViewComponent_ID(targetComponent.getAD_ViewComponent_ID()); + columnTarget.setEntityType(targetComponent.getEntityType()); + + columnTarget.setIsActive(sourceColumns[i].isActive()); + columnTarget.saveEx(get_TrxName()); + } + + } + +} From 70e97317adc5bd9170c4e3c4b8f2eb823c1db9e3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 3 Feb 2016 18:48:39 +0100 Subject: [PATCH 20/34] IDEMPIERE-3005 Copy view and view components / peer review --- migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql | 5 ++++- migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql b/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql index f13859bce1..8fe6dbe67e 100644 --- a/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql +++ b/migration/i3.1/oracle/201602031708_IDEMPIERE-3005.sql @@ -47,6 +47,9 @@ INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,Is ; -- Feb 3, 2016 5:06:28 PM CET -UPDATE AD_Process_Para SET AD_Val_Rule_ID=200088,Updated=TO_DATE('2016-02-03 17:06:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=50005 +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200088,Updated=TO_DATE('2016-02-03 17:06:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200155 +; + +SELECT register_migration_script('201602031708_IDEMPIERE-3005.sql') FROM dual ; diff --git a/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql b/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql index 3f5f55e355..d4558bb810 100644 --- a/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql +++ b/migration/i3.1/postgresql/201602031708_IDEMPIERE-3005.sql @@ -44,5 +44,9 @@ INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,Is ; -- Feb 3, 2016 5:06:28 PM CET -UPDATE AD_Process_Para SET AD_Val_Rule_ID=200088,Updated=TO_TIMESTAMP('2016-02-03 17:06:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=50005 +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200088,Updated=TO_TIMESTAMP('2016-02-03 17:06:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200155 +; + +SELECT register_migration_script('201602031708_IDEMPIERE-3005.sql') FROM dual +; From 42f3bd217b3eec35b6e282235fc292c150b4ca27 Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Mon, 1 Feb 2016 17:19:21 +0100 Subject: [PATCH 21/34] IDEMPIERE-3022 Copy Columns from table error message --- migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql | 8 ++++++++ migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql | 5 +++++ .../src/org/compiere/process/CopyColumnsFromTable.java | 5 +++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql create mode 100644 migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql diff --git a/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql b/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql new file mode 100644 index 0000000000..cb8be70eb1 --- /dev/null +++ b/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql @@ -0,0 +1,8 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3022 Copy Columns from table error message +-- Feb 1, 2016 5:11:42 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Target table must not have columns',0,0,'Y',TO_DATE('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,200398,'ErrorCopyColumns','D','e74d8970-44f1-4cd0-9b5e-ee21af6c286e') +; + diff --git a/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql b/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql new file mode 100644 index 0000000000..a400313af9 --- /dev/null +++ b/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql @@ -0,0 +1,5 @@ +-- IDEMPIERE-3022 Copy Columns from table error message +-- Feb 1, 2016 5:11:42 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Target table must not have columns',0,0,'Y',TO_TIMESTAMP('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,200398,'ErrorCopyColumns','D','e74d8970-44f1-4cd0-9b5e-ee21af6c286e') +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyColumnsFromTable.java b/org.adempiere.base.process/src/org/compiere/process/CopyColumnsFromTable.java index 513b7e0dff..1b09fd1f2d 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CopyColumnsFromTable.java +++ b/org.adempiere.base.process/src/org/compiere/process/CopyColumnsFromTable.java @@ -22,6 +22,8 @@ import org.compiere.model.MTable; import org.compiere.model.M_Element; import org.compiere.model.PO; import org.compiere.util.AdempiereSystemError; +import org.compiere.util.Env; +import org.compiere.util.Msg; /** * Copy columns from one table to other @@ -76,8 +78,7 @@ public class CopyColumnsFromTable extends SvrProcess MTable targetTable = new MTable(getCtx(), p_target_AD_Table_ID, get_TrxName()); MColumn[] targetColumns = targetTable.getColumns(true); if (targetColumns.length > 0) - // TODO: dictionary message - throw new AdempiereSystemError("Target table must not have columns"); + throw new AdempiereSystemError(Msg.getMsg(Env.getCtx(), "ErrorCopyColumns")); MTable sourceTable = new MTable(getCtx(), p_source_AD_Table_ID, get_TrxName()); MColumn[] sourceColumns = sourceTable.getColumns(true); From abad3091d086c2ff70f55ac35284439b18a5aee0 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 3 Feb 2016 18:52:21 +0100 Subject: [PATCH 22/34] IDEMPIERE-3022 Copy Columns from table error message / peer review --- migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql | 3 +++ migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql | 3 +++ 2 files changed, 6 insertions(+) diff --git a/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql b/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql index cb8be70eb1..601bad74e6 100644 --- a/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql +++ b/migration/i3.1/oracle/201602011711_IDEMPIERE-3022.sql @@ -6,3 +6,6 @@ SET DEFINE OFF INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Target table must not have columns',0,0,'Y',TO_DATE('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,200398,'ErrorCopyColumns','D','e74d8970-44f1-4cd0-9b5e-ee21af6c286e') ; +SELECT register_migration_script('201602011711_IDEMPIERE-3022.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql b/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql index a400313af9..9bd99cc889 100644 --- a/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql +++ b/migration/i3.1/postgresql/201602011711_IDEMPIERE-3022.sql @@ -3,3 +3,6 @@ INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Target table must not have columns',0,0,'Y',TO_TIMESTAMP('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2016-02-01 17:11:42','YYYY-MM-DD HH24:MI:SS'),0,200398,'ErrorCopyColumns','D','e74d8970-44f1-4cd0-9b5e-ee21af6c286e') ; +SELECT register_migration_script('201602011711_IDEMPIERE-3022.sql') FROM dual +; + From 2a27ac6c9f8d7a4e8e2987a48ca76f1921c62091 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 3 Feb 2016 19:31:54 +0100 Subject: [PATCH 23/34] IDEMPIERE-2954 Hardcoded messages when an error occurs on converting currencies in invoices --- .../src/org/compiere/model/MConversionRateUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java b/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java index 8e76c0a2d3..a034fab118 100644 --- a/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java +++ b/org.adempiere.base/src/org/compiere/model/MConversionRateUtil.java @@ -106,6 +106,8 @@ public final class MConversionRateUtil /** Return the message to show when no exchange rate is found */ public static String getErrorMessage(Properties ctx, String adMessage, int currencyFromID, int currencyToID, int convertionTypeID, Timestamp date, String trxName) { + if (convertionTypeID == 0) + convertionTypeID = MConversionType.getDefault(Env.getAD_Client_ID(ctx)); String retValue = Msg.getMsg(ctx, adMessage, new Object[] {MCurrency.get(ctx, currencyFromID).getISO_Code(), MCurrency.get(ctx, currencyToID).getISO_Code(), new MConversionType(ctx, convertionTypeID, trxName).getName(), date}); return retValue; From c3ac442984e54b7fb35aae7cc54dc2f154ca9e1c Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Wed, 3 Feb 2016 20:21:46 +0100 Subject: [PATCH 24/34] IDEMPIERE-3004 View Column - View Component require SeqNo --- .../oracle/201601161728_IDEMPIERE-3004.sql | 43 +++++++++++++++++++ .../201601161728_IDEMPIERE-3004.sql | 39 +++++++++++++++++ .../org/compiere/model/I_AD_ViewColumn.java | 15 +++++++ .../org/compiere/model/MViewComponent.java | 2 +- .../org/compiere/model/X_AD_ViewColumn.java | 22 +++++++++- 5 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql create mode 100644 migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql diff --git a/migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql b/migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..92021503a8 --- /dev/null +++ b/migration/i3.1/oracle/201601161728_IDEMPIERE-3004.sql @@ -0,0 +1,43 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3004: View Column - View Component require SeqNo +-- Jan 25, 2016 5:22:40 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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 (212635,0,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200088,'SeqNo','@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_Table_ID=@AD_Table_ID@',22,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_DATE('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,566,'Y','N','D','N','N','N','Y','cc51c32b-7c4a-49c8-a9d4-94989260e242','Y',0,'N','N') +; + +-- Jan 25, 2016 5:24:53 PM CET +UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_ViewComponent_ID=@AD_ViewComponent_ID@',Updated=TO_DATE('2016-01-25 17:24:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212635 +; + +-- Jan 25, 2016 5:25:19 PM CET +ALTER TABLE AD_ViewColumn ADD SeqNo NUMBER(10) DEFAULT NULL +; + +-- Jan 25, 2016 5:27:04 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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 (204135,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200099,212635,'Y',22,110,'N','N','N','N',0,0,'Y',TO_DATE('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6f955e38-0d37-4410-b8d2-3034ab5edd4a','Y',90,2) +; + +-- Jan 25, 2016 5:27:47 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, XPosition=4,Updated=TO_DATE('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=100,Updated=TO_DATE('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202244 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2016-01-25 17:27:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202248 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_Field SET SortNo=1.0,Updated=TO_DATE('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_ViewColumn SET SeqNo = 0,Updated=TO_DATE('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 +; + +SELECT register_migration_script('201601161728_IDEMPIERE-3004.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql b/migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..3a559d176c --- /dev/null +++ b/migration/i3.1/postgresql/201601161728_IDEMPIERE-3004.sql @@ -0,0 +1,39 @@ +-- IDEMPIERE-3004: View Column - View Component require SeqNo +-- Jan 25, 2016 5:22:40 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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 (212635,0,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200088,'SeqNo','@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_Table_ID=@AD_Table_ID@',22,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_TIMESTAMP('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-01-25 17:22:39','YYYY-MM-DD HH24:MI:SS'),100,566,'Y','N','D','N','N','N','Y','cc51c32b-7c4a-49c8-a9d4-94989260e242','Y',0,'N','N') +; + +-- Jan 25, 2016 5:24:53 PM CET +UPDATE AD_Column SET DefaultValue='@SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_ViewColumn WHERE AD_ViewComponent_ID=@AD_ViewComponent_ID@',Updated=TO_TIMESTAMP('2016-01-25 17:24:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212635 +; + +-- Jan 25, 2016 5:25:19 PM CET +ALTER TABLE AD_ViewColumn ADD COLUMN SeqNo NUMERIC(10) DEFAULT NULL +; + +-- Jan 25, 2016 5:27:04 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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 (204135,'Sequence','Method of ordering records; lowest number comes first','The Sequence indicates the order of records',200099,212635,'Y',22,110,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-01-25 17:27:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6f955e38-0d37-4410-b8d2-3034ab5edd4a','Y',90,2) +; + +-- Jan 25, 2016 5:27:47 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, XPosition=4,Updated=TO_TIMESTAMP('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2016-01-25 17:27:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202244 +; + +-- Jan 25, 2016 5:27:48 PM CET +UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2016-01-25 17:27:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202248 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_Field SET SortNo=1.0,Updated=TO_TIMESTAMP('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204135 +; + +-- Jan 25, 2016 5:28:00 PM CET +UPDATE AD_ViewColumn SET SeqNo = 0,Updated=TO_TIMESTAMP('2016-01-25 17:28:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 +; + +SELECT register_migration_script('201601161728_IDEMPIERE-3004.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java b/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java index 438ea43627..db7ff728bd 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_ViewColumn.java @@ -196,6 +196,21 @@ public interface I_AD_ViewColumn */ public boolean isActive(); + /** Column name SeqNo */ + public static final String COLUMNNAME_SeqNo = "SeqNo"; + + /** Set Sequence. + * Method of ordering records; + lowest number comes first + */ + public void setSeqNo (int SeqNo); + + /** Get Sequence. + * Method of ordering records; + lowest number comes first + */ + public int getSeqNo(); + /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; diff --git a/org.adempiere.base/src/org/compiere/model/MViewComponent.java b/org.adempiere.base/src/org/compiere/model/MViewComponent.java index 8552919064..97074e6bc3 100644 --- a/org.adempiere.base/src/org/compiere/model/MViewComponent.java +++ b/org.adempiere.base/src/org/compiere/model/MViewComponent.java @@ -76,7 +76,7 @@ public class MViewComponent extends X_AD_ViewComponent { Query query = new Query(getCtx(), MViewColumn.Table_Name, MViewColumn.COLUMNNAME_AD_ViewComponent_ID + "=?", get_TrxName()); query.setParameters(getAD_ViewComponent_ID()); - query.setOrderBy(MViewColumn.COLUMNNAME_AD_ViewColumn_ID); + query.setOrderBy("SeqNo, AD_ViewColumn_ID"); List list = query.list(); m_columns = new MViewColumn[list.size()]; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java b/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java index 7d7413b90b..7bb99fe6fd 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_ViewColumn.java @@ -29,7 +29,7 @@ public class X_AD_ViewColumn extends PO implements I_AD_ViewColumn, I_Persistent /** * */ - private static final long serialVersionUID = 20151030L; + private static final long serialVersionUID = 20160125L; /** Standard Constructor */ public X_AD_ViewColumn (Properties ctx, int AD_ViewColumn_ID, String trxName) @@ -252,4 +252,24 @@ public class X_AD_ViewColumn extends PO implements I_AD_ViewColumn, I_Persistent { return (String)get_Value(COLUMNNAME_Help); } + + /** Set Sequence. + @param SeqNo + Method of ordering records; lowest number comes first + */ + public void setSeqNo (int SeqNo) + { + set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); + } + + /** Get Sequence. + @return Method of ordering records; lowest number comes first + */ + public int getSeqNo () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo); + if (ii == null) + return 0; + return ii.intValue(); + } } \ No newline at end of file From c072828a97bda5d2e2208819a25698e67f2fd3a2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 3 Feb 2016 20:36:37 +0100 Subject: [PATCH 25/34] IDEMPIERE-3004 View Column - View Component require SeqNo / peer review --- migration/i3.1/oracle/201602032036_IDEMPIERE-3004.sql | 11 +++++++++++ .../i3.1/postgresql/201602032036_IDEMPIERE-3004.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i3.1/oracle/201602032036_IDEMPIERE-3004.sql create mode 100644 migration/i3.1/postgresql/201602032036_IDEMPIERE-3004.sql diff --git a/migration/i3.1/oracle/201602032036_IDEMPIERE-3004.sql b/migration/i3.1/oracle/201602032036_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..8610ebbdac --- /dev/null +++ b/migration/i3.1/oracle/201602032036_IDEMPIERE-3004.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3004 View Column - View Component require SeqNo +-- Feb 3, 2016 8:35:41 PM CET +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2016-02-03 20:35:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210567 +; + +SELECT register_migration_script('201602032036_IDEMPIERE-3004.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201602032036_IDEMPIERE-3004.sql b/migration/i3.1/postgresql/201602032036_IDEMPIERE-3004.sql new file mode 100644 index 0000000000..899fa6824c --- /dev/null +++ b/migration/i3.1/postgresql/201602032036_IDEMPIERE-3004.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-3004 View Column - View Component require SeqNo +-- Feb 3, 2016 8:35:41 PM CET +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2016-02-03 20:35:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210567 +; + +SELECT register_migration_script('201602032036_IDEMPIERE-3004.sql') FROM dual +; + From 8d7cd2bed3814459919a1c25a4c7c49aeaae068c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 6 Feb 2016 16:31:04 +0100 Subject: [PATCH 26/34] IDEMPIERE-3017 CSV Importer leaving open trx (DB locks) / fix error reported by Andrea Belloto https://groups.google.com/d/msg/idempiere/6L0B7H2pDvo/FHVRirSTGQAJ --- .../adempiere/impexp/GridTabCSVImporter.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 81d0f909a3..e6904bddf8 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.nio.charset.Charset; +import java.sql.SQLException; import java.sql.Timestamp; import java.text.DecimalFormatSymbols; import java.text.SimpleDateFormat; @@ -315,10 +316,16 @@ public class GridTabCSVImporter implements IGridTabImporter /** * Commit the trx and writes in the file */ - private void commitTrx(){ - trx.commit(); + private String commitTrx(){ + try { + trx.commit(true); + } catch (SQLException e) { + setError(true); + return e.getLocalizedMessage(); + } for( String row : rowsTmpResult ) logFileW.write(row); + return null; } /** @@ -533,6 +540,7 @@ public class GridTabCSVImporter implements IGridTabImporter setError(false); }else { + boolean commit = false; if( isThereDocAction ){ boolean isError = false; @@ -553,11 +561,19 @@ public class GridTabCSVImporter implements IGridTabImporter gridTab.dataDelete(); rollbackTrx(); }else{ - commitTrx(); + commit = true; } }else{ - commitTrx(); - } + commit = true; + } + if (commit) { + String commitResult = commitTrx(); + if (isError()) { + rowsTmpResult.set(0,rowsTmpResult.get(0).replace(quoteChar + "\n",commitResult + quoteChar + "\n")); + gridTab.dataDelete(); + rollbackTrx(); + } + } } trx.close(); From 9e585c01805939fead908a075dfb1ca102e2b186 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Feb 2016 15:03:36 +0100 Subject: [PATCH 27/34] IDEMPIERE-3027 'Closed' projects are still selectable in drop downs - integrate patch from Antoni Ten --- migration/i3.1/oracle/201602171450_IDEMPIERE-3027.sql | 11 +++++++++++ .../i3.1/postgresql/201602171450_IDEMPIERE-3027.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i3.1/oracle/201602171450_IDEMPIERE-3027.sql create mode 100644 migration/i3.1/postgresql/201602171450_IDEMPIERE-3027.sql diff --git a/migration/i3.1/oracle/201602171450_IDEMPIERE-3027.sql b/migration/i3.1/oracle/201602171450_IDEMPIERE-3027.sql new file mode 100644 index 0000000000..96fa4a2364 --- /dev/null +++ b/migration/i3.1/oracle/201602171450_IDEMPIERE-3027.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3027 'Closed' projects are still selectable in drop downs +-- Feb 4, 2016 2:27:17 PM UTC +UPDATE AD_Val_Rule SET Code='C_Project.Processed=''N'' AND C_Project.IsSummary=''N'' AND (C_Project.C_BPartner_ID IS NULL OR C_Project.C_BPartner_ID=@C_BPartner_ID@ OR C_Project.C_BPartnerSR_ID=@C_BPartner_ID@)',Updated=TO_DATE('2016-02-04 14:27:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=227 +; + +SELECT register_migration_script('201602171450_IDEMPIERE-3027.sql') FROM dual +; + diff --git a/migration/i3.1/postgresql/201602171450_IDEMPIERE-3027.sql b/migration/i3.1/postgresql/201602171450_IDEMPIERE-3027.sql new file mode 100644 index 0000000000..803a81cdd8 --- /dev/null +++ b/migration/i3.1/postgresql/201602171450_IDEMPIERE-3027.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-3027 'Closed' projects are still selectable in drop downs +-- Feb 4, 2016 2:27:17 PM UTC +UPDATE AD_Val_Rule SET Code='C_Project.Processed=''N'' AND C_Project.IsSummary=''N'' AND (C_Project.C_BPartner_ID IS NULL OR C_Project.C_BPartner_ID=@C_BPartner_ID@ OR C_Project.C_BPartnerSR_ID=@C_BPartner_ID@)',Updated=TO_TIMESTAMP('2016-02-04 14:27:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=227 +; + +SELECT register_migration_script('201602171450_IDEMPIERE-3027.sql') FROM dual +; + From f2e89799360e0be1d25dda8f03a5dd0a71920cd2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Feb 2016 15:32:45 +0100 Subject: [PATCH 28/34] IDEMPIERE-3024 solve force change on login for System --- org.adempiere.base/src/org/compiere/model/MUser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java index 237b924dfa..99e5541b32 100644 --- a/org.adempiere.base/src/org/compiere/model/MUser.java +++ b/org.adempiere.base/src/org/compiere/model/MUser.java @@ -988,7 +988,7 @@ public class MUser extends X_AD_User rs = pstmt.executeQuery (); if (rs.next()) { - retValue = new MUser (ctx, rs.getInt(1), null); + retValue = MUser.get(ctx, rs.getInt(1)); if (rs.next()) s_log.warning ("More then one user with Name/Password = " + name); } From 460e8b9e782e590a75041d1d26e565de1633dd56 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Wed, 17 Feb 2016 15:37:28 +0100 Subject: [PATCH 29/34] IDEMPIERE-3020 Custom Libero setting need to be out of core model --- org.adempiere.base/src/org/compiere/wf/MWFNode.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNode.java b/org.adempiere.base/src/org/compiere/wf/MWFNode.java index 241b511109..d0745c41a7 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFNode.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFNode.java @@ -559,13 +559,7 @@ public class MWFNode extends X_AD_WF_Node */ @Override protected boolean beforeSave (boolean newRecord) - { - if(MWorkflow.WORKFLOWTYPE_Manufacturing.equals(getAD_Workflow().getWorkflowType())) - { - setAction(MWFNode.ACTION_WaitSleep); - return true; - } - + { String action = getAction(); if (action.equals(ACTION_WaitSleep)) ; From 62fa6b90efc77ad0b6137dd774390fbec8ea9f0f Mon Sep 17 00:00:00 2001 From: hieplq Date: Sat, 13 Feb 2016 22:38:24 +0700 Subject: [PATCH 30/34] IDEMPIERE-2745:2Pack is not creating foreign keys --- org.adempiere.base/src/org/compiere/model/MColumn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index aa89649459..9b90e4dd40 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -843,7 +843,7 @@ public class MColumn extends X_AD_Column { StringBuilder fkConstraintSql = new StringBuilder(); - if (!column.isKey() && !column.getColumnName().equals(PO.getUUIDColumnName(table.getTableName()))) + if (!column.isKey() && !column.getColumnName().equals(PO.getUUIDColumnName(table.getTableName())) && !column.isVirtualColumn()) { int refid = column.getAD_Reference_ID(); if (refid != DisplayType.List && refid != DisplayType.Payment) From fdc607bb7836c06cec3925a7ee2a6e702f9dcc8c Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 10 Jan 2016 10:52:54 +0700 Subject: [PATCH 31/34] IDEMPIERE-1756:some case recent item don't work case same user but use difference role --- .../src/org/adempiere/webui/dashboard/DPRecentItems.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java index 764fe0f1c7..80a2040721 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java @@ -230,6 +230,9 @@ public class DPRecentItems extends DashboardPanel implements EventListener 0 && MRole.getDefault().getWindowAccess(ri.getAD_Window_ID()) == null) continue; + if (ri.getAD_Window_ID() > 0 && !MRole.getDefault().isRecordAccess(ri.getAD_Table_ID(), ri.getRecord_ID(), false)) + continue; + String label = ri.getLabel(); if (label == null) continue; From 80e519c76013f0887b16200e5177120164889ef5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Feb 2016 16:20:28 +0100 Subject: [PATCH 32/34] IDEMPIERE-1756 include also read-only records --- .../src/org/adempiere/webui/dashboard/DPRecentItems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java index 80a2040721..3767892cf6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java @@ -230,7 +230,7 @@ public class DPRecentItems extends DashboardPanel implements EventListener 0 && MRole.getDefault().getWindowAccess(ri.getAD_Window_ID()) == null) continue; - if (ri.getAD_Window_ID() > 0 && !MRole.getDefault().isRecordAccess(ri.getAD_Table_ID(), ri.getRecord_ID(), false)) + if (ri.getAD_Window_ID() > 0 && !MRole.getDefault().isRecordAccess(ri.getAD_Table_ID(), ri.getRecord_ID(), true)) continue; String label = ri.getLabel(); From 61ae46fb381deaf9e417507b89551ad5ff826fa5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Feb 2016 17:11:24 +0100 Subject: [PATCH 33/34] IDEMPIERE-3032 Save clicking on detail button --- .../src/org/adempiere/webui/adwindow/CompositeADTabbox.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java index bdf8bd386c..fccf1fea02 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java @@ -93,7 +93,7 @@ public class CompositeADTabbox extends AbstractADTabbox @Override public void onEvent(Event event) throws Exception { if (DetailPane.ON_EDIT_EVENT.equals(event.getName())) { - if (headerTab.getGridTab().isNew()) return; + if (headerTab.getGridTab().isNew() && ! headerTab.needSave(true, false)) return; final int row = getSelectedDetailADTabpanel() != null ? getSelectedDetailADTabpanel().getGridTab().getCurrentRow() @@ -227,6 +227,7 @@ public class CompositeADTabbox extends AbstractADTabbox IADTabpanel selectedPanel = getSelectedDetailADTabpanel(); if (selectedPanel == null) return; int newIndex = selectedPanel.getTabNo(); + selectedPanel.query(); Executions.getCurrent().setAttribute(AD_TABBOX_ON_EDIT_DETAIL_ATTRIBUTE, selectedPanel); Event selectionChanged = new Event(ON_SELECTION_CHANGED_EVENT, layout, new Object[]{oldIndex, newIndex}); From f33db5b1ee751e61cc7af90ed40e353a7abf45fc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Feb 2016 22:15:09 +0100 Subject: [PATCH 34/34] IDEMPIERE-2944 Preserve iDempiere session between sucessive webservice calls --- .../adinterface/CompiereService.java | 133 +++++++++++++++++- .../webservices/AbstractService.java | 17 ++- 2 files changed, 142 insertions(+), 8 deletions(-) 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 148efc89e4..d063d53945 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 @@ -16,9 +16,13 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import java.util.logging.Level; +import javax.servlet.http.HttpServletRequest; + import org.adempiere.util.ServerContext; import org.compiere.model.MSession; import org.compiere.model.MUser; @@ -29,6 +33,7 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Language; import org.compiere.util.Login; +import org.idempiere.adInterface.x10.ADLoginRequest; /** * @author deepak @@ -46,6 +51,12 @@ public class CompiereService { private int m_M_Warehouse_ID; private String m_locale; private String m_userName; + private String m_password; + private int m_expiryMinutes; + private long m_lastAuthorizationTime; + private String m_IPAddress; + private static Map csMap = new HashMap(); + private static Map ctxMap = new HashMap(); private boolean m_loggedin = false; @@ -68,7 +79,7 @@ public class CompiereService { public final String dateFormatOnlyForCtx = "yyyy-MM-dd"; private boolean m_connected; - + /** * * @return AD_Client_ID of current request @@ -131,12 +142,23 @@ public class CompiereService { */ public void disconnect() { - if (m_connected) - { - Env.logout(); - ServerContext.dispose(); - m_loggedin = false; - m_connected = false; + // TODO: create a thread that checks expired connected compiereservices and log them out + if (! isExpired()) { + // do not close, save session in cache + if (! csMap.containsValue(this)) { + String key = getKey(m_AD_Client_ID, + m_AD_Org_ID, + m_userName, + m_AD_Role_ID, + m_M_Warehouse_ID, + m_locale, + m_password, + m_IPAddress); + csMap.put(key.toString(), this); + Properties savedCache = new Properties(); + savedCache.putAll(Env.getCtx()); + ctxMap.put(key.toString(), savedCache); + } } } @@ -328,4 +350,101 @@ public class CompiereService { return m_userName; } + /** + * @return set password + */ + public void setPassword(String pass) { + m_password = pass; + } + + /** + * @return logged in password of current request + */ + public String getPassword() { + return m_password; + } + + /** + * @return set expiry minutes + */ + public void setExpiryMinutes(int expiryMinutes) { + m_expiryMinutes = expiryMinutes; + } + + /** + * @return logged in expiry minutes of current request + */ + public int getExpiryMinutes() { + return m_expiryMinutes; + } + + public void refreshLastAuthorizationTime() { + m_lastAuthorizationTime = System.currentTimeMillis(); + } + + public void setIPAddress(String remoteAddr) { + m_IPAddress = remoteAddr; + } + + public static CompiereService get(HttpServletRequest req, ADLoginRequest loginRequest) { + String key = getKey(loginRequest.getClientID(), + loginRequest.getOrgID(), + loginRequest.getUser(), + loginRequest.getRoleID(), + loginRequest.getWarehouseID(), + loginRequest.getLang(), + loginRequest.getPass(), + req.getRemoteAddr()); + CompiereService l_cs = null; + if (csMap.containsKey(key)) { + l_cs = csMap.get(key); + if (l_cs != null) { + if (l_cs.isExpired()) { + l_cs = null; + } else { + Properties cachedCtx = ctxMap.get(key); + Env.getCtx().putAll(cachedCtx); + } + } + } + return l_cs; + } + + private static String getKey( + int aD_Client_ID, + int aD_Org_ID, + String userName, + int aD_Role_ID, + int m_Warehouse_ID, + String locale, + String password, + String iPAddress) { + StringBuilder key = new StringBuilder() + .append(aD_Client_ID).append("|") + .append(aD_Org_ID).append("|") + .append(userName).append("|") + .append(aD_Role_ID).append("|") + .append(m_Warehouse_ID).append("|") + .append(locale).append("|") + .append(password).append("|") + .append(iPAddress); + return key.toString(); + } + + private boolean isExpired() { + boolean expired = + ( + (getExpiryMinutes() <= 0) + || (m_lastAuthorizationTime + (getExpiryMinutes() * 60000) <= System.currentTimeMillis()) + ); + if (m_connected && expired) + { + Env.logout(); + ServerContext.dispose(); + m_loggedin = false; + m_connected = false; + } + return expired; + } + } diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java index 413c04dcce..48685917e1 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java @@ -85,6 +85,16 @@ public class AbstractService { protected String login(ADLoginRequest loginRequest, String webService, String method, String serviceType) { CompiereService m_cs = getCompiereService(); + if (m_cs.getUserName() == null) { + HttpServletRequest req = getHttpServletRequest(); + // search for a non-expired CompiereService with same login data + CompiereService cachedCs = CompiereService.get(req, loginRequest); + if (cachedCs != null) { + m_cs = cachedCs; + req.setAttribute(COMPIERE_SERVICE, cachedCs); + return authenticate(webService, method, serviceType, cachedCs); // already logged with same data + } + } if (m_cs.isLoggedIn() && m_cs.getAD_Client_ID() == loginRequest.getClientID() && loginRequest.getClientID() == Env.getAD_Client_ID(Env.getCtx()) && m_cs.getAD_Org_ID() == loginRequest.getOrgID() && m_cs.getAD_Role_ID() == loginRequest.getRoleID() @@ -99,6 +109,9 @@ public class AbstractService { KeyNamePair[] clients = login.getClients(loginRequest.getUser(), loginRequest.getPass()); if (clients == null) return "Error login - User invalid"; + m_cs.setPassword(loginRequest.getPass()); + m_cs.setExpiryMinutes(loginRequest.getStage()); + m_cs.setIPAddress(getHttpServletRequest().getRemoteAddr()); boolean okclient = false; KeyNamePair selectedClient = null; @@ -248,7 +261,9 @@ public class AbstractService { String ret=invokeLoginValidator(null, m_cs.getCtx(), m_webservicetype, IWSValidator.TIMING_ON_AUTHORIZATION); if(ret!=null && ret.length()>0) return ret; - + + m_cs.refreshLastAuthorizationTime(); + return null; }