From 95c5b756be3da86be9b9b3813befea7977fa27ee Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 19 Apr 2010 22:52:43 +0000 Subject: [PATCH] Fix [2987531] Cannot search on Posted field - Thanks to Paul reverted revision 12035 implemented new patch submitted by Paul peer reviewed and tested (swing and zkwebui) added migration script to fix some dictionary errors on Posted columns Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2987531 --- client/src/org/compiere/apps/search/Find.java | 36 +++++++++---------- migration/354a-trunk/oracle/716_BF2987531.sql | 13 +++++++ .../354a-trunk/postgresql/716_BF2987531.sql | 13 +++++++ .../adempiere/webui/window/FindWindow.java | 23 ++++++++++++ 4 files changed, 67 insertions(+), 18 deletions(-) create mode 100644 migration/354a-trunk/oracle/716_BF2987531.sql create mode 100644 migration/354a-trunk/postgresql/716_BF2987531.sql diff --git a/client/src/org/compiere/apps/search/Find.java b/client/src/org/compiere/apps/search/Find.java index eca4db3fba..6b7e4ac8d4 100644 --- a/client/src/org/compiere/apps/search/Find.java +++ b/client/src/org/compiere/apps/search/Find.java @@ -116,7 +116,7 @@ public final class Find extends CDialog /** * */ - private static final long serialVersionUID = 6414604433732835411L; + private static final long serialVersionUID = -5064336990363669996L; private int m_AD_Tab_ID; /** @@ -209,8 +209,6 @@ public final class Find extends CDialog public static final int FIELDLENGTH = 20; /** Reference ID for Yes/No */ public static final int AD_REFERENCE_ID_YESNO = 319; - /** Reference ID for Posted */ - public static final int AD_REFERENCE_ID_POSTED = 234; // @@ -491,25 +489,27 @@ public final class Find extends CDialog mField = ynfield; } - // Make Posted searchable - if ( mField.getVO().displayType == DisplayType.Button && "Posted".equals(mField.getColumnName()) ) + // Make Buttons searchable + if ( mField.getVO().displayType == DisplayType.Button ) { GridFieldVO vo = mField.getVO(); - GridFieldVO postedvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); - postedvo.IsDisplayed = true; - postedvo.displayType = DisplayType.List; - postedvo.AD_Reference_Value_ID = AD_REFERENCE_ID_POSTED; + if ( vo.AD_Reference_Value_ID > 0 ) + { + GridFieldVO postedvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); + postedvo.IsDisplayed = true; + postedvo.displayType = DisplayType.List; - postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType, - Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID, - postedvo.IsParent, postedvo.ValidationCode); - postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass; - - GridField postedfield = new GridField(postedvo); + postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType, + Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID, + postedvo.IsParent, postedvo.ValidationCode); + postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass; - // replace the original field by the Posted List field - m_findFields[i] = postedfield; - mField = postedfield; + GridField postedfield = new GridField(postedvo); + + // replace the original field by the Posted List field + m_findFields[i] = postedfield; + mField = postedfield; + } } if (columnName.equals("Value")) diff --git a/migration/354a-trunk/oracle/716_BF2987531.sql b/migration/354a-trunk/oracle/716_BF2987531.sql new file mode 100644 index 0000000000..647f0f358a --- /dev/null +++ b/migration/354a-trunk/oracle/716_BF2987531.sql @@ -0,0 +1,13 @@ +-- Apr 19, 2010 5:37:09 PM COT +-- 2987531_Cannot search on Posted field +UPDATE AD_Column SET AD_Reference_Value_ID=234,Updated=TO_DATE('2010-04-19 17:37:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56347 +; + +-- Apr 19, 2010 5:43:13 PM COT +UPDATE AD_Column SET AD_Reference_ID=28, AD_Reference_Value_ID=234,Updated=TO_DATE('2010-04-19 17:43:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=57934 +; + +-- Apr 19, 2010 5:44:04 PM COT +UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=234,Updated=TO_DATE('2010-04-19 17:44:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58179 +; + diff --git a/migration/354a-trunk/postgresql/716_BF2987531.sql b/migration/354a-trunk/postgresql/716_BF2987531.sql new file mode 100644 index 0000000000..7ca0ccfae4 --- /dev/null +++ b/migration/354a-trunk/postgresql/716_BF2987531.sql @@ -0,0 +1,13 @@ +-- Apr 19, 2010 5:37:09 PM COT +-- 2987531_Cannot search on Posted field +UPDATE AD_Column SET AD_Reference_Value_ID=234,Updated=TO_TIMESTAMP('2010-04-19 17:37:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56347 +; + +-- Apr 19, 2010 5:43:13 PM COT +UPDATE AD_Column SET AD_Reference_ID=28, AD_Reference_Value_ID=234,Updated=TO_TIMESTAMP('2010-04-19 17:43:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=57934 +; + +-- Apr 19, 2010 5:44:04 PM COT +UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=234,Updated=TO_TIMESTAMP('2010-04-19 17:44:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58179 +; + diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 9b5ddbb5b8..b6e3b6be2c 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -514,6 +514,29 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe mField = ynfield; } + // Make Buttons searchable + if ( mField.getVO().displayType == DisplayType.Button ) + { + GridFieldVO vo = mField.getVO(); + if ( vo.AD_Reference_Value_ID > 0 ) + { + GridFieldVO postedvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); + postedvo.IsDisplayed = true; + postedvo.displayType = DisplayType.List; + + postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType, + Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID, + postedvo.IsParent, postedvo.ValidationCode); + postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass; + + GridField postedfield = new GridField(postedvo); + + // replace the original field by the Posted List field + m_findFields[i] = postedfield; + mField = postedfield; + } + } + if (columnName.equals("Value")) hasValue = true; else if (columnName.equals("Name"))