* [ 2009480 ] Sales Order Line - unable to enter qty,prc,uprc.

* Implemented auto commit.
This commit is contained in:
Heng Sin Low 2008-07-24 07:49:08 +00:00
parent 9bc79e497d
commit 95b790fa1f
2 changed files with 51 additions and 5 deletions

View File

@ -17,6 +17,8 @@
package org.adempiere.webui.editor;
import java.math.BigDecimal;
import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.event.ContextMenuEvent;
@ -66,7 +68,13 @@ public class WNumberEditor extends WEditor
public void onEvent(Event event)
{
String newValue = getComponent().getValue();
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
BigDecimal oldNumber = null;
if (oldValue != null && oldValue.trim().length() > 0)
oldNumber = new BigDecimal(oldValue);
BigDecimal newNumber = null;
if (newValue != null && newValue.trim().length() > 0)
newNumber = new BigDecimal(newValue);
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldNumber, newNumber);
super.fireValueChange(changeEvent);
oldValue = newValue;
}

View File

@ -531,11 +531,44 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
return true;
}
if (curTabpanel.isEditing())
if (curTab != null)
{
FDialog.warn(curWindowNo, "Please save your changes before " +
"switching tabs!!!", title);
return false;
if (curTab.isSortTab())
{
if (curTabpanel instanceof ADSortTab)
{
((ADSortTab)curTabpanel).saveData();
((ADSortTab)curTabpanel).unregisterPanel();
}
}
else if (curTab.needSave(true, false))
{
if (curTab.needSave(true, true))
{
// Automatic Save
if (Env.isAutoCommit(ctx, curWindowNo))
{
if (!curTab.dataSave(true))
{
// there is a problem, stop here
return false;
}
}
// explicitly ask when changing tabs
else if (FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", curTab.getCommitWarning()))
{ // yes we want to save
if (!curTab.dataSave(true))
{
// there is a problem, stop here
return false;
}
}
else // Don't save
curTab.dataIgnore();
}
else // new record, but nothing changed
curTab.dataIgnore();
} // there is a change
}
if (!adTab.updateSelectedIndex(oldTabIndex, newTabIndex))
@ -565,6 +598,11 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
curTabIndex = newTabIndex;
curTabpanel = newTabpanel;
if (curTabpanel instanceof ADSortTab)
{
((ADSortTab)curTabpanel).registerAPanel(this);
}
updateToolbar();