IDEMPIERE-1335 Info window multi-select for product info is broken. Fixed save error when user select multiple product with QtyAvailable=0.
This commit is contained in:
parent
838af05634
commit
ada15c177b
|
@ -20,6 +20,8 @@ import java.io.Serializable;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.EventObject;
|
||||
|
||||
import org.idempiere.fa.util.Util;
|
||||
|
||||
/**
|
||||
* Data Status Event
|
||||
* <p>
|
||||
|
@ -337,4 +339,17 @@ public final class DataStatusEvent extends EventObject implements Serializable
|
|||
return m_confirmed;
|
||||
} // isConfirmed
|
||||
|
||||
public boolean isEqual(DataStatusEvent e) {
|
||||
if (e == null) return false;
|
||||
|
||||
return e.m_changed == m_changed &&
|
||||
e.m_inserting == m_inserting &&
|
||||
e.m_isError == m_isError &&
|
||||
e.m_isWarning == m_isWarning &&
|
||||
Util.equals(e.m_AD_Message, m_AD_Message) &&
|
||||
e.m_changedColumn == m_changedColumn &&
|
||||
Util.equals(e.m_columnName, m_columnName) &&
|
||||
e.m_currentRow == m_currentRow;
|
||||
}
|
||||
|
||||
} // DataStatusEvent
|
||||
|
|
|
@ -2238,6 +2238,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
// set current row
|
||||
m_DataStatusEvent = e; // setCurrentRow clear it, need to save again
|
||||
m_DataStatusEvent.setCurrentRow(m_currentRow);
|
||||
|
||||
// Same row - update value
|
||||
if (oldCurrentRow == m_currentRow)
|
||||
{
|
||||
|
@ -2248,8 +2249,25 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
field.setValue(value, m_mTable.isInserting());
|
||||
}
|
||||
}
|
||||
else // Redistribute Info with current row info
|
||||
fireDataStatusChanged(m_DataStatusEvent);
|
||||
else
|
||||
{
|
||||
// Redistribute Info with current row info
|
||||
// Avoid firing of duplicate event
|
||||
boolean fire = true;
|
||||
if (m_lastDataStatusEvent != null)
|
||||
{
|
||||
if (System.currentTimeMillis() - m_lastDataStatusEventTime < 200)
|
||||
{
|
||||
if (m_lastDataStatusEvent.isEqual(m_DataStatusEvent))
|
||||
{
|
||||
fire = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fire)
|
||||
fireDataStatusChanged(m_DataStatusEvent);
|
||||
}
|
||||
|
||||
//reset
|
||||
m_lastDataStatusEventTime = System.currentTimeMillis();
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zhtml.Text;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -244,7 +245,20 @@ public class Messagebox extends Window implements EventListener<Event>
|
|||
this.setSizable(true);
|
||||
|
||||
this.setVisible(true);
|
||||
this.setId("MessageBox_"+AdempiereIdGenerator.escapeId(title));
|
||||
String id = "MessageBox_"+AdempiereIdGenerator.escapeId(title);
|
||||
//make sure id is unique
|
||||
Page page = AEnv.getDesktop().getFirstPage();
|
||||
Component fellow = page.getFellowIfAny(id);
|
||||
if (fellow != null) {
|
||||
int count = 0;
|
||||
String newId = null;
|
||||
while (fellow != null) {
|
||||
newId = id + "_" + ++count;
|
||||
fellow = page.getFellowIfAny(newId);
|
||||
}
|
||||
id = newId;
|
||||
}
|
||||
this.setId(id);
|
||||
AEnv.showCenterScreen(this);
|
||||
|
||||
return returnValue;
|
||||
|
|
|
@ -195,9 +195,9 @@ public class GridTabDataBinder implements ValueChangeListener {
|
|||
|
||||
for (int i = 0; i < values.length; i++)
|
||||
{
|
||||
if (!gridTab.dataNew(true))
|
||||
if (!gridTab.dataNew(false))
|
||||
{
|
||||
throw new IllegalStateException("Could not clone tab");
|
||||
throw new IllegalStateException("Could not create new row");
|
||||
}
|
||||
|
||||
gridTab.setValue(columnName, values[i]);
|
||||
|
@ -209,10 +209,9 @@ public class GridTabDataBinder implements ValueChangeListener {
|
|||
|
||||
if (!gridTab.dataSave(false))
|
||||
{
|
||||
throw new IllegalStateException("Could not update tab");
|
||||
throw new IllegalStateException("Could not update row");
|
||||
}
|
||||
|
||||
gridTab.setCurrentRow(oldRow);
|
||||
}
|
||||
gridTab.setCurrentRow(oldRow);
|
||||
}
|
||||
}
|
|
@ -62,7 +62,7 @@ public class FDialog
|
|||
|
||||
if (message != null && message.length() > 0)
|
||||
{
|
||||
out.append("\n").append(message);
|
||||
out.append("<br>").append(message);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
|
Loading…
Reference in New Issue