From cc07ae21b7a68003a41d722364d874469222370d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 14 Mar 2012 19:47:50 -0500 Subject: [PATCH] IDEMPIERE-191 Product Info search dialog assign the wrong value to the name field. http://jira.idempiere.com/browse/IDEMPIERE-191 --- .../org/compiere/apps/search/InfoProduct.java | 8 +++++--- .../adempiere/webui/editor/WSearchEditor.java | 16 ++++++++++++++-- .../adempiere/webui/panel/InfoProductPanel.java | 5 +++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java index 50da19ae75..21dc2e3a55 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java @@ -480,9 +480,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener // Pick init fillPicks(M_PriceList_ID); int M_PriceList_Version_ID = findPLV (M_PriceList_ID); - // Set Value or Name - if (value.startsWith("@") && value.endsWith("@")) - fieldName.setText(value.substring(1,value.length()-1)); + // Set Value + if (value != null && value.length() > 0 && value.indexOf("_") > 0) { + String values[] = value.split("_"); + fieldValue.setText(values[0]); + } else fieldValue.setText(value); // Set Warehouse diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index 73411af9df..bafbebfc96 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -203,7 +203,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value public void onEvent(Event e) { - if (Events.ON_CHANGE.equals(e.getName()) || Events.ON_OK.equals(e.getName())) + if (Events.ON_CHANGE.equals(e.getName())) { if (infoPanel != null) { @@ -211,7 +211,19 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value infoPanel = null; } actionText(getComponent().getText()); - + } + else if ((Events.ON_OK.equals(e.getName()))) { + if (getComponent().getText() == null || getComponent().getText().length() == 0) { + // open Info window similar to swing client + if (infoPanel != null) + { + infoPanel.detach(); + infoPanel = null; + } + actionText(getComponent().getText()); + } else { + actionRefresh(getValue()); + } } else if (Events.ON_CLICK.equals(e.getName())) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java index 0901b9bf79..ca9a7e2472 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java @@ -203,6 +203,11 @@ public class InfoProductPanel extends InfoPanel implements EventListener // AutoQuery if (value != null && value.length() > 0) { + // Set Value + if (value.indexOf("_") > 0) { + String values[] = value.split("_"); + value = values[0]; + } // Set Value or Name fieldValue.setText(value); testCount();