hg merge release-1.0c (merge release1 into release2)

This commit is contained in:
Carlos Ruiz 2013-12-17 12:05:23 -05:00
commit 053bf7e8f4
7 changed files with 98 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,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

@ -364,7 +364,7 @@ public class ImportBankStatement extends SvrProcess
//Import Bank Statement //Import Bank Statement
sql = new StringBuilder("SELECT * FROM I_BankStatement") sql = new StringBuilder("SELECT * FROM I_BankStatement")
.append(" WHERE I_IsImported='N'") .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; MBankStatement statement = null;
MBankAccount account = null; MBankAccount account = null;
@ -448,7 +448,7 @@ public class ImportBankStatement extends SvrProcess
statement.setDescription(imp.getDescription()); statement.setDescription(imp.getDescription());
statement.setEftStatementReference(imp.getEftStatementReference()); statement.setEftStatementReference(imp.getEftStatementReference());
statement.setEftStatementDate(imp.getEftStatementDate()); statement.setEftStatementDate(imp.getEftStatementDate());
if (statement.save()) if (statement.save(get_TrxName()))
{ {
noInsert++; noInsert++;
} }
@ -496,7 +496,7 @@ public class ImportBankStatement extends SvrProcess
line.setEftAmt(imp.getEftAmt()); line.setEftAmt(imp.getEftAmt());
// Save statement line // Save statement line
if (line.save()) if (line.save(get_TrxName()))
{ {
imp.setC_BankStatement_ID(statement.getC_BankStatement_ID()); imp.setC_BankStatement_ID(statement.getC_BankStatement_ID());
imp.setC_BankStatementLine_ID(line.getC_BankStatementLine_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"; 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 final static Integer NEW_ROW_ID = Integer.valueOf(-1);
private static final int DEFAULT_FETCH_SIZE = 200; 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 * Set Table Name
* @param newTableName table name * @param newTableName table name
@ -890,6 +894,13 @@ public class GridTable extends AbstractTableModel
} }
if (getRowCount() == 0) if (getRowCount() == 0)
return; return;
boolean isSameSortEntries = (col == m_lastSortColumnIndex && ascending == m_lastSortedAscending);
if (!isSameSortEntries)
{
m_lastSortColumnIndex = col;
m_lastSortedAscending = ascending;
}
//cache changed row //cache changed row
Object[] changedRow = m_rowChanged >= 0 ? getDataAtRow(m_rowChanged) : null; Object[] changedRow = m_rowChanged >= 0 ? getDataAtRow(m_rowChanged) : null;
@ -948,10 +959,14 @@ public class GridTable extends AbstractTableModel
m_sort.get(i).data = null; m_sort.get(i).data = null;
} }
} }
// update UI
fireTableDataChanged(); if (!isSameSortEntries)
// Info detected by MTab.dataStatusChanged and current row set to 0 {
fireDataStatusIEvent("Sorted", "#" + m_sort.size()); // update UI
fireTableDataChanged();
// Info detected by MTab.dataStatusChanged and current row set to 0
fireDataStatusIEvent("Sorted", "#" + m_sort.size());
}
} // sort } // sort
/** /**
@ -2919,6 +2934,11 @@ public class GridTable extends AbstractTableModel
m_changed = false; m_changed = false;
m_rowChanged = -1; m_rowChanged = -1;
m_inserting = false; m_inserting = false;
if (m_lastSortColumnIndex >= 0)
{
loadComplete();
sort(m_lastSortColumnIndex, m_lastSortedAscending);
}
fireTableDataChanged(); fireTableDataChanged();
if (fireStatusEvent) if (fireStatusEvent)
fireDataStatusIEvent(DATA_REFRESH_MESSAGE, ""); fireDataStatusIEvent(DATA_REFRESH_MESSAGE, "");
@ -3847,4 +3867,12 @@ public class GridTable extends AbstractTableModel
public String get_TrxName() { public String get_TrxName() {
return m_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(), Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo(),
get_TrxName()); get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID()); 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()) if (!alloc.save())
{ {
log.severe("P.Allocations not created"); log.severe("P.Allocations not created");
@ -2628,10 +2629,11 @@ public final class MPayment extends X_C_Payment
// Create automatic Allocation // Create automatic Allocation
MAllocationHdr alloc = new MAllocationHdr (getCtx(), false, MAllocationHdr alloc = new MAllocationHdr (getCtx(), false,
( accrual ? dateAcct : getDateTrx() ), getDateTrx(),
getC_Currency_ID(), getC_Currency_ID(),
Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName()); Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID()); alloc.setAD_Org_ID(getAD_Org_ID());
alloc.setDateAcct(dateAcct); // dateAcct variable already take into account the accrual parameter
alloc.saveEx(get_TrxName()); alloc.saveEx(get_TrxName());
// Original Allocation // Original Allocation

View File

@ -108,6 +108,7 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Column; import org.zkoss.zul.Column;
import org.zkoss.zul.Columns; import org.zkoss.zul.Columns;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup; import org.zkoss.zul.Menupopup;
import org.zkoss.zul.Window.Mode; import org.zkoss.zul.Window.Mode;
@ -1668,9 +1669,40 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/ */
public void onRefresh() public void onRefresh()
{ {
GridTab gridTab = adTabbox.getSelectedGridTab();
if (gridTab != null && gridTab.getTableModel() != null)
{
gridTab.getTableModel().resetCacheSortState();
}
Column sortColumn = findCurrentSortColumn();
onRefresh(true, false); 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() * @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 (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)) if (m_mLocator.getSize()==0)
throw new AdempiereUserError(Msg.getMsg(Env.getCtx(), "DRP-001", false)); {
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++) for (int i = 0; i < m_mLocator.getSize(); i++)
{ {