From b9ea0e6c85d078d94c2113eff9e6dfda5caac690 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 16 Dec 2013 14:43:55 +0800 Subject: [PATCH 1/7] 1003579 Improve check for BOM child records with zero quantity. --- migration/i2.0/oracle/201312131400_Ticket_1003579.sql | 8 ++++++++ migration/i2.0/postgresql/201312131400_Ticket_1003579.sql | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 migration/i2.0/oracle/201312131400_Ticket_1003579.sql create mode 100644 migration/i2.0/postgresql/201312131400_Ticket_1003579.sql diff --git a/migration/i2.0/oracle/201312131400_Ticket_1003579.sql b/migration/i2.0/oracle/201312131400_Ticket_1003579.sql new file mode 100644 index 0000000000..788ec2737c --- /dev/null +++ b/migration/i2.0/oracle/201312131400_Ticket_1003579.sql @@ -0,0 +1,8 @@ +-- Dec 13, 2013 1:43:47 PM COT +-- Ticket: 1003579 - Improve check for BOM child records with zero quantity +UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-12-13 13:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723 +; + +SELECT register_migration_script('201312131400_Ticket_1003579.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql b/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql new file mode 100644 index 0000000000..6f2dbca319 --- /dev/null +++ b/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql @@ -0,0 +1,7 @@ +-- Dec 13, 2013 1:43:47 PM COT +-- Ticket: 1003579 - Improve check for BOM child records with zero quantity +UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-12-13 13:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723 +; + +SELECT register_migration_script('201312131400_Ticket_1003579.sql') FROM dual +; \ No newline at end of file From c7e8bd965d5b9b57efd51118ec80b79b7b54d898 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 16 Dec 2013 15:45:07 -0500 Subject: [PATCH 2/7] 1003579 Improve check for BOM child records with zero quantity. / peer review --- migration/i2.0/oracle/201312131400_Ticket_1003579.sql | 2 +- migration/i2.0/postgresql/201312131400_Ticket_1003579.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/i2.0/oracle/201312131400_Ticket_1003579.sql b/migration/i2.0/oracle/201312131400_Ticket_1003579.sql index 788ec2737c..d6f1bdea41 100644 --- a/migration/i2.0/oracle/201312131400_Ticket_1003579.sql +++ b/migration/i2.0/oracle/201312131400_Ticket_1003579.sql @@ -1,6 +1,6 @@ -- Dec 13, 2013 1:43:47 PM COT -- Ticket: 1003579 - Improve check for BOM child records with zero quantity -UPDATE AD_Column SET ValueMin='1',Updated=TO_DATE('2013-12-13 13:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723 +UPDATE AD_Column SET ValueMin='0.0000000001',Updated=TO_DATE('2013-12-13 13:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723 ; SELECT register_migration_script('201312131400_Ticket_1003579.sql') FROM dual diff --git a/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql b/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql index 6f2dbca319..355ae58887 100644 --- a/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql +++ b/migration/i2.0/postgresql/201312131400_Ticket_1003579.sql @@ -1,7 +1,7 @@ -- Dec 13, 2013 1:43:47 PM COT -- Ticket: 1003579 - Improve check for BOM child records with zero quantity -UPDATE AD_Column SET ValueMin='1',Updated=TO_TIMESTAMP('2013-12-13 13:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723 +UPDATE AD_Column SET ValueMin='0.0000000001',Updated=TO_TIMESTAMP('2013-12-13 13:43:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723 ; SELECT register_migration_script('201312131400_Ticket_1003579.sql') FROM dual -; \ No newline at end of file +; From b58546521f85a2adb5be029eb27d7318bff2eeeb Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 17 Dec 2013 10:44:06 +0800 Subject: [PATCH 3/7] 1003572 Problem with Locator field on "Import Inventory" process. Fixed wrong checking for "first locator element is empty". --- .../org/adempiere/webui/window/WLocatorDialog.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java index b7db1d0f50..e2a5ea540f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocatorDialog.java @@ -304,8 +304,18 @@ public class WLocatorDialog extends Window implements EventListener if (log.isLoggable(Level.FINE)) log.fine(m_mLocator.toString()); - if (m_mLocator.getSize()==0 || (m_mLocator.getSize()==1 && m_mLocator.get(m_mLocator.getElementAt(0))==null)) - throw new AdempiereUserError(Msg.getMsg(Env.getCtx(), "DRP-001", false)); + if (m_mLocator.getSize()==0) + { + throw new AdempiereUserError(Msg.getMsg(Env.getCtx(), "DRP-001", false)); + } + else if (m_mLocator.getSize()==1) + { + MLocator locator = (MLocator) m_mLocator.getElementAt(0); + if (locator == null || locator.getM_Locator_ID() <= 0) + { + throw new AdempiereUserError(Msg.getMsg(Env.getCtx(), "DRP-001", false)); + } + } for (int i = 0; i < m_mLocator.getSize(); i++) { From 0e6d317e2b847c29fb6439c76e1246ee62d2f047 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 17 Dec 2013 18:04:50 +0800 Subject: [PATCH 4/7] 1003581 IDEMPIERE-1584 -- Custom sort order is lost when updating a record. --- .../src/org/compiere/model/GridTable.java | 38 ++++++++++++++++--- .../adwindow/AbstractADWindowContent.java | 32 ++++++++++++++++ 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index bec1206e6f..2cbe2efa1b 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -101,7 +101,7 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = -2181155164268688340L; + private static final long serialVersionUID = 4223765688790104180L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; @@ -232,6 +232,10 @@ public class GridTable extends AbstractTableModel private final static Integer NEW_ROW_ID = Integer.valueOf(-1); private static final int DEFAULT_FETCH_SIZE = 200; + /** Keep track of last sorted column index and sort direction */ + private int m_lastSortColumnIndex = -1; + private boolean m_lastSortedAscending = true; + /** * Set Table Name * @param newTableName table name @@ -890,6 +894,13 @@ public class GridTable extends AbstractTableModel } if (getRowCount() == 0) return; + + boolean isSameSortEntries = (col == m_lastSortColumnIndex && ascending == m_lastSortedAscending); + if (!isSameSortEntries) + { + m_lastSortColumnIndex = col; + m_lastSortedAscending = ascending; + } //cache changed row Object[] changedRow = m_rowChanged >= 0 ? getDataAtRow(m_rowChanged) : null; @@ -948,10 +959,14 @@ public class GridTable extends AbstractTableModel m_sort.get(i).data = null; } } - // update UI - fireTableDataChanged(); - // Info detected by MTab.dataStatusChanged and current row set to 0 - fireDataStatusIEvent("Sorted", "#" + m_sort.size()); + + if (!isSameSortEntries) + { + // update UI + fireTableDataChanged(); + // Info detected by MTab.dataStatusChanged and current row set to 0 + fireDataStatusIEvent("Sorted", "#" + m_sort.size()); + } } // sort /** @@ -2919,6 +2934,11 @@ public class GridTable extends AbstractTableModel m_changed = false; m_rowChanged = -1; m_inserting = false; + if (m_lastSortColumnIndex >= 0) + { + loadComplete(); + sort(m_lastSortColumnIndex, m_lastSortedAscending); + } fireTableDataChanged(); if (fireStatusEvent) fireDataStatusIEvent(DATA_REFRESH_MESSAGE, ""); @@ -3842,4 +3862,12 @@ public class GridTable extends AbstractTableModel public String get_TrxName() { return m_trxName; } + + /** + * reset the cache sort state ( sort column and sort ascending ) + */ + public void resetCacheSortState() { + m_lastSortColumnIndex = -1; + m_lastSortedAscending = true; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index e95ed650cb..60c8b05694 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -115,6 +115,7 @@ import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Column; import org.zkoss.zul.Columns; import org.zkoss.zul.Div; +import org.zkoss.zul.Grid; import org.zkoss.zul.Hbox; import org.zkoss.zul.Listitem; import org.zkoss.zul.Menuitem; @@ -1656,9 +1657,40 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements */ public void onRefresh() { + GridTab gridTab = adTabbox.getSelectedGridTab(); + if (gridTab != null && gridTab.getTableModel() != null) + { + gridTab.getTableModel().resetCacheSortState(); + } + Column sortColumn = findCurrentSortColumn(); onRefresh(true, false); + if (sortColumn != null) + { + sortColumn.setSortDirection("natural"); + } } + private Column findCurrentSortColumn() { + IADTabpanel iadtabpanel = getADTab().getSelectedTabpanel(); + if (iadtabpanel instanceof ADTabpanel) { + ADTabpanel adtabpanel = (ADTabpanel) iadtabpanel; + Grid grid = adtabpanel.getGridView().getListbox(); + Columns columns = grid.getColumns(); + List list = columns.getChildren(); + for(int i = 0; i < list.size(); i++) + { + Component c = (Component) list.get(i); + if (c instanceof Column) { + Column column = (Column) c; + if (!"natural".equals(column.getSortDirection())) { + return column; + } + } + } + } + return null; + } + /** * @see ToolbarListener#onHelp() */ From 9c9a42c4c6b4e1b6be8cfbce88bb225d9532b1ba Mon Sep 17 00:00:00 2001 From: Thomas Bayen Date: Tue, 17 Dec 2013 10:48:52 -0500 Subject: [PATCH 5/7] IDEMPIERE-1636 ImportBankStatement process uses wrong order in sql --- .../src/org/compiere/process/ImportBankStatement.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportBankStatement.java b/org.adempiere.base.process/src/org/compiere/process/ImportBankStatement.java index a160cd5488..64c0aa482d 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportBankStatement.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportBankStatement.java @@ -364,7 +364,7 @@ public class ImportBankStatement extends SvrProcess //Import Bank Statement sql = new StringBuilder("SELECT * FROM I_BankStatement") .append(" WHERE I_IsImported='N'") - .append(" ORDER BY C_BankAccount_ID, Name, EftStatementDate, EftStatementReference"); + .append(" ORDER BY C_BankAccount_ID, Name, StatementDate, ReferenceNo"); MBankStatement statement = null; MBankAccount account = null; @@ -448,7 +448,7 @@ public class ImportBankStatement extends SvrProcess statement.setDescription(imp.getDescription()); statement.setEftStatementReference(imp.getEftStatementReference()); statement.setEftStatementDate(imp.getEftStatementDate()); - if (statement.save()) + if (statement.save(get_TrxName())) { noInsert++; } @@ -496,7 +496,7 @@ public class ImportBankStatement extends SvrProcess line.setEftAmt(imp.getEftAmt()); // Save statement line - if (line.save()) + if (line.save(get_TrxName())) { imp.setC_BankStatement_ID(statement.getC_BankStatement_ID()); imp.setC_BankStatementLine_ID(line.getC_BankStatementLine_ID()); From 498a858f3a08896a8a50561ba1979105bf524a0e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 17 Dec 2013 11:13:22 -0500 Subject: [PATCH 6/7] IDEMPIERE-1603 Copy Info Window Columns from other Info Window's / thanks to Hagiwara Hideaki --- .../oracle/201312171107_IDEMPIERE-1603.sql | 19 +++ .../201312171107_IDEMPIERE-1603.sql | 16 +++ .../process/CopyInfoWindowColumns.java | 111 ++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 migration/i2.0/oracle/201312171107_IDEMPIERE-1603.sql create mode 100644 migration/i2.0/postgresql/201312171107_IDEMPIERE-1603.sql create mode 100644 org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java diff --git a/migration/i2.0/oracle/201312171107_IDEMPIERE-1603.sql b/migration/i2.0/oracle/201312171107_IDEMPIERE-1603.sql new file mode 100644 index 0000000000..d9784233aa --- /dev/null +++ b/migration/i2.0/oracle/201312171107_IDEMPIERE-1603.sql @@ -0,0 +1,19 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Dec 17, 2013 11:04:16 AM COT +-- IDEMPIERE-1603 Copy Info Window Columns from other Info Window's +INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,Name,AD_Org_ID,Updated,UpdatedBy,Created,IsActive,CreatedBy,Classname,Value,AD_Client_ID) VALUES ('N',200067,'N','N','32fe7794-53ce-442d-bb40-a132ebcdff7e','4','N','N',0,0,'Y','D','Copy Info Window Columns',0,TO_DATE('2013-12-17 11:04:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-12-17 11:04:16','YYYY-MM-DD HH24:MI:SS'),'Y',100,'org.compiere.process.CopyInfoWindowColumns','CopyInfoWindowColumns',0) +; + +-- Dec 17, 2013 11:05:01 AM COT +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID) VALUES ('N',200073,'989f60c7-012b-4f13-9a15-6118d75a4854','The Info window is used to search and select records as well as display information relevant to the selection.',200067,19,'Y','D','Info Window','AD_InfoWindow_ID','Info and search/select Window',10,'Y',10,'Y',100,TO_DATE('2013-12-17 11:05:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-12-17 11:05:01','YYYY-MM-DD HH24:MI:SS'),0,'N',0,3068) +; + +-- Dec 17, 2013 11:06:48 AM COT +INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,AD_Process_ID,SeqNo,Name,ComponentName,IsCustomization,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,IsActive,AD_Client_ID,AD_ToolBarButton_UU) VALUES ('W',842,200067,10,'Copy Info Window Columns','CopyInfoWindowColumns','N',0,TO_DATE('2013-12-17 11:06:48','YYYY-MM-DD HH24:MI:SS'),100,200079,TO_DATE('2013-12-17 11:06:48','YYYY-MM-DD HH24:MI:SS'),100,'Y',0,'c4845d6f-abf8-4419-b7e6-adaec70cebe2') +; + +SELECT register_migration_script('201312171107_IDEMPIERE-1603.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201312171107_IDEMPIERE-1603.sql b/migration/i2.0/postgresql/201312171107_IDEMPIERE-1603.sql new file mode 100644 index 0000000000..200b45eeef --- /dev/null +++ b/migration/i2.0/postgresql/201312171107_IDEMPIERE-1603.sql @@ -0,0 +1,16 @@ +-- Dec 17, 2013 11:04:16 AM COT +-- IDEMPIERE-1603 Copy Info Window Columns from other Info Window's +INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,Name,AD_Org_ID,Updated,UpdatedBy,Created,IsActive,CreatedBy,Classname,Value,AD_Client_ID) VALUES ('N',200067,'N','N','32fe7794-53ce-442d-bb40-a132ebcdff7e','4','N','N',0,0,'Y','D','Copy Info Window Columns',0,TO_TIMESTAMP('2013-12-17 11:04:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-12-17 11:04:16','YYYY-MM-DD HH24:MI:SS'),'Y',100,'org.compiere.process.CopyInfoWindowColumns','CopyInfoWindowColumns',0) +; + +-- Dec 17, 2013 11:05:01 AM COT +INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID) VALUES ('N',200073,'989f60c7-012b-4f13-9a15-6118d75a4854','The Info window is used to search and select records as well as display information relevant to the selection.',200067,19,'Y','D','Info Window','AD_InfoWindow_ID','Info and search/select Window',10,'Y',10,'Y',100,TO_TIMESTAMP('2013-12-17 11:05:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-12-17 11:05:01','YYYY-MM-DD HH24:MI:SS'),0,'N',0,3068) +; + +-- Dec 17, 2013 11:06:48 AM COT +INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,AD_Process_ID,SeqNo,Name,ComponentName,IsCustomization,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,IsActive,AD_Client_ID,AD_ToolBarButton_UU) VALUES ('W',842,200067,10,'Copy Info Window Columns','CopyInfoWindowColumns','N',0,TO_TIMESTAMP('2013-12-17 11:06:48','YYYY-MM-DD HH24:MI:SS'),100,200079,TO_TIMESTAMP('2013-12-17 11:06:48','YYYY-MM-DD HH24:MI:SS'),100,'Y',0,'c4845d6f-abf8-4419-b7e6-adaec70cebe2') +; + +SELECT register_migration_script('201312171107_IDEMPIERE-1603.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java b/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java new file mode 100644 index 0000000000..c1242cc8af --- /dev/null +++ b/org.adempiere.base.process/src/org/compiere/process/CopyInfoWindowColumns.java @@ -0,0 +1,111 @@ +/********************************************************************** +* 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: * +* - Hideaki Hagiwara * +**********************************************************************/ + +package org.compiere.process; + +import java.util.logging.Level; + +import org.compiere.model.MInfoColumn; +import org.compiere.model.MInfoWindow; +import org.compiere.model.PO; +import org.compiere.util.AdempiereSystemError; + +/** + * Copy Info Window Columns from other Info Window + * + * @author Hideaki Hagiwara + * @version $Id: CopyInfoWindowColumns v 1.0 2013/12/4 + */ +public class CopyInfoWindowColumns extends SvrProcess +{ + /** Target Info Window */ + private int p_target_AD_InfoWindow_ID = 0; + /** Source Info Window */ + private int p_source_AD_InfoWindow_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_InfoWindow_ID")) + p_source_AD_InfoWindow_ID = para[i].getParameterAsInt(); + else + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + p_target_AD_InfoWindow_ID = getRecord_ID(); + } // prepare + + /** + * Process + * @return info + * @throws Exception + */ + protected String doIt () throws Exception + { + if (p_target_AD_InfoWindow_ID == 0) + throw new AdempiereSystemError("@NotFound@ @AD_InfoWindow_ID@ " + p_target_AD_InfoWindow_ID); + if (p_source_AD_InfoWindow_ID == 0) + throw new AdempiereSystemError("@NotFound@ @AD_InfoWindow_ID@ " + p_source_AD_InfoWindow_ID); + if (log.isLoggable(Level.INFO)) log.info("Source AD_InfoWindow_ID=" + p_source_AD_InfoWindow_ID + + ", Target AD_InfoWindow_ID=" + p_target_AD_InfoWindow_ID); + + MInfoWindow targetInfoWindow = new MInfoWindow(getCtx(), p_target_AD_InfoWindow_ID, get_TrxName()); + MInfoColumn[] targetColumns = targetInfoWindow.getInfoColumns(); + if (targetColumns.length > 0) //Target Info Window must not have columns + throw new AdempiereSystemError("Target info window must not have columns"); + + MInfoWindow sourceInfoWindow = new MInfoWindow(getCtx(), p_source_AD_InfoWindow_ID, get_TrxName()); + MInfoColumn[] sourceColumns = sourceInfoWindow.getInfoColumns(); + + for (int i = 0; i < sourceColumns.length; i++) + { + MInfoColumn colTarget = new MInfoColumn(getCtx(),0, get_TrxName()); + PO.copyValues(sourceColumns[i], colTarget); + colTarget.setAD_InfoWindow_ID (targetInfoWindow.getAD_InfoWindow_ID()); + colTarget.setAD_Org_ID(targetInfoWindow.getAD_Org_ID()); + colTarget.setEntityType(targetInfoWindow.getEntityType()); + colTarget.setIsActive(sourceColumns[i].isActive()); + colTarget.saveEx(get_TrxName()); + + m_count++; + } + + // + return "#" + m_count; + } // doIt + + +} // CopyInfoWindowColumns From 6ed966a30774e08c5fc7b9e8cac9a224e1431643 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 17 Dec 2013 11:47:12 -0500 Subject: [PATCH 7/7] IDEMPIERE-1532 Reversed Allocation document has wrong TrxDate / based on patch from Thomas Bayen (tbayen) --- org.adempiere.base/src/org/compiere/model/MPayment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 9ddbe060b3..96447ccfb5 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -2200,6 +2200,7 @@ public final class MPayment extends X_C_Payment Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo(), get_TrxName()); alloc.setAD_Org_ID(getAD_Org_ID()); + alloc.setDateAcct(getDateAcct()); // in case date acct is different from datetrx in payment; IDEMPIERE-1532 tbayen if (!alloc.save()) { log.severe("P.Allocations not created"); @@ -2628,10 +2629,11 @@ public final class MPayment extends X_C_Payment // Create automatic Allocation MAllocationHdr alloc = new MAllocationHdr (getCtx(), false, - ( accrual ? dateAcct : getDateTrx() ), + getDateTrx(), getC_Currency_ID(), Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName()); alloc.setAD_Org_ID(getAD_Org_ID()); + alloc.setDateAcct(dateAcct); // dateAcct variable already take into account the accrual parameter alloc.saveEx(get_TrxName()); // Original Allocation