From 5c31c1903668746533f5c50e3d5963c339b4d91e Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 15 Jul 2013 15:49:16 +0800 Subject: [PATCH 01/31] IDEMPIERE-1174 Match PO not posted after material receipt have been posted when client accounting is post immediate. --- .../src/org/compiere/model/MInOut.java | 16 +++------------- .../src/org/compiere/model/MInvoice.java | 11 ++--------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 2180842ddb..2b3b38c527 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1605,16 +1605,12 @@ public class MInOut extends X_M_InOut implements DocAction iLine.saveEx(); // update matched invoice with ASI inv.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); } - boolean isNewMatchInv = false; - if (inv.get_ID() == 0) - isNewMatchInv = true; if (!inv.save(get_TrxName())) { m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching"); return DocAction.STATUS_Invalid; } - if (isNewMatchInv) - addDocsPostProcess(inv); + addDocsPostProcess(inv); } } @@ -1625,15 +1621,12 @@ public class MInOut extends X_M_InOut implements DocAction // Ship - PO MMatchPO po = MMatchPO.create (null, sLine, getMovementDate(), matchQty); if (po != null) { - boolean isNewMatchPO = false; - if (po.get_ID() == 0) - isNewMatchPO = true; if (!po.save(get_TrxName())) { m_processMsg = "Could not create PO Matching"; return DocAction.STATUS_Invalid; } - if (isNewMatchPO) + if (!po.isPosted()) addDocsPostProcess(po); } // Update PO with ASI @@ -1655,15 +1648,12 @@ public class MInOut extends X_M_InOut implements DocAction MMatchPO po = MMatchPO.create (iLine, sLine, getMovementDate(), matchQty); if (po != null) { - boolean isNewMatchPO = false; - if (po.get_ID() == 0) - isNewMatchPO = true; if (!po.save(get_TrxName())) { m_processMsg = "Could not create PO(Inv) Matching"; return DocAction.STATUS_Invalid; } - if (isNewMatchPO) + if (!po.isPosted()) addDocsPostProcess(po); } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index c762d01750..45cff928e0 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1807,17 +1807,13 @@ public class MInvoice extends X_C_Invoice implements DocAction matchQty = receiptLine.getMovementQty(); MMatchInv inv = new MMatchInv(line, getDateInvoiced(), matchQty); - boolean isNewMatchInv = false; - if (inv.get_ID() == 0) - isNewMatchInv = true; if (!inv.save(get_TrxName())) { m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching"); return DocAction.STATUS_Invalid; } matchInv++; - if (isNewMatchInv) - addDocsPostProcess(inv); + addDocsPostProcess(inv); } // Update Order Line @@ -1845,18 +1841,15 @@ public class MInvoice extends X_C_Invoice implements DocAction BigDecimal matchQty = line.getQtyInvoiced(); MMatchPO po = MMatchPO.create (line, null, getDateInvoiced(), matchQty); - boolean isNewMatchPO = false; if (po != null) { - if (po.get_ID() == 0) - isNewMatchPO = true; if (!po.save(get_TrxName())) { m_processMsg = "Could not create PO Matching"; return DocAction.STATUS_Invalid; } matchPO++; - if (isNewMatchPO) + if (!po.isPosted()) addDocsPostProcess(po); } } From 69ed0297c486312f3cbc042969c124e2d1b02aca Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 15 Jul 2013 16:03:43 +0800 Subject: [PATCH 02/31] IDEMPIERE-1173 Fixed landed cost allocation for Average Costing. --- .../src/org/compiere/acct/Doc_Invoice.java | 82 +++++++---- .../src/org/compiere/model/MCost.java | 8 ++ .../src/org/compiere/model/MCostDetail.java | 133 +++++------------- 3 files changed, 99 insertions(+), 124 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java index fdb042e4a2..3444a4077c 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java @@ -20,12 +20,15 @@ import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Savepoint; import java.util.ArrayList; import java.util.logging.Level; +import org.adempiere.exceptions.AverageCostingZeroQtyException; import org.compiere.model.MAccount; import org.compiere.model.MAcctSchema; import org.compiere.model.MClientInfo; +import org.compiere.model.MConversionRate; import org.compiere.model.MCostDetail; import org.compiere.model.MCurrency; import org.compiere.model.MInvoice; @@ -33,8 +36,10 @@ import org.compiere.model.MInvoiceLine; import org.compiere.model.MLandedCostAllocation; import org.compiere.model.MTax; import org.compiere.model.ProductCost; +import org.compiere.model.X_M_Cost; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Trx; /** * Post Invoice Documents. @@ -835,22 +840,8 @@ public class Doc_Invoice extends Doc if (line.getDescription() != null) desc += " - " + line.getDescription(); - // Accounting - ProductCost pc = new ProductCost (Env.getCtx(), - lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), getTrxName()); - BigDecimal drAmt = null; - BigDecimal crAmt = null; - if (dr) - drAmt = lca.getAmt(); - else - crAmt = lca.getAmt(); - FactLine fl = fact.createLine (line, pc.getAccount(ProductCost.ACCTTYPE_P_CostAdjustment, as), - getC_Currency_ID(), drAmt, crAmt); - fl.setDescription(desc); - fl.setM_Product_ID(lca.getM_Product_ID()); - // Cost Detail - Convert to AcctCurrency - /* + BigDecimal allocationAmt = lca.getAmt(); if (getC_Currency_ID() != as.getC_Currency_ID()) allocationAmt = MConversionRate.convert(getCtx(), allocationAmt, @@ -861,15 +852,58 @@ public class Doc_Invoice extends Doc allocationAmt = allocationAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); if (!dr) allocationAmt = allocationAmt.negate(); - // AZ Goodwill - // use createInvoice to create/update non Material Cost Detail - MCostDetail.createInvoice(as, lca.getAD_Org_ID(), - lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), - C_InvoiceLine_ID, lca.getM_CostElement_ID(), - allocationAmt, lca.getQty(), - desc, getTrxName()); - */ - // end AZ + + Trx trx = Trx.get(getTrxName(), false); + Savepoint savepoint = null; + boolean zeroQty = false; + try { + savepoint = trx.setSavepoint(null); + + if (!MCostDetail.createInvoice(as, lca.getAD_Org_ID(), + lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), + C_InvoiceLine_ID, lca.getM_CostElement_ID(), + allocationAmt, lca.getQty(), + desc, getTrxName())) { + throw new RuntimeException("Failed to create cost detail record."); + } + } catch (SQLException e) { + throw new RuntimeException(e.getLocalizedMessage(), e); + } catch (AverageCostingZeroQtyException e) { + zeroQty = true; + try { + trx.rollback(savepoint); + savepoint = null; + } catch (SQLException e1) { + throw new RuntimeException(e1.getLocalizedMessage(), e1); + } + } finally { + if (savepoint != null) { + try { + trx.releaseSavepoint(savepoint); + } catch (SQLException e) {} + } + } + + // Accounting + ProductCost pc = new ProductCost (Env.getCtx(), + lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), getTrxName()); + BigDecimal drAmt = null; + BigDecimal crAmt = null; + if (dr) + drAmt = lca.getAmt(); + else + crAmt = lca.getAmt(); + String costingMethod = pc.getProduct().getCostingMethod(as); + MAccount account = null; + if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod) || X_M_Cost.COSTINGMETHOD_AveragePO.equals(costingMethod)) { + account = zeroQty ? pc.getAccount(ProductCost.ACCTTYPE_P_Cogs, as) : pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); + } else { + account = pc.getAccount(ProductCost.ACCTTYPE_P_CostAdjustment, as); + } + + FactLine fl = fact.createLine (line, account, getC_Currency_ID(), drAmt, crAmt); + fl.setDescription(desc); + fl.setM_Product_ID(lca.getM_Product_ID()); } if (log.isLoggable(Level.CONFIG)) log.config("Created #" + lcas.length); diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index 33a4633321..b67fcbe2b0 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -28,6 +28,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.exceptions.AverageCostingNegativeQtyException; +import org.adempiere.exceptions.AverageCostingZeroQtyException; import org.adempiere.exceptions.DBException; import org.compiere.Adempiere; import org.compiere.util.CLogger; @@ -1487,6 +1488,13 @@ public class MCost extends X_M_Cost amt = amt.negate(); } + //can't do cost adjustment if there's no stock left + if (qty.signum() == 0 && getCurrentQty().signum() <= 0) + { + throw new AverageCostingZeroQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", Trx Qty="+qty + +", CostElement="+getM_CostElement().getName()+", Schema="+getC_AcctSchema().getName()); + } + if (getCurrentQty().add(qty).signum() < 0) { throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", Trx Qty="+qty diff --git a/org.adempiere.base/src/org/compiere/model/MCostDetail.java b/org.adempiere.base/src/org/compiere/model/MCostDetail.java index 735e4d46c4..ec8df41c4b 100644 --- a/org.adempiere.base/src/org/compiere/model/MCostDetail.java +++ b/org.adempiere.base/src/org/compiere/model/MCostDetail.java @@ -151,11 +151,13 @@ public class MCostDetail extends X_M_CostDetail .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0") .append(" AND C_InvoiceLine_ID=").append(C_InvoiceLine_ID) .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID()) - .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); + .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID) + .append(" AND Coalesce(M_CostElement_ID,0)=").append(M_CostElement_ID); + int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); - MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=?", + MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=? AND Coalesce(M_CostElement_ID,0)="+M_CostElement_ID, C_InvoiceLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); // if (cd == null) // createNew @@ -796,7 +798,20 @@ public class MCostDetail extends X_M_CostDetail else { MCostElement ce = MCostElement.get(getCtx(), getM_CostElement_ID()); - ok = process (as, product, ce, Org_ID, M_ASI_ID); + if (ce.getCostingMethod() == null) + { + MCostElement[] ces = MCostElement.getCostingMethods(this); + for (MCostElement costingElement : ces) + { + ok = process (as, product, costingElement, Org_ID, M_ASI_ID); + if (!ok) + break; + } + } + else + { + ok = process (as, product, ce, Org_ID, M_ASI_ID); + } } // Save it @@ -859,6 +874,14 @@ public class MCostDetail extends X_M_CostDetail amt = getAmt(); } // end MZ + + boolean costAdjustment = false; + //landed cost adjustment + if (this.getM_CostElement_ID() > 0 && this.getM_CostElement_ID() != ce.getM_CostElement_ID() && getC_InvoiceLine_ID() > 0) + { + qty = BigDecimal.ZERO; + costAdjustment = true; + } int precision = as.getCostingPrecision(); BigDecimal price = amt; @@ -942,6 +965,10 @@ public class MCostDetail extends X_M_CostDetail cost.setWeightedAverage(amt, qty); if (log.isLoggable(Level.FINER)) log.finer("Inv - AverageInv - " + cost); } + else if (ce.isAveragePO() && costAdjustment) + { + cost.setWeightedAverage(amt, qty); + } else if (ce.isFifo() || ce.isLifo()) { @@ -958,7 +985,7 @@ public class MCostDetail extends X_M_CostDetail cost.add(amt, qty); if (log.isLoggable(Level.FINER)) log.finer("Inv - FiFo/LiFo - " + cost); } - else if (ce.isLastInvoice()) + else if (ce.isLastInvoice() && !costAdjustment) { if (!isReturnTrx) { @@ -973,7 +1000,7 @@ public class MCostDetail extends X_M_CostDetail cost.add(amt, qty); if (log.isLoggable(Level.FINER)) log.finer("Inv - LastInv - " + cost); } - else if (ce.isStandardCosting()) + else if (ce.isStandardCosting() && !costAdjustment) { // Update cost record only if it is zero if (cost.getCurrentCostPrice().signum() == 0 @@ -996,54 +1023,7 @@ public class MCostDetail extends X_M_CostDetail // Interface cost.add(amt, qty); if (log.isLoggable(Level.FINER)) log.finer("Inv - UserDef - " + cost); - } - /* - else if (!ce.isCostingMethod()) // Cost Adjustments - { - // AZ Goodwill - //get costing method for product - String costingMethod = product.getCostingMethod(as); - if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) || - MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod)) - { - // Problem with Landed Costs: certain cost element may not occur in every purchases, - // causing the average calculation of that cost element wrongly took the current qty. - // - // Solution: - // Make sure the current qty is reflecting the actual qty in storage - // - StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand") - .append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID()) - .append(" AND M_Product_ID=").append(cost.getM_Product_ID()); - //Costing Level - String CostingLevel = product.getCostingLevel(as); - if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel)) - sql.append(" AND AD_Org_ID=").append(cost.getAD_Org_ID()); - else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) - sql.append(" AND M_AttributeSetInstance_ID=").append(M_ASI_ID); - // - BigDecimal qtyOnhand = DB.getSQLValueBD(get_TrxName(), sql.toString()); - if (qtyOnhand.signum() != 0) - { - BigDecimal oldSum = cost.getCurrentCostPrice().multiply(cost.getCurrentQty()); - BigDecimal sumAmt = oldSum.add(amt); // amt is total already - BigDecimal costs = sumAmt.divide(qtyOnhand, precision, BigDecimal.ROUND_HALF_UP); - cost.setCurrentCostPrice(costs); - } - cost.setCumulatedAmt(cost.getCumulatedAmt().add(amt)); - cost.setCumulatedQty(cost.getCumulatedQty().add(qty)); - cost.setCurrentQty(qtyOnhand); - } - else //original logic from Compiere - { - BigDecimal cCosts = cost.getCurrentCostPrice().add(amt); - cost.setCurrentCostPrice(cCosts); - cost.add(amt, qty); - } - // end AZ - if (log.isLoggable(Level.FINER)) log.finer("Inv - Landed Costs - " + cost); - } - */ + } // else // log.warning("Inv - " + ce + " - " + cost); } @@ -1177,53 +1157,6 @@ public class MCostDetail extends X_M_CostDetail else log.warning("QtyAdjust - " + ce + " - " + cost); - //AZ Goodwill - //Also update Landed Costs to reflect the actual qty in storage - /* - String costingMethod = ce.getCostingMethod(); - if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) || - MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod)) - { - MCostElement[] lce = MCostElement.getNonCostingMethods(this); - if (lce.length > 0) - { - StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand") - .append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID()) - .append(" AND M_Product_ID=").append(cost.getM_Product_ID()); - //Costing Level - String CostingLevel = product.getCostingLevel(as); - if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel)) - sql.append(" AND AD_Org_ID=").append(cost.getAD_Org_ID()); - else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) - sql.append(" AND M_AttributeSetInstance_ID=").append(M_ASI_ID); - // - BigDecimal qtyOnhand = DB.getSQLValueBD(get_TrxName(), sql.toString()); - for (int i = 0 ; i < lce.length ; i++) - { - MCost lCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), - cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), - lce[i].getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID(), get_TrxName()); - if (lCost != null) - { - if (qtyOnhand.signum() != 0) - { - // new average cost - BigDecimal oldSum = lCost.getCurrentCostPrice().multiply(lCost.getCurrentQty()); - BigDecimal costs = oldSum.divide(qtyOnhand, precision, BigDecimal.ROUND_HALF_UP); - lCost.setCurrentCostPrice(costs); - } - lCost.setCurrentQty(qtyOnhand); - if (!lCost.save()) - { - log.warning("Update Landed Costs (Qty) fail: " + lce + " - " + lCost); - return false; - } - } - } - }//end-if - } - */ - //end AZ } else // unknown or no id { From 4f600b50602cb1d769ccf456e61d80d1af25a2f3 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 15 Jul 2013 17:13:07 +0800 Subject: [PATCH 03/31] IDEMPIERE-1175 iDempiere Server update script should preserve tomcat configuration file. --- org.idempiere.eclipse.platform-feature/update.bat | 8 ++++++++ org.idempiere.eclipse.platform-feature/update.sh | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/org.idempiere.eclipse.platform-feature/update.bat b/org.idempiere.eclipse.platform-feature/update.bat index c118194b91..c94db344cf 100644 --- a/org.idempiere.eclipse.platform-feature/update.bat +++ b/org.idempiere.eclipse.platform-feature/update.bat @@ -4,9 +4,17 @@ cd %~dp0 cp idempiere.ini idempiere.ini.sav +if exist server.xml.sav del /q server.xml.sav +if exist plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml ( + copy plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml server.xml.sav +) java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %~dp0 -repository %1 -u org.adempiere.server.product java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %~dp0 -repository %1 -i org.adempiere.server.product cp idempiere.ini.sav idempiere.ini +if exist server.xml.sav ( + copy server.xml.sav plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml + del /q server.xml.sav +) diff --git a/org.idempiere.eclipse.platform-feature/update.sh b/org.idempiere.eclipse.platform-feature/update.sh index 4553aa04f3..32a677d9c0 100644 --- a/org.idempiere.eclipse.platform-feature/update.sh +++ b/org.idempiere.eclipse.platform-feature/update.sh @@ -6,8 +6,23 @@ DESTINATION=$(pwd) cp idempiere.ini idempiere.ini.sav +if [ -f server.xml.sav ]; +then + rm -f server.xml.sav +fi +if [ -f plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml ] +then + cp plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml server.xml.sav +fi + java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination $DESTINATION -repository $1 -u org.adempiere.server.product java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination $DESTINATION -repository $1 -i org.adempiere.server.product cp idempiere.ini.sav idempiere.ini +if [ -f server.xml.sav ] +then + cp server.xml.sav plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml + rm -f server.xml.sav +fi + From 0062c09768c0409ab33661652e7f22f97334c271 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 15 Jul 2013 23:02:18 +0800 Subject: [PATCH 04/31] IDEMPIERE-1173 Fixed landed cost allocation for Average Costing. --- .../AverageCostingZeroQtyException.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 org.adempiere.base/src/org/adempiere/exceptions/AverageCostingZeroQtyException.java diff --git a/org.adempiere.base/src/org/adempiere/exceptions/AverageCostingZeroQtyException.java b/org.adempiere.base/src/org/adempiere/exceptions/AverageCostingZeroQtyException.java new file mode 100644 index 0000000000..e58426f72b --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/exceptions/AverageCostingZeroQtyException.java @@ -0,0 +1,36 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2012 Heng Sin Low * + * Copyright (C) 2012 www.iDempiere.org * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.exceptions; + +/** + * + * @author hengsin + * + */ +public class AverageCostingZeroQtyException extends AdempiereException { + + /** + * generated serial version id + */ + private static final long serialVersionUID = 4165497320719149773L; + + public AverageCostingZeroQtyException() { + super(); + } + + public AverageCostingZeroQtyException(String message) { + super(message); + } +} From eef3b475b92be3d463be5377d609fbd3f048eaff Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 15 Jul 2013 10:47:11 -0500 Subject: [PATCH 05/31] IDEMPIERE-1173 Fixed landed cost allocation for Average Costing --- .../oracle/201307151037_IDEMPIERE-1173.sql | 76 +++++++++++++++++++ .../201307151037_IDEMPIERE-1173.sql | 76 +++++++++++++++++++ .../src/org/compiere/acct/Doc_Invoice.java | 2 +- 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 migration/i1.0c-release/oracle/201307151037_IDEMPIERE-1173.sql create mode 100644 migration/i1.0c-release/postgresql/201307151037_IDEMPIERE-1173.sql diff --git a/migration/i1.0c-release/oracle/201307151037_IDEMPIERE-1173.sql b/migration/i1.0c-release/oracle/201307151037_IDEMPIERE-1173.sql new file mode 100644 index 0000000000..db9cc0f4aa --- /dev/null +++ b/migration/i1.0c-release/oracle/201307151037_IDEMPIERE-1173.sql @@ -0,0 +1,76 @@ +-- Jul 15, 2013 10:36:11 AM COT +-- IDEMPIERE-1173 Fixed landed cost allocation for Average Costing +UPDATE AD_Field SET SeqNo=280, AD_FieldGroup_ID=200013, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-07-15 10:36:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58783 +; + +-- Jul 15, 2013 10:36:11 AM COT +UPDATE AD_Field SET SeqNo=290,Updated=TO_DATE('2013-07-15 10:36:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2662 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=300,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3842 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=310,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3841 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=320,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5132 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=330,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5133 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=340,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3845 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=350,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3844 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=360,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3839 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=370,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3840 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=380,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3836 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=390,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3851 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=400,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2654 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=410,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3835 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=420,Updated=TO_DATE('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3823 +; + +-- Jul 15, 2013 10:36:42 AM COT +UPDATE AD_Field SET SeqNo=190, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-07-15 10:36:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58784 +; + +-- Jul 15, 2013 10:36:42 AM COT +UPDATE AD_Field SET SeqNo=200,Updated=TO_DATE('2013-07-15 10:36:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3945 +; + +-- Jul 15, 2013 10:37:13 AM COT +UPDATE AD_Field SET SeqNo=170, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-07-15 10:37:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58785 +; + +SELECT register_migration_script('201307151037_IDEMPIERE-1173.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201307151037_IDEMPIERE-1173.sql b/migration/i1.0c-release/postgresql/201307151037_IDEMPIERE-1173.sql new file mode 100644 index 0000000000..22518240eb --- /dev/null +++ b/migration/i1.0c-release/postgresql/201307151037_IDEMPIERE-1173.sql @@ -0,0 +1,76 @@ +-- Jul 15, 2013 10:36:11 AM COT +-- IDEMPIERE-1173 Fixed landed cost allocation for Average Costing +UPDATE AD_Field SET SeqNo=280, AD_FieldGroup_ID=200013, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-07-15 10:36:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58783 +; + +-- Jul 15, 2013 10:36:11 AM COT +UPDATE AD_Field SET SeqNo=290,Updated=TO_TIMESTAMP('2013-07-15 10:36:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2662 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=300,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3842 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=310,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3841 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=320,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5132 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=330,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5133 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=340,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3845 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=350,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3844 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=360,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3839 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=370,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3840 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=380,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3836 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=390,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3851 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=400,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2654 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=410,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3835 +; + +-- Jul 15, 2013 10:36:12 AM COT +UPDATE AD_Field SET SeqNo=420,Updated=TO_TIMESTAMP('2013-07-15 10:36:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3823 +; + +-- Jul 15, 2013 10:36:42 AM COT +UPDATE AD_Field SET SeqNo=190, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-07-15 10:36:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58784 +; + +-- Jul 15, 2013 10:36:42 AM COT +UPDATE AD_Field SET SeqNo=200,Updated=TO_TIMESTAMP('2013-07-15 10:36:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3945 +; + +-- Jul 15, 2013 10:37:13 AM COT +UPDATE AD_Field SET SeqNo=170, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-07-15 10:37:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58785 +; + +SELECT register_migration_script('201307151037_IDEMPIERE-1173.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java index 3444a4077c..5017708be7 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java @@ -896,7 +896,7 @@ public class Doc_Invoice extends Doc String costingMethod = pc.getProduct().getCostingMethod(as); MAccount account = null; if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod) || X_M_Cost.COSTINGMETHOD_AveragePO.equals(costingMethod)) { - account = zeroQty ? pc.getAccount(ProductCost.ACCTTYPE_P_Cogs, as) : pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); + account = zeroQty ? pc.getAccount(ProductCost.ACCTTYPE_P_AverageCostVariance, as) : pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); } else { account = pc.getAccount(ProductCost.ACCTTYPE_P_CostAdjustment, as); } From b68a7730ea23f848be58d1a502859a20205bb062 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 15 Jul 2013 17:59:52 -0500 Subject: [PATCH 06/31] IDEMPIERE-1176 Cannot generate UUIDs on migrated database --- .../oracle/201307151553_IDEMPIERE-1176.sql | 20 ++++++++++ .../201307151553_IDEMPIERE-1176.sql | 20 ++++++++++ .../org/adempiere/process/UUIDGenerator.java | 38 +++++++++++++------ 3 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 migration/i1.0c-release/oracle/201307151553_IDEMPIERE-1176.sql create mode 100644 migration/i1.0c-release/postgresql/201307151553_IDEMPIERE-1176.sql diff --git a/migration/i1.0c-release/oracle/201307151553_IDEMPIERE-1176.sql b/migration/i1.0c-release/oracle/201307151553_IDEMPIERE-1176.sql new file mode 100644 index 0000000000..8b63fbc1bc --- /dev/null +++ b/migration/i1.0c-release/oracle/201307151553_IDEMPIERE-1176.sql @@ -0,0 +1,20 @@ +-- Jul 15, 2013 3:50:50 PM COT +-- IDEMPIERE-1176 Cannot generate UUIDs on migrated database +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsFillUUID',202570,'Fill UUID','Fill UUID','512112d3-bf9b-49a3-a354-90c710d52c6f',TO_DATE('2013-07-15 15:50:49','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-07-15 15:50:49','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Jul 15, 2013 3:50:50 PM COT +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=202570 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Jul 15, 2013 3:51:35 PM COT +INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID) VALUES ('N',202570,200068,'ecd91936-ca2c-4262-87c1-4861c8b00663',53252,20,'Y','D','Fill UUID','IsFillUUID',10,'Y',20,'Y','Y',100,TO_DATE('2013-07-15 15:51:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-07-15 15:51:34','YYYY-MM-DD HH24:MI:SS'),0,'N',0) +; + +-- Jul 15, 2013 3:51:35 PM COT +INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200068 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) +; + +SELECT register_migration_script('201307151553_IDEMPIERE-1176.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201307151553_IDEMPIERE-1176.sql b/migration/i1.0c-release/postgresql/201307151553_IDEMPIERE-1176.sql new file mode 100644 index 0000000000..28cf29a845 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201307151553_IDEMPIERE-1176.sql @@ -0,0 +1,20 @@ +-- Jul 15, 2013 3:50:50 PM COT +-- IDEMPIERE-1176 Cannot generate UUIDs on migrated database +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsFillUUID',202570,'Fill UUID','Fill UUID','512112d3-bf9b-49a3-a354-90c710d52c6f',TO_TIMESTAMP('2013-07-15 15:50:49','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-07-15 15:50:49','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Jul 15, 2013 3:50:50 PM COT +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=202570 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Jul 15, 2013 3:51:35 PM COT +INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,IsEncrypted,AD_Client_ID) VALUES ('N',202570,200068,'ecd91936-ca2c-4262-87c1-4861c8b00663',53252,20,'Y','D','Fill UUID','IsFillUUID',10,'Y',20,'Y','Y',100,TO_TIMESTAMP('2013-07-15 15:51:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-07-15 15:51:34','YYYY-MM-DD HH24:MI:SS'),0,'N',0) +; + +-- Jul 15, 2013 3:51:35 PM COT +INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200068 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) +; + +SELECT register_migration_script('201307151553_IDEMPIERE-1176.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java b/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java index a0714f2884..576a3d6217 100644 --- a/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java +++ b/org.adempiere.base/src/org/adempiere/process/UUIDGenerator.java @@ -20,7 +20,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.logging.Level; @@ -50,6 +49,8 @@ public class UUIDGenerator extends SvrProcess { private String tableName; + private boolean isFillUUID = false; + /** Logger */ private static CLogger log = CLogger.getCLogger(UUIDGenerator.class); @@ -63,6 +64,8 @@ public class UUIDGenerator extends SvrProcess { ; else if (param.getParameterName().equals("TableName")) tableName = param.getParameter().toString(); + else if (param.getParameterName().equals("IsFillUUID")) + isFillUUID = param.getParameterAsBoolean(); else log.log(Level.SEVERE, "Unknown Parameter: " + param.getParameterName()); } @@ -79,7 +82,7 @@ public class UUIDGenerator extends SvrProcess { tableName = tableName.trim(); if (!tableName.endsWith("%")) tableName = tableName + "%"; - String sql = "SELECT AD_Table_ID, TableName FROM AD_Table WHERE TableName LIKE ? AND IsView = 'N' AND IsActive='Y'"; + String sql = "SELECT AD_Table_ID, TableName FROM AD_Table WHERE TableName LIKE ? AND IsView = 'N' AND IsActive='Y' ORDER BY TableName"; PreparedStatement stmt = null; ResultSet rs = null; int count = 0; @@ -122,8 +125,16 @@ public class UUIDGenerator extends SvrProcess { syncColumn(mColumn); //update db - // COMMENT NEXT LINE ON RELEASE WORK - updateUUID(mColumn, null); + if (isFillUUID) { + // COMMENT NEXT LINE ON RELEASE WORK + updateUUID(mColumn, null); + } + } else { + if (isFillUUID) { + MColumn mColumn = MColumn.get(getCtx(), AD_Column_ID); + // COMMENT NEXT LINE ON RELEASE WORK + updateUUID(mColumn, null); + } } /* @@ -148,16 +159,21 @@ public class UUIDGenerator extends SvrProcess { public static void updateUUID(MColumn column, String trxName) { MTable table = (MTable) column.getAD_Table(); - int AD_Column_ID = DB.getSQLValue(null, "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=? AND ColumnName=?", table.getAD_Table_ID(), table.getTableName()+"_ID"); + if (table.getTableName().startsWith("T_")) { + // don't update UUID for temporary tables + return; + } + int AD_Column_ID = 0; StringBuilder sql = new StringBuilder("SELECT "); String keyColumn = null; - List compositeKeys = null; - if (AD_Column_ID > 0) { - keyColumn = table.getTableName()+"_ID"; - } else { - compositeKeys = Arrays.asList(table.getKeyColumns()); + String[] compositeKeys = table.getKeyColumns(); + if (compositeKeys == null || compositeKeys.length == 1) { + keyColumn = compositeKeys[0]; + AD_Column_ID = table.getColumn(keyColumn).getAD_Column_ID(); + compositeKeys = null; } - if ((compositeKeys == null || compositeKeys.size() == 0) && keyColumn == null) { + if ((compositeKeys == null || compositeKeys.length == 0) && keyColumn == null) { + // TODO: Update using rowid for oracle or ctid for postgresql log.warning("Cannot update orphan table " + table.getTableName() + " (not ID neither parents)"); return; } From 97135e403e550347d447ceeeba4c0e1c5840b047 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 15 Jul 2013 18:38:35 -0500 Subject: [PATCH 07/31] IDEMPIERE-1179 DB.executeUpdateEx is not allowing byte[] objects --- org.adempiere.base/src/org/compiere/util/DB.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/util/DB.java b/org.adempiere.base/src/org/compiere/util/DB.java index 63f89ccc02..3e77508e0c 100644 --- a/org.adempiere.base/src/org/compiere/util/DB.java +++ b/org.adempiere.base/src/org/compiere/util/DB.java @@ -844,6 +844,8 @@ public final class DB pstmt.setTimestamp(index, (Timestamp)param); else if (param instanceof Boolean) pstmt.setString(index, ((Boolean)param).booleanValue() ? "Y" : "N"); + else if (param instanceof byte[]) + pstmt.setBytes(index, (byte[]) param); else throw new DBException("Unknown parameter type "+index+" - "+param); } From 6ade4c42ca0950d23009b23f261a3fb7e104f411 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 15 Jul 2013 19:57:51 -0500 Subject: [PATCH 08/31] IDEMPIERE-842 The How-To help widget is partly language dependent / Thanks to Naim Berisha (nberisha) --- .../adempiere/webui/panel/HelpController.java | 153 +++++++++++++----- 1 file changed, 110 insertions(+), 43 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java index 1de491c144..b66e885b3e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java @@ -322,50 +322,116 @@ public class HelpController } } } - else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) - { - MWorkflow workflow = new MWorkflow(Env.getCtx(), recordId, null); - if (workflow != null && workflow.getName() != null && workflow.getName().length() != 0) - { - sb.append("

\n" + workflow.getName() + ""); - - if (workflow.getDescription() != null && workflow.getDescription().length() != 0) - sb.append("

\n" + workflow.getDescription() + ""); - - if (workflow.getHelp() != null && workflow.getHelp().length() != 0) - sb.append("

\n" + workflow.getHelp()); - } - } - else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) - { - MTask task = new MTask(Env.getCtx(), recordId, null); - if (task != null && task.getName() != null && task.getName().length() != 0) - { - sb.append("

\n" + task.getName() + ""); - - if (task.getDescription() != null && task.getDescription().length() != 0) - sb.append("

\n" + task.getDescription() + ""); - - if (task.getHelp() != null && task.getHelp().length() != 0) - sb.append("

\n" + task.getHelp()); - } - } - else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) - { - MWFNode node = new MWFNode(Env.getCtx(), recordId, null); - if (node != null && node.getName() != null && node.getName().length() != 0) - { - sb.append("

\n" + node.getName() + ""); - - if (node.getDescription() != null && node.getDescription().length() != 0) - sb.append("

\n" + node.getDescription() + ""); - - if (node.getHelp() != null && node.getHelp().length() != 0) - sb.append("

\n" + node.getHelp()); - } - } - } + else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) { + MWorkflow workflow = new MWorkflow(Env.getCtx(), recordId, null); + if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + + nameMsg = workflow.get_Translation("Name"); + + if (workflow != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); + + descMsg = workflow.get_Translation("Description"); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); + + helpMsg = workflow.get_Translation("Help"); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } + } else { + + if (workflow != null && workflow.getName() != null + && workflow.getName().length() != 0) { + sb.append("

\n" + workflow.getName() + ""); + + if (workflow.getDescription() != null + && workflow.getDescription().length() != 0) + sb.append("

\n" + + workflow.getDescription() + ""); + + if (workflow.getHelp() != null + && workflow.getHelp().length() != 0) + sb.append("

\n" + workflow.getHelp()); + } + + } + + } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) { + MTask task = new MTask(Env.getCtx(), recordId, null); + + if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + + nameMsg = task.get_Translation("Name"); + + if (task != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); + + descMsg = task.get_Translation("Description"); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); + + helpMsg = task.get_Translation("Help"); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } + } else { + + if (task != null && task.getName() != null + && task.getName().length() != 0) { + sb.append("

\n" + task.getName() + ""); + + if (task.getDescription() != null + && task.getDescription().length() != 0) + sb.append("

\n" + task.getDescription() + + ""); + + if (task.getHelp() != null + && task.getHelp().length() != 0) + sb.append("

\n" + task.getHelp()); + } + } + } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) { + MWFNode node = new MWFNode(Env.getCtx(), recordId, null); + + if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + + nameMsg = node.get_Translation("Name"); + + if (node != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); + + descMsg = node.get_Translation("Description"); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); + + helpMsg = node.get_Translation("Help"); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } + + } else { + if (node != null && node.getName() != null + && node.getName().length() != 0) { + sb.append("

\n" + node.getName() + ""); + + if (node.getDescription() != null + && node.getDescription().length() != 0) + sb.append("

\n" + node.getDescription() + + ""); + + if (node.getHelp() != null + && node.getHelp().length() != 0) + sb.append("

\n" + node.getHelp()); + } + } + } + } + sb.append("\n\n"); htmlContextHelp.setContent(sb.toString()); @@ -519,6 +585,7 @@ public class HelpController finally { DB.close(rs, pstmt); + rs=null; pstmt=null; } } From 2ab9b1554a870473fbee6a28d614b50b28973612 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 15 Jul 2013 21:08:05 -0500 Subject: [PATCH 09/31] IDEMPIERE-1172 Setup Wizard uses randomly languages / found the issue is because of adding object to cache on constructor (found and cleared same issue on MRfQLine and MRfQLineQty) --- .../src/org/compiere/model/MRfQLine.java | 2 - .../src/org/compiere/model/MRfQLineQty.java | 2 - .../src/org/compiere/wf/MWFNode.java | 17 +++- .../adempiere/webui/panel/HelpController.java | 86 ++++++------------- 4 files changed, 40 insertions(+), 67 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRfQLine.java b/org.adempiere.base/src/org/compiere/model/MRfQLine.java index 5a064a4e09..ab39cf0438 100644 --- a/org.adempiere.base/src/org/compiere/model/MRfQLine.java +++ b/org.adempiere.base/src/org/compiere/model/MRfQLine.java @@ -85,8 +85,6 @@ public class MRfQLine extends X_C_RfQLine public MRfQLine (Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); - if (get_ID() > 0) - s_cache.put(new Integer(get_ID()), this); } // MRfQLine /** diff --git a/org.adempiere.base/src/org/compiere/model/MRfQLineQty.java b/org.adempiere.base/src/org/compiere/model/MRfQLineQty.java index 3cd9688fa3..212c536174 100644 --- a/org.adempiere.base/src/org/compiere/model/MRfQLineQty.java +++ b/org.adempiere.base/src/org/compiere/model/MRfQLineQty.java @@ -89,8 +89,6 @@ public class MRfQLineQty extends X_C_RfQLineQty public MRfQLineQty (Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); - if (get_ID() > 0) - s_cache.put (new Integer (get_ID()), this); } // MRfQLineQty /** diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNode.java b/org.adempiere.base/src/org/compiere/wf/MWFNode.java index 961cd2bc76..e3f8398bc3 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFNode.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFNode.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; import org.compiere.model.MColumn; import org.compiere.model.Query; @@ -104,9 +105,10 @@ public class MWFNode extends X_AD_WF_Node setXPosition (0); setYPosition (0); } - // Save to Cache - if (get_ID() != 0) - s_cache.put (new Integer(getAD_WF_Node_ID()), this); + if (getAD_WF_Node_ID() > 0) { + loadNext(); + loadTrl(); + } } // MWFNode /** @@ -137,7 +139,14 @@ public class MWFNode extends X_AD_WF_Node loadNext(); loadTrl(); // Save to Cache - s_cache.put (get_ID(), this); + Integer key = null; + try { + key = new Integer (rs.getInt("AD_WF_Node_ID")); + } catch (SQLException e) { + throw new AdempiereException(e); + } + if (key != null && trxName == null && !s_cache.containsKey(key)) + s_cache.put (key, this); } // MWFNode diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java index b66e885b3e..3c2f912b7c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java @@ -216,7 +216,7 @@ public class HelpController } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Process)) { - MProcess process = new MProcess(Env.getCtx(), recordId, null); + MProcess process = MProcess.get(Env.getCtx(), recordId); if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process")) { nameMsg = process.get_Translation("Name"); @@ -323,41 +323,24 @@ public class HelpController } } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) { - MWorkflow workflow = new MWorkflow(Env.getCtx(), recordId, null); + MWorkflow workflow = MWorkflow.get(Env.getCtx(), recordId); - if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { + boolean trl = !Env.getLoginLanguage(Env.getCtx()).isBaseLanguage(); - nameMsg = workflow.get_Translation("Name"); + nameMsg = workflow.getName(trl); - if (workflow != null && nameMsg != null - && nameMsg.length() != 0) { - sb.append("

\n" + nameMsg + ""); + if (workflow != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); - descMsg = workflow.get_Translation("Description"); - if (descMsg != null && descMsg.length() != 0) - sb.append("

\n" + descMsg + ""); + descMsg = workflow.getDescription(trl); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); - helpMsg = workflow.get_Translation("Help"); - if (helpMsg != null && helpMsg.length() != 0) - sb.append("

\n" + helpMsg); - } - } else { - - if (workflow != null && workflow.getName() != null - && workflow.getName().length() != 0) { - sb.append("

\n" + workflow.getName() + ""); - - if (workflow.getDescription() != null - && workflow.getDescription().length() != 0) - sb.append("

\n" - + workflow.getDescription() + ""); - - if (workflow.getHelp() != null - && workflow.getHelp().length() != 0) - sb.append("

\n" + workflow.getHelp()); - } - - } + helpMsg = workflow.getHelp(trl); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); + } } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) { MTask task = new MTask(Env.getCtx(), recordId, null); @@ -395,40 +378,25 @@ public class HelpController } } } else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) { - MWFNode node = new MWFNode(Env.getCtx(), recordId, null); + MWFNode node = MWFNode.get(Env.getCtx(), recordId); - if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) { - - nameMsg = node.get_Translation("Name"); + boolean trl = !Env.getLoginLanguage(Env.getCtx()).isBaseLanguage(); - if (node != null && nameMsg != null - && nameMsg.length() != 0) { - sb.append("

\n" + nameMsg + ""); + nameMsg = node.getName(trl); - descMsg = node.get_Translation("Description"); - if (descMsg != null && descMsg.length() != 0) - sb.append("

\n" + descMsg + ""); + if (node != null && nameMsg != null + && nameMsg.length() != 0) { + sb.append("

\n" + nameMsg + ""); - helpMsg = node.get_Translation("Help"); - if (helpMsg != null && helpMsg.length() != 0) - sb.append("

\n" + helpMsg); - } + descMsg = node.getDescription(trl); + if (descMsg != null && descMsg.length() != 0) + sb.append("

\n" + descMsg + ""); - } else { - if (node != null && node.getName() != null - && node.getName().length() != 0) { - sb.append("

\n" + node.getName() + ""); - - if (node.getDescription() != null - && node.getDescription().length() != 0) - sb.append("

\n" + node.getDescription() - + ""); - - if (node.getHelp() != null - && node.getHelp().length() != 0) - sb.append("

\n" + node.getHelp()); - } + helpMsg = node.getHelp(trl); + if (helpMsg != null && helpMsg.length() != 0) + sb.append("

\n" + helpMsg); } + } } From 4ce7fba3a94e0c3351ab192cc89ef9eb1e3dd493 Mon Sep 17 00:00:00 2001 From: Richard Morales Date: Tue, 16 Jul 2013 00:12:28 -0500 Subject: [PATCH 10/31] IDEMPIERE-941 NPE in WebServices when logging in with wrong username --- .../WEB-INF/src/org/idempiere/webservices/AbstractService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java index 8e9a3e98fc..7febafedd9 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java @@ -93,6 +93,9 @@ public class AbstractService { Login login = new Login(m_cs.getCtx()); KeyNamePair[] clients = login.getClients(loginRequest.getUser(), loginRequest.getPass()); + if (clients == null) + return "Error login - User invalid"; + boolean okclient = false; KeyNamePair selectedClient = null; for (KeyNamePair client : clients) { From 656fe8a36617854e6d5aaf51c5b60378b5fff7cc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 16 Jul 2013 00:15:05 -0500 Subject: [PATCH 11/31] IDEMPIERE-941 soapUI tests not working - required for peer review and tests, added 2Pack for the soapUI tests --- .../adinterface/ModelADServiceImpl.java | 2 +- .../AdempiereWebServices-soapui-project.xml | 849 ------------------ .../testScripts/GW_Sample_WebServices.zip | Bin 0 -> 5733 bytes .../testScripts/MsgModelRunProcess | 23 - .../testScripts/MsgModelSetDocAction | 25 - .../testScripts/TestModelMsg.sh | 18 - .../iDempiereWebServices-soapui-project.xml | 714 +++++++++++++++ .../idempiere-composite-soapui-project.xml | 514 ++++++----- 8 files changed, 968 insertions(+), 1177 deletions(-) delete mode 100644 org.idempiere.webservices/testScripts/AdempiereWebServices-soapui-project.xml create mode 100644 org.idempiere.webservices/testScripts/GW_Sample_WebServices.zip delete mode 100644 org.idempiere.webservices/testScripts/MsgModelRunProcess delete mode 100644 org.idempiere.webservices/testScripts/MsgModelSetDocAction delete mode 100644 org.idempiere.webservices/testScripts/TestModelMsg.sh create mode 100644 org.idempiere.webservices/testScripts/iDempiereWebServices-soapui-project.xml diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java index 15f3f05a52..0934fd7e7c 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java @@ -944,7 +944,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic sqlBuilder.append(" ot.").append(colName).append(" Is Null AND "); } else if (holderPo.get_Value(colName) == null) { return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() - + ": Record Identifiier column " + colName + " must be set"); + + ": Record Identifier column " + colName + " must be set"); } else { sqlBuilder.append(" ot.").append(colName).append("=? AND "); sqlParaList.add(holderPo.get_Value(colName)); diff --git a/org.idempiere.webservices/testScripts/AdempiereWebServices-soapui-project.xml b/org.idempiere.webservices/testScripts/AdempiereWebServices-soapui-project.xml deleted file mode 100644 index 6d1ccd7ea1..0000000000 --- a/org.idempiere.webservices/testScripts/AdempiereWebServices-soapui-project.xml +++ /dev/null @@ -1,849 +0,0 @@ - -/home/carlos/srcAdempiere/branches/3E_WebServices/testScriptshttps://localhost:8443/ADInterface/services/ModelADService?wsdl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]>http://schemas.xmlsoap.org/wsdl/https://localhost:8443/ADInterface/services/ModelADServiceUTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - CreateBPartner - C_BPartner - 0 - Create - - - GlobalQSS - - - Quality Systems & Solutions - - - 830.085.359-4 - - - Y - - - N - - - N - - - QSS Ltda. - http://www.globalqss.com - - - 104 - - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - DeleteBPartner - C_BPartner - 114 - Delete - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - GetListSalesRegions - 144 - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - QueryBPartner - C_BPartner - name<'S' - Read - - - 103 - - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - ReadBPartner - C_BPartner - 114 - Read - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - ProcessInvoice - - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - - - RunStorageDetail - - - 103 - - - 133 - - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - ActionCompleteOrder - C_Order - 102 - CO - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]>UTF-8https://localhost:8443/ADInterface/services/ModelADService - - - - - - UpdateBPartner - C_BPartner - 114 - Update - - - http://www.treefarm.com - - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - 9 - - - - -]]> \ No newline at end of file diff --git a/org.idempiere.webservices/testScripts/GW_Sample_WebServices.zip b/org.idempiere.webservices/testScripts/GW_Sample_WebServices.zip new file mode 100644 index 0000000000000000000000000000000000000000..a2c832293b81563d964ee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&S4OiH$p_#zBldw_#T zkBE@}%rGC;!$aT!_FnxS|8W8QPmkYB^Y8fW!S|5# zBA);8`Df<&A17FF;h%l}9|8UEgZk&L`LAaa!T+l5AFKX%52-4mqW$(keK_JCI - - - - - - ProcessInvoice - - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - - - - - - diff --git a/org.idempiere.webservices/testScripts/MsgModelSetDocAction b/org.idempiere.webservices/testScripts/MsgModelSetDocAction deleted file mode 100644 index 181c5c1fd5..0000000000 --- a/org.idempiere.webservices/testScripts/MsgModelSetDocAction +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - ActionCompleteOrder - C_Order - 102 - CO - - - WebService - WebService - en_US - 11 - 50004 - 11 - 103 - - - - - - diff --git a/org.idempiere.webservices/testScripts/TestModelMsg.sh b/org.idempiere.webservices/testScripts/TestModelMsg.sh deleted file mode 100644 index bad61bf6e7..0000000000 --- a/org.idempiere.webservices/testScripts/TestModelMsg.sh +++ /dev/null @@ -1,18 +0,0 @@ -: -if [ $# -ne 1 ] -then - echo "Usage: $0 Message_File - echo " i.e.: $0 MsgModelSetDocAction - exit 1 -fi -FILENAME=ModelADService.wsdl.$$ -wget \ - --no-check-certificate \ - --post-file=$1 \ - --save-headers \ - https://localhost:8443/ADInterface/services/ModelADService \ - -O $FILENAME -ls -l $FILENAME -cat $FILENAME -echo -rm -f $FILENAME diff --git a/org.idempiere.webservices/testScripts/iDempiereWebServices-soapui-project.xml b/org.idempiere.webservices/testScripts/iDempiereWebServices-soapui-project.xml new file mode 100644 index 0000000000..820f83227c --- /dev/null +++ b/org.idempiere.webservices/testScripts/iDempiereWebServices-soapui-project.xml @@ -0,0 +1,714 @@ + +https://localhost:8443/ADInterface/services/ModelADService?wsdl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]>http://schemas.xmlsoap.org/wsdl/https://localhost:8443/ADInterface/services/ModelADService<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:createData> + <_0:ModelCRUDRequest> + <_0:ModelCRUD> + <_0:serviceType>CreateBPartner + <_0:TableName>C_BPartner + <_0:RecordID>0 + <_0:Action>Create + <_0:DataRow> + <_0:field column="Value"> + <_0:val>GlobalQSS + + <_0:field column="Name"> + <_0:val>Quality Systems & Solutions + + <_0:field column="TaxID"> + <_0:val>830.085.359-4 + + <_0:field column="IsVendor"> + <_0:val>Y + + <_0:field column="IsCustomer"> + <_0:val>N + + <_0:field column="IsTaxExempt"> + <_0:val>N + + <_0:field column="Name2"> + <_0:val>QSS Ltda. - http://www.globalqss.com + + <_0:field column="C_BP_Group_ID"> + <_0:val>104 + + + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:deleteData> + <_0:ModelCRUDRequest> + <_0:ModelCRUD> + <_0:serviceType>DeleteBPartner + <_0:TableName>C_BPartner + <_0:RecordID>114 + <_0:Action>Delete + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:getList> + <_0:ModelGetListRequest> + <_0:ModelGetList> + <_0:serviceType>GetListSalesRegions + <_0:AD_Reference_ID>144 + <_0:Filter> + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:queryData> + <_0:ModelCRUDRequest> + <_0:ModelCRUD> + <_0:serviceType>QueryBPartner + <_0:TableName>C_BPartner + <_0:Filter>name<'S' + <_0:Action>Read + <_0:DataRow> + <_0:field column="C_BP_Group_ID"> + <_0:val>103 + + + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:readData> + <_0:ModelCRUDRequest> + <_0:ModelCRUD> + <_0:serviceType>ReadBPartner + <_0:TableName>C_BPartner + <_0:RecordID>114 + <_0:Action>Read + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP SettingsExample on how to run report Storage Detail with HQ Warehouse and Patio Chair as parameters You need to define web service security for: Web Service Type: RunStorageDetail Web Service Parameters: AD_Process_ID Constant 236 AD_Menu_ID Constant 0 AD_Record_ID Constant 0 And allow execution to the WebService role on the report. <xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:runProcess> + <_0:ModelRunProcessRequest> + <_0:ModelRunProcess AD_Process_ID="236"> + <_0:serviceType>RunStorageDetail + <_0:ParamValues> + <_0:field column="M_Warehouse_ID"> + <_0:val>103 + + + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:runProcess> + <_0:ModelRunProcessRequest> + <_0:ModelRunProcess AD_Process_ID="111" AD_Menu_ID="0" AD_Record_ID="103" DocAction="CO"> + <_0:serviceType>ProcessInvoice + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:setDocAction> + <_0:ModelSetDocActionRequest> + <_0:ModelSetDocAction> + <_0:serviceType>ActionCompleteOrder + <_0:tableName>C_Order + <_0:recordID>102 + <_0:docAction>CO + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/ModelADService + + + <_0:updateData> + <_0:ModelCRUDRequest> + <_0:ModelCRUD> + <_0:serviceType>UpdateBPartner + <_0:TableName>C_BPartner + <_0:RecordID>114 + <_0:Action>Update + <_0:DataRow> + <_0:field column="URL"> + <_0:val>http://www.treefarm.com + + + + <_0:ADLoginRequest> + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 + + + + +]]>Global HTTP Settings \ No newline at end of file diff --git a/org.idempiere.webservices/testScripts/idempiere-composite-soapui-project.xml b/org.idempiere.webservices/testScripts/idempiere-composite-soapui-project.xml index 4b4353f4a0..16c5b3b0dd 100644 --- a/org.idempiere.webservices/testScripts/idempiere-composite-soapui-project.xml +++ b/org.idempiere.webservices/testScripts/idempiere-composite-soapui-project.xml @@ -1,5 +1,5 @@ -http://localhost:9191/ADInterface/services/compositeInterface?wsdl +https://localhost:8443/ADInterface/services/compositeInterface?wsdl @@ -382,277 +382,269 @@ - + -]]>http://schemas.xmlsoap.org/wsdl/http://localhost:9191/ADInterface/services/compositeInterface<xml-fragment/>UTF-8http://localhost:9191/ADInterface/services/compositeInterface +]]>http://schemas.xmlsoap.org/wsdl/https://localhost:8443/ADInterface/services/compositeInterface<xml-fragment/>UTF-8https://localhost:8443/ADInterface/services/compositeInterface <_0:compositeOperation> <_0:CompositeRequest> <_0:ADLoginRequest> - <_0:user>WebService - <_0:pass>WebService - <_0:lang>en_US - <_0:ClientID>11 - <_0:RoleID>50004 - <_0:OrgID>11 - <_0:WarehouseID>103 - <_0:stage>9 + <_0:user>WebService + <_0:pass>WebService + <_0:lang>en_US + <_0:ClientID>11 + <_0:RoleID>50004 + <_0:OrgID>11 + <_0:WarehouseID>103 + <_0:stage>9 <_0:serviceType>SyncOrder <_0:operations> - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateBPartner - <_0:TableName>C_BPartner - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="Name"> - <_0:val>Trek Global - - <_0:field column="email"> - <_0:val>dpansheriya@trekglobal.com - - <_0:field column="TaxID"> - <_0:val>830.085.359-4 - - <_0:field column="IsVendor"> - <_0:val>Y - - <_0:field column="IsCustomer"> - <_0:val>N - - <_0:field column="IsTaxExempt"> - <_0:val>N - - <_0:field column="C_BP_Group_ID"> - <_0:val>104 - - - - - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateUpdateUser - <_0:TableName>AD_User - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="Name"> - <_0:val>Deepak Pansheriya - - <_0:field column="EMail"> - <_0:val>dpansheriya@trekglobal.com - - <_0:field column="C_BPartner_ID"> - <_0:val>@C_BPartner.C_BPartner_ID - - <_0:field column="Phone"> - <_0:val>9228785734 - - - - - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateUpdateLocation1 - <_0:TableName>C_Location - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="C_Country_ID" lval="United States"/> - <_0:field column="Address1"> - <_0:val>1625 Cowboy Chaps Place - - <_0:field column="Address2"> - <_0:val> - - <_0:field column="C_Region_ID" lval="NV"/> - <_0:field column="RegionName"> - <_0:val>NV - - <_0:field column="Postal"> - <_0:val>89002 - - <_0:field column="City"> - <_0:val>Henderson - - - - - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateUpdateBPLocation - <_0:TableName>C_BPartner_Location - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="C_BPartner_ID"> - <_0:val>@C_BPartner.C_BPartner_ID - - <_0:field column="C_Location_ID"> - <_0:val>@C_Location.C_Location_ID - - <_0:field column="IsShipTo"> - <_0:val>True - - <_0:field column="IsBillTo"> - <_0:val>True - - - - - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateUpdateUser - <_0:TableName>AD_User - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="EMail"> - <_0:val>dpansheriya@trekglobal.com - - <_0:field column="C_BPartner_ID"> - <_0:val>@C_BPartner.C_BPartner_ID - - <_0:field column="C_BPartner_Location_ID"> - <_0:val>@C_BPartner_Location.C_BPartner_Location_ID - - - - - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>createOrderRecord - <_0:TableName>C_Order - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="M_Warehouse_ID"> - <_0:val>50001 - - <_0:field column="DocumentNo"> - <_0:val>DEEPTEST03 - - <_0:field column="AD_User_ID"> - <_0:val>@AD_User.AD_User_ID - - <_0:field column="C_BPartner_ID"> - <_0:val>@C_BPartner.C_BPartner_ID - - <_0:field column="C_BPartner_Location_ID"> - <_0:val>@C_BPartner_Location.C_BPartner_Location_ID - - <_0:field column="Bill_BPartner_ID"> - <_0:val>@C_BPartner.C_BPartner_ID - - <_0:field column="Bill_Location_ID"> - <_0:val>@C_BPartner_Location.C_BPartner_Location_ID - - <_0:field column="C_DocTypeTarget_ID"> - <_0:val>132 - - - <_0:field column="FreightCostRule" lval="Freight included"/> - <_0:field column="FreightAmt"> - <_0:val>6 - - - - - <_0:operation preCommit="true" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateOrderLine - <_0:TableName>C_OrderLine - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="AD_Org_ID"> - <_0:val>11 - - <_0:field column="AD_Client_ID"> - <_0:val>11 - - - <_0:field column="C_Order_ID"> - <_0:val>@C_Order.C_Order_ID - - <_0:field column="M_Product_ID"> - <_0:val>140 - - <_0:field column="QtyEntered"> - <_0:val>1 - - <_0:field column="QtyOrdered"> - <_0:val>1 - - <_0:field column="Line"> - <_0:val>10 - - <_0:field column="PriceEntered"> - <_0:val>12 - - <_0:field column="PriceActual"> - <_0:val>13 - - - - - - <_0:operation preCommit="false" postCommit="false"> - <_0:TargetPort>createUpdateData - <_0:ModelCRUD> - <_0:serviceType>CreateOrderLine - <_0:TableName>C_OrderLine - <_0:RecordID>0 - <_0:Action>CreateUpdate - <_0:DataRow> - <_0:field column="C_Order_ID"> - <_0:val>@C_Order.C_Order_ID - - <_0:field column="M_Product_ID"> - <_0:val>123 - - <_0:field column="QtyEntered"> - <_0:val>2 - - <_0:field column="QtyOrdered"> - <_0:val>2 - - <_0:field column="Line"> - <_0:val>10 - - <_0:field column="PriceEntered"> - <_0:val>14 - - <_0:field column="PriceActual"> - <_0:val>15 - - - - - - <_0:operation preCommit="true" postCommit="true"> - <_0:TargetPort>setDocAction - <_0:ModelSetDocAction> - <_0:serviceType>CompleteOrder - <_0:tableName>C_Order - <_0:recordID>0 - <_0:recordIDVariable>@C_Order.C_Order_ID - <_0:docAction>CO - - + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateBPartner + <_0:TableName>C_BPartner + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="Name"> + <_0:val>Trek Global + + <_0:field column="TaxID"> + <_0:val>830.085.359-4 + + <_0:field column="IsVendor"> + <_0:val>Y + + <_0:field column="IsCustomer"> + <_0:val>N + + <_0:field column="IsTaxExempt"> + <_0:val>N + + <_0:field column="C_BP_Group_ID"> + <_0:val>104 + + + + + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateUpdateUser + <_0:TableName>AD_User + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="Name"> + <_0:val>Deepak Pansheriya + + <_0:field column="EMail"> + <_0:val>dpansheriya@trekglobal.com + + <_0:field column="C_BPartner_ID"> + <_0:val>@C_BPartner.C_BPartner_ID + + <_0:field column="Phone"> + <_0:val>9228785734 + + + + + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateUpdateLocation1 + <_0:TableName>C_Location + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="C_Country_ID" lval="United States"/> + <_0:field column="Address1"> + <_0:val>1625 Cowboy Chaps Place + + <_0:field column="Address2"> + <_0:val/> + + <_0:field column="C_Region_ID" lval="NV"/> + <_0:field column="RegionName"> + <_0:val>NV + + <_0:field column="Postal"> + <_0:val>89002 + + <_0:field column="City"> + <_0:val>Henderson + + + + + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateUpdateBPLocation + <_0:TableName>C_BPartner_Location + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="C_BPartner_ID"> + <_0:val>@C_BPartner.C_BPartner_ID + + <_0:field column="C_Location_ID"> + <_0:val>@C_Location.C_Location_ID + + <_0:field column="IsShipTo"> + <_0:val>True + + <_0:field column="IsBillTo"> + <_0:val>True + + + + + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateUpdateUser + <_0:TableName>AD_User + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="EMail"> + <_0:val>dpansheriya@trekglobal.com + + <_0:field column="C_BPartner_ID"> + <_0:val>@C_BPartner.C_BPartner_ID + + <_0:field column="C_BPartner_Location_ID"> + <_0:val>@C_BPartner_Location.C_BPartner_Location_ID + + + + + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>createOrderRecord + <_0:TableName>C_Order + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="M_Warehouse_ID"> + <_0:val>50001 + + <_0:field column="DocumentNo"> + <_0:val>DEEPTEST03 + + <_0:field column="AD_User_ID"> + <_0:val>@AD_User.AD_User_ID + + <_0:field column="C_BPartner_ID"> + <_0:val>@C_BPartner.C_BPartner_ID + + <_0:field column="C_BPartner_Location_ID"> + <_0:val>@C_BPartner_Location.C_BPartner_Location_ID + + <_0:field column="Bill_BPartner_ID"> + <_0:val>@C_BPartner.C_BPartner_ID + + <_0:field column="Bill_Location_ID"> + <_0:val>@C_BPartner_Location.C_BPartner_Location_ID + + <_0:field column="C_DocTypeTarget_ID"> + <_0:val>132 + + <_0:field column="FreightAmt"> + <_0:val>6 + + + + + <_0:operation preCommit="true" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateOrderLine + <_0:TableName>C_OrderLine + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="AD_Org_ID"> + <_0:val>11 + + <_0:field column="AD_Client_ID"> + <_0:val>11 + + <_0:field column="C_Order_ID"> + <_0:val>@C_Order.C_Order_ID + + <_0:field column="M_Product_ID"> + <_0:val>140 + + <_0:field column="QtyEntered"> + <_0:val>1 + + <_0:field column="QtyOrdered"> + <_0:val>1 + + <_0:field column="Line"> + <_0:val>10 + + <_0:field column="PriceEntered"> + <_0:val>12 + + <_0:field column="PriceActual"> + <_0:val>13 + + + + + <_0:operation preCommit="false" postCommit="false"> + <_0:TargetPort>createUpdateData + <_0:ModelCRUD> + <_0:serviceType>CreateOrderLine + <_0:TableName>C_OrderLine + <_0:RecordID>0 + <_0:Action>CreateUpdate + <_0:DataRow> + <_0:field column="C_Order_ID"> + <_0:val>@C_Order.C_Order_ID + + <_0:field column="M_Product_ID"> + <_0:val>123 + + <_0:field column="QtyEntered"> + <_0:val>2 + + <_0:field column="QtyOrdered"> + <_0:val>2 + + <_0:field column="Line"> + <_0:val>10 + + <_0:field column="PriceEntered"> + <_0:val>14 + + <_0:field column="PriceActual"> + <_0:val>15 + + + + + <_0:operation preCommit="true" postCommit="true"> + <_0:TargetPort>setDocAction + <_0:ModelSetDocAction> + <_0:serviceType>CompleteOrder + <_0:tableName>C_Order + <_0:recordID>0 + <_0:recordIDVariable>@C_Order.C_Order_ID + <_0:docAction>CO + + -]]> \ No newline at end of file +]]>Global HTTP Settings \ No newline at end of file From ce5a67c2204f15bac6a802e342454c04c7066ceb Mon Sep 17 00:00:00 2001 From: Dirk Niemeyer Date: Wed, 10 Jul 2013 16:41:55 +0200 Subject: [PATCH 12/31] IDEMPIERE-1120 Implement Field SeqNo customization --- .../src/org/compiere/model/GridField.java | 2 ++ .../src/org/compiere/model/GridFieldVO.java | 29 +++++++++++++++++-- .../src/org/compiere/model/GridTabVO.java | 2 ++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 7d3276ac0f..635aec55e3 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -28,6 +28,7 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Properties; @@ -1782,6 +1783,7 @@ public class GridField AD_Window_ID, AD_Tab_ID, readOnly, rs); listVO.add(vo); } + Collections.sort(listVO, new GridFieldVO.SeqNoComparator()); } catch (Exception e) { diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index 43716718be..c7158efb93 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -21,6 +21,7 @@ import java.io.Serializable; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; +import java.util.Comparator; import java.util.Properties; import java.util.logging.Level; @@ -66,6 +67,7 @@ public class GridFieldVO implements Serializable return sql.toString(); } // getSQL + /** * Create Field Value Object * @param ctx context @@ -112,6 +114,8 @@ public class GridFieldVO implements Serializable vo.IsDisplayed = "Y".equals(rs.getString (i)); else if (columnName.equalsIgnoreCase("IsDisplayedGrid")) vo.IsDisplayedGrid = "Y".equals(rs.getString (i)); + else if (columnName.equalsIgnoreCase("SeqNo")) + vo.SeqNo = rs.getInt (i); else if (columnName.equalsIgnoreCase("SeqNoGrid")) vo.SeqNoGrid = rs.getInt (i); else if (columnName.equalsIgnoreCase("DisplayLogic")) @@ -275,7 +279,11 @@ public class GridFieldVO implements Serializable if (userDef.getNumLines() > 0) vo.NumLines=userDef.getNumLines(); if (userDef.getIsToolbarButton() != null) - vo.IsToolbarButton = "Y".equals(userDef.getIsToolbarButton()); + vo.IsToolbarButton = "Y".equals(userDef.getIsToolbarButton()); + //IDEMPIERE-1120 Implement Field SeqNo customization + if (userDef.getSeqNo() > 0) + vo.SeqNo = userDef.getSeqNo(); + } } // @@ -491,8 +499,10 @@ public class GridFieldVO implements Serializable public boolean IsDisplayed = false; /** Displayed Grid */ public boolean IsDisplayedGrid = false; + /** Position */ + public int SeqNo = 0; /** Grid Display sequence */ - public int SeqNoGrid = 0; + public int SeqNoGrid = 0; /** Dislay Logic */ public String DisplayLogic = ""; /** Default Value */ @@ -684,6 +694,7 @@ public class GridFieldVO implements Serializable clone.IsDisplayed = IsDisplayed; clone.IsDisplayedGrid = IsDisplayedGrid; clone.AD_Field_ID = AD_Field_ID; + clone.SeqNo = SeqNo; clone.SeqNoGrid = SeqNoGrid; clone.DisplayLogic = DisplayLogic; clone.DefaultValue = DefaultValue; @@ -741,4 +752,16 @@ public class GridFieldVO implements Serializable return sb.toString (); } // toString -} // MFieldVO + /** + * + * @author a42niem + * IDEMPIERE-1120 Implement Field SeqNo customization + */ + public static class SeqNoComparator implements Comparator { + @Override + public int compare(GridFieldVO gf1, GridFieldVO gf2) { + return (new Integer(gf1.SeqNo)).compareTo(new Integer(gf2.SeqNo)); + } + } + +} // GridFieldVO diff --git a/org.adempiere.base/src/org/compiere/model/GridTabVO.java b/org.adempiere.base/src/org/compiere/model/GridTabVO.java index 963ffe0f4d..5b1a6d25c6 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTabVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridTabVO.java @@ -21,6 +21,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.Properties; import java.util.logging.Level; @@ -314,6 +315,7 @@ public class GridTabVO implements Evaluatee, Serializable pstmt = null; } + Collections.sort(mTabVO.Fields, new GridFieldVO.SeqNoComparator()); mTabVO.initFields = true; return mTabVO.Fields.size() != 0; From 9cbe18feafb0412816a6e9a5f391147d7025ab0b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 16 Jul 2013 08:32:25 -0500 Subject: [PATCH 13/31] IDEMPIERE-1120 Implement Field SeqNo customization / minor peer review --- org.adempiere.base/src/org/compiere/model/GridFieldVO.java | 2 +- org.adempiere.base/src/org/compiere/model/GridTabVO.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index c7158efb93..9619af6d7c 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -46,7 +46,7 @@ public class GridFieldVO implements Serializable /** * */ - private static final long serialVersionUID = -6098724121324445114L; + private static final long serialVersionUID = -767158053380874050L; /** * Return the SQL statement used for the MFieldVO.create diff --git a/org.adempiere.base/src/org/compiere/model/GridTabVO.java b/org.adempiere.base/src/org/compiere/model/GridTabVO.java index 5b1a6d25c6..2a2f4851da 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTabVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridTabVO.java @@ -38,6 +38,11 @@ import org.compiere.util.Evaluatee; */ public class GridTabVO implements Evaluatee, Serializable { + /** + * + */ + private static final long serialVersionUID = -5120775523212893253L; + /************************************************************************** * Create MTab VO * @@ -386,8 +391,6 @@ public class GridTabVO implements Evaluatee, Serializable WindowNo = windowNo; } // MTabVO - static final long serialVersionUID = 9160212869277319305L; - /** Context - replicated */ public Properties ctx; /** Window No - replicated */ From 95bad1508c2d42830f7c1fd287deb57df775cfea Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 16 Jul 2013 09:52:17 -0500 Subject: [PATCH 14/31] IDEMPIERE-1178 2Pack exporting AD_Role_ID=0 as null --- org.adempiere.pipo/src/org/adempiere/pipo2/ReferenceUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo2/ReferenceUtils.java b/org.adempiere.pipo/src/org/adempiere/pipo2/ReferenceUtils.java index 47d8633bc4..c437b2520e 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo2/ReferenceUtils.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo2/ReferenceUtils.java @@ -85,7 +85,8 @@ public class ReferenceUtils { public static String getTableReference(String tableName, String searchColumn, int id, AttributesImpl atts) { String keyColumn = tableName + "_ID"; - if (id > 0 && id <= PackOut.MAX_OFFICIAL_ID) + if ( (id > 0 && id <= PackOut.MAX_OFFICIAL_ID) + || (id == 0 && MTable.isZeroIDTable(tableName))) { //official id atts.addAttribute("", "", "reference", "CDATA", "id"); From c5211d7bf397f323eb06f723568c21853fb6930c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 16 Jul 2013 10:24:49 -0500 Subject: [PATCH 15/31] IDEMPIERE-1177 Record Info not showing UUID for zero ID records / this was affecting any program trying to read the zero ID records programatically using the ID constructor --- org.adempiere.base/src/org/compiere/model/PO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 8f89a4aa14..e6ddf2fc8a 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -1276,7 +1276,7 @@ public abstract class PO protected void load (int ID, String trxName) { if (log.isLoggable(Level.FINEST)) log.finest("ID=" + ID); - if (ID > 0) + if (ID > 0 || (ID == 0 && MTable.isZeroIDTable(get_TableName()))) { setKeyInfo(); m_IDs = new Object[] {new Integer(ID)}; From 89ff83536f7f05a8709ceff694cc168414cb41d8 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Wed, 17 Jul 2013 14:52:11 +0530 Subject: [PATCH 16/31] IDEMPIERE-460: Fixing regression issue with lookup on web service --- .../adinterface/ModelADServiceImpl.java | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java index 0934fd7e7c..32b11a47eb 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java @@ -45,6 +45,7 @@ import javax.xml.ws.WebServiceContext; import org.apache.xmlbeans.StringEnumAbstractBase.Table; import org.compiere.model.Lookup; import org.compiere.model.MColumn; +import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MRefTable; import org.compiere.model.MRole; @@ -57,7 +58,9 @@ import org.compiere.model.X_WS_WebServiceFieldInput; import org.compiere.model.X_WS_WebService_Para; import org.compiere.util.CLogger; import org.compiere.util.DB; +import org.compiere.util.DisplayType; import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; import org.compiere.util.Trx; import org.compiere.util.Util; import org.compiere.util.ValueNamePair; @@ -1071,11 +1074,38 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic "LookupResolutionFailed")); } - String sql = ADLookup.getDirectAccessSQL(lookup, lookupValue.toUpperCase()); - int id = DB.getSQLValue(localTrxName, sql); - if (id > 0) - value = id; - + int AD_Reference_ID = 0; + if(lookup instanceof MLookup){ + AD_Reference_ID = ((MLookup)lookup).getDisplayType(); + } + + if(AD_Reference_ID==DisplayType.List) + { + if (lookup.getSize() == 0) + lookup.refresh(); + Object[] list = lookup.getData(true, true, true, false,false).toArray(); // IDEMPIERE 90 + + for (Object pair : list) { + if (pair instanceof KeyNamePair) { + KeyNamePair p = (KeyNamePair) pair; + if (p.getName().equalsIgnoreCase(lookupValue)) { + value = p.getID(); + break; + } + } else { + ValueNamePair p = (ValueNamePair) pair; + if (p.getName().equalsIgnoreCase(lookupValue)) { + value = p.getValue(); + break; + } + } + } + }else{ + String sql = ADLookup.getDirectAccessSQL(lookup, lookupValue.toUpperCase()); + int id = DB.getSQLValue(localTrxName, sql); + if (id > 0) + value = id; + } if (value == null) { throw new IdempiereServiceFault(" Invalid Lookup value:" + lookupValue, new QName("LookupResolutionFailed")); } From 54862b0d9eeeed052507ded2f41a4d530b07d933 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 08:48:02 -0500 Subject: [PATCH 17/31] IDEMPIERE-460 Add back sample for list lookup --- .../testScripts/GW_Sample_WebServices.zip | Bin 5733 -> 5672 bytes .../idempiere-composite-soapui-project.xml | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/org.idempiere.webservices/testScripts/GW_Sample_WebServices.zip b/org.idempiere.webservices/testScripts/GW_Sample_WebServices.zip index a2c832293b81563d964eeabe04c6ab80be2d7232..691eb49dac0a2b3f4673ca4ab3d2c9089ea6a363 100644 GIT binary patch delta 4643 zcmV+;65Q?OET}9EP)h>@3IG5A005Om@sSNN1C>SbkwG>Cl|}K9dNmQ2Me#y8+hhHa z5dZ*7-2eb4lQ9(^k>3~zR#n!`A#v80){*}jf61XiG@yo|2Z{}LH>&HLI(0JZ($D_( zfA7wYe&^}sPiTyZ2}O<~Po-dHVaL@a6H*ueWaW>7q{`A0NF;v-C~6y!8=Zmg(gEY<{@7>rs`{ ze~#M4^l0`^KKd?AE1&;%F+HnC|I7LE)7O1{HT&nqwBKX#+kd`Gle6c?lk;}*A8*et zayt8;%gZmz#k=F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kfhPGzTtwmvaM^Q|i+VGEfXXeL#hp$5vMsfBEh?I~Zp- zvE#>`I;(LP<{M;+PBZfByQF_$Vk0en&37yg?3Nc z$0w~3fOmkjHleqXJYZ3^fA0>h`r1zoVrAJ{-3s%D;;=nwAD^@o{4UJVqbau;O-k#2z^1&*)9iVe{4jUms^s2vdxm8G7e>G6rMGnSClQy-& zLGLZac5I@*vP(Qe=<<93p;&CgU6N(f+}Xd zFwz0BR!|ceLsfe&fBS)oT_Wu+gl>k(t0?BSqS#z3M?eV?0>)xWtBKQoBd{GJ?O+Sd zwn^F)oy);$@NK?qr@su)2x+}fQHL6xcKb<=J40F}ws{w%w#3$A^Z{zb05&;-9+*KZ zm;x4SD=$X{YqD1FrS{QTD^j})BNa+%n@Ay4A0$T8wm}Xqe?V|v?5<0(t-R%DPukIv zwoC0UWN>q&oRU)_us({^)(U-F8c-IqHa3~2HZ`F<>{W;Q`n!Zt@u5DKfX`2uA~+cTrWJE2!SIElC$ef1VJucG+5Lsm_A1aJvi>Or^I_e ztP<5=CMNVL7`*W<9peY@_Gv_;0nZuarfmlCi=xYl3Z!5aG;$>+AB;D9*<2I6Qn <_0:val>132 + <_0:field column="FreightCostRule" lval="Freight included"/> <_0:field column="FreightAmt"> <_0:val>6 @@ -647,4 +648,4 @@ -]]>Global HTTP Settings \ No newline at end of file +]]>Global HTTP Settings From a8766eb2762c5ca437e4b362603abdf74caf37ae Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 11:19:28 -0500 Subject: [PATCH 18/31] IDEMPIERE-1170 Cannot Drag Tree Item After Insert New Record --- .../src/org/adempiere/webui/adwindow/ADTabpanel.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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 2436d63623..b4af00a3d2 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 @@ -1216,14 +1216,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer }else if(e.isInserting() && gridTab.getRecord_ID() < 0 && gridTab.getTabLevel() > 0 ) { int AD_Tree_ID = Integer.parseInt(gridTab.getParentTab().getValue("AD_Tree_ID").toString()); - MTreeNode root = new MTree (Env.getCtx(), AD_Tree_ID, true, true, null).getRoot(); - SimpleTreeModel treeModel = SimpleTreeModel.createFrom(root); - try { - treePanel.getTree().setItemRenderer(treeModel); - treePanel.getTree().setModel(treeModel); - } catch (Exception treeExc) { - logger.log(Level.SEVERE, "Failed to setup tree"); - } + treePanel.initTree(AD_Tree_ID, windowNo); } } if (listPanel.isVisible()) { From bef6671726c6d66b14d9e6112212b70320f290c6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 12:26:51 -0500 Subject: [PATCH 19/31] backout 206712e3cad5 / IDEMPIERE-1177 Record Info not showing UUID for zero ID records, messed out creation of users on window, will need to find a better solution for this --- org.adempiere.base/src/org/compiere/model/PO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index e6ddf2fc8a..8f89a4aa14 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -1276,7 +1276,7 @@ public abstract class PO protected void load (int ID, String trxName) { if (log.isLoggable(Level.FINEST)) log.finest("ID=" + ID); - if (ID > 0 || (ID == 0 && MTable.isZeroIDTable(get_TableName()))) + if (ID > 0) { setKeyInfo(); m_IDs = new Object[] {new Integer(ID)}; From 7ee9b8ddc466a391b56f34e275e95b30b45ed1d4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 12:52:24 -0500 Subject: [PATCH 20/31] IDEMPIERE-1177 Record Info not showing UUID for zero ID records --- .../src/org/compiere/model/GridTable.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 79417d23ae..8908165a4d 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -3822,10 +3822,14 @@ public class GridTable extends AbstractTableModel MTable table = MTable.get (m_ctx, m_AD_Table_ID); PO po = null; int Record_ID = getKeyID(row); - if (Record_ID != -1) - po = table.getPO(Record_ID, m_trxName); - else // Multi - Key - po = table.getPO(getWhereClause(getDataAtRow(row)), m_trxName); + if (Record_ID == 0 && MTable.isZeroIDTable(getTableName())) { + po = new Query(Env.getCtx(), table, getKeyColumnName()+"=0", null).first(); + } else { + if (Record_ID != -1) + po = table.getPO(Record_ID, m_trxName); + else // Multi - Key + po = table.getPO(getWhereClause(getDataAtRow(row)), m_trxName); + } return po; } From be82eec408eca2aca6bef400cefdfa0f3c2ed56e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 13:15:21 -0500 Subject: [PATCH 21/31] IDEMPIERE-347 Password for user System must be changed via Reset Password window - as a security measure, and also because hashed password corrupt the password if changed from window --- .../i1.0c-release/oracle/201307171313_IDEMPIERE-347.sql | 8 ++++++++ .../postgresql/201307171313_IDEMPIERE-347.sql | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 migration/i1.0c-release/oracle/201307171313_IDEMPIERE-347.sql create mode 100644 migration/i1.0c-release/postgresql/201307171313_IDEMPIERE-347.sql diff --git a/migration/i1.0c-release/oracle/201307171313_IDEMPIERE-347.sql b/migration/i1.0c-release/oracle/201307171313_IDEMPIERE-347.sql new file mode 100644 index 0000000000..d84027ca70 --- /dev/null +++ b/migration/i1.0c-release/oracle/201307171313_IDEMPIERE-347.sql @@ -0,0 +1,8 @@ +-- Jul 17, 2013 1:10:17 PM COT +-- IDEMPIERE-347 passwords hash +UPDATE AD_Column SET ReadOnlyLogic='@AD_User_ID@=0',Updated=TO_DATE('2013-07-17 13:10:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=417 +; + +SELECT register_migration_script('201307171313_IDEMPIERE-347.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201307171313_IDEMPIERE-347.sql b/migration/i1.0c-release/postgresql/201307171313_IDEMPIERE-347.sql new file mode 100644 index 0000000000..7943dcb69d --- /dev/null +++ b/migration/i1.0c-release/postgresql/201307171313_IDEMPIERE-347.sql @@ -0,0 +1,8 @@ +-- Jul 17, 2013 1:10:17 PM COT +-- IDEMPIERE-347 passwords hash +UPDATE AD_Column SET ReadOnlyLogic='@AD_User_ID@=0',Updated=TO_TIMESTAMP('2013-07-17 13:10:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=417 +; + +SELECT register_migration_script('201307171313_IDEMPIERE-347.sql') FROM dual +; + From abdf87066945d0c7acb6605642f79d2b77e889b6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 16:32:20 -0500 Subject: [PATCH 22/31] IDEMPIERE-1185 Cannot Lookup records in Reports --- .../webui/window/ZkReportViewer.java | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) 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 7398361b74..0ecd852f5f 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 @@ -31,6 +31,7 @@ import javax.activation.FileDataSource; import javax.servlet.http.HttpServletRequest; import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.DBException; import org.adempiere.pdf.Document; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; @@ -125,7 +126,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab /** * */ - private static final long serialVersionUID = 344552813342946104L; + private static final long serialVersionUID = 6208607687967139151L; /** Window No */ private int m_WindowNo = -1; @@ -296,6 +297,9 @@ public class ZkReportViewer extends Window implements EventListener, ITab bFind.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Find"))); toolBar.appendChild(bFind); bFind.addEventListener(Events.ON_CLICK, this); + if (getAD_Tab_ID(m_reportEngine.getPrintFormat().getAD_Table_ID()) <= 0) { + bFind.setVisible(false); // IDEMPIERE-1185 + } toolBar.appendChild(new Separator("vertical")); @@ -421,6 +425,22 @@ public class ZkReportViewer extends Window implements EventListener, ITab init = true; } + /** + * Get the maintenance tab of the table associated to the report engine + * @return AD_Tab_ID or -1 if not found + */ + private int getAD_Tab_ID(int AD_Table_ID) { + // Get Find Tab Info + final String sql = "SELECT t.AD_Tab_ID " + + "FROM AD_Tab t" + + " INNER JOIN AD_Window w ON (t.AD_Window_ID=w.AD_Window_ID)" + + " INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) " + + "WHERE tt.AD_Table_ID=? " + + "ORDER BY w.IsDefault DESC, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID)"; + int AD_Tab_ID = DB.getSQLValueEx(null, sql, AD_Table_ID); + return AD_Tab_ID; + } + private void renderReport() throws Exception { media = null; Listitem selected = previewType.getSelectedItem(); @@ -448,8 +468,10 @@ public class ZkReportViewer extends Window implements EventListener, ITab m_reportEngine.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp", this.getUuid())); media = new AMedia(file.getName(), "html", "text/html", file, false); - labelDrill.setVisible(true); - comboDrill.setVisible(true); + if (comboDrill.getItemCount() > 1) { + labelDrill.setVisible(true); + comboDrill.setVisible(true); + } } else if ("XLS".equals(previewType.getSelectedItem().getValue())) { String path = System.getProperty("java.io.tmpdir"); String prefix = makePrefix(m_reportEngine.getName()); @@ -1008,20 +1030,11 @@ public class ZkReportViewer extends Window implements EventListener, ITab */ private void cmd_find() { - int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID(); - String title = null; String tableName = null; - // Get Find Tab Info - String sql = "SELECT t.AD_Tab_ID " - // ,w.Name, t.Name, w.IsDefault, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID) - + "FROM AD_Tab t" - + " INNER JOIN AD_Window w ON (t.AD_Window_ID=w.AD_Window_ID)" - + " INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) " - + "WHERE tt.AD_Table_ID=? " - + "ORDER BY w.IsDefault DESC, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID)"; - int AD_Tab_ID = DB.getSQLValue(null, sql, AD_Table_ID); + int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID(); + int AD_Tab_ID = getAD_Tab_ID(AD_Table_ID); // ASP MClient client = MClient.get(Env.getCtx()); String ASPFilter = ""; @@ -1060,10 +1073,13 @@ public class ZkReportViewer extends Window implements EventListener, ITab + " AND ce.AD_Field_ID IS NULL " + " AND ce.ASP_Status = 'H')"; // Hide // - sql = "SELECT Name, TableName FROM AD_Tab_v WHERE AD_Tab_ID=? " + ASPFilter; - if (!Env.isBaseLanguage(Env.getCtx(), "AD_Tab")) + String sql = null; + if (!Env.isBaseLanguage(Env.getCtx(), "AD_Tab")) { sql = "SELECT Name, TableName FROM AD_Tab_vt WHERE AD_Tab_ID=?" - + " AND AD_Language='" + Env.getAD_Language(Env.getCtx()) + "' " + ASPFilter; + + " AND AD_Language='" + Env.getAD_Language(Env.getCtx()) + "' " + ASPFilter; + } else { + sql = "SELECT Name, TableName FROM AD_Tab_v WHERE AD_Tab_ID=? " + ASPFilter; + } PreparedStatement pstmt = null; ResultSet rs = null; try @@ -1080,7 +1096,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab } catch (SQLException e) { - log.log(Level.SEVERE, sql, e); + throw new DBException(e); } finally { From 180a720f253e313d6d19bdb357e35586e05353ae Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 18:33:58 -0500 Subject: [PATCH 23/31] IDEMPIERE-1174 Found a matchinv created on matchpo was not being posted on immediate accounting --- .../src/org/compiere/model/MInOut.java | 4 ++++ .../src/org/compiere/model/MMatchPO.java | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 2b3b38c527..e9eb47a446 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1628,6 +1628,10 @@ public class MInOut extends X_M_InOut implements DocAction } if (!po.isPosted()) addDocsPostProcess(po); + if (po.getMatchInvCreated() != null) { + addDocsPostProcess(po.getMatchInvCreated()); + po.setMatchInvCreated(null); + } } // Update PO with ASI if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0 diff --git a/org.adempiere.base/src/org/compiere/model/MMatchPO.java b/org.adempiere.base/src/org/compiere/model/MMatchPO.java index 41904ec972..99bf94df30 100644 --- a/org.adempiere.base/src/org/compiere/model/MMatchPO.java +++ b/org.adempiere.base/src/org/compiere/model/MMatchPO.java @@ -59,8 +59,7 @@ public class MMatchPO extends X_M_MatchPO /** * */ - private static final long serialVersionUID = 7189366329684552916L; - + private static final long serialVersionUID = -3669451656879485463L; /** * Get PO Match with order/invoice @@ -446,6 +445,7 @@ public class MMatchPO extends X_M_MatchPO s_log.fine(msg); continue; } + mpo.setMatchInvCreated(matchInv); if (savepoint != null) { try { @@ -549,7 +549,19 @@ public class MMatchPO extends X_M_MatchPO return retValue; } // create - + + private MMatchInv m_matchInv; + /** + * Register the match inv created for immediate accounting purposes + * @param matchInv + */ + public void setMatchInvCreated(MMatchInv matchInv) { + m_matchInv = matchInv; + } + public MMatchInv getMatchInvCreated() { + return m_matchInv; + } + /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MMatchPO.class); From 46585842d2b35106e12a676fa79c4f0f397a6e23 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 19:47:09 -0500 Subject: [PATCH 24/31] IDEMPIERE-1174 Found avg po cost detail record was not being created when following flow PO->Inv->Receipt - force the posting of matchpo just when receipt is associated --- .../src/org/compiere/acct/Doc_MatchPO.java | 9 +++++++-- org.adempiere.base/src/org/compiere/model/MInvoice.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java index daecc82367..f62e68820d 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java @@ -126,14 +126,19 @@ public class Doc_MatchPO extends Doc ArrayList facts = new ArrayList(); // if (getM_Product_ID() == 0 // Nothing to do if no Product - || getQty().signum() == 0 - || m_M_InOutLine_ID == 0) // No posting if not matched to Shipment + || getQty().signum() == 0) { if (log.isLoggable(Level.FINE)) log.fine("No Product/Qty - M_Product_ID=" + getM_Product_ID() + ",Qty=" + getQty()); return facts; } + if (m_M_InOutLine_ID == 0) // No posting if not matched to Shipment + { + p_Error = "No posting if not matched to Shipment"; + return null; + } + // create Fact Header Fact fact = new Fact(this, as, Fact.POST_Actual); setC_Currency_ID(as.getC_Currency_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 45cff928e0..be7f08cd7a 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1849,7 +1849,7 @@ public class MInvoice extends X_C_Invoice implements DocAction return DocAction.STATUS_Invalid; } matchPO++; - if (!po.isPosted()) + if (!po.isPosted() && po.getM_InOutLine_ID() > 0) // match po don't post if receipt is not assigned, and it doesn't create avg po record addDocsPostProcess(po); } } From 61b9cd95085fbf5792d5afd463cc08388fe7289d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 22:04:15 -0500 Subject: [PATCH 25/31] IDEMPIERE-1174 Found a matchinv created on matchpo was not being posted on immediate accounting / follow recommendation from Heng Sin about privacy of method --- .../src/org/compiere/model/MInOut.java | 1 - .../src/org/compiere/model/MInOutLine.java | 8 +++- .../src/org/compiere/model/MInvoiceLine.java | 39 +++++++++++++++---- .../src/org/compiere/model/MMatchPO.java | 13 ++++++- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index e9eb47a446..a2071bcd7a 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1630,7 +1630,6 @@ public class MInOut extends X_M_InOut implements DocAction addDocsPostProcess(po); if (po.getMatchInvCreated() != null) { addDocsPostProcess(po.getMatchInvCreated()); - po.setMatchInvCreated(null); } } // Update PO with ASI diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index 2489de1d82..0479bda181 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -651,8 +651,12 @@ public class MInOutLine extends X_M_InOutLine MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this); if (m_il == null) { - log.severe("No Invoice Line for: " + this.toString()); - return Env.ZERO; + m_il = MInvoiceLine.getOfInOutLineFromMatchInv(this); + if (m_il == null) + { + log.severe("No Invoice Line for: " + this.toString()); + return Env.ZERO; + } } return this.getMovementQty().multiply(m_il.getPriceActual()); // Actual delivery } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index f55d4f5c05..b087747a1e 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -52,7 +52,7 @@ public class MInvoiceLine extends X_C_InvoiceLine /** * */ - private static final long serialVersionUID = -5113860437274708398L; + private static final long serialVersionUID = 6157080330492848409L; /** * Get Invoice Line referencing InOut Line @@ -78,6 +78,29 @@ public class MInvoiceLine extends X_C_InvoiceLine return retValue; } // getOfInOutLine + /** + * Get Invoice Line referencing InOut Line - from MatchInv + * @param sLine shipment line + * @return (first) invoice line + */ + public static MInvoiceLine getOfInOutLineFromMatchInv(MInOutLine sLine) { + if (sLine == null) + return null; + final String whereClause = "C_InvoiceLine_ID IN (SELECT C_InvoiceLine_ID FROM M_MatchInv WHERE M_InOutLine_ID=?)"; + List list = new Query(sLine.getCtx(),I_C_InvoiceLine.Table_Name,whereClause,sLine.get_TrxName()) + .setParameters(sLine.getM_InOutLine_ID()) + .list(); + + MInvoiceLine retValue = null; + if (list.size() > 0) { + retValue = list.get(0); + if (list.size() > 1) + s_log.warning("More than one C_InvoiceLine of " + sLine); + } + + return retValue; + } + /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MInvoiceLine.class); @@ -1053,9 +1076,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - double result = getLineNetAmt().multiply(base).doubleValue(); - result /= total.doubleValue(); - lca.setAmt(result, getPrecision()); + BigDecimal result = getLineNetAmt().multiply(base); + result = result.divide(total, BigDecimal.ROUND_HALF_UP); + lca.setAmt(result.doubleValue(), getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); @@ -1079,6 +1102,8 @@ public class MInvoiceLine extends X_C_InvoiceLine lca.setM_Product_ID(iol.getM_Product_ID()); lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); BigDecimal base = iol.getBase(lc.getLandedCostDistribution()); + if (base.signum() == 0) + return "Base value is 0 - " + lc.getLandedCostDistribution(); lca.setBase(base); lca.setAmt(getLineNetAmt()); // MZ Goodwill @@ -1174,9 +1199,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - double result = getLineNetAmt().multiply(base).doubleValue(); - result /= total.doubleValue(); - lca.setAmt(result, getPrecision()); + BigDecimal result = getLineNetAmt().multiply(base); + result = result.divide(total, BigDecimal.ROUND_HALF_UP); + lca.setAmt(result.doubleValue(), getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); diff --git a/org.adempiere.base/src/org/compiere/model/MMatchPO.java b/org.adempiere.base/src/org/compiere/model/MMatchPO.java index 99bf94df30..8bc2e6e388 100644 --- a/org.adempiere.base/src/org/compiere/model/MMatchPO.java +++ b/org.adempiere.base/src/org/compiere/model/MMatchPO.java @@ -551,15 +551,24 @@ public class MMatchPO extends X_M_MatchPO private MMatchInv m_matchInv; + /** * Register the match inv created for immediate accounting purposes * @param matchInv */ - public void setMatchInvCreated(MMatchInv matchInv) { + private void setMatchInvCreated(MMatchInv matchInv) { m_matchInv = matchInv; } + + /** + * Get the match inv created for immediate accounting purposes + * Is cleared after read, so if you read twice second time it returns null + * @param matchInv + */ public MMatchInv getMatchInvCreated() { - return m_matchInv; + MMatchInv tmp = m_matchInv; + m_matchInv = null; + return tmp; } /** Static Logger */ From 8390b8ed1692a82709cf0bbba1342a3b433c2724 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 22:12:21 -0500 Subject: [PATCH 26/31] Backed out changeset 4c2a0e55b08a / wrong commit affecting two tickets and with a bug introduced, will fix in next IDEMPIERE-1174 --- .../src/org/compiere/model/MInOut.java | 1 + .../src/org/compiere/model/MInOutLine.java | 8 +--- .../src/org/compiere/model/MInvoiceLine.java | 39 ++++--------------- .../src/org/compiere/model/MMatchPO.java | 13 +------ 4 files changed, 12 insertions(+), 49 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index a2071bcd7a..e9eb47a446 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1630,6 +1630,7 @@ public class MInOut extends X_M_InOut implements DocAction addDocsPostProcess(po); if (po.getMatchInvCreated() != null) { addDocsPostProcess(po.getMatchInvCreated()); + po.setMatchInvCreated(null); } } // Update PO with ASI diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index 0479bda181..2489de1d82 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -651,12 +651,8 @@ public class MInOutLine extends X_M_InOutLine MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this); if (m_il == null) { - m_il = MInvoiceLine.getOfInOutLineFromMatchInv(this); - if (m_il == null) - { - log.severe("No Invoice Line for: " + this.toString()); - return Env.ZERO; - } + log.severe("No Invoice Line for: " + this.toString()); + return Env.ZERO; } return this.getMovementQty().multiply(m_il.getPriceActual()); // Actual delivery } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index b087747a1e..f55d4f5c05 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -52,7 +52,7 @@ public class MInvoiceLine extends X_C_InvoiceLine /** * */ - private static final long serialVersionUID = 6157080330492848409L; + private static final long serialVersionUID = -5113860437274708398L; /** * Get Invoice Line referencing InOut Line @@ -78,29 +78,6 @@ public class MInvoiceLine extends X_C_InvoiceLine return retValue; } // getOfInOutLine - /** - * Get Invoice Line referencing InOut Line - from MatchInv - * @param sLine shipment line - * @return (first) invoice line - */ - public static MInvoiceLine getOfInOutLineFromMatchInv(MInOutLine sLine) { - if (sLine == null) - return null; - final String whereClause = "C_InvoiceLine_ID IN (SELECT C_InvoiceLine_ID FROM M_MatchInv WHERE M_InOutLine_ID=?)"; - List list = new Query(sLine.getCtx(),I_C_InvoiceLine.Table_Name,whereClause,sLine.get_TrxName()) - .setParameters(sLine.getM_InOutLine_ID()) - .list(); - - MInvoiceLine retValue = null; - if (list.size() > 0) { - retValue = list.get(0); - if (list.size() > 1) - s_log.warning("More than one C_InvoiceLine of " + sLine); - } - - return retValue; - } - /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MInvoiceLine.class); @@ -1076,9 +1053,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - BigDecimal result = getLineNetAmt().multiply(base); - result = result.divide(total, BigDecimal.ROUND_HALF_UP); - lca.setAmt(result.doubleValue(), getPrecision()); + double result = getLineNetAmt().multiply(base).doubleValue(); + result /= total.doubleValue(); + lca.setAmt(result, getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); @@ -1102,8 +1079,6 @@ public class MInvoiceLine extends X_C_InvoiceLine lca.setM_Product_ID(iol.getM_Product_ID()); lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); BigDecimal base = iol.getBase(lc.getLandedCostDistribution()); - if (base.signum() == 0) - return "Base value is 0 - " + lc.getLandedCostDistribution(); lca.setBase(base); lca.setAmt(getLineNetAmt()); // MZ Goodwill @@ -1199,9 +1174,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - BigDecimal result = getLineNetAmt().multiply(base); - result = result.divide(total, BigDecimal.ROUND_HALF_UP); - lca.setAmt(result.doubleValue(), getPrecision()); + double result = getLineNetAmt().multiply(base).doubleValue(); + result /= total.doubleValue(); + lca.setAmt(result, getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); diff --git a/org.adempiere.base/src/org/compiere/model/MMatchPO.java b/org.adempiere.base/src/org/compiere/model/MMatchPO.java index 8bc2e6e388..99bf94df30 100644 --- a/org.adempiere.base/src/org/compiere/model/MMatchPO.java +++ b/org.adempiere.base/src/org/compiere/model/MMatchPO.java @@ -551,24 +551,15 @@ public class MMatchPO extends X_M_MatchPO private MMatchInv m_matchInv; - /** * Register the match inv created for immediate accounting purposes * @param matchInv */ - private void setMatchInvCreated(MMatchInv matchInv) { + public void setMatchInvCreated(MMatchInv matchInv) { m_matchInv = matchInv; } - - /** - * Get the match inv created for immediate accounting purposes - * Is cleared after read, so if you read twice second time it returns null - * @param matchInv - */ public MMatchInv getMatchInvCreated() { - MMatchInv tmp = m_matchInv; - m_matchInv = null; - return tmp; + return m_matchInv; } /** Static Logger */ From 0ab9dca20d6c0a4efffb900a9b5cdd076261f743 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 22:27:22 -0500 Subject: [PATCH 27/31] IDEMPIERE-1174 Found a matchinv created on matchpo was not being posted on immediate accounting / follow recommendation from Heng Sin about privacy of method --- .../src/org/compiere/model/MInOut.java | 6 +++--- .../src/org/compiere/model/MMatchPO.java | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index e9eb47a446..c68d731039 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1628,9 +1628,9 @@ public class MInOut extends X_M_InOut implements DocAction } if (!po.isPosted()) addDocsPostProcess(po); - if (po.getMatchInvCreated() != null) { - addDocsPostProcess(po.getMatchInvCreated()); - po.setMatchInvCreated(null); + MMatchInv matchInvCreated = po.getMatchInvCreated(); + if (matchInvCreated != null) { + addDocsPostProcess(matchInvCreated); } } // Update PO with ASI diff --git a/org.adempiere.base/src/org/compiere/model/MMatchPO.java b/org.adempiere.base/src/org/compiere/model/MMatchPO.java index 99bf94df30..8bc2e6e388 100644 --- a/org.adempiere.base/src/org/compiere/model/MMatchPO.java +++ b/org.adempiere.base/src/org/compiere/model/MMatchPO.java @@ -551,15 +551,24 @@ public class MMatchPO extends X_M_MatchPO private MMatchInv m_matchInv; + /** * Register the match inv created for immediate accounting purposes * @param matchInv */ - public void setMatchInvCreated(MMatchInv matchInv) { + private void setMatchInvCreated(MMatchInv matchInv) { m_matchInv = matchInv; } + + /** + * Get the match inv created for immediate accounting purposes + * Is cleared after read, so if you read twice second time it returns null + * @param matchInv + */ public MMatchInv getMatchInvCreated() { - return m_matchInv; + MMatchInv tmp = m_matchInv; + m_matchInv = null; + return tmp; } /** Static Logger */ From 45db44b0240e9236a26e18d7c206319b158e3b9f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 22:28:31 -0500 Subject: [PATCH 28/31] IDEMPIERE-1173 Fixed landed cost allocation for Average Costing / fix problems with distribution using cost --- .../src/org/compiere/model/MInOutLine.java | 8 +++- .../src/org/compiere/model/MInvoiceLine.java | 39 +++++++++++++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index 2489de1d82..0479bda181 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -651,8 +651,12 @@ public class MInOutLine extends X_M_InOutLine MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this); if (m_il == null) { - log.severe("No Invoice Line for: " + this.toString()); - return Env.ZERO; + m_il = MInvoiceLine.getOfInOutLineFromMatchInv(this); + if (m_il == null) + { + log.severe("No Invoice Line for: " + this.toString()); + return Env.ZERO; + } } return this.getMovementQty().multiply(m_il.getPriceActual()); // Actual delivery } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index f55d4f5c05..b087747a1e 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -52,7 +52,7 @@ public class MInvoiceLine extends X_C_InvoiceLine /** * */ - private static final long serialVersionUID = -5113860437274708398L; + private static final long serialVersionUID = 6157080330492848409L; /** * Get Invoice Line referencing InOut Line @@ -78,6 +78,29 @@ public class MInvoiceLine extends X_C_InvoiceLine return retValue; } // getOfInOutLine + /** + * Get Invoice Line referencing InOut Line - from MatchInv + * @param sLine shipment line + * @return (first) invoice line + */ + public static MInvoiceLine getOfInOutLineFromMatchInv(MInOutLine sLine) { + if (sLine == null) + return null; + final String whereClause = "C_InvoiceLine_ID IN (SELECT C_InvoiceLine_ID FROM M_MatchInv WHERE M_InOutLine_ID=?)"; + List list = new Query(sLine.getCtx(),I_C_InvoiceLine.Table_Name,whereClause,sLine.get_TrxName()) + .setParameters(sLine.getM_InOutLine_ID()) + .list(); + + MInvoiceLine retValue = null; + if (list.size() > 0) { + retValue = list.get(0); + if (list.size() > 1) + s_log.warning("More than one C_InvoiceLine of " + sLine); + } + + return retValue; + } + /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MInvoiceLine.class); @@ -1053,9 +1076,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - double result = getLineNetAmt().multiply(base).doubleValue(); - result /= total.doubleValue(); - lca.setAmt(result, getPrecision()); + BigDecimal result = getLineNetAmt().multiply(base); + result = result.divide(total, BigDecimal.ROUND_HALF_UP); + lca.setAmt(result.doubleValue(), getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); @@ -1079,6 +1102,8 @@ public class MInvoiceLine extends X_C_InvoiceLine lca.setM_Product_ID(iol.getM_Product_ID()); lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); BigDecimal base = iol.getBase(lc.getLandedCostDistribution()); + if (base.signum() == 0) + return "Base value is 0 - " + lc.getLandedCostDistribution(); lca.setBase(base); lca.setAmt(getLineNetAmt()); // MZ Goodwill @@ -1174,9 +1199,9 @@ public class MInvoiceLine extends X_C_InvoiceLine // end MZ if (base.signum() != 0) { - double result = getLineNetAmt().multiply(base).doubleValue(); - result /= total.doubleValue(); - lca.setAmt(result, getPrecision()); + BigDecimal result = getLineNetAmt().multiply(base); + result = result.divide(total, BigDecimal.ROUND_HALF_UP); + lca.setAmt(result.doubleValue(), getPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); From 839f02d82347fd4e9d47576eda669b3c5f4f7f79 Mon Sep 17 00:00:00 2001 From: Carlos Augusto Sanchez Date: Thu, 18 Jul 2013 16:20:29 -0500 Subject: [PATCH 29/31] IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows / use case 1 --- .../oracle/20130717091459_IDEMPIERE-984.sql | 10 ++++ .../20130717091459_IDEMPIERE-984.sql | 11 ++++ .../adwindow/AbstractADWindowContent.java | 5 ++ .../webui/desktop/AbstractDesktop.java | 5 ++ .../webui/desktop/DefaultDesktop.java | 17 ++++++ .../org/adempiere/webui/desktop/IDesktop.java | 2 + .../org/adempiere/webui/panel/UserPanel.java | 52 +++++++++++++++++-- 7 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql create mode 100644 migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql diff --git a/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql b/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql new file mode 100644 index 0000000000..1c2b601aeb --- /dev/null +++ b/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql @@ -0,0 +1,10 @@ +-- Jul 17, 2013 9:14:59 AM COT +-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows +INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','There are records that haven''t been saved yet. ','Do you still want to proceed?',200207,'D','78553b48-d536-4366-90ee-7fc69e80f35a','ProceedWithTask?','Y',TO_DATE('2013-07-17 09:14:58','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-17 09:14:58','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 17, 2013 9:14:59 AM COT +-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200207 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; +SELECT register_migration_script('20130717091459_IDEMPIERE-984.sql') FROM dual diff --git a/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql b/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql new file mode 100644 index 0000000000..7c56888df9 --- /dev/null +++ b/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql @@ -0,0 +1,11 @@ +-- Jul 17, 2013 9:14:59 AM COT +-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows +INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','There are records that haven''t been saved yet. ','Do you still want to proceed?',200207,'D','78553b48-d536-4366-90ee-7fc69e80f35a','ProceedWithTask?','Y',TO_TIMESTAMP('2013-07-17 09:14:58','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-17 09:14:58','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 17, 2013 9:14:59 AM COT +-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200207 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +SELECT register_migration_script('20130717091459_IDEMPIERE-984.sql') FROM dual 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 47e3d91660..e1ec1dcaad 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 @@ -2931,4 +2931,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements LayoutUtils.openEmbeddedWindow(getComponent().getParent(), findWindow, "overlap"); } } + + public boolean isPendingChanges() { + return boolChanges; + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java index 54e7e48380..85e656ffef 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/AbstractDesktop.java @@ -295,4 +295,9 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop win.setPage(page); win.doHighlighted(); } + + protected List getWindows(){ + return windows; + } + } 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 253624c85f..62b739ee64 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 @@ -18,6 +18,7 @@ package org.adempiere.webui.desktop; import java.io.Serializable; +import java.util.List; import java.util.Map; import java.util.Properties; @@ -26,6 +27,7 @@ import org.adempiere.base.event.IEventManager; import org.adempiere.base.event.IEventTopics; import org.adempiere.model.MBroadcastMessage; import org.adempiere.util.ServerContext; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.apps.ProcessDialog; @@ -593,4 +595,19 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria super.openTask(taskId); updateHelpContext(X_AD_CtxHelp.CTXTYPE_Task, taskId); } + + public boolean isPendingWindow() { + List windows = getWindows(); + if (windows != null) { + for (int idx = 0; idx < windows.size(); idx++) { + Object ad = windows.get(idx); + if (ad != null && ad instanceof ADWindow) { + if ( ((ADWindow)ad).getADWindowContent().isPendingChanges()) { + return true; + } + } + } + } + return false; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java index 7c12de8ca5..4a8b670e75 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java @@ -204,4 +204,6 @@ public interface IDesktop extends UIPart { public void updateHelpContext(String ctxType, int recordId); public void updateHelpTooltip(GridField gridField); + + public boolean isPendingWindow(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java index 354ef58b69..d910b0f261 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java @@ -17,13 +17,16 @@ package org.adempiere.webui.panel; + import java.util.Properties; +import org.adempiere.util.Callback; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Menupopup; import org.adempiere.webui.component.Messagebox; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.FeedbackManager; +import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.WPreference; import org.compiere.model.MClient; import org.compiere.model.MOrg; @@ -136,14 +139,34 @@ public class UserPanel implements EventListener, Composer return "*"; } } - public void onEvent(Event event) throws Exception { if (event == null) return; if (logout == event.getTarget()) { - SessionManager.logoutSession(); + component.addEventListener("onLogout", new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + SessionManager.logoutSession(); + } + }); + + if (SessionManager.getAppDesktop().isPendingWindow()) { + FDialog.ask(0, component, "ProceedWithTask?", new Callback() { + + @Override + public void onCallback(Boolean result) + { + if (result) + { + Events.echoEvent(new Event("onLogout", component)); + } + } + }); + } else { + SessionManager.logoutSession(); + } } else if (lblUserNameValue == event.getTarget()) { @@ -153,8 +176,29 @@ public class UserPanel implements EventListener, Composer } else if (changeRole == event.getTarget()) { - MUser user = MUser.get(ctx); - SessionManager.changeRole(user); + component.addEventListener("onChangeRole", new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + MUser user = MUser.get(ctx); + SessionManager.changeRole(user); + } + }); + if (SessionManager.getAppDesktop().isPendingWindow()) { + FDialog.ask(0, component, "ProceedWithTask?", new Callback() { + + @Override + public void onCallback(Boolean result) + { + if (result) + { + Events.echoEvent(new Event("onChangeRole", component)); + } + } + }); + } else { + MUser user = MUser.get(ctx); + SessionManager.changeRole(user); + } } else if (preference == event.getTarget()) { From 3e06cf32552cc7367a049b25187f5c49d390da96 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 18 Jul 2013 16:21:18 -0500 Subject: [PATCH 30/31] IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows / use case 1 / peer review --- .../oracle/20130717091459_IDEMPIERE-984.sql | 2 + .../20130717091459_IDEMPIERE-984.sql | 1 + .../org/adempiere/webui/panel/UserPanel.java | 43 ++++++++++--------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql b/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql index 1c2b601aeb..b0003e00ae 100644 --- a/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql +++ b/migration/i1.0c-release/oracle/20130717091459_IDEMPIERE-984.sql @@ -7,4 +7,6 @@ INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Messa -- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200207 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) ; + SELECT register_migration_script('20130717091459_IDEMPIERE-984.sql') FROM dual +; diff --git a/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql b/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql index 7c56888df9..820178942d 100644 --- a/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql +++ b/migration/i1.0c-release/postgresql/20130717091459_IDEMPIERE-984.sql @@ -9,3 +9,4 @@ INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTransla ; SELECT register_migration_script('20130717091459_IDEMPIERE-984.sql') FROM dual +; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java index d910b0f261..ca2265442f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java @@ -17,7 +17,6 @@ package org.adempiere.webui.panel; - import java.util.Properties; import org.adempiere.util.Callback; @@ -66,7 +65,10 @@ public class UserPanel implements EventListener, Composer protected Component component; - public UserPanel() + private static final String ON_DEFER_CHANGE_ROLE = "onDeferChangeRole"; + private static final String ON_DEFER_LOGOUT = "onDeferLogout"; + + public UserPanel() { super(); this.ctx = Env.getCtx(); @@ -106,6 +108,9 @@ public class UserPanel implements EventListener, Composer SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, this); component.addEventListener("onEmailSupport", this); + + component.addEventListener(ON_DEFER_LOGOUT, this); + component.addEventListener(ON_DEFER_CHANGE_ROLE, this); } private String getUserName() @@ -139,19 +144,13 @@ public class UserPanel implements EventListener, Composer return "*"; } } + public void onEvent(Event event) throws Exception { if (event == null) return; if (logout == event.getTarget()) { - component.addEventListener("onLogout", new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - SessionManager.logoutSession(); - } - }); - if (SessionManager.getAppDesktop().isPendingWindow()) { FDialog.ask(0, component, "ProceedWithTask?", new Callback() { @@ -160,12 +159,12 @@ public class UserPanel implements EventListener, Composer { if (result) { - Events.echoEvent(new Event("onLogout", component)); + Events.echoEvent(ON_DEFER_LOGOUT, component, null); } } }); } else { - SessionManager.logoutSession(); + Events.echoEvent(ON_DEFER_LOGOUT, component, null); } } else if (lblUserNameValue == event.getTarget()) @@ -176,13 +175,6 @@ public class UserPanel implements EventListener, Composer } else if (changeRole == event.getTarget()) { - component.addEventListener("onChangeRole", new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - MUser user = MUser.get(ctx); - SessionManager.changeRole(user); - } - }); if (SessionManager.getAppDesktop().isPendingWindow()) { FDialog.ask(0, component, "ProceedWithTask?", new Callback() { @@ -191,13 +183,12 @@ public class UserPanel implements EventListener, Composer { if (result) { - Events.echoEvent(new Event("onChangeRole", component)); + Events.echoEvent(ON_DEFER_CHANGE_ROLE, component, null); } } }); } else { - MUser user = MUser.get(ctx); - SessionManager.changeRole(user); + Events.echoEvent(ON_DEFER_CHANGE_ROLE, component, null); } } else if (preference == event.getTarget()) @@ -246,6 +237,16 @@ public class UserPanel implements EventListener, Composer } } } + else if (ON_DEFER_LOGOUT.equals(event.getName())) + { + SessionManager.logoutSession(); + } + else if (ON_DEFER_CHANGE_ROLE.equals(event.getName())) + { + MUser user = MUser.get(ctx); + SessionManager.changeRole(user); + } + } @Override From 1319bae51a661f00a9003e864e56d99eac4ab4b3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 18 Jul 2013 16:43:19 -0500 Subject: [PATCH 31/31] Backout aecb6ca - IDEMPIERE-1177 - backed out as a better solution has been proposed, pending to implement --- .../src/org/compiere/model/GridTable.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 8908165a4d..79417d23ae 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -3822,14 +3822,10 @@ public class GridTable extends AbstractTableModel MTable table = MTable.get (m_ctx, m_AD_Table_ID); PO po = null; int Record_ID = getKeyID(row); - if (Record_ID == 0 && MTable.isZeroIDTable(getTableName())) { - po = new Query(Env.getCtx(), table, getKeyColumnName()+"=0", null).first(); - } else { - if (Record_ID != -1) - po = table.getPO(Record_ID, m_trxName); - else // Multi - Key - po = table.getPO(getWhereClause(getDataAtRow(row)), m_trxName); - } + if (Record_ID != -1) + po = table.getPO(Record_ID, m_trxName); + else // Multi - Key + po = table.getPO(getWhereClause(getDataAtRow(row)), m_trxName); return po; }