hg merge release-2.0 (merge release2 into development)

This commit is contained in:
Carlos Ruiz 2013-12-17 12:06:55 -05:00
commit 6d261a199b
10 changed files with 244 additions and 11 deletions

View File

@ -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='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
;

View File

@ -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
;

View File

@ -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='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
;

View File

@ -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
;

View File

@ -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

View File

@ -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());

View File

@ -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, "");
@ -3847,4 +3867,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;
}
}

View File

@ -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

View File

@ -108,6 +108,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.Menuitem;
import org.zkoss.zul.Menupopup;
import org.zkoss.zul.Window.Mode;
@ -1668,9 +1669,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()
*/

View File

@ -304,8 +304,18 @@ public class WLocatorDialog extends Window implements EventListener<Event>
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++)
{