From 1c6b9399eff44f490fc254829c8ced18fbaa2d68 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 8 Apr 2015 18:08:32 -0500 Subject: [PATCH 01/12] IDEMPIERE-2555 Another leak found in CommissionCalc --- .../src/org/compiere/process/CommissionCalc.java | 1 - 1 file changed, 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/CommissionCalc.java b/org.adempiere.base.process/src/org/compiere/process/CommissionCalc.java index 3b945457d5..d35364b340 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CommissionCalc.java +++ b/org.adempiere.base.process/src/org/compiere/process/CommissionCalc.java @@ -376,7 +376,6 @@ public class CommissionCalc extends SvrProcess if (!cd.save()) throw new IllegalArgumentException ("CommissionCalc - Detail Not saved"); } - pstmt = null; } catch (Exception e) { From 68d8fadf9802c4e1b15c71c436db4497ee4d7136 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 9 Apr 2015 10:41:36 -0500 Subject: [PATCH 02/12] IDEMPIERE-2564 Mismatch between Created (Attribute Set Instance) and Date Material Policy (Storage On Hand) --- .../src/org/compiere/model/MMovement.java | 14 ++++++-------- .../src/org/compiere/model/MStorageOnHand.java | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index 2614d6a421..31bc0ef42f 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -435,7 +435,8 @@ public class MMovement extends X_M_Movement implements DocAction M_AttributeSetInstanceTo_ID = ma.getM_AttributeSetInstance_ID(); } //Update Storage - if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), + MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); + if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), line.getM_LocatorTo_ID(), line.getM_Product_ID(), M_AttributeSetInstanceTo_ID, @@ -473,17 +474,13 @@ public class MMovement extends X_M_Movement implements DocAction // Fallback - We have ASI if (trxFrom == null) { - I_M_AttributeSetInstance asi = line.getM_AttributeSetInstance(); - Timestamp dateMPolicy= getMovementDate(); - dateMPolicy = asi.getCreated(); - MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName()); //Update Storage if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), - line.getMovementQty().negate(),dateMPolicy, get_TrxName())) + line.getMovementQty().negate(), null, get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; @@ -491,11 +488,12 @@ public class MMovement extends X_M_Movement implements DocAction } //Update Storage - if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), + MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); + if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), line.getM_LocatorTo_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstanceTo_ID(), - line.getMovementQty(),dateMPolicy, get_TrxName())) + line.getMovementQty(), null, get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index 997afc20c6..4f0e00b5b6 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -713,7 +713,7 @@ public class MStorageOnHand extends X_M_StorageOnHand if (M_AttributeSetInstance_ID > 0) { MAttributeSetInstance asi = new MAttributeSetInstance(ctx, M_AttributeSetInstance_ID, trxName); - dateMPolicy = asi.getCreated(); + dateMPolicy = asi.getCreated(); } else { From 60c119b30434d1ffeb10ca292d5209b61c09453f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 9 Apr 2015 12:11:28 -0500 Subject: [PATCH 03/12] IDEMPIERE-2535 Date material policy BUG on receipt --- migration/i2.1/oracle/201504091207_IDEMPIERE-2535.sql | 11 +++++++++++ .../i2.1/postgresql/201504091207_IDEMPIERE-2535.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i2.1/oracle/201504091207_IDEMPIERE-2535.sql create mode 100644 migration/i2.1/postgresql/201504091207_IDEMPIERE-2535.sql diff --git a/migration/i2.1/oracle/201504091207_IDEMPIERE-2535.sql b/migration/i2.1/oracle/201504091207_IDEMPIERE-2535.sql new file mode 100644 index 0000000000..e418a83563 --- /dev/null +++ b/migration/i2.1/oracle/201504091207_IDEMPIERE-2535.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2535 Date material policy BUG on receipt +-- Apr 9, 2015 12:04:34 PM COT +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_DATE('2015-04-09 12:04:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208342 +; + +SELECT register_migration_script('201504091207_IDEMPIERE-2535.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201504091207_IDEMPIERE-2535.sql b/migration/i2.1/postgresql/201504091207_IDEMPIERE-2535.sql new file mode 100644 index 0000000000..00181ebf59 --- /dev/null +++ b/migration/i2.1/postgresql/201504091207_IDEMPIERE-2535.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-2535 Date material policy BUG on receipt +-- Apr 9, 2015 12:04:34 PM COT +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2015-04-09 12:04:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208342 +; + +SELECT register_migration_script('201504091207_IDEMPIERE-2535.sql') FROM dual +; + From a40c7109c10ef91f4f09f26d09989f3d4b441b0f Mon Sep 17 00:00:00 2001 From: michal_zilincar Date: Sun, 12 Apr 2015 14:28:09 -0500 Subject: [PATCH 04/12] IDEMPIERE-2575 BOM functionality sales order --- .../src/org/compiere/model/MOrder.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 4462c3e6d6..c94dcd62c2 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1605,7 +1605,7 @@ public class MOrder extends X_C_Order implements DocAction // New Lines int lineNo = line.getLine (); //find default BOM with valid dates and to this product - MPPProductBOM bom = MPPProductBOM.get(product, getAD_Org_ID(),getDatePromised(), get_TrxName()); + /*/MPPProductBOM bom = MPPProductBOM.get(product, getAD_Org_ID(),getDatePromised(), get_TrxName()); if(bom != null) { MPPProductBOMLine[] bomlines = bom.getLines(getDatePromised()); @@ -1624,30 +1624,30 @@ public class MOrder extends X_C_Order implements DocAction newLine.setPrice (); newLine.save (get_TrxName()); } - } + } */ - /*MProductBOM[] boms = MProductBOM.getBOMLines (product); + MProductBOM[] boms = MProductBOM.getBOMLines (product); for (int j = 0; j < boms.length; j++) { - //MProductBOM bom = boms[j]; - MPPProductBOMLine bom = boms[j]; + MProductBOM bom = boms[j]; + //MPPProductBOMLine bom = boms[j]; MOrderLine newLine = new MOrderLine (this); newLine.setLine (++lineNo); //newLine.setM_Product_ID (bom.getProduct () // .getM_Product_ID ()); newLine.setM_Product_ID (bom.getM_Product_ID ()); - //newLine.setC_UOM_ID (bom.getProduct ().getC_UOM_ID ()); - newLine.setC_UOM_ID (bom.getC_UOM_ID ()); - //newLine.setQty (line.getQtyOrdered ().multiply ( - // bom.getBOMQty ())); + newLine.setC_UOM_ID (bom.getProduct ().getC_UOM_ID ()); + //newLine.setC_UOM_ID (bom.getC_UOM_ID ()); newLine.setQty (line.getQtyOrdered ().multiply ( - bom.getQtyBOM())); + bom.getBOMQty ())); + //newLine.setQty (line.getQtyOrdered ().multiply ( + // bom.getQtyBOM())); if (bom.getDescription () != null) newLine.setDescription (bom.getDescription ()); // newLine.setPrice (); newLine.save (get_TrxName()); - }*/ + } // Convert into Comment Line line.setM_Product_ID (0); From d3aff28345b60ea7813fdfddbd821ef35a457e18 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 12 Apr 2015 14:57:07 -0500 Subject: [PATCH 05/12] IDEMPIERE-2575 BOM functionality sales order - implement same in MInvoice --- .../src/org/compiere/model/MInvoice.java | 33 ++++++++----------- .../src/org/compiere/model/MOrder.java | 33 ++++++------------- 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 9163f41b3b..3f67ebf446 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -45,8 +45,6 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; -import org.eevolution.model.MPPProductBOM; -import org.eevolution.model.MPPProductBOMLine; /** @@ -1538,7 +1536,7 @@ public class MInvoice extends X_C_Invoice implements DocAction int lineNo = line.getLine (); //find default BOM with valid dates and to this product - MPPProductBOM bom = MPPProductBOM.get(product, getAD_Org_ID(),getDateInvoiced(), get_TrxName()); + /*MPPProductBOM bom = MPPProductBOM.get(product, getAD_Org_ID(),getDateInvoiced(), get_TrxName()); if(bom != null) { MPPProductBOMLine[] bomlines = bom.getLines(getDateInvoiced()); @@ -1557,25 +1555,20 @@ public class MInvoice extends X_C_Invoice implements DocAction newLine.setPrice (); newLine.saveEx (get_TrxName()); } - } - - /*MProductBOM[] boms = MProductBOM.getBOMLines (product); - for (int j = 0; j < boms.length; j++) - { - MProductBOM bom = boms[j]; - MInvoiceLine newLine = new MInvoiceLine (this); - newLine.setLine (++lineNo); - newLine.setM_Product_ID (bom.getProduct().getM_Product_ID(), - bom.getProduct().getC_UOM_ID()); - newLine.setQty (line.getQtyInvoiced().multiply( - bom.getBOMQty ())); // Invoiced/Entered - if (bom.getDescription () != null) - newLine.setDescription (bom.getDescription ()); - // - newLine.setPrice (); - newLine.save (get_TrxName()); }*/ + for (MProductBOM bom : MProductBOM.getBOMLines(product)) + { + MInvoiceLine newLine = new MInvoiceLine(this); + newLine.setLine(++lineNo); + newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true); + newLine.setQty(line.getQtyInvoiced().multiply(bom.getBOMQty())); + if (bom.getDescription() != null) + newLine.setDescription(bom.getDescription()); + newLine.setPrice(); + newLine.save(get_TrxName()); + } + // Convert into Comment Line line.setM_Product_ID (0); line.setM_AttributeSetInstance_ID (0); diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index c94dcd62c2..e7e986aa9c 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -47,8 +47,6 @@ import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; -import org.eevolution.model.MPPProductBOM; -import org.eevolution.model.MPPProductBOMLine; /** @@ -1625,28 +1623,17 @@ public class MOrder extends X_C_Order implements DocAction newLine.save (get_TrxName()); } } */ - - MProductBOM[] boms = MProductBOM.getBOMLines (product); - for (int j = 0; j < boms.length; j++) + + for (MProductBOM bom : MProductBOM.getBOMLines(product)) { - MProductBOM bom = boms[j]; - //MPPProductBOMLine bom = boms[j]; - MOrderLine newLine = new MOrderLine (this); - newLine.setLine (++lineNo); - //newLine.setM_Product_ID (bom.getProduct () - // .getM_Product_ID ()); - newLine.setM_Product_ID (bom.getM_Product_ID ()); - newLine.setC_UOM_ID (bom.getProduct ().getC_UOM_ID ()); - //newLine.setC_UOM_ID (bom.getC_UOM_ID ()); - newLine.setQty (line.getQtyOrdered ().multiply ( - bom.getBOMQty ())); - //newLine.setQty (line.getQtyOrdered ().multiply ( - // bom.getQtyBOM())); - if (bom.getDescription () != null) - newLine.setDescription (bom.getDescription ()); - // - newLine.setPrice (); - newLine.save (get_TrxName()); + MOrderLine newLine = new MOrderLine(this); + newLine.setLine(++lineNo); + newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true); + newLine.setQty(line.getQtyOrdered().multiply(bom.getBOMQty())); + if (bom.getDescription() != null) + newLine.setDescription(bom.getDescription()); + newLine.setPrice(); + newLine.save(get_TrxName()); } // Convert into Comment Line From 9ac075d5be17e25bb43b395357eccef5b9fb30c5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 13 Apr 2015 16:54:00 -0500 Subject: [PATCH 06/12] IDEMPIERE-454 - minor typo in message --- .../src/org/adempiere/impexp/GridTabCSVImporter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 5314bbdb48..c7c7c23920 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -336,7 +336,7 @@ public class GridTabCSVImporter implements IGridTabImporter } if (!isMasterok && isDetail){ - rawLine = rawLine + delimiter + quoteChar + Msg.getMsg(Env.getCtx(),"NotProccesed") + quoteChar + "\n"; + rawLine = rawLine + delimiter + quoteChar + Msg.getMsg(Env.getCtx(),"NotProcessed") + quoteChar + "\n"; rowsTmpResult.add(rawLine); continue; }else if(isMasterok && isDetail && !isDetailok){ From 9cd68b58a684749b02fac8ac66923ab5e27b9970 Mon Sep 17 00:00:00 2001 From: hriess Date: Mon, 13 Apr 2015 19:14:20 -0500 Subject: [PATCH 07/12] IDEMPIERE-2562 BOM Drop does not show items in correct position / IDEMPIERE-2551 BOM Drop Form: wrong sorting / IDEMPIERE-2546 BOM Drop Form does not show big Structures (Scrolling not enabled) --- .../org/adempiere/webui/apps/form/WBOMDrop.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java index 463d93e06f..fefcd820b1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java @@ -413,6 +413,7 @@ public class WBOMDrop extends ADForm implements EventListener this.appendChild(confirmPanel); this.appendChild(new Separator()); this.setBorder("normal"); + this.setContentStyle("overflow: auto"); Caption title = new Caption(Msg.getMsg(Env.getCtx(), "SelectProduct")); @@ -467,6 +468,17 @@ public class WBOMDrop extends ADForm implements EventListener } }); + // 2nd sort by Line Number in order to correspond with BOM Structure, patch 2015-03-31 + Arrays.sort(bomLines, new Comparator() { + @Override + public int compare(MProductBOM arg0, MProductBOM arg1) { + String t1 = String.valueOf(arg0.getLine()+100000); + String t2 = String.valueOf(arg1.getLine()+100000); + return t1.compareTo(t2); + } + }); + + for (int i = 0; i < bomLines.length; i++) { addBOMLine (bomLines[i], qty, parentPanel, bomLevel); @@ -592,7 +604,8 @@ public class WBOMDrop extends ADForm implements EventListener if (MProductBOM.BOMTYPE_StandardPart.equals(bomType) || MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) { outerContainer.appendChild(outerProductPanel); } else { - String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType; + // String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType; + String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType + "_" + parentPanel.toString(); Radiogroup group = m_buttonGroups.get(groupName); if (group == null) { From 5e37d9aee45b208e3237a6e15160937519f09b3c Mon Sep 17 00:00:00 2001 From: Murilo Habermann Torquato Date: Wed, 15 Apr 2015 10:40:23 -0500 Subject: [PATCH 08/12] IDEMPIERE-2578 MProduction without TIMING_BEFORE_COMPLETE and TIMING_AFTER_COMPLETE validation --- .../src/org/compiere/model/MProduction.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MProduction.java b/org.adempiere.base/src/org/compiere/model/MProduction.java index 3f00141260..01f344d87f 100644 --- a/org.adempiere.base/src/org/compiere/model/MProduction.java +++ b/org.adempiere.base/src/org/compiere/model/MProduction.java @@ -67,6 +67,10 @@ public class MProduction extends X_M_Production implements DocAction { return status; } + m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); + if (m_processMsg != null) + return DocAction.STATUS_Invalid; + StringBuilder errors = new StringBuilder(); int processed = 0; @@ -96,7 +100,15 @@ public class MProduction extends X_M_Production implements DocAction { } } - setProcessed(true); + // User Validation + String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); + if (valid != null) + { + m_processMsg = valid; + return DocAction.STATUS_Invalid; + } + + setProcessed(true); setDocAction(DOCACTION_Close); return DocAction.STATUS_Completed; } From 804116fe13424fa3055311564a46e5dd1f5ffc54 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 15 Apr 2015 11:26:09 -0500 Subject: [PATCH 09/12] IDEMPIERE-2578 / IDEMPIERE-1715 --- .../src/org/compiere/model/MProduction.java | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MProduction.java b/org.adempiere.base/src/org/compiere/model/MProduction.java index 01f344d87f..46c361c813 100644 --- a/org.adempiere.base/src/org/compiere/model/MProduction.java +++ b/org.adempiere.base/src/org/compiere/model/MProduction.java @@ -545,6 +545,12 @@ public class MProduction extends X_M_Production implements DocAction { @Override public boolean voidIt() { + if (log.isLoggable(Level.INFO)) log.info(toString()); + // Before Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID); + if (m_processMsg != null) + return false; + if (DOCSTATUS_Closed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Voided.equals(getDocStatus())) @@ -595,6 +601,11 @@ public class MProduction extends X_M_Production implements DocAction { return reverseCorrectIt(); } + // After Void + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID); + if (m_processMsg != null) + return false; + setProcessed(true); setDocAction(DOCACTION_None); return true; @@ -752,8 +763,8 @@ public class MProduction extends X_M_Production implements DocAction { @Override public boolean reverseAccrualIt() { if (log.isLoggable(Level.INFO)) log.info(toString()); - // Before reverseCorrect - m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT); + // Before reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL); if (m_processMsg != null) return false; @@ -761,8 +772,8 @@ public class MProduction extends X_M_Production implements DocAction { if (reversal == null) return false; - // After reverseCorrect - m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); + // After reverseAccrual + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL); if (m_processMsg != null) return false; @@ -773,7 +784,17 @@ public class MProduction extends X_M_Production implements DocAction { @Override public boolean reActivateIt() { - throw new UnsupportedOperationException(); + if (log.isLoggable(Level.INFO)) log.info("reActivateIt - " + toString()); + // Before reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE); + if (m_processMsg != null) + return false; + + // After reActivate + m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); + if (m_processMsg != null) + return false; + return false; } @Override From 7d01f70a64302446fef7a0d98e589c020d0bc6b0 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 15 Apr 2015 12:42:42 -0500 Subject: [PATCH 10/12] IDEMPIERE-2549 Password rule break Initial Client Setup --- .../oracle/201504151220_IDEMPIERE-2549.sql | 55 +++++++++++++++++++ .../201504151220_IDEMPIERE-2549.sql | 52 ++++++++++++++++++ .../adempiere/process/InitialClientSetup.java | 6 +- .../src/org/compiere/model/MSetup.java | 9 ++- .../webui/apps/form/WResetPassword.java | 15 ++++- 5 files changed, 132 insertions(+), 5 deletions(-) create mode 100644 migration/i2.1/oracle/201504151220_IDEMPIERE-2549.sql create mode 100644 migration/i2.1/postgresql/201504151220_IDEMPIERE-2549.sql diff --git a/migration/i2.1/oracle/201504151220_IDEMPIERE-2549.sql b/migration/i2.1/oracle/201504151220_IDEMPIERE-2549.sql new file mode 100644 index 0000000000..a84fe3fc97 --- /dev/null +++ b/migration/i2.1/oracle/201504151220_IDEMPIERE-2549.sql @@ -0,0 +1,55 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +update ad_process_para set seqno=seqno+1000 where ad_process_id=53161 and seqno>=80; + +update ad_process_para set seqno=seqno-990 where ad_process_id=53161 and seqno>=1080; + +-- IDEMPIERE-2549 Password rule break Initial Client Setup +-- Apr 15, 2015 12:17:41 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202876,0,0,'Y',TO_DATE('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,'IsSetInitialPassword','IsSetInitialPassword','IsSetInitialPassword','D','0e03fdbc-cb25-4705-bbd8-4442b02563af') +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Element SET Name='Set Initial Password', PrintName='Set Initial Password',Updated=TO_DATE('2015-04-15 12:17:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202876 +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Column SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL, AD_Element_ID=202876 WHERE UPPER(ColumnName)='ISSETINITIALPASSWORD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y' +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_InfoColumn SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y' +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Field SET Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202876) AND IsCentrallyMaintained='Y' +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_PrintFormatItem SET PrintName='Set Initial Password', Name='Set Initial Password' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=202876) +; + +-- Apr 15, 2015 12:18:34 PM COT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200132,0,0,'Y',TO_DATE('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,'Set Initial Password',53161,80,20,'N',1,'Y','Y','IsSetInitialPassword','Y','D',202876,'54bfb648-044e-47d3-b232-bb61a4632772','N') +; + +-- Apr 15, 2015 12:19:10 PM COT +UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2015-04-15 12:19:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=288 +; + +-- Apr 15, 2015 12:36:59 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Force change on next login',0,0,'Y',TO_DATE('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,200349,'ForceChangeOnNextLogin','D','ef609a89-2d65-44f8-8aaf-4a29854510c9') +; + +SELECT register_migration_script('201504151220_IDEMPIERE-2549.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201504151220_IDEMPIERE-2549.sql b/migration/i2.1/postgresql/201504151220_IDEMPIERE-2549.sql new file mode 100644 index 0000000000..6dc66ee2a9 --- /dev/null +++ b/migration/i2.1/postgresql/201504151220_IDEMPIERE-2549.sql @@ -0,0 +1,52 @@ +update ad_process_para set seqno=seqno+1000 where ad_process_id=53161 and seqno>=80; + +update ad_process_para set seqno=seqno-990 where ad_process_id=53161 and seqno>=1080; + +-- IDEMPIERE-2549 Password rule break Initial Client Setup +-- Apr 15, 2015 12:17:41 PM COT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202876,0,0,'Y',TO_TIMESTAMP('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,'IsSetInitialPassword','IsSetInitialPassword','IsSetInitialPassword','D','0e03fdbc-cb25-4705-bbd8-4442b02563af') +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Element SET Name='Set Initial Password', PrintName='Set Initial Password',Updated=TO_TIMESTAMP('2015-04-15 12:17:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202876 +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Column SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL, AD_Element_ID=202876 WHERE UPPER(ColumnName)='ISSETINITIALPASSWORD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y' +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_InfoColumn SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y' +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_Field SET Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202876) AND IsCentrallyMaintained='Y' +; + +-- Apr 15, 2015 12:17:58 PM COT +UPDATE AD_PrintFormatItem SET PrintName='Set Initial Password', Name='Set Initial Password' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=202876) +; + +-- Apr 15, 2015 12:18:34 PM COT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200132,0,0,'Y',TO_TIMESTAMP('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,'Set Initial Password',53161,80,20,'N',1,'Y','Y','IsSetInitialPassword','Y','D',202876,'54bfb648-044e-47d3-b232-bb61a4632772','N') +; + +-- Apr 15, 2015 12:19:10 PM COT +UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2015-04-15 12:19:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=288 +; + +-- Apr 15, 2015 12:36:59 PM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Force change on next login',0,0,'Y',TO_TIMESTAMP('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,200349,'ForceChangeOnNextLogin','D','ef609a89-2d65-44f8-8aaf-4a29854510c9') +; + +SELECT register_migration_script('201504151220_IDEMPIERE-2549.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java b/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java index 66741cf624..26a9b36327 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java +++ b/org.adempiere.base.process/src/org/adempiere/process/InitialClientSetup.java @@ -62,6 +62,7 @@ public class InitialClientSetup extends SvrProcess private String p_OrgName = null; private String p_AdminUserName = null; private String p_NormalUserName = null; + private boolean p_IsSetInitialPassword = true; private int p_C_Currency_ID = 0; private int p_C_Country_ID = 0; private int p_C_Region_ID = 0; @@ -110,6 +111,8 @@ public class InitialClientSetup extends SvrProcess p_AdminUserName = (String) para[i].getParameter(); else if (name.equals("NormalUserName")) p_NormalUserName = (String) para[i].getParameter(); + else if (name.equals("IsSetInitialPassword")) + p_IsSetInitialPassword = para[i].getParameterAsBoolean(); else if (name.equals("C_Currency_ID")) p_C_Currency_ID = para[i].getParameterAsInt(); else if (name.equals("C_Country_ID")) @@ -175,6 +178,7 @@ public class InitialClientSetup extends SvrProcess .append(", OrgName=").append(p_OrgName) .append(", AdminUserName=").append(p_AdminUserName) .append(", NormalUserName=").append(p_NormalUserName) + .append(", IsSetInitialPassword=").append(p_IsSetInitialPassword) .append(", C_Currency_ID=").append(p_C_Currency_ID) .append(", C_Country_ID=").append(p_C_Country_ID) .append(", C_Region_ID=").append(p_C_Region_ID) @@ -259,7 +263,7 @@ public class InitialClientSetup extends SvrProcess MSetup ms = new MSetup(Env.getCtx(), WINDOW_THIS_PROCESS); try { if (! ms.createClient(p_ClientName, p_OrgValue, p_OrgName, p_AdminUserName, p_NormalUserName - , p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail)) { + , p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail, p_IsSetInitialPassword)) { ms.rollback(); throw new AdempiereException("Create client failed"); } diff --git a/org.adempiere.base/src/org/compiere/model/MSetup.java b/org.adempiere.base/src/org/compiere/model/MSetup.java index 7d221a958e..4f86fef8d5 100644 --- a/org.adempiere.base/src/org/compiere/model/MSetup.java +++ b/org.adempiere.base/src/org/compiere/model/MSetup.java @@ -108,11 +108,12 @@ public final class MSetup * @param orgName org name * @param userClient user id client * @param userOrg user id org + * @param isSetInitialPassword * @return true if created */ public boolean createClient (String clientName, String orgValue, String orgName, String userClient, String userOrg, String phone, String phone2, String fax, String eMail, String taxID, - String adminEmail, String userEmail) + String adminEmail, String userEmail, boolean isSetInitialPassword) { log.info(clientName); m_trx.start(); @@ -286,7 +287,8 @@ public final class MSetup if (name == null || name.length() == 0) name = m_clientName + "Client"; - clientAdminUser.setPassword(name); + if (isSetInitialPassword) + clientAdminUser.setPassword(name); clientAdminUser.setDescription(name); clientAdminUser.setName(name); clientAdminUser.setAD_Client_ID(AD_Client_ID); @@ -320,7 +322,8 @@ public final class MSetup if (name == null || name.length() == 0) name = m_clientName + "Org"; - clientUser.setPassword(name); + if (isSetInitialPassword) + clientUser.setPassword(name); clientUser.setDescription(name); clientUser.setName(name); clientUser.setAD_Client_ID(AD_Client_ID); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WResetPassword.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WResetPassword.java index 7f0bede13d..7e45908fda 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WResetPassword.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WResetPassword.java @@ -17,6 +17,7 @@ package org.adempiere.webui.apps.form; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; +import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Column; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Grid; @@ -75,6 +76,7 @@ public class WResetPassword implements IFormController, EventListener, Va private Textbox txtOldPassword; private Textbox txtNewPassword; private Textbox txtRetypeNewPassword; + private Checkbox cbForceChangeNextLogin; private Textbox txtNewEMail; private Textbox txtNewEMailUser; private Textbox txtNewEMailUserPW; @@ -144,7 +146,11 @@ public class WResetPassword implements IFormController, EventListener, Va txtRetypeNewPassword.setType("password"); txtRetypeNewPassword.setCols(25); txtRetypeNewPassword.setWidth("220px"); - + + cbForceChangeNextLogin = new Checkbox(); + cbForceChangeNextLogin.setLabel(Msg.getMsg(Env.getCtx(), "ForceChangeOnNextLogin")); + cbForceChangeNextLogin.setChecked(false); + txtNewEMail = new Textbox(); txtNewEMail.setId("txtNewEMail"); txtNewEMail.setCols(25); @@ -209,6 +215,11 @@ public class WResetPassword implements IFormController, EventListener, Va row.appendChild(lblRetypeNewPassword.rightAlign()); row.appendChild(txtRetypeNewPassword); + row = new Row(); + rows.appendChild(row); + row.appendChild(new Label()); + row.appendChild(cbForceChangeNextLogin); + row = new Row(); rows.appendChild(row); row.appendChild(lblNewEMail.rightAlign()); @@ -327,6 +338,8 @@ public class WResetPassword implements IFormController, EventListener, Va user.setEMailUser(p_NewEMailUser); if (!Util.isEmpty(p_NewEMailUserPW)) user.setEMailUserPW(p_NewEMailUserPW); + if (cbForceChangeNextLogin.isChecked()) + user.setIsExpired(true); try { user.saveEx(); From fe98584345b3102b11c437a3bc96936964353d12 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 15 Apr 2015 14:04:41 -0500 Subject: [PATCH 11/12] IDEMPIERE-2549 Password rule break Initial Client Setup / fix broken swing --- org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java index 571ea9c4b0..af4c9bceb6 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VSetup.java @@ -474,7 +474,7 @@ public class VSetup extends CPanel m_frame.setBusyTimer(45); // Step 1 boolean ok = ms.createClient(fClientName.getText(), fOrgValue.getText(), fOrgName.getText(), - fUserClient.getText(), fUserOrg.getText(), null, null, null, null, null, null, null); // this form is not used + fUserClient.getText(), fUserOrg.getText(), null, null, null, null, null, null, null, true); // this form is not used String info = ms.getInfo(); if (ok) From a1f152019d70e90b25a2484d1635795ad1759e2d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 15 Apr 2015 17:55:26 -0500 Subject: [PATCH 12/12] IDEMPIERE-476 Report Engine related bugs --- .../oracle/201504151752_IDEMPIERE-476.sql | 35 +++++++++++++++++++ .../postgresql/201504151752_IDEMPIERE-476.sql | 34 ++++++++++++++++++ .../org/compiere/print/PrintDataFunction.java | 6 ++-- 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 migration/i2.1/oracle/201504151752_IDEMPIERE-476.sql create mode 100644 migration/i2.1/postgresql/201504151752_IDEMPIERE-476.sql diff --git a/migration/i2.1/oracle/201504151752_IDEMPIERE-476.sql b/migration/i2.1/oracle/201504151752_IDEMPIERE-476.sql new file mode 100644 index 0000000000..881079225e --- /dev/null +++ b/migration/i2.1/oracle/201504151752_IDEMPIERE-476.sql @@ -0,0 +1,35 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-476 Report Engine related bugs +-- 15/04/2015 05:50:45 PM COT +UPDATE AD_Element SET Name='Calculate Maximum (↑)',Updated=TO_DATE('2015-04-15 17:50:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2207 +; + +-- 15/04/2015 05:50:45 PM COT +UPDATE AD_Column SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Element_ID=2207 +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_Process_Para SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.', AD_Element_ID=2207 WHERE UPPER(ColumnName)='ISMAXCALC' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_Process_Para SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Element_ID=2207 AND IsCentrallyMaintained='Y' +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_InfoColumn SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Element_ID=2207 AND IsCentrallyMaintained='Y' +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_Field SET Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2207) AND IsCentrallyMaintained='Y' +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_PrintFormatItem SET PrintName='Calc Max', Name='Calculate Maximum (↑)' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=2207) +; + +SELECT register_migration_script('201504151752_IDEMPIERE-476.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201504151752_IDEMPIERE-476.sql b/migration/i2.1/postgresql/201504151752_IDEMPIERE-476.sql new file mode 100644 index 0000000000..2f6cb4590b --- /dev/null +++ b/migration/i2.1/postgresql/201504151752_IDEMPIERE-476.sql @@ -0,0 +1,34 @@ +SET CLIENT_ENCODING TO 'UTF8'; + +-- IDEMPIERE-476 Report Engine related bugs +-- 15/04/2015 05:50:45 PM COT +UPDATE AD_Element SET Name='Calculate Maximum (↑)',Updated=TO_TIMESTAMP('2015-04-15 17:50:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2207 +; + +-- 15/04/2015 05:50:45 PM COT +UPDATE AD_Column SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Element_ID=2207 +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_Process_Para SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.', AD_Element_ID=2207 WHERE UPPER(ColumnName)='ISMAXCALC' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_Process_Para SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Element_ID=2207 AND IsCentrallyMaintained='Y' +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_InfoColumn SET ColumnName='IsMaxCalc', Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Element_ID=2207 AND IsCentrallyMaintained='Y' +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_Field SET Name='Calculate Maximum (↑)', Description='Calculate the maximum amount', Help='Calculate the Maximum (↑) of the data if the field is numeric, otherwise maximum length of the field.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2207) AND IsCentrallyMaintained='Y' +; + +-- 15/04/2015 05:50:46 PM COT +UPDATE AD_PrintFormatItem SET PrintName='Calc Max', Name='Calculate Maximum (↑)' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=2207) +; + +SELECT register_migration_script('201504151752_IDEMPIERE-476.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java b/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java index 0a331ebdae..ddba97f545 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java +++ b/org.adempiere.base/src/org/compiere/print/PrintDataFunction.java @@ -137,10 +137,10 @@ public class PrintDataFunction mean = mean.setScale(4, BigDecimal.ROUND_HALF_UP); return mean; } - // Variance = sum of squares - (square of sum / count) + // Variance = ( sum of squares - (square of sum / count) ) / count BigDecimal ss = m_sum.multiply(m_sum); - ss = ss.divide(count, 4, BigDecimal.ROUND_HALF_UP); - BigDecimal variance = m_sumSquare.subtract(ss); + ss = ss.divide(count, 10, BigDecimal.ROUND_HALF_UP); + BigDecimal variance = m_sumSquare.subtract(ss).divide(count, 10, BigDecimal.ROUND_HALF_UP); if (function == F_VARIANCE) { if (variance.scale() > 4)