Merge with 953e38a41ffdc47e8890daf31c1ec60ff8cf3b05

This commit is contained in:
Heng Sin Low 2012-07-01 10:18:31 +08:00
commit 1ca7cd5112
9 changed files with 65 additions and 41 deletions

View File

@ -107,7 +107,7 @@ 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"; 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); e.Record_ID = getValue(m_keyColumnName);
// Info // Info
StringBuffer info = new StringBuffer(getTableName()); 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 // We have a key column
if (m_keyColumnName != null && m_keyColumnName.length() > 0) if (m_keyColumnName != null && m_keyColumnName.length() > 0)
{ {
info.append(" - ") info.append("\n ")
.append(m_keyColumnName).append("=").append(e.Record_ID); .append(m_keyColumnName).append("=").append(e.Record_ID);
} }
else // we have multiple parents 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++) for (int i = 0; i < m_parents.size(); i++)
{ {
String keyCol = (String)m_parents.get(i); String keyCol = (String)m_parents.get(i);
info.append(" - ") info.append(i == 0 ? "\n " : " - ")
.append(keyCol).append("=").append(getValue(keyCol)); .append(keyCol).append("=").append(getValue(keyCol));
} }
} }

View File

@ -90,9 +90,9 @@ public class GridTable extends AbstractTableModel
implements Serializable, SystemIDs implements Serializable, SystemIDs
{ {
/** /**
* generated *
*/ */
private static final long serialVersionUID = 7799823493936826600L; private static final long serialVersionUID = 4648364477309024202L;
public static final String DATA_REFRESH_MESSAGE = "Refreshed"; public static final String DATA_REFRESH_MESSAGE = "Refreshed";
@ -2568,13 +2568,7 @@ public class GridTable extends AbstractTableModel
MSort sort = (MSort)m_sort.get(row); MSort sort = (MSort)m_sort.get(row);
Object[] rowData = getDataAtRow(row); Object[] rowData = getDataAtRow(row);
// //
MTable table = MTable.get (m_ctx, m_AD_Table_ID); PO po = getPO(row);
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);
// Delete via PO // Delete via PO
if (po != null) if (po != null)
@ -3699,4 +3693,15 @@ public class GridTable extends AbstractTableModel
return bChanged; 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;
}
} }

View File

@ -2112,6 +2112,8 @@ public class MInOut extends X_M_InOut implements DocAction
// Void Confirmations // Void Confirmations
setDocStatus(DOCSTATUS_Reversed); // need to set & save docstatus to be able to check it in MInOutConfirm.voidIt() setDocStatus(DOCSTATUS_Reversed); // need to set & save docstatus to be able to check it in MInOutConfirm.voidIt()
saveEx(); saveEx();
//FR1948157
this.setReversal_ID(reversal.getM_InOut_ID());
voidConfirmations(); voidConfirmations();
// After reverseCorrect // After reverseCorrect
@ -2120,8 +2122,6 @@ public class MInOut extends X_M_InOut implements DocAction
return false; return false;
m_processMsg = reversal.getDocumentNo(); m_processMsg = reversal.getDocumentNo();
//FR1948157
this.setReversal_ID(reversal.getM_InOut_ID());
setProcessed(true); setProcessed(true);
setDocStatus(DOCSTATUS_Reversed); // may come from void setDocStatus(DOCSTATUS_Reversed); // may come from void
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);

View File

@ -116,7 +116,7 @@ public class MRecentItem extends X_AD_RecentItem
} }
// //
MRecentItem retValue = null; 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; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -185,10 +185,10 @@ public class MRecentItem extends X_AD_RecentItem
int maxri = MSysConfig.getIntValue("RecentItems_MaxSaved", 50, AD_Client_ID); int maxri = MSysConfig.getIntValue("RecentItems_MaxSaved", 50, AD_Client_ID);
if (maxri < 0) if (maxri < 0)
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) { if (cntri > maxri) {
int cntdel = 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; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -226,7 +226,7 @@ public class MRecentItem extends X_AD_RecentItem
} }
public static List<MRecentItem> getFromUser(Properties ctx, int AD_User_ID) { public static List<MRecentItem> getFromUser(Properties ctx, int AD_User_ID) {
List<MRecentItem> ris = new Query(ctx, MRecentItem.Table_Name, "AD_User_ID=?", null) List<MRecentItem> ris = new Query(ctx, MRecentItem.Table_Name, "NVL(AD_User_ID,0)=?", null)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setClient_ID() .setClient_ID()
.setParameters(AD_User_ID) .setParameters(AD_User_ID)

View File

@ -444,7 +444,7 @@ public final class VPanel extends CTabbedPane
{ {
CLabel label = new CLabel(fieldGroup, CLabel.LEADING); CLabel label = new CLabel(fieldGroup, CLabel.LEADING);
label.setFont(AdempierePLAF.getFont_Label().deriveFont(Font.BOLDITALIC, AdempierePLAF.getFont_Label().getSize2D())); 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"); m_main.add(new JSeparator(), "newline, spanx, growx");
// reset // reset
} }

View File

@ -57,7 +57,7 @@ public class VMemo extends CTextArea
/** /**
* *
*/ */
private static final long serialVersionUID = -1589654941310687511L; private static final long serialVersionUID = -7168406072766858933L;
/** /**
* Mouse Listener * Mouse Listener
@ -156,7 +156,7 @@ public class VMemo extends CTextArea
private String m_columnName; private String m_columnName;
private String m_oldText = ""; private String m_oldText = "";
private boolean m_firstChange; private volatile boolean m_setting = false;
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(VMemo.class); private static CLogger log = CLogger.getCLogger(VMemo.class);
@ -167,7 +167,8 @@ public class VMemo extends CTextArea
public void setValue(Object value) public void setValue(Object value)
{ {
super.setValue(value); super.setValue(value);
m_firstChange = true; if (m_setting)
return;
// Always position Top // Always position Top
setCaretPosition(0); setCaretPosition(0);
} // setValue } // setValue
@ -266,14 +267,13 @@ public class VMemo extends CTextArea
*/ */
public void focusLost (FocusEvent e) public void focusLost (FocusEvent e)
{ {
// Indicate Change m_setting = true;
log.fine( "focusLost");
try try
{ {
String text = getText(); fireVetoableChange(m_columnName, m_oldText, getText());
fireVetoableChange(m_columnName, text, null); // No data committed - done when focus lost !!!
} }
catch (PropertyVetoException pve) {} catch (PropertyVetoException pve) {}
m_setting = false;
} // focusLost } // focusLost
/*************************************************************************/ /*************************************************************************/

View File

@ -130,7 +130,7 @@ public class Viewer extends CFrame
/** /**
* *
*/ */
private static final long serialVersionUID = 7306392362119021781L; private static final long serialVersionUID = 3453340777183200393L;
/** /**
* @deprecated * @deprecated
@ -451,9 +451,14 @@ public class Viewer extends CFrame
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
} }
// 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(" **"); StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(m_ctx, "NewReport")).append(" **");
KeyNamePair pp = new KeyNamePair(-1, sb.toString()); KeyNamePair pp = new KeyNamePair(-1, sb.toString());
comboReport.addItem(pp); comboReport.addItem(pp);
}
if (selectValue != null) if (selectValue != null)
comboReport.setSelectedItem(selectValue); comboReport.setSelectedItem(selectValue);
comboReport.addActionListener(this); comboReport.addActionListener(this);

View File

@ -110,8 +110,8 @@ public final class UserPreference implements Serializable {
* save user preference * save user preference
*/ */
public void savePreference() { public void savePreference() {
if (m_AD_User_ID > 0) { 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); 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++) { for (int i = 0; i < PROPERTIES.length; i++) {
String attribute = PROPERTIES[i]; String attribute = PROPERTIES[i];
String value = props.getProperty(attribute); String value = props.getProperty(attribute);
@ -137,11 +137,11 @@ public final class UserPreference implements Serializable {
* @param AD_User_ID * @param AD_User_ID
*/ */
public void loadPreference(int 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; m_AD_User_ID = AD_User_ID;
props = new Properties(); 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++) { for (int i = 0; i < PROPERTIES.length; i++) {
String attribute = PROPERTIES[i]; String attribute = PROPERTIES[i];

View File

@ -77,13 +77,13 @@ import org.zkoss.zk.ui.ext.render.DynamicMedia;
import org.zkoss.zul.A; import org.zkoss.zul.A;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.North;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Filedownload; import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Iframe; import org.zkoss.zul.Iframe;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
import org.zkoss.zul.North;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
import org.zkoss.zul.South; import org.zkoss.zul.South;
import org.zkoss.zul.Tab; import org.zkoss.zul.Tab;
@ -115,7 +115,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
/** /**
* *
*/ */
private static final long serialVersionUID = -7554542090648903080L; private static final long serialVersionUID = 2079827289589862794L;
/** Window No */ /** Window No */
private int m_WindowNo = -1; private int m_WindowNo = -1;
@ -547,9 +547,14 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
} }
// 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(" **"); StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(Env.getCtx(), "NewReport")).append(" **");
KeyNamePair pp = new KeyNamePair(-1, sb.toString()); KeyNamePair pp = new KeyNamePair(-1, sb.toString());
comboReport.appendItem(pp.getName(), pp.getKey()); comboReport.appendItem(pp.getName(), pp.getKey());
}
comboReport.addEventListener(Events.ON_SELECT, this); comboReport.addEventListener(Events.ON_SELECT, this);
} // fillComboReport } // fillComboReport