diff --git a/migration/i3.1/oracle/201610041640_IDEMPIERE-3000_fix.sql b/migration/i3.1/oracle/201610041640_IDEMPIERE-3000_fix.sql new file mode 100644 index 0000000000..7fa72dcc14 --- /dev/null +++ b/migration/i3.1/oracle/201610041640_IDEMPIERE-3000_fix.sql @@ -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 +; \ No newline at end of file diff --git a/migration/i3.1/postgresql/201610041640_IDEMPIERE-3000_fix.sql b/migration/i3.1/postgresql/201610041640_IDEMPIERE-3000_fix.sql new file mode 100644 index 0000000000..6335ef2bae --- /dev/null +++ b/migration/i3.1/postgresql/201610041640_IDEMPIERE-3000_fix.sql @@ -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 +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/acct/DocLine_Allocation.java b/org.adempiere.base/src/org/compiere/acct/DocLine_Allocation.java index d61a4b5082..0b9498600f 100644 --- a/org.adempiere.base/src/org/compiere/acct/DocLine_Allocation.java +++ b/org.adempiere.base/src/org/compiere/acct/DocLine_Allocation.java @@ -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; diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java index 278921afa8..6934a93025 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java @@ -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); diff --git a/org.adempiere.base/src/org/compiere/acct/FactLine.java b/org.adempiere.base/src/org/compiere/acct/FactLine.java index 76890e035f..45c2bc6318 100644 --- a/org.adempiere.base/src/org/compiere/acct/FactLine.java +++ b/org.adempiere.base/src/org/compiere/acct/FactLine.java @@ -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(); diff --git a/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java b/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java index 0327477f1a..e0a164aa76 100644 --- a/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java +++ b/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index f9c094ccb2..2324809613 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java index 775f30908e..6041a67c53 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MAssetAddition.java b/org.adempiere.base/src/org/compiere/model/MAssetAddition.java index d598853e64..a8d70bdb53 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetAddition.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetAddition.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java b/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java index 6e28a1a77b..050311f78e 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetDisposed.java @@ -173,6 +173,7 @@ implements DocAction if (!m_justPrepared) { String status = prepareIt(); + m_justPrepared = false; if (!DocAction.STATUS_InProgress.equals(status)) return status; } diff --git a/org.adempiere.base/src/org/compiere/model/MAssetReval.java b/org.adempiere.base/src/org/compiere/model/MAssetReval.java index 0cebc627fd..a19cb00245 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetReval.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetReval.java @@ -128,6 +128,7 @@ implements DocAction if (!m_justPrepared) { String status = prepareIt(); + m_justPrepared = false; if (!DocAction.STATUS_InProgress.equals(status)) return status; } diff --git a/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java b/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java index 93adfcd8ab..fd67fe9689 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetTransfer.java @@ -191,6 +191,7 @@ implements DocAction if (!m_justPrepared) { String status = prepareIt(); + m_justPrepared = false; if (!DocAction.STATUS_InProgress.equals(status)) return status; } diff --git a/org.adempiere.base/src/org/compiere/model/MBankStatement.java b/org.adempiere.base/src/org/compiere/model/MBankStatement.java index 4002743401..65cb83022f 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankStatement.java +++ b/org.adempiere.base/src/org/compiere/model/MBankStatement.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MCash.java b/org.adempiere.base/src/org/compiere/model/MCash.java index 5c9bee25ef..a8d2e162fb 100644 --- a/org.adempiere.base/src/org/compiere/model/MCash.java +++ b/org.adempiere.base/src/org/compiere/model/MCash.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index 9b4b65577e..0168eeb707 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java b/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java index 10995f7dfc..0fc1f397b4 100644 --- a/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java +++ b/org.adempiere.base/src/org/compiere/model/MDepreciationEntry.java @@ -236,6 +236,7 @@ implements DocAction if (!m_justPrepared) { String status = prepareIt(); + m_justPrepared = false; if (!DocAction.STATUS_InProgress.equals(status)) return status; } diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index ab20a57dfd..8eb831f898 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MInOutConfirm.java b/org.adempiere.base/src/org/compiere/model/MInOutConfirm.java index 33c879a201..294d346eed 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutConfirm.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutConfirm.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index 553dde6538..201bf391f3 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 4a8d068279..9925a808c5 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index ca05943263..14f5d2be77 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index 69c64251f2..fc3beaf415 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index 1599cb2dc1..35b5c4592c 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java b/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java index 062689eb32..0d30f27fb9 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java +++ b/org.adempiere.base/src/org/compiere/model/MMovementConfirm.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 18c98a4014..8b88601987 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 536b5a55e2..a8844dc757 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MProduction.java b/org.adempiere.base/src/org/compiere/model/MProduction.java index a4abcb63e0..30402d564e 100644 --- a/org.adempiere.base/src/org/compiere/model/MProduction.java +++ b/org.adempiere.base/src/org/compiere/model/MProduction.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MRMA.java b/org.adempiere.base/src/org/compiere/model/MRMA.java index f537eaa4d9..c15742b3f1 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMA.java +++ b/org.adempiere.base/src/org/compiere/model/MRMA.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MRequisition.java b/org.adempiere.base/src/org/compiere/model/MRequisition.java index cc743f2c7a..81d38bfeb8 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisition.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisition.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/model/MTimeExpense.java b/org.adempiere.base/src/org/compiere/model/MTimeExpense.java index 7eb872a930..d17c0d690e 100644 --- a/org.adempiere.base/src/org/compiere/model/MTimeExpense.java +++ b/org.adempiere.base/src/org/compiere/model/MTimeExpense.java @@ -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; } diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index 0de7d5fcbc..330e3ee69e 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java index 884e88bafd..d49fd59123 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java +++ b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java b/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java index de527dd5a0..1773484983 100644 --- a/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java +++ b/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java @@ -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; } diff --git a/org.adempiere.base/src/org/eevolution/model/MDDOrder.java b/org.adempiere.base/src/org/eevolution/model/MDDOrder.java index 60b5e26582..abc0e43dd1 100644 --- a/org.adempiere.base/src/org/eevolution/model/MDDOrder.java +++ b/org.adempiere.base/src/org/eevolution/model/MDDOrder.java @@ -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; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 02efbb3d15..c1b7e3c07a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -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, IWebClient { - /** * */ @@ -290,7 +283,6 @@ public class AdempiereWebUI extends Window implements EventListener, 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, 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> rows = DB.getSQLArrayObjectsEx(null, sql.toString()); - if (rows != null && rows.size() > 0) { - for (List 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); - } - } - } - } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 85fbd917b0..d40eeaa6bc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -1077,7 +1077,8 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer } else if (treePanel != null && event.getTarget() == treePanel.getTree()) { Treeitem item = treePanel.getTree().getSelectedItem(); - navigateTo((DefaultTreeNode)item.getValue()); + if (item.getValue() != null) + navigateTo((DefaultTreeNode)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()); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 3c07c9df58..96f6b8d552 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -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 = ""; } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index 1222803584..98cb2cec18 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -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> rows = DB.getSQLArrayObjectsEx(null, sql.toString()); + if (rows != null && rows.size() > 0) { + for (List 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); + } + } + } + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java index d897fde824..c5b55aeec1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java @@ -73,6 +73,8 @@ public abstract class WEditor implements EventListener, 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, 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, PropertyChangeLis component.addEventListener(event, this); } + component.addEventListener(INIT_EDIT_EVENT, this); component.setAttribute("idempiere.editor", this); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java index 2e0ffa7fdb..d54e5dc7dc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java @@ -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 } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/ValueChangeEvent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/ValueChangeEvent.java index 8aeac44ca8..62fd08e386 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/ValueChangeEvent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/event/ValueChangeEvent.java @@ -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; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java index f737961748..c2ab38daf9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java @@ -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; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java index 19a2a6b905..e03daa84fb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java @@ -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") ) { 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 d1a6f03d74..ded2841b57 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 @@ -532,6 +532,8 @@ public class ZkReportViewer extends Window implements EventListener, ITab reportLink.setLabel(media.getName()); revalidate(); } finally { + if (m_reportEngine != null) + m_reportEngine.cleanTempObj(); hideBusyDialog(); future = null; } diff --git a/org.adempiere.ui.zk/index.zul b/org.adempiere.ui.zk/index.zul index d517f2cc99..cb93c1a172 100644 --- a/org.adempiere.ui.zk/index.zul +++ b/org.adempiere.ui.zk/index.zul @@ -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 } } }