From 5c55d46ad19edd4a548c736bcf66bfd7f438d1e5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 25 Jan 2013 17:28:38 -0800 Subject: [PATCH] IDEMPIERE-594 Improve positioning on windows / Change DocAction button to have the name of the Document Action element --- .../201301251726_IDEMPIERE-594_DocAction.sql | 48 +++++++++++++++++++ .../201301251726_IDEMPIERE-594_DocAction.sql | 48 +++++++++++++++++++ .../src/org/compiere/model/MSysConfig.java | 4 +- .../adempiere/webui/editor/WButtonEditor.java | 18 +++++-- 4 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 migration/i1.0a-release/oracle/201301251726_IDEMPIERE-594_DocAction.sql create mode 100644 migration/i1.0a-release/postgresql/201301251726_IDEMPIERE-594_DocAction.sql diff --git a/migration/i1.0a-release/oracle/201301251726_IDEMPIERE-594_DocAction.sql b/migration/i1.0a-release/oracle/201301251726_IDEMPIERE-594_DocAction.sql new file mode 100644 index 0000000000..e4331ebcdb --- /dev/null +++ b/migration/i1.0a-release/oracle/201301251726_IDEMPIERE-594_DocAction.sql @@ -0,0 +1,48 @@ +-- Jan 25, 2013 5:26:22 PM PST +-- IDEMPIERE-594 Improve positioning on windows +INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name) VALUES (200025,'D','C','N','Show Action Name on DocAction button','ee66f3e4-8fed-4591-97dd-ae1ba1219fdc',TO_DATE('2013-01-25 17:26:21','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-01-25 17:26:21','YYYY-MM-DD HH24:MI:SS'),0,0,100,'Y',100,'DOCACTIONBUTTON_SHOWACTIONNAME') +; + +-- Jan 25, 2013 5:26:37 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Element SET Name='Action',Updated=TO_DATE('2013-01-25 17:26:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=287 +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=287 +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Column SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Element_ID=287 +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Process_Para SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup', AD_Element_ID=287 WHERE UPPER(ColumnName)='DOCACTION' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Process_Para SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Element_ID=287 AND IsCentrallyMaintained='Y' +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_InfoColumn SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Element_ID=287 AND IsCentrallyMaintained='Y' +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Field SET Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=287) AND IsCentrallyMaintained='Y' +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_PrintFormatItem pi SET PrintName='Doc Action', Name='Action' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=287) +; + +SELECT register_migration_script('201301251726_IDEMPIERE-594_DocAction.sql') FROM dual +; + diff --git a/migration/i1.0a-release/postgresql/201301251726_IDEMPIERE-594_DocAction.sql b/migration/i1.0a-release/postgresql/201301251726_IDEMPIERE-594_DocAction.sql new file mode 100644 index 0000000000..90053f0925 --- /dev/null +++ b/migration/i1.0a-release/postgresql/201301251726_IDEMPIERE-594_DocAction.sql @@ -0,0 +1,48 @@ +-- Jan 25, 2013 5:26:22 PM PST +-- IDEMPIERE-594 Improve positioning on windows +INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name) VALUES (200025,'D','C','N','Show Action Name on DocAction button','ee66f3e4-8fed-4591-97dd-ae1ba1219fdc',TO_TIMESTAMP('2013-01-25 17:26:21','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-01-25 17:26:21','YYYY-MM-DD HH24:MI:SS'),0,0,100,'Y',100,'DOCACTIONBUTTON_SHOWACTIONNAME') +; + +-- Jan 25, 2013 5:26:37 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Element SET Name='Action',Updated=TO_TIMESTAMP('2013-01-25 17:26:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=287 +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=287 +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Column SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Element_ID=287 +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Process_Para SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup', AD_Element_ID=287 WHERE UPPER(ColumnName)='DOCACTION' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Process_Para SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Element_ID=287 AND IsCentrallyMaintained='Y' +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_InfoColumn SET ColumnName='DocAction', Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Element_ID=287 AND IsCentrallyMaintained='Y' +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Field SET Name='Action', Description='The targeted status of the document', Help='You find the current status in the Document Status field. The options are listed in a popup' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=287) AND IsCentrallyMaintained='Y' +; + +-- Jan 25, 2013 5:26:38 PM PST +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_PrintFormatItem SET PrintName='Doc Action', Name='Action' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=287) +; + +SELECT register_migration_script('201301251726_IDEMPIERE-594_DocAction.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index e10823d194..4c5dbc8d6e 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,8 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 2906768000936142606L; - + private static final long serialVersionUID = 6995907727239458114L; public final static String PDF_FONT_DIR = "PDF_FONT_DIR"; public final static String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS"; public static final String ZK_DESKTOP_CLASS = "ZK_DESKTOP_CLASS"; @@ -113,6 +112,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String REAL_TIME_POS = "REAL_TIME_POS"; public static final String SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE = "SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE"; public static final String SHIPPING_SAVE_REQUEST_RESPONSE_LOG = "SHIPPING_SAVE_REQUEST_RESPONSE_LOG"; + public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME"; /** * Standard Constructor diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java index 0ea7fe495a..69ee75c1ce 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java @@ -35,6 +35,7 @@ import org.adempiere.webui.event.ActionListener; import org.compiere.model.GridField; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.MSysConfig; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -187,6 +188,11 @@ public class WButtonEditor extends WEditor implements IProcessButton { ; } + else if (super.getColumnName().equals("DocAction") + && !MSysConfig.getBooleanValue(MSysConfig.DOCACTIONBUTTON_SHOWACTIONNAME, false, Env.getAD_Client_ID(Env.getCtx()))) + { + text = Msg.getElement(Env.getCtx(), "DocAction"); + } else if (m_values != null) { text = (String)m_values.get(value); @@ -237,11 +243,13 @@ public class WButtonEditor extends WEditor implements IProcessButton + " AND t.AD_Language='" + Env.getAD_Language(Env.getCtx()) + "'" + " AND l.AD_Reference_ID=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; try { - PreparedStatement pstmt = DB.prepareStatement(SQL, null); + pstmt = DB.prepareStatement(SQL, null); pstmt.setInt(1, AD_Reference_ID); - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); while (rs.next()) { @@ -251,13 +259,15 @@ public class WButtonEditor extends WEditor implements IProcessButton } - rs.close(); - pstmt.close(); } catch (SQLException e) { logger.log(Level.SEVERE, SQL, e); } + finally + { + DB.close(rs, pstmt); + } } // readReference