hg merge release-3.1 (merge release3.1 into development)

This commit is contained in:
Carlos Ruiz 2016-10-17 11:31:50 +02:00
commit dbbb2d0022
45 changed files with 345 additions and 171 deletions

View File

@ -0,0 +1,18 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Oct 4, 2016 4:32:10 PM CEST
-- osef
UPDATE AD_Column SET AD_Element_ID=110, AD_Reference_ID=30, ColumnName='AD_Menu_ID', ColumnSQL='Node_ID', Description='Identifies a Menu', FKConstraintType=NULL, FieldLength=22, Help='The Menu identifies a unique Menu. Menus are used to control the display of those screens a user has access to.', IsIdentifier='N', Name='Menu',Updated=TO_DATE('2016-10-04 16:32:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=212589
;
-- Oct 4, 2016 4:32:39 PM CEST
UPDATE AD_Field SET EntityType='D',Updated=TO_DATE('2016-10-04 16:32:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=204112
;
-- Oct 4, 2016 4:32:43 PM CEST
UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2016-10-04 16:32:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=212589
;
SELECT register_migration_script('201610041640_IDEMPIERE-3000_fix.sql') FROM dual
;

View File

@ -0,0 +1,15 @@
-- Oct 4, 2016 4:32:10 PM CEST
-- osef
UPDATE AD_Column SET AD_Element_ID=110, AD_Reference_ID=30, ColumnName='AD_Menu_ID', ColumnSQL='Node_ID', Description='Identifies a Menu', FKConstraintType=NULL, FieldLength=22, Help='The Menu identifies a unique Menu. Menus are used to control the display of those screens a user has access to.', IsIdentifier='N', Name='Menu',Updated=TO_TIMESTAMP('2016-10-04 16:32:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=212589
;
-- Oct 4, 2016 4:32:39 PM CEST
UPDATE AD_Field SET EntityType='D',Updated=TO_TIMESTAMP('2016-10-04 16:32:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=204112
;
-- Oct 4, 2016 4:32:43 PM CEST
UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2016-10-04 16:32:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=212589
;
SELECT register_migration_script('201610041640_IDEMPIERE-3000_fix.sql') FROM dual
;

View File

@ -53,6 +53,14 @@ public class DocLine_Allocation extends DocLine
m_DiscountAmt = line.getDiscountAmt();
m_WriteOffAmt = line.getWriteOffAmt();
m_OverUnderAmt = line.getOverUnderAmt();
// Get Payment Conversion Rate
if (line.getC_Payment_ID() != 0)
{
MPayment payment = new MPayment (doc.getCtx(), line.getC_Payment_ID(), doc.getTrxName());
int C_ConversionType_ID = payment.getC_ConversionType_ID();
this.setC_ConversionType_ID(C_ConversionType_ID);
}
} // DocLine_Allocation
private int m_C_Invoice_ID;

View File

@ -100,14 +100,6 @@ public class Doc_AllocationHdr extends Doc
{
MAllocationLine line = lines[i];
DocLine_Allocation docLine = new DocLine_Allocation(line, this);
// Get Payment Conversion Rate
if (line.getC_Payment_ID() != 0)
{
MPayment payment = new MPayment (getCtx(), line.getC_Payment_ID(), getTrxName());
int C_ConversionType_ID = payment.getC_ConversionType_ID();
docLine.setC_ConversionType_ID(C_ConversionType_ID);
}
//
if (log.isLoggable(Level.FINE)) log.fine(docLine.toString());
list.add (docLine);

View File

@ -728,7 +728,7 @@ public final class FactLine extends X_Fact_Acct
Timestamp convDate = getDateAcct();
if ( m_doc instanceof Doc_BankStatement || m_doc instanceof Doc_AllocationHdr )
if ( m_docLine != null && ( m_doc instanceof Doc_BankStatement || m_doc instanceof Doc_AllocationHdr ) )
convDate = m_docLine.getDateConv();

View File

@ -32,10 +32,11 @@ import org.idempiere.fa.util.Util;
*/
public final class DataStatusEvent extends EventObject implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -8126804905593738238L;
private static final long serialVersionUID = -1988674163839245029L;
/**
* Constructor
@ -73,6 +74,10 @@ public final class DataStatusEvent extends EventObject implements Serializable
private int m_changedColumn = -1;
private String m_columnName = null;
// IDEMPIERE-1287:indicate case user just start edit field, want update status of toolbar button (like save button)
// but don't want change anything (ever value of edit field)
private boolean isInitEdit = false;
/** Created */
public Timestamp Created = null;
/** Created By */
@ -352,4 +357,19 @@ public final class DataStatusEvent extends EventObject implements Serializable
e.m_currentRow == m_currentRow;
}
/**
* @return indicate this event is by user start edit this field but not yet complete edit
*/
public boolean isInitEdit() {
return isInitEdit;
}
/**
* @param indicate this event is by user start edit this field but not yet complete edit
*/
public void setIsInitEdit(boolean isInitEdit) {
this.isInitEdit = isInitEdit;
}
} // DataStatusEvent

View File

@ -99,11 +99,12 @@ import org.compiere.util.ValueNamePair;
public class GridTable extends AbstractTableModel
implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -3993077765244392901L;
private static final long serialVersionUID = -4982992333796276205L;
public static final String DATA_REFRESH_MESSAGE = "Refreshed";
public static final String DATA_UPDATE_COPIED_MESSAGE = "UpdateCopied";
public static final String DATA_INSERTED_MESSAGE = "Inserted";
@ -1247,11 +1248,11 @@ public class GridTable extends AbstractTableModel
*/
public final void setValueAt (Object value, int row, int col)
{
setValueAt (value, row, col, false);
setValueAt (value, row, col, false, false);
} // setValueAt
/**
* Set Value in data and update GridField.
* call {@link #setValueAt(Object, int, int, boolean, boolean)} with isInitEdit = false
* (called directly or from JTable.editingStopped())
*
* @param value value to assign to cell
@ -1260,6 +1261,21 @@ public class GridTable extends AbstractTableModel
* @param force force setting new value
*/
public final void setValueAt (Object value, int row, int col, boolean force)
{
setValueAt (value, row, col, force, false);
} // setValueAt
/**
* Set Value in data and update GridField.
* (called directly or from JTable.editingStopped())
*
* @param value value to assign to cell
* @param row row index of cell
* @param col column index of cell
* @param force force setting new value
* @param isInitEdit indicate event rise by start edit a field. just want change status to edit, don't change anything else
*/
public final void setValueAt (Object value, int row, int col, boolean force, boolean isInitEdit)
{
// Can we edit?
if (!m_open || m_readOnly // not accessible
@ -1275,7 +1291,7 @@ public class GridTable extends AbstractTableModel
// Has anything changed?
Object oldValue = getValueAt(row, col);
if (!force && !isValueChanged(oldValue, value) )
if (!force && !isInitEdit && !isValueChanged(oldValue, value) )
{
if (log.isLoggable(Level.FINEST)) log.finest("r=" + row + " c=" + col + " - New=" + value + "==Old=" + oldValue + " - Ignored");
return;
@ -1321,6 +1337,7 @@ public class GridTable extends AbstractTableModel
field.setValue(value, m_inserting);
// inform
DataStatusEvent evt = createDSE();
evt.setIsInitEdit(isInitEdit);
evt.setChangedColumn(col, field.getColumnName());
fireDataStatusChanged(evt);
} // setValueAt

View File

@ -498,6 +498,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -633,6 +633,7 @@ public class MAssetAddition extends X_A_Asset_Addition
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -173,6 +173,7 @@ implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -128,6 +128,7 @@ implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -191,6 +191,7 @@ implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -373,6 +373,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -441,6 +441,7 @@ public class MCash extends X_C_Cash implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -23,6 +23,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
@ -690,78 +691,114 @@ public class MCost extends X_M_Cost
*/
protected static void create (MProduct product)
{
s_log.config(product.getName());
s_log.config(product.getName());
// Cost Elements
MCostElement[] ces = MCostElement.getCostingMethods(product);
MCostElement ce = null;
for (MCostElement element : ces) {
if (X_M_CostElement.COSTINGMETHOD_StandardCosting.equals(element.getCostingMethod()))
{
ce = element;
break;
}
}
if (ce == null)
// Cost Elements
MCostElement[] ces = MCostElement.getCostingMethods(product);
MCostElement ce = null;
for (MCostElement element : ces) {
if (X_M_CostElement.COSTINGMETHOD_StandardCosting.equals(element.getCostingMethod()))
{
s_log.fine("No Standard Costing in System");
return;
ce = element;
break;
}
}
if (ce == null)
{
s_log.fine("No Standard Costing in System");
return;
}
MAcctSchema[] mass = MAcctSchema.getClientAcctSchema(product.getCtx(),
product.getAD_Client_ID(), product.get_TrxName());
MOrg[] orgs = null;
MAcctSchema[] mass = MAcctSchema.getClientAcctSchema(product.getCtx(),
product.getAD_Client_ID(), product.get_TrxName());
MOrg[] orgs = null;
int M_ASI_ID = 0; // No Attribute
for (MAcctSchema as : mass)
int M_ASI_ID = 0; // No Attribute
for (MAcctSchema as : mass)
{
String cl = product.getCostingLevel(as);
// Create Std Costing
if (MAcctSchema.COSTINGLEVEL_Client.equals(cl))
{
String cl = product.getCostingLevel(as);
// Create Std Costing
if (MAcctSchema.COSTINGLEVEL_Client.equals(cl))
{
MCost cost = MCost.get (product, M_ASI_ID,
as, 0, ce.getM_CostElement_ID(), product.get_TrxName());
if (cost.is_new())
{
if (cost.save()) {
if (s_log.isLoggable(Level.CONFIG)) s_log.config("Std.Cost for " + product.getName()
+ " - " + as.getName());
} else {
s_log.warning("Not created: Std.Cost for " + product.getName()
+ " - " + as.getName());
}
}
}
else if (MAcctSchema.COSTINGLEVEL_Organization.equals(cl))
createCostingRecord(product, M_ASI_ID, as, 0,ce.getM_CostElement_ID() );
}
else if (MAcctSchema.COSTINGLEVEL_Organization.equals(cl))
{
if (as.getAD_OrgOnly_ID() > 0 && MOrg.get(product.getCtx(), as.getAD_OrgOnly_ID()).isSummary())
{
if (orgs == null)
orgs = MOrg.getOfClient(product);
for (MOrg o : orgs)
{
MCost cost = MCost.get (product, M_ASI_ID,
as, o.getAD_Org_ID(), ce.getM_CostElement_ID(), product.get_TrxName());
if (cost.is_new())
{
if (cost.save()) {
if (s_log.isLoggable(Level.CONFIG)) s_log.config("Std.Cost for " + product.getName()
+ " - " + o.getName()
+ " - " + as.getName());
} else {
s_log.warning("Not created: Std.Cost for " + product.getName()
+ " - " + o.getName()
+ " - " + as.getName());
}
}
} // for all orgs
MClient client = MClient.get(product.getCtx(), product.getAD_Client_ID());
MClientInfo ci = client.getInfo();
MTree vTree = new MTree (product.getCtx(), ci.getAD_Tree_Org_ID(), false, true, true, product.get_TrxName());
MTreeNode root = vTree.getRoot();
createForChildOrg(root, product, as, M_ASI_ID, ce, false);
}
else
{
s_log.warning("Not created: Std.Cost for " + product.getName()
+ " - Costing Level on Batch/Lot");
if (orgs == null)
orgs = MOrg.getOfClient(product);
for (MOrg o : orgs)
{
if (o.isSummary())
continue;
if (as.getAD_OrgOnly_ID() == o.getAD_Org_ID() || as.getAD_OrgOnly_ID() == 0)
{
createCostingRecord(product, M_ASI_ID, as, o.getAD_Org_ID(), ce.getM_CostElement_ID() );
}
}
}
} // accounting schema loop
}
else
{
s_log.warning("Not created: Std.Cost for " + product.getName()
+ " - Costing Level on Batch/Lot");
}// accounting schema loop
}
} // create
private static void createForChildOrg(MTreeNode root, MProduct product, MAcctSchema as, int M_ASI_ID, MCostElement ce, boolean found)
{
int parentId = root.getNode_ID();
if (!found)
found = (parentId == as.getAD_OrgOnly_ID());
Enumeration<?> nodeEnum = root.children();
MTreeNode child = null;
while(nodeEnum.hasMoreElements())
{
child = (MTreeNode)nodeEnum.nextElement();
if (child != null && child.getChildCount() > 0)
{
createForChildOrg(child, product, as, M_ASI_ID, ce, found);
}
else if (found)
{
int orgId = child.getNode_ID();
MOrg org = MOrg.get(product.getCtx(), orgId);
if (!org.isSummary())
createCostingRecord(product, M_ASI_ID, as, orgId, ce.getM_CostElement_ID());
}
}
}
private static void createCostingRecord(MProduct product,int M_ASI_ID, MAcctSchema as, int AD_Org_ID, int M_CostElement_ID) {
MCost cost = MCost.get (product, M_ASI_ID,
as, AD_Org_ID, M_CostElement_ID, product.get_TrxName());
if (cost.is_new())
{
if (cost.save()) {
if (s_log.isLoggable(Level.CONFIG)) s_log.config("Std.Cost for " + product.getName()
+ " - " + as.getName());
} else {
s_log.warning("Not created: Std.Cost for " + product.getName()
+ " - " + as.getName());
}
}
}
/**
* Delete standard Costing records for Product
* @param product product

View File

@ -236,6 +236,7 @@ implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -1251,6 +1251,7 @@ public class MInOut extends X_M_InOut implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -384,6 +384,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -418,6 +418,7 @@ public class MInventory extends X_M_Inventory implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -1696,6 +1696,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -594,6 +594,7 @@ public class MJournal extends X_GL_Journal implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -434,6 +434,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -386,6 +386,7 @@ public class MMovement extends X_M_Movement implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -365,6 +365,7 @@ public class MMovementConfirm extends X_M_MovementConfirm implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -1885,6 +1885,7 @@ public class MOrder extends X_C_Order implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -1938,6 +1938,7 @@ public class MPayment extends X_C_Payment
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -92,6 +92,7 @@ public class MProduction extends X_M_Production implements DocAction {
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -426,6 +426,7 @@ public class MRMA extends X_M_RMA implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -327,6 +327,7 @@ public class MRequisition extends X_M_Requisition implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -377,6 +377,7 @@ public class MTimeExpense extends X_S_TimeExpense implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -2084,6 +2084,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
}
}
public void cleanTempObj (){
m_layout = null;
}
/**
* store info of report column,
* now just use index to create css selector, but for later maybe will construct a complex class name

View File

@ -1509,7 +1509,10 @@ public class TableElement extends PrintElement
String[] lines = Pattern.compile("\n", Pattern.MULTILINE).split(str);
for (int lineNo = 0; lineNo < lines.length; lineNo++)
{
aString = new AttributedString(lines[lineNo]);
String thisLine = lines[lineNo];
if (thisLine.length() == 0)
thisLine = " ";
aString = new AttributedString(thisLine);
aString.addAttribute(TextAttribute.FONT, getFont(row, col));
if (isView && printItems[index] instanceof NamePair) // ID
{
@ -1521,7 +1524,7 @@ public class TableElement extends PrintElement
//
iter = aString.getIterator();
boolean fastDraw = LayoutEngine.s_FASTDRAW;
if (fastDraw && !isView && !Util.is8Bit(lines[lineNo]))
if (fastDraw && !isView && !Util.is8Bit(thisLine))
fastDraw = false;
measurer = new LineBreakMeasurer(iter, g2D.getFontRenderContext());
while (measurer.getPosition() < iter.getEndIndex()) // print element

View File

@ -212,6 +212,7 @@ public class DocActionTemplate extends PO implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -951,6 +951,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
if (!m_justPrepared)
{
String status = prepareIt();
m_justPrepared = false;
if (!DocAction.STATUS_InProgress.equals(status))
return status;
}

View File

@ -17,12 +17,8 @@
package org.adempiere.webui;
import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@ -45,7 +41,6 @@ import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.BrowserToken;
import org.adempiere.webui.util.UserPreference;
import org.compiere.model.MMenu;
import org.compiere.model.MRole;
import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
@ -54,7 +49,6 @@ import org.compiere.model.MTable;
import org.compiere.model.MUser;
import org.compiere.model.MUserPreference;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Language;
import org.compiere.util.Msg;
@ -85,7 +79,6 @@ import org.zkoss.zul.Window;
*/
public class AdempiereWebUI extends Window implements EventListener<Event>, IWebClient
{
/**
*
*/
@ -290,7 +283,6 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Env.setContext(ctx, "#LocalHttpAddr", localHttpAddr.toString());
Clients.response(new AuScript("zAu.cmd0.clearBusy()"));
automaticOpen();
processParameters();
}
@ -550,69 +542,4 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
}
return uploadSetting.toString();
}
int getMenuID()
{
int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());
int AD_Tree_ID = DB.getSQLValue(null,
"SELECT COALESCE(r.AD_Tree_Menu_ID, ci.AD_Tree_Menu_ID)"
+ "FROM AD_ClientInfo ci"
+ " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) "
+ "WHERE AD_Role_ID=?", AD_Role_ID);
if (AD_Tree_ID <= 0)
AD_Tree_ID = TREE_MENUPRIMARY; // Menu
return AD_Tree_ID;
}
private void automaticOpen() {
StringBuilder sql = new StringBuilder("SELECT m.Action, COALESCE(m.AD_Window_ID, m.AD_Process_ID, m.AD_Form_ID, m.AD_Workflow_ID, m.AD_Task_ID, AD_InfoWindow_ID) ")
.append(" FROM AD_TreeBar tb")
.append(" INNER JOIN AD_Menu m ON (tb.Node_ID = m.AD_Menu_ID)")
.append(" WHERE tb.AD_Tree_ID = ").append(getMenuID())
.append(" AND tb.AD_User_ID = ").append(Env.getAD_User_ID(Env.getCtx()))
.append(" AND tb.IsActive = 'Y' AND tb.LoginOpenSeqNo > 0")
.append(" ORDER BY tb.LoginOpenSeqNo");
List<List<Object>> rows = DB.getSQLArrayObjectsEx(null, sql.toString());
if (rows != null && rows.size() > 0) {
for (List<Object> row : rows) {
String action = (String) row.get(0);
int recordID = ((BigDecimal) row.get(1)).intValue();
if (action.equals(MMenu.ACTION_Form)) {
Boolean access = MRole.getDefault().getFormAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openForm(recordID);
}
else if (action.equals(MMenu.ACTION_Info)) {
Boolean access = MRole.getDefault().getInfoAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openInfo(recordID);
}
else if (action.equals(MMenu.ACTION_Process) || action.equals(MMenu.ACTION_Report)) {
Boolean access = MRole.getDefault().getProcessAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openProcessDialog(recordID, DB.getSQLValueStringEx(null, "SELECT IsSOTrx FROM AD_Menu WHERE AD_Menu_ID = ?", recordID).equals("Y"));
}
else if (action.equals(MMenu.ACTION_Task)) {
Boolean access = MRole.getDefault().getTaskAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openTask(recordID);
}
else if (action.equals(MMenu.ACTION_Window)) {
Boolean access = MRole.getDefault().getWindowAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openWindow(recordID, null);
}
else if (action.equals(MMenu.ACTION_WorkFlow)) {
Boolean access = MRole.getDefault().getWorkflowAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openWorkflow(recordID);
}
}
}
}
}

View File

@ -1077,7 +1077,8 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
}
else if (treePanel != null && event.getTarget() == treePanel.getTree()) {
Treeitem item = treePanel.getTree().getSelectedItem();
navigateTo((DefaultTreeNode<MTreeNode>)item.getValue());
if (item.getValue() != null)
navigateTo((DefaultTreeNode<MTreeNode>)item.getValue());
}
else if (ON_DEFER_SET_SELECTED_NODE.equals(event.getName())) {
removeAttribute(ON_DEFER_SET_SELECTED_NODE_ATTR);
@ -1214,7 +1215,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
public void dataStatusChanged(DataStatusEvent e)
{
//ignore background event
if (Executions.getCurrent() == null) return;
if (Executions.getCurrent() == null || e.isInitEdit()) return;
int col = e.getChangedColumn();
if (logger.isLoggable(Level.CONFIG)) logger.config("(" + gridTab + ") Col=" + col + ": " + e.toString());

View File

@ -1314,7 +1314,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
private String prevdbInfo = "";
/**
* @param e
* @see DataStatusListener#dataStatusChanged(DataStatusEvent)
@ -1347,15 +1346,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
breadCrumb.setStatusDB(dbInfo, e);
String adInfo = e.getAD_Message();
if ( ! prevdbInfo.equals(dbInfo)
&& ( adInfo == null
|| GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
|| GridTable.DATA_REFRESH_MESSAGE.equals(adInfo)
|| GridTable.DATA_INSERTED_MESSAGE.equals(adInfo)
|| GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo)
)
if ( adInfo == null
|| GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
|| GridTable.DATA_REFRESH_MESSAGE.equals(adInfo)
|| GridTable.DATA_INSERTED_MESSAGE.equals(adInfo)
|| GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo)
) {
prevdbInfo = dbInfo;
String prefix = null;
if (dbInfo.contains("*"))
@ -3262,7 +3258,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
Env.setContext(ctx, curWindowNo, "Value", "");
Env.setContext(ctx, curWindowNo, "Name", "");
}
prevdbInfo = "";
}
}

View File

@ -17,7 +17,10 @@
package org.adempiere.webui.desktop;
import static org.compiere.model.SystemIDs.TREE_MENUPRIMARY;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -61,6 +64,7 @@ import org.compiere.Adempiere;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.I_AD_Preference;
import org.compiere.model.MMenu;
import org.compiere.model.MPreference;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
@ -69,6 +73,7 @@ import org.compiere.model.Query;
import org.compiere.model.SystemIDs;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
@ -112,7 +117,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
/**
*
*/
private static final long serialVersionUID = 6775071898539380777L;
private static final long serialVersionUID = 7189914859100400758L;
private static final String IMAGES_UPARROW_PNG = "images/collapse-header.png";
@ -323,6 +328,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
try {
ServerContext.setCurrentInstance(ctx);
renderHomeTab();
automaticOpen(ctx);
} finally {
ServerContext.dispose();
}
@ -892,6 +898,68 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
Clients.response(new AuScript(script));
}
}
int getMenuID()
{
int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());
int AD_Tree_ID = DB.getSQLValue(null,
"SELECT COALESCE(r.AD_Tree_Menu_ID, ci.AD_Tree_Menu_ID)"
+ "FROM AD_ClientInfo ci"
+ " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) "
+ "WHERE AD_Role_ID=?", AD_Role_ID);
if (AD_Tree_ID <= 0)
AD_Tree_ID = TREE_MENUPRIMARY; // Menu
return AD_Tree_ID;
}
private void automaticOpen(Properties ctx) {
StringBuilder sql = new StringBuilder("SELECT m.Action, COALESCE(m.AD_Window_ID, m.AD_Process_ID, m.AD_Form_ID, m.AD_Workflow_ID, m.AD_Task_ID, AD_InfoWindow_ID) ")
.append(" FROM AD_TreeBar tb")
.append(" INNER JOIN AD_Menu m ON (tb.Node_ID = m.AD_Menu_ID)")
.append(" WHERE tb.AD_Tree_ID = ").append(getMenuID())
.append(" AND tb.AD_User_ID = ").append(Env.getAD_User_ID(ctx))
.append(" AND tb.IsActive = 'Y' AND tb.LoginOpenSeqNo > 0")
.append(" ORDER BY tb.LoginOpenSeqNo");
List<List<Object>> rows = DB.getSQLArrayObjectsEx(null, sql.toString());
if (rows != null && rows.size() > 0) {
for (List<Object> row : rows) {
String action = (String) row.get(0);
int recordID = ((BigDecimal) row.get(1)).intValue();
if (action.equals(MMenu.ACTION_Form)) {
Boolean access = MRole.getDefault().getFormAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openForm(recordID);
}
else if (action.equals(MMenu.ACTION_Info)) {
Boolean access = MRole.getDefault().getInfoAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openInfo(recordID);
}
else if (action.equals(MMenu.ACTION_Process) || action.equals(MMenu.ACTION_Report)) {
Boolean access = MRole.getDefault().getProcessAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openProcessDialog(recordID, DB.getSQLValueStringEx(null, "SELECT IsSOTrx FROM AD_Menu WHERE AD_Menu_ID = ?", recordID).equals("Y"));
}
else if (action.equals(MMenu.ACTION_Task)) {
Boolean access = MRole.getDefault().getTaskAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openTask(recordID);
}
else if (action.equals(MMenu.ACTION_Window)) {
Boolean access = MRole.getDefault().getWindowAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openWindow(recordID, null);
}
else if (action.equals(MMenu.ACTION_WorkFlow)) {
Boolean access = MRole.getDefault().getWorkflowAccess(recordID);
if (access != null && access)
SessionManager.getAppDesktop().openWorkflow(recordID);
}
}
}
}
}

View File

@ -73,6 +73,8 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
public static final int MAX_DISPLAY_LENGTH = 35;
public static final String INIT_EDIT_EVENT = "onInitEdit";
protected GridField gridField;
protected GridTab gridTab;
@ -183,7 +185,10 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
/**
* Normal zk component just fire onChange event when user loss focus
* call this method with true value let component fire event when user type first character
* call this method with true value let component fire event when user type first character
*
* remark: editor set true for this method also need handle INIT_EDIT_EVENT to take effect,
* can refer implement at {@link WStringEditor#onEvent(Event)}
* @param isChangeEventWhenEditing
*/
public void setChangeEventWhenEditing (boolean isChangeEventWhenEditing){
@ -291,6 +296,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
component.addEventListener(event, this);
}
component.addEventListener(INIT_EDIT_EVENT, this);
component.setAttribute("idempiere.editor", this);
}

View File

@ -174,16 +174,20 @@ public class WStringEditor extends WEditor implements ContextMenuListener
public void onEvent(Event event)
{
if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()))
boolean isStartEdit = INIT_EDIT_EVENT.equalsIgnoreCase (event.getName());
if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName()) || isStartEdit)
{
String newValue = getComponent().getValue();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
if (!isStartEdit && oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
if (!isStartEdit && oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
changeEvent.setIsInitEdit(isStartEdit);
super.fireValueChange(changeEvent);
oldValue = getComponent().getValue(); // IDEMPIERE-963 - check again the value could be changed by callout
}

View File

@ -45,6 +45,10 @@ public class ValueChangeEvent
* Previous value for property. May be null if not known.
*/
private Object oldValue;
// IDEMPIERE-1287:indicate case user just start edit field, want update status of toolbar button (like save button)
// but don't want change anything (ever value of edit field)
private boolean isInitEdit = false;
public ValueChangeEvent(Object source, String propertyName,
Object oldValue, Object newValue)
@ -74,4 +78,18 @@ public class ValueChangeEvent
{
return source;
}
/**
* @return indicate this event is by user start edit this field but not yet complete edit
*/
public boolean isInitEdit() {
return isInitEdit;
}
/**
* @param indicate this event is by user start edit this field but not yet complete edit
*/
public void setIsInitEdit(boolean isInitEdit) {
this.isInitEdit = isInitEdit;
}
}

View File

@ -448,7 +448,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
isQueryByUser = true;
for (int i = 0; i < identifiers.size(); i++) {
WEditor editor = identifiers.get(i);
editor.setValue(queryValue);
try{
editor.setValue(queryValue);
}catch(Exception ex){
log.log(Level.SEVERE, "error", ex.getCause());
}
testCount(false);
if (m_count > 0) {
break;

View File

@ -123,7 +123,10 @@ public class GridTabDataBinder implements ValueChangeListener {
throw new IllegalArgumentException("Multiple Selection values not available for this field. " + e.getPropertyName());
}
mTable.setValueAt (newValue, row, col);
if (e.isInitEdit())
mTable.setValueAt (newValue, row, col, false, true);
else
mTable.setValueAt (newValue, row, col);
// Force Callout
if ( e.getPropertyName().equals("S_ResourceAssignment_ID") )
{

View File

@ -532,6 +532,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
reportLink.setLabel(media.getName());
revalidate();
} finally {
if (m_reportEngine != null)
m_reportEngine.cleanTempObj();
hideBusyDialog();
future = null;
}

View File

@ -24,6 +24,12 @@ Copyright (C) 2007 Ashley G Ramdass.
// just sent fake event when control is textfield and value is not yet sync to server
if (wgt.$instanceof(zul.inp.Textbox) && wgt.$n().value != wgt.getText())
zAu.send(new zk.Event(zk.Widget.$(wgt), 'onChange',{"value":wgt.$n().value}));
},
fireOnInitEdit: function (wgt) {
// sent even to indicate field is start edit, this event sent new value to server but now don't use this data.
if (wgt.$instanceof(zul.inp.Textbox))
zAu.send(new zk.Event(zk.Widget.$(wgt), 'onInitEdit',{"value":wgt.$n().value}));
}
});
});
@ -74,7 +80,8 @@ Copyright (C) 2007 Ashley G Ramdass.
var isEditting = winLayoutWg.get ("isEditting");
// winLayoutWg should cache to improve perfomance
if (isEditting == "false"){
id.zk.Extend.fakeOnchange (this);//fire change event to move to edit
winLayoutWg.set ("isEditting", "true");
id.zk.Extend.fireOnInitEdit (this);//fire change event to move to edit
}
}
}