From 4f9756bbc70a248ed48bc17ca752724fe3feaf02 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Sat, 23 Jun 2012 23:48:11 -0500 Subject: [PATCH 1/7] IDEMPIERE-248 : Field group labels can be truncated (Swing) Integrated by Carlos Ruiz - globalqss --- org.adempiere.ui.swing/src/org/compiere/grid/VPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPanel.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPanel.java index 960ec24909..9456c95f16 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VPanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPanel.java @@ -444,7 +444,7 @@ public final class VPanel extends CTabbedPane { CLabel label = new CLabel(fieldGroup, CLabel.LEADING); label.setFont(AdempierePLAF.getFont_Label().deriveFont(Font.BOLDITALIC, AdempierePLAF.getFont_Label().getSize2D())); - m_main.add(label, "newline, alignx leading"); + m_main.add(label, "newline, spanx, growx"); m_main.add(new JSeparator(), "newline, spanx, growx"); // reset } From 124c49217b16324f8e21a3496b992e5342a5f15f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 23 Jun 2012 23:54:10 -0500 Subject: [PATCH 2/7] IDEMPIERE-296 Bug in MInOut for reverse complete - thanks to Emiliano Pereyra --- org.adempiere.base/src/org/compiere/model/MInOut.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 691a22ff85..ee2282bced 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -2112,6 +2112,8 @@ public class MInOut extends X_M_InOut implements DocAction // Void Confirmations setDocStatus(DOCSTATUS_Reversed); // need to set & save docstatus to be able to check it in MInOutConfirm.voidIt() saveEx(); + //FR1948157 + this.setReversal_ID(reversal.getM_InOut_ID()); voidConfirmations(); // After reverseCorrect @@ -2120,8 +2122,6 @@ public class MInOut extends X_M_InOut implements DocAction return false; m_processMsg = reversal.getDocumentNo(); - //FR1948157 - this.setReversal_ID(reversal.getM_InOut_ID()); setProcessed(true); setDocStatus(DOCSTATUS_Reversed); // may come from void setDocAction(DOCACTION_None); From 11583224a9762f74723a4ab1cf7f40cc585ee41e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 24 Jun 2012 00:14:18 -0500 Subject: [PATCH 3/7] IDEMPIERE-297 Any user can create new reports (PF) - thanks to Nelson Chan for reporting and Hesham S. Ahmed for the suggested patch --- .../src/org/compiere/print/Viewer.java | 13 +++++++++---- .../adempiere/webui/window/ZkReportViewer.java | 15 ++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java b/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java index a60941ad4f..7de0ead2ed 100644 --- a/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java +++ b/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java @@ -130,7 +130,7 @@ public class Viewer extends CFrame /** * */ - private static final long serialVersionUID = 7306392362119021781L; + private static final long serialVersionUID = 3453340777183200393L; /** * @deprecated @@ -451,9 +451,14 @@ public class Viewer extends CFrame { log.log(Level.SEVERE, sql, e); } - StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(m_ctx, "NewReport")).append(" **"); - KeyNamePair pp = new KeyNamePair(-1, sb.toString()); - comboReport.addItem(pp); + // IDEMPIERE-297 - Check for Table Access and Window Access for New Report + if ( MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false) + && MRole.getDefault().getWindowAccess(WINDOW_PRINTFORMAT)) + { + StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(m_ctx, "NewReport")).append(" **"); + KeyNamePair pp = new KeyNamePair(-1, sb.toString()); + comboReport.addItem(pp); + } if (selectValue != null) comboReport.setSelectedItem(selectValue); comboReport.addActionListener(this); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index 700c7c38ea..09f9729d9f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -77,13 +77,13 @@ import org.zkoss.zk.ui.ext.render.DynamicMedia; import org.zkoss.zul.A; import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; -import org.zkoss.zul.North; import org.zkoss.zul.Div; import org.zkoss.zul.Filedownload; import org.zkoss.zul.Hbox; import org.zkoss.zul.Iframe; import org.zkoss.zul.Listitem; import org.zkoss.zul.Menuitem; +import org.zkoss.zul.North; import org.zkoss.zul.Separator; import org.zkoss.zul.South; import org.zkoss.zul.Tab; @@ -115,7 +115,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab /** * */ - private static final long serialVersionUID = -7554542090648903080L; + private static final long serialVersionUID = 2079827289589862794L; /** Window No */ private int m_WindowNo = -1; @@ -547,9 +547,14 @@ public class ZkReportViewer extends Window implements EventListener, ITab { log.log(Level.SEVERE, sql, e); } - StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(Env.getCtx(), "NewReport")).append(" **"); - KeyNamePair pp = new KeyNamePair(-1, sb.toString()); - comboReport.appendItem(pp.getName(), pp.getKey()); + // IDEMPIERE-297 - Check for Table Access and Window Access for New Report + if ( MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false) + && MRole.getDefault().getWindowAccess(WINDOW_PRINTFORMAT)) + { + StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(Env.getCtx(), "NewReport")).append(" **"); + KeyNamePair pp = new KeyNamePair(-1, sb.toString()); + comboReport.appendItem(pp.getName(), pp.getKey()); + } comboReport.addEventListener(Events.ON_SELECT, this); } // fillComboReport From b42fe550f70361577cbc00a458115b8f41ae2795 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 24 Jun 2012 00:32:01 -0500 Subject: [PATCH 4/7] IDEMPIERE-245 Fix problem reported by Nicolas about Memo fields --- .../src/org/compiere/grid/ed/VMemo.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VMemo.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VMemo.java index 734cfdea47..edb5759336 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VMemo.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VMemo.java @@ -57,7 +57,7 @@ public class VMemo extends CTextArea /** * */ - private static final long serialVersionUID = -1589654941310687511L; + private static final long serialVersionUID = -7168406072766858933L; /** * Mouse Listener @@ -156,7 +156,7 @@ public class VMemo extends CTextArea private String m_columnName; private String m_oldText = ""; - private boolean m_firstChange; + private volatile boolean m_setting = false; /** Logger */ private static CLogger log = CLogger.getCLogger(VMemo.class); @@ -167,7 +167,8 @@ public class VMemo extends CTextArea public void setValue(Object value) { super.setValue(value); - m_firstChange = true; + if (m_setting) + return; // Always position Top setCaretPosition(0); } // setValue @@ -266,14 +267,13 @@ public class VMemo extends CTextArea */ public void focusLost (FocusEvent e) { - // Indicate Change - log.fine( "focusLost"); + m_setting = true; try { - String text = getText(); - fireVetoableChange(m_columnName, text, null); // No data committed - done when focus lost !!! + fireVetoableChange(m_columnName, m_oldText, getText()); } catch (PropertyVetoException pve) {} + m_setting = false; } // focusLost /*************************************************************************/ From b84c95fb483f44a31dd3d648ad7f4165b4f24e7e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 25 Jun 2012 19:05:19 -0500 Subject: [PATCH 5/7] IDEMPIERE-305 Preference throws NPE --- .../src/org/adempiere/webui/util/UserPreference.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/UserPreference.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/UserPreference.java index 551406537f..37836b56f8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/UserPreference.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/UserPreference.java @@ -110,8 +110,8 @@ public final class UserPreference implements Serializable { * save user preference */ public void savePreference() { - if (m_AD_User_ID > 0) { - Query query = new Query(Env.getCtx(), I_AD_Preference.Table_Name, "AD_User_ID = ? AND Attribute = ? AND AD_Window_ID Is NULL", null); + if (m_AD_User_ID >= 0) { + Query query = new Query(Env.getCtx(), I_AD_Preference.Table_Name, "NVL(AD_User_ID,0) = ? AND Attribute = ? AND AD_Window_ID Is NULL", null); for (int i = 0; i < PROPERTIES.length; i++) { String attribute = PROPERTIES[i]; String value = props.getProperty(attribute); @@ -137,11 +137,11 @@ public final class UserPreference implements Serializable { * @param AD_User_ID */ public void loadPreference(int AD_User_ID) { - if (AD_User_ID > 0) { + if (AD_User_ID >= 0) { m_AD_User_ID = AD_User_ID; props = new Properties(); - Query query = new Query(Env.getCtx(), I_AD_Preference.Table_Name, "AD_User_ID = ? AND Attribute = ? AND AD_Window_ID Is NULL", null); + Query query = new Query(Env.getCtx(), I_AD_Preference.Table_Name, "NVL(AD_User_ID,0) = ? AND Attribute = ? AND AD_Window_ID Is NULL", null); for (int i = 0; i < PROPERTIES.length; i++) { String attribute = PROPERTIES[i]; From 2fe8ea2a91232685bca1bd0fe70fc037daf3dddc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 27 Jun 2012 09:12:31 -0500 Subject: [PATCH 6/7] IDEMPIERE-127 Implement Recent Items dashboard / fix recent items not working for System user --- .../src/org/compiere/model/MRecentItem.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRecentItem.java b/org.adempiere.base/src/org/compiere/model/MRecentItem.java index 6272629599..db6c1c5522 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecentItem.java +++ b/org.adempiere.base/src/org/compiere/model/MRecentItem.java @@ -116,7 +116,7 @@ public class MRecentItem extends X_AD_RecentItem } // MRecentItem retValue = null; - String sql = "SELECT * FROM AD_RecentItem WHERE AD_Table_ID=? AND Record_ID=? AND AD_User_ID=?"; + String sql = "SELECT * FROM AD_RecentItem WHERE AD_Table_ID=? AND Record_ID=? AND NVL(AD_User_ID,0)=?"; PreparedStatement pstmt = null; ResultSet rs = null; try @@ -185,10 +185,10 @@ public class MRecentItem extends X_AD_RecentItem int maxri = MSysConfig.getIntValue("RecentItems_MaxSaved", 50, AD_Client_ID); if (maxri < 0) maxri = 0; - int cntri = DB.getSQLValue(null, "SELECT COUNT(*) FROM AD_RecentItem WHERE AD_User_ID=? AND AD_Client_ID=?", AD_User_ID, AD_Client_ID); + int cntri = DB.getSQLValue(null, "SELECT COUNT(*) FROM AD_RecentItem WHERE NVL(AD_User_ID,0)=? AND AD_Client_ID=?", AD_User_ID, AD_Client_ID); if (cntri > maxri) { int cntdel = cntri - maxri; - String sql = "SELECT AD_Table_ID, Record_ID FROM AD_RecentItem WHERE AD_User_ID=? AND AD_Client_ID=? ORDER BY Updated"; + String sql = "SELECT AD_Table_ID, Record_ID FROM AD_RecentItem WHERE NVL(AD_User_ID,0)=? AND AD_Client_ID=? ORDER BY Updated"; PreparedStatement pstmt = null; ResultSet rs = null; try @@ -226,7 +226,7 @@ public class MRecentItem extends X_AD_RecentItem } public static List getFromUser(Properties ctx, int AD_User_ID) { - List ris = new Query(ctx, MRecentItem.Table_Name, "AD_User_ID=?", null) + List ris = new Query(ctx, MRecentItem.Table_Name, "NVL(AD_User_ID,0)=?", null) .setOnlyActiveRecords(true) .setClient_ID() .setParameters(AD_User_ID) From d2ab5564bf4992ae3fd843e5bf12203d0dc61dd3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 27 Jun 2012 18:19:10 -0500 Subject: [PATCH 7/7] IDEMPIERE-152 Show UUID value on Record Info --- .../src/org/compiere/model/GridTab.java | 17 ++++++++++--- .../src/org/compiere/model/GridTable.java | 25 +++++++++++-------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 019e005bda..a82ce19db8 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -105,9 +105,9 @@ import org.compiere.util.ValueNamePair; public class GridTab implements DataStatusListener, Evaluatee, Serializable { /** - * + * */ - private static final long serialVersionUID = -3825605601192688998L; + private static final long serialVersionUID = 6841849146086698231L; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; @@ -2342,10 +2342,19 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable e.Record_ID = getValue(m_keyColumnName); // Info StringBuffer info = new StringBuffer(getTableName()); + + /* get UUID */ + PO po = m_mTable.getPO(m_currentRow); + if (po != null) { + String uuidcol = po.getUUIDColumnName(); + String uuid = po.get_ValueAsString(uuidcol); + info.append("\n ").append(uuidcol).append("=").append(uuid); + } + // We have a key column if (m_keyColumnName != null && m_keyColumnName.length() > 0) { - info.append(" - ") + info.append("\n ") .append(m_keyColumnName).append("=").append(e.Record_ID); } else // we have multiple parents @@ -2353,7 +2362,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable for (int i = 0; i < m_parents.size(); i++) { String keyCol = (String)m_parents.get(i); - info.append(" - ") + info.append(i == 0 ? "\n " : " - ") .append(keyCol).append("=").append(getValue(keyCol)); } } diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 85d3a30154..1c1e0c13f6 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -90,10 +90,10 @@ public class GridTable extends AbstractTableModel implements Serializable, SystemIDs { /** - * generated + * */ - private static final long serialVersionUID = 7799823493936826600L; - + private static final long serialVersionUID = 4648364477309024202L; + public static final String DATA_REFRESH_MESSAGE = "Refreshed"; /** @@ -2568,13 +2568,7 @@ public class GridTable extends AbstractTableModel MSort sort = (MSort)m_sort.get(row); Object[] rowData = getDataAtRow(row); // - MTable table = MTable.get (m_ctx, m_AD_Table_ID); - PO po = null; - int Record_ID = getKeyID(row); - if (Record_ID != -1) - po = table.getPO(Record_ID, null); - else // Multi - Key - po = table.getPO(getWhereClause(rowData), null); + PO po = getPO(row); // Delete via PO if (po != null) @@ -3698,5 +3692,16 @@ public class GridTable extends AbstractTableModel } return bChanged; } + + public PO getPO(int row) { + MTable table = MTable.get (m_ctx, m_AD_Table_ID); + PO po = null; + int Record_ID = getKeyID(row); + if (Record_ID != -1) + po = table.getPO(Record_ID, null); + else // Multi - Key + po = table.getPO(getWhereClause(getDataAtRow(row)), null); + return po; + } }