diff --git a/db/ddlutils/oracle/functions/BOM_PriceLimit.sql b/db/ddlutils/oracle/functions/BOM_PriceLimit.sql index 37733c93fe..8ca102b31c 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceLimit.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceLimit.sql @@ -27,8 +27,6 @@ AS WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y'; -- BEGIN diff --git a/db/ddlutils/oracle/functions/BOM_PriceList.sql b/db/ddlutils/oracle/functions/BOM_PriceList.sql index da274c35d8..b9590f4501 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceList.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceList.sql @@ -27,8 +27,6 @@ AS WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y'; -- BEGIN diff --git a/db/ddlutils/oracle/functions/BOM_PriceStd.sql b/db/ddlutils/oracle/functions/BOM_PriceStd.sql index eace5db30a..143dbf87d6 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceStd.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceStd.sql @@ -27,8 +27,6 @@ AS WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y'; -- BEGIN diff --git a/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql b/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql index f9c1b0b4b9..216dce20a5 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql @@ -20,8 +20,6 @@ BEGIN WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); diff --git a/db/ddlutils/postgresql/functions/BOM_PriceList.sql b/db/ddlutils/postgresql/functions/BOM_PriceList.sql index 8677da115c..03f69e0dae 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceList.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceList.sql @@ -20,8 +20,6 @@ BEGIN WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); diff --git a/db/ddlutils/postgresql/functions/BOM_PriceStd.sql b/db/ddlutils/postgresql/functions/BOM_PriceStd.sql index 96c3dabf00..5c34e42dca 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceStd.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceStd.sql @@ -20,8 +20,6 @@ BEGIN WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); diff --git a/migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql b/migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql new file mode 100644 index 0000000000..e2acc007da --- /dev/null +++ b/migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql @@ -0,0 +1,157 @@ +CREATE OR REPLACE FUNCTION BOMPRICELIMIT +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceLimit.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Limit Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE (SUM(PriceLimit), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricelimit (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; +END Bompricelimit; +/ + +CREATE OR REPLACE FUNCTION BOMPRICELIST +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceList.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return List Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE (SUM(PriceList), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricelist (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + -- DBMS_OUTPUT.PUT_LINE('Qry=' || bom.BOMQty || ' @ ' || v_ProductPrice || ', Price=' || v_Price); + END LOOP; -- BOM + END IF; + -- + RETURN v_Price; +END Bompricelist; +/ + +CREATE OR REPLACE FUNCTION BOMPRICESTD +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceStd.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Standard Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE(SUM(PriceStd), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricestd (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + -- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + END LOOP; -- BOM + END IF; + -- + RETURN v_Price; +END Bompricestd; +/ + +SELECT register_migration_script('201505201243_IDEMPIERE-2625.sql') FROM dual +; diff --git a/migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql b/migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql new file mode 100644 index 0000000000..3a299d3b64 --- /dev/null +++ b/migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql @@ -0,0 +1,113 @@ +CREATE OR REPLACE FUNCTION bompricelimit (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE (SUM(PriceLimit), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bompricelist (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE (SUM(PriceList), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bompricestd (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE(SUM(PriceStd), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +SELECT register_migration_script('201505201243_IDEMPIERE-2625.sql') FROM dual +; diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java b/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java index 4bdd140712..a78ed98038 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java +++ b/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java @@ -76,6 +76,8 @@ public class CopyFromBankStmt extends SvrProcess for (MBankStatementLine fromLine : from.getLines(false)) { + if (!fromLine.isActive()) + continue; if (fromLine.getC_Payment_ID() > 0) { // check if payment is used on another statement diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java b/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java index ef8f147a95..f8ae106ae8 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java @@ -101,9 +101,11 @@ public class Doc_BankStatement extends Doc for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; - DocLine_Bank docLine = new DocLine_Bank(line, this); - - list.add(docLine); + if(line.isActive()) + { + DocLine_Bank docLine = new DocLine_Bank(line, this); + list.add(docLine); + } } // Return Array diff --git a/org.adempiere.base/src/org/compiere/model/MBankStatement.java b/org.adempiere.base/src/org/compiere/model/MBankStatement.java index 3a9d647894..4002743401 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankStatement.java +++ b/org.adempiere.base/src/org/compiere/model/MBankStatement.java @@ -317,6 +317,8 @@ public class MBankStatement extends X_C_BankStatement implements DocAction for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; + if (!line.isActive()) + continue; total = total.add(line.getStmtAmt()); if (line.getDateAcct().before(minDate)) minDate = line.getDateAcct(); diff --git a/org.adempiere.base/src/org/compiere/util/Language.java b/org.adempiere.base/src/org/compiere/util/Language.java index d6a06c9a4e..366ac3f435 100644 --- a/org.adempiere.base/src/org/compiere/util/Language.java +++ b/org.adempiere.base/src/org/compiere/util/Language.java @@ -170,8 +170,6 @@ public class Language implements Serializable StringBuilder msglog = new StringBuilder("Adding Language=").append(language).append(", Country=").append(country).append(", Locale=").append(locale); log.info (msglog.toString()); } - StringBuilder msglog = new StringBuilder("Adding Language=").append(language).append(", Country=").append(country).append(", Locale=").append(locale); - log.warning(msglog.toString()); if (idxReplace >= 0) { s_languages.set(idxReplace, ll); } else { 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 df1bbc6288..7589cb4f5c 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 @@ -2053,6 +2053,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements adTabbox.getSelectedGridTab().dataRefreshAll(true, true); adTabbox.getSelectedGridTab().refreshParentTabs(); statusBar.setStatusLine(statusLine); + if( adTabbox.getSelectedDetailADTabpanel() != null && + adTabbox.getSelectedDetailADTabpanel().getGridTab() != null ) + adTabbox.getSelectedDetailADTabpanel().getGridTab().dataRefreshAll(true, true); } if (dirtyTabpanel != null) { if (dirtyTabpanel == adTabbox.getSelectedDetailADTabpanel()) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 8f7a8480b4..9cbd173724 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -162,7 +162,11 @@ public final class AEnv if (AD_Window_ID == 0) return; MTable table = MTable.get(Env.getCtx(), AD_Table_ID); - zoom(AD_Window_ID, MQuery.getEqualQuery(table.getKeyColumns()[0], Record_ID)); + MQuery query = MQuery.getEqualQuery(table.getKeyColumns()[0], Record_ID); + query.setZoomTableName(table.getTableName()); + query.setZoomColumnName(table.getKeyColumns()[0]); + query.setZoomValue(Record_ID); + zoom(AD_Window_ID, query); } // zoom /************************************************************************* diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index 40c545ea92..8132a33538 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -211,7 +211,8 @@ public abstract class InfoPanel extends Window implements EventListener, infoWindow = MInfoWindow.get(p_keyColumn.replace("_ID", ""), null); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); addEventListener(ON_RUN_PROCESS, this); - + addEventListener(Events.ON_CLOSE, this); + } // InfoPanel private void init() @@ -1441,7 +1442,7 @@ public abstract class InfoPanel extends Window implements EventListener, // do nothing when parameter not change and at window mode, or at dialog mode but select non record onOk(); } - }else if (event.getName().equals(Events.ON_CANCEL)){ + }else if (event.getName().equals(Events.ON_CANCEL) || (event.getTarget().equals(this) && event.getName().equals(Events.ON_CLOSE))){ m_cancel = true; dispose(false); } diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java index e25d66206f..444de85e38 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java @@ -73,7 +73,7 @@ public abstract class CreateFromRMA extends CreateFrom { sqlStmt.append("SELECT iol.M_InOutLine_ID, iol.Line, "); sqlStmt.append("COALESCE(p.Name, c.Name) AS ProductName, "); sqlStmt.append("iol.QtyEntered, "); - sqlStmt.append("iol.movementQty, "); + sqlStmt.append("iol.movementQty-(SELECT COALESCE((SELECT SUM(rmal.qty) FROM M_RMALine rmal JOIN M_RMA rma ON rma.M_RMA_ID=rmal.M_RMA_ID WHERE rmal.M_InOutLine_ID=iol.M_InOutLine_ID AND rma.DocStatus IN ('CO','CL')),0)) AS MovementQty, "); sqlStmt.append("CASE WHEN iol.M_AttributeSetInstance_ID IS NOT NULL THEN (SELECT SerNo FROM M_AttributeSetInstance asi WHERE asi.M_AttributeSetInstance_ID=iol.M_AttributeSetInstance_ID) END as ASI "); sqlStmt.append("FROM M_InOutLine iol "); sqlStmt.append("LEFT JOIN M_Product p ON p.M_Product_ID = iol.M_Product_ID "); @@ -136,7 +136,7 @@ public abstract class CreateFromRMA extends CreateFrom { miniTable.setColumnClass(2, String.class, true); // 2-Product miniTable.setColumnClass(3, String.class, true); // 3-ASI miniTable.setColumnClass(4, BigDecimal.class, true); // 4-Qty - miniTable.setColumnClass(5, BigDecimal.class, true); // 5-Delivered Qty + miniTable.setColumnClass(5, BigDecimal.class, false); // 5-Delivered Qty // Table UI miniTable.autoSize(); diff --git a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java index 61addf67a7..e82eee8deb 100644 --- a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java +++ b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java @@ -1362,6 +1362,8 @@ public class DB_Oracle implements AdempiereDatabase } rs = stmt.executeQuery(); if (rs.next()) { + // reload the record being locked - it could have changed in a different thread - IDEMPIERE-2629 + po.load(po.get_TrxName()); return true; } else { return false; diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java index 05c7113916..80002cbba8 100755 --- a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java @@ -1089,6 +1089,8 @@ public class DB_PostgreSQL implements AdempiereDatabase rs = stmt.executeQuery(); if (rs.next()) { + // reload the record being locked - it could have changed in a different thread - IDEMPIERE-2629 + po.load(po.get_TrxName()); return true; } else { return false; diff --git a/org.idempiere.webservices/Notes/HowToAddNewWebService.txt b/org.idempiere.webservices/Notes/HowToAddNewWebService.txt index 045bd2ce31..341baf5b71 100644 --- a/org.idempiere.webservices/Notes/HowToAddNewWebService.txt +++ b/org.idempiere.webservices/Notes/HowToAddNewWebService.txt @@ -11,9 +11,27 @@ the new webservice will have the following parameters: Note, if you need to define new datatypes you need to define them in WEB-INF/xsd/idempiere-schema.xsd and generate the idempiere-xmlbeans.jar again with this command: + scomp -out ./WEB-INF/lib/idempiere-xmlbeans.jar ./WEB-INF/xsd/idempiere-schema.xsd + scomp will generate the corresponding classes to manipulate the xml objects from the messages +To install xmlbeans Git Clone URL: git://git.apache.org/xmlbeans.git +cd xmlbeans/ +./xbeanenv.sh +ant + +Environment example: +export XMLBEANS_HOME=/opt/xmlbeans +export PATH=$PATH:$XMLBEANS_HOME/bin +export XMLBEANS_LIB=$XMLBEANS_HOME/build/lib +export JAVA_HOME=/usr/lib/jvm/java-1.7.0...(your path) + +Apps: +ant +svn +git + The method will be called modelSetDocAction - the model in name indicates that the web service is going to be based on model classes, current web services are based in UI instead of model. 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 7e370c3ff0..4b73fc370e 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 @@ -1478,6 +1478,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID()); int cnt = 0; + int rowCnt = 0; + int offset = modelCRUD.getOffset(); + int limit = modelCRUD.getLimit(); PreparedStatement pstmtquery = null; ResultSet rsquery = null; @@ -1539,6 +1542,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic DataSet ds = resp.addNewDataSet(); while (rsquery.next ()) { cnt++; + if ((offset >= cnt) || (limit > 0 && offset+limit < cnt)) + continue; + rowCnt++; DataRow dr = ds.addNewDataRow(); for (int i = 0; i < poinfo.getColumnCount(); i++) { String columnName = poinfo.getColumnName(i); @@ -1560,11 +1566,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic rsquery = null; pstmtquery = null; } - resp.setSuccess(true); - resp.setRowCount(cnt); - resp.setNumRows(cnt); + resp.setSuccess(true); + resp.setRowCount(rowCnt); + resp.setNumRows(rowCnt); resp.setTotalRows(cnt); - resp.setStartRow(1); + resp.setStartRow(offset); return ret; } finally { diff --git a/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd b/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd index 3ec31594ac..0ab0ec392f 100644 --- a/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd +++ b/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd @@ -263,6 +263,8 @@ + +