Merge cf0dee99e897

This commit is contained in:
Heng Sin Low 2013-06-13 19:55:55 +08:00
commit 91971e5bd3
8 changed files with 151 additions and 28 deletions

View File

@ -0,0 +1,12 @@
-- Jun 12, 2013 12:21:45 PM COT
-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Fill Minimum Information of:',200180,'D','03c360e6-3cdb-4058-818f-260e3aeff485','FillMinimumlInfo','Y',TO_DATE('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jun 12, 2013 12:21:45 PM COT
-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200180 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('20130612122145_IDEMPIERE-974.sql') FROM dual
;

View File

@ -0,0 +1,13 @@
-- Jun 12, 2013 12:21:45 PM COT
-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Fill Minimum Information of:',200180,'D','03c360e6-3cdb-4058-818f-260e3aeff485','FillMinimumlInfo','Y',TO_TIMESTAMP('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-06-12 12:21:42','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jun 12, 2013 12:21:45 PM COT
-- IDEMPIERE-974 Issue with Quick Entry editor when a checkbox is added and a new record is created
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200180 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('20130612122145_IDEMPIERE-974.sql') FROM dual
;

View File

@ -348,7 +348,7 @@ public class GridField
return false; return false;
// Numeric Keys and Created/Updated as well as // Numeric Keys and Created/Updated as well as
// DocumentNo/Value/ASI ars not mandatory (persistency layer manages them) // DocumentNo/Value/ASI are not mandatory (persistence layer manages them)
if (m_gridTab != null && // if gridtab doesn't exist then it's not a window field (probably a process parameter field) if (m_gridTab != null && // if gridtab doesn't exist then it's not a window field (probably a process parameter field)
( (m_vo.IsKey && m_vo.ColumnName.endsWith("_ID")) ( (m_vo.IsKey && m_vo.ColumnName.endsWith("_ID"))
|| m_vo.ColumnName.startsWith("Created") || m_vo.ColumnName.startsWith("Updated") || m_vo.ColumnName.startsWith("Created") || m_vo.ColumnName.startsWith("Updated")

View File

@ -601,9 +601,19 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
//create tree //create tree
if (gridTab.isTreeTab() && treePanel != null) { if (gridTab.isTreeTab() && treePanel != null) {
int AD_Tree_ID = MTree.getDefaultAD_Tree_ID ( int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true);
Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName()); int AD_Tree_ID_Default = MTree.getDefaultAD_Tree_ID (Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
if (gridTab.getRecord_ID() >= 0) {
if (AD_Tree_ID != 0) {
treePanel.initTree(AD_Tree_ID, windowNo); treePanel.initTree(AD_Tree_ID, windowNo);
setSelectedNode(gridTab.getRecord_ID());
} else if (AD_Tree_ID_Default != 0) {
treePanel.initTree(AD_Tree_ID_Default, windowNo);
setSelectedNode(gridTab.getRecord_ID());
}
} else {
treePanel.getTree().clear();
}
} }
if (!gridTab.isSingleRow() && !isGridView()) if (!gridTab.isSingleRow() && !isGridView())
@ -1156,18 +1166,64 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
dynamicDisplay(col); dynamicDisplay(col);
//sync tree //sync tree
if (treePanel != null) { if (treePanel != null)
{
if ("Deleted".equalsIgnoreCase(e.getAD_Message())) if ("Deleted".equalsIgnoreCase(e.getAD_Message()))
if (e.Record_ID != null {
&& e.Record_ID instanceof Integer if (e.Record_ID != null && e.Record_ID instanceof Integer && ((Integer)e.Record_ID != gridTab.getRecord_ID()))
&& ((Integer)e.Record_ID != gridTab.getRecord_ID()))
deleteNode((Integer)e.Record_ID); deleteNode((Integer)e.Record_ID);
else else
setSelectedNode(gridTab.getRecord_ID()); setSelectedNode(gridTab.getRecord_ID());
else }
else if (!e.isInserting())
{
boolean refresh=true;
Treeitem item = treePanel.getTree().getSelectedItem();
if (item != null)
{
@SuppressWarnings("unchecked")
MTreeNode treeNode = ((DefaultTreeNode<MTreeNode>) item.getValue()).getData();
if (treeNode.getNode_ID() == gridTab.getRecord_ID()){
setSelectedNode(gridTab.getRecord_ID()); setSelectedNode(gridTab.getRecord_ID());
refresh = false;
}
} }
if (refresh)
{
int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true);
if (gridTab.getRecord_ID()>=0)
{
if (AD_Tree_ID != 0)
{
treePanel.initTree(AD_Tree_ID, windowNo);
setSelectedNode(gridTab.getRecord_ID());
}
else
{
AD_Tree_ID = MTree.getDefaultAD_Tree_ID (Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
treePanel.initTree(AD_Tree_ID, windowNo);
}
}
else
{
treePanel.getTree().clear();
}
}
}else if(e.isInserting() && gridTab.getRecord_ID() < 0 && gridTab.getTabLevel() > 0 )
{
int AD_Tree_ID = Integer.parseInt(gridTab.getParentTab().getValue("AD_Tree_ID").toString());
MTreeNode root = new MTree (Env.getCtx(), AD_Tree_ID, true, true, null).getRoot();
SimpleTreeModel treeModel = SimpleTreeModel.createFrom(root);
try {
treePanel.getTree().setItemRenderer(treeModel);
treePanel.getTree().setModel(treeModel);
} catch (Exception treeExc) {
logger.log(Level.SEVERE, "Failed to setup tree");
}
}
}
if (listPanel.isVisible()) { if (listPanel.isVisible()) {
listPanel.updateListIndex(); listPanel.updateListIndex();
listPanel.dynamicDisplay(col); listPanel.dynamicDisplay(col);
@ -1242,8 +1298,16 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
} }
} }
Boolean summary = (Boolean) gridTab.getValue("IsSummary"); Object summaryobj = gridTab.getValue("IsSummary");
if (summary != null && !summary.booleanValue() == data.isSummary()) { boolean summary = false;
if (summaryobj != null) {
if (summaryobj instanceof Boolean) {
summary = ((Boolean)summaryobj).booleanValue();
} else {
summary = "Y".equals(summaryobj.toString());
}
}
if (summary != data.isSummary()) {
data.setSummary(summary); data.setSummary(summary);
changed = true; changed = true;
} }

View File

@ -460,8 +460,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
Boolean error = (Boolean) messageContainer.getAttribute(STATUS_ERROR_ATTRIBUTE); Boolean error = (Boolean) messageContainer.getAttribute(STATUS_ERROR_ATTRIBUTE);
String status = (String) messageContainer.getAttribute(STATUS_TEXT_ATTRIBUTE); String status = (String) messageContainer.getAttribute(STATUS_TEXT_ATTRIBUTE);
createPopupContent(status); showPopup(error, status);
showPopup(error, messageContainer);
} else if (event.getName().equals(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT)) { } else if (event.getName().equals(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT)) {
if (LayoutUtils.isReallyVisible(this)) if (LayoutUtils.isReallyVisible(this))
updateProcessToolbar(); updateProcessToolbar();
@ -483,8 +482,8 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
msgPopupCnt.appendChild(t); msgPopupCnt.appendChild(t);
} }
private void showPopup(boolean error, Component messageContainer) { private void showPopup(boolean error, String msg) {
LayoutUtils.openOverlappedWindow(messageContainer, msgPopup, "overlap_end"); Clients.showNotification(buildNotificationText(msg), "error", findTabpanel(this), "at_pointer", 3500, true);
} }
private void createPopup() { private void createPopup() {

View File

@ -82,10 +82,15 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
treeModel.setItemDraggable(true); treeModel.setItemDraggable(true);
treeModel.addOnDropEventListener(new ADTreeOnDropListener(tree, treeModel, vTree, windowNo)); treeModel.addOnDropEventListener(new ADTreeOnDropListener(tree, treeModel, vTree, windowNo));
if (tree.getTreecols() == null)
{
Treecols treeCols = new Treecols(); Treecols treeCols = new Treecols();
tree.getTreecols();
tree.appendChild(treeCols); tree.appendChild(treeCols);
Treecol treeCol = new Treecol(); Treecol treeCol = new Treecol();
treeCols.appendChild(treeCol); treeCols.appendChild(treeCol);
}
tree.setPageSize(-1); tree.setPageSize(-1);
try { try {
tree.setItemRenderer(treeModel); tree.setItemRenderer(treeModel);

View File

@ -324,11 +324,14 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
int parentID = 0; int parentID = 0;
String parentColumn = null; String parentColumn = null;
String tabZeroName=null;
boolean isParentSave = (getRecord_ID() > 0);
for (int idxt = 0; idxt < quickTabs.size(); idxt++) { for (int idxt = 0; idxt < quickTabs.size(); idxt++) {
GridTab gridtab = quickTabs.get(idxt); GridTab gridtab = quickTabs.get(idxt);
PO po = quickPOs.get(idxt); PO po = quickPOs.get(idxt);
if (idxt == 0) { if (idxt == 0) {
parentColumn = gridtab.getTableName() + "_ID"; parentColumn = gridtab.getTableName() + "_ID";
tabZeroName=gridtab.getName();
} }
boolean savePO = false; boolean savePO = false;
@ -346,7 +349,6 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
boolean changed = (value != null && initialValue == null) boolean changed = (value != null && initialValue == null)
|| (value == null && initialValue != null) || (value == null && initialValue != null)
|| (value != null && initialValue != null && !value.equals(initialValue)); || (value != null && initialValue != null && !value.equals(initialValue));
boolean thisMandatoryError = false; boolean thisMandatoryError = false;
if (field.isMandatory(true)) { if (field.isMandatory(true)) {
if (value == null || value.toString().length() == 0) { if (value == null || value.toString().length() == 0) {
@ -374,8 +376,24 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
po.set_ValueOfColumn(parentColumn, parentID); po.set_ValueOfColumn(parentColumn, parentID);
} }
} }
if(gridtab.getTabLevel()>0 && !isParentSave){
FDialog.error(m_WindowNo, this, "FillMinimumInfo",tabZeroName);
return false;
}
po.saveEx(); po.saveEx();
if(gridtab.getTabLevel()==0){
isParentSave=true;
}
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
if (field.getGridTab() != gridtab)
continue;
WEditor we = quickEditors.get(idxf);
if (po.get_Value(we.getColumnName()) != null) {
we.setValue(po.get_Value(we.getColumnName()));
}
}
} }
if (idxt == 0) { if (idxt == 0) {
parentID = po.get_ID(); parentID = po.get_ID();

View File

@ -336,7 +336,19 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
return; return;
} }
for(Component comp : cmbSearch.getChildren())
{
Comboitem item = (Comboitem) comp;
if (item.getLabel().equals(value))
{
String type = item.getContent();
if (!Util.isEmpty(type))
selectTreeitem(value+"."+type);
else
selectTreeitem(value); selectTreeitem(value);
return;
}
}
} }
} }
else if (event.getName().equals(ON_POST_FIRE_TREE_EVENT)) else if (event.getName().equals(ON_POST_FIRE_TREE_EVENT))