details: https://code.openbravo.com/erp/devel/pi/rev/583bebddfa28 changeset: 18389:583bebddfa28 user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Wed Oct 31 17:37:36 2012 +0100 summary: comparing with https://code.openbravo.com/erp/devel/pi/ searching for changes changeset: 18300:cb08550b4527 user: Ioritz Cia <[email protected]> date: Fri Oct 26 13:03:25 2012 +0200 summary: Fixes issue 21616: If the user deactivate an account with balance,
details: https://code.openbravo.com/erp/devel/pi/rev/8edc8b56385f changeset: 18390:8edc8b56385f user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Wed Oct 31 17:37:36 2012 +0100 summary: changeset: 18301:0b345b4d6c02 user: Ioritz Cia <[email protected]> date: Mon Oct 29 16:42:18 2012 +0100 summary: Fixes issue 21782: Http0 error obtained in manual Reconcile process. details: https://code.openbravo.com/erp/devel/pi/rev/4f75ce8264e2 changeset: 18391:4f75ce8264e2 user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Wed Oct 31 17:37:37 2012 +0100 summary: changeset: 18302:5d7748976956 user: Ioritz Cia <[email protected]> date: Mon Oct 29 16:44:43 2012 +0100 summary: Improvement while recalculating process options. details: https://code.openbravo.com/erp/devel/pi/rev/e887399e206b changeset: 18392:e887399e206b user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Wed Oct 31 17:37:37 2012 +0100 summary: changeset: 18303:e6e884e6160e user: Ioritz Cia <[email protected]> date: Tue Oct 30 12:28:48 2012 +0100 summary: Fixes issue 22087: 'Ordered Qty' showed in Product selector details: https://code.openbravo.com/erp/devel/pi/rev/bfbc83480241 changeset: 18393:bfbc83480241 user: Ioritz Cia <ioritz.cia <at> openbravo.com> date: Wed Oct 31 17:37:37 2012 +0100 summary: changeset: 18304:5466e2426f93 tag: tip user: Ioritz Cia <[email protected]> date: Wed Oct 31 13:22:42 2012 +0100 summary: Deleted unused method. diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java | 93 +-- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.html | 8 + modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java | 17 + src-db/database/model/functions/C_ORDER_POST1.xml | 335 +++++---- src/org/openbravo/erpCommon/businessUtility/AccountTree.java | 21 +- src/org/openbravo/erpCommon/businessUtility/AccountTree_data.xsql | 10 +- 6 files changed, 248 insertions(+), 236 deletions(-) diffs (truncated from 659 to 300 lines): diff -r e28f59d8ece5 -r bfbc83480241 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java Wed Oct 31 13:53:12 2012 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java Wed Oct 31 17:37:37 2012 +0100 @@ -33,7 +33,6 @@ import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; -import org.hibernate.Query; import org.hibernate.criterion.Restrictions; import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao; import org.openbravo.advpaymentmngt.process.FIN_AddPayment; @@ -270,7 +269,7 @@ String strFinancialAccountId = vars.getRequiredStringParameter("inpFinancialAccount"); String strOrgId = vars.getRequiredStringParameter("inpadOrgId"); boolean isReceipt = vars.getRequiredStringParameter("isReceipt").equals("Y"); - refreshProcessOptions(response, strPaymentMethodId, strFinancialAccountId, strOrgId, + refreshProcessOptions(response, vars, strPaymentMethodId, strFinancialAccountId, strOrgId, isReceipt); } @@ -595,9 +594,9 @@ out.close(); } - private void refreshProcessOptions(HttpServletResponse response, String strPaymentMethod, - String strFinancialAccountId, String strOrgId, boolean isReceipt) throws IOException, - ServletException { + private void refreshProcessOptions(HttpServletResponse response, VariablesSecureApp vars, + String strPaymentMethod, String strFinancialAccountId, String strOrgId, boolean isReceipt) + throws IOException, ServletException { log4j.debug("Callout: Financial Account has changed to" + strFinancialAccountId); FIN_PaymentMethod paymentMethod = OBDal.getInstance().get(FIN_PaymentMethod.class, @@ -614,48 +613,22 @@ } } String processOprtionsComboHtml = null; - if (isReceipt) { - if (finAccPaymentMethod.isAutomaticDeposit()) { - // 1 option: Process. - processOprtionsComboHtml = FIN_Utility.getOptionsList( - processActionWithDepositWithdrawn("F903F726B41A49D3860243101CEEBA25", true), null, - true, true); - } else { - // 2 options: Process or Process and Deposit. - try { - OBContext.setAdminMode(true); - org.openbravo.model.ad.domain.Reference reference = OBDal.getInstance().get( - org.openbravo.model.ad.domain.Reference.class, "F903F726B41A49D3860243101CEEBA25"); - processOprtionsComboHtml = FIN_Utility.getOptionsList(reference.getADListList(), null, - true, true); - } catch (Exception e) { + boolean forcedFinancialAccountTransaction = finAccPaymentMethod.isAutomaticDeposit() + || finAccPaymentMethod.isAutomaticWithdrawn(); - } finally { - OBContext.restorePreviousMode(); - } - } - } else { - if (finAccPaymentMethod.isAutomaticWithdrawn()) { - // 1 option: Process. - processOprtionsComboHtml = FIN_Utility.getOptionsList( - processActionWithDepositWithdrawn("F15C13A199A748F1B0B00E985A64C036", false), null, - true, true); + try { + ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "", + (isReceipt ? "F903F726B41A49D3860243101CEEBA25" : "F15C13A199A748F1B0B00E985A64C036"), + forcedFinancialAccountTransaction ? "29010995FD39439D97A5C0CE8CE27D70" : "", + Utility.getContext(this, vars, "#AccessibleOrgTree", "AddPaymentFromInvoice"), + Utility.getContext(this, vars, "#User_Client", "AddPaymentFromInvoice"), 0); + Utility.fillSQLParameters(this, vars, null, comboTableData, "AddPaymentFromInvoice", ""); + FieldProvider[] properOptions = comboTableData.select(false); + processOprtionsComboHtml = FIN_Utility.getOptionsListFromFieldProvider(properOptions, null, + true); + } catch (Exception e) { - } else { - // 2 Options: Process or Process and Withdrawn - try { - OBContext.setAdminMode(true); - org.openbravo.model.ad.domain.Reference reference = OBDal.getInstance().get( - org.openbravo.model.ad.domain.Reference.class, "F15C13A199A748F1B0B00E985A64C036"); - processOprtionsComboHtml = FIN_Utility.getOptionsList(reference.getADListList(), null, - true, true); - } catch (Exception e) { - - } finally { - OBContext.restorePreviousMode(); - } - } } response.setContentType("text/html; charset=UTF-8"); @@ -665,37 +638,6 @@ out.close(); } - /** - * Returns the list of the reference list for payment process - * - * @param refId - * . Indicates the Id of the reference. - * @param deposit - * . Indicates whether the method is being executed for deposit of withdrawn. - * @return. Returns the list of process actions. - */ - private List processActionWithDepositWithdrawn(String refId, boolean deposit) { - try { - OBContext.setAdminMode(true); - StringBuilder hql = new StringBuilder(); - hql.append("select l "); - hql.append("from ADReference r "); - hql.append(" left join r.aDListList l "); - hql.append("where r.id = '").append(refId).append("' "); - hql.append(" and lower(l.name) like '%").append((deposit == true) ? "deposit" : "withdrawn") - .append("%'"); - - final Query query = OBDal.getInstance().getSession().createQuery(hql.toString()); - - return query.list(); - } catch (Exception e) { - return null; - } finally { - OBContext.restorePreviousMode(); - } - - } - private BigDecimal findExchangeRate(VariablesSecureApp vars, Currency paymentCurrency, Currency financialAccountCurrency, Date paymentDate, Organization organization, int conversionRatePrecision) { @@ -759,5 +701,4 @@ } return false; } - } diff -r e28f59d8ece5 -r bfbc83480241 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.html --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.html Wed Oct 31 13:53:12 2012 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.html Wed Oct 31 17:37:37 2012 +0100 @@ -257,6 +257,10 @@ function saveTransactionLineStatus(isChecked, transLineId) { document.frmMain.inpCurrentTransIdSelected.value = transLineId; document.frmMain.inpIsCurrentTransSelected.value = isChecked; + document.frmMain.inpClearAll.disabled = true; + document.getElementById('buttonSave').disabled = true; + document.getElementById('buttonProcess').disabled = true; + document.getElementById('buttonCancel').disabled = true; try { var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/Reconciliation.html"; var paramXMLReq = null; @@ -272,6 +276,10 @@ try { if (XMLHttpRequestObj.responseText) { strText = XMLHttpRequestObj.responseText; + document.frmMain.inpClearAll.disabled = false; + document.getElementById('buttonSave').disabled = false; + document.getElementById('buttonProcess').disabled = false; + document.getElementById('buttonCancel').disabled = false; } else { } } catch (e) { diff -r e28f59d8ece5 -r bfbc83480241 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Wed Oct 31 13:53:12 2012 +0100 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Wed Oct 31 17:37:37 2012 +0100 @@ -548,6 +548,23 @@ return strOptions.toString(); } + public static <T extends BaseOBObject> String getOptionsListFromFieldProvider( + FieldProvider[] fieldProvider, String selectedValue, boolean isMandatory) { + StringBuilder strOptions = new StringBuilder(); + if (!isMandatory) + strOptions.append("<option value=\"\"></option>"); + + for (int i = 0; i < fieldProvider.length; i++) { + strOptions.append("<option value=\"").append(fieldProvider[i].getField("ID")).append("\""); + if (fieldProvider[i].getField("ID").equals(selectedValue)) + strOptions.append(" selected=\"selected\""); + strOptions.append(">"); + strOptions.append(escape(fieldProvider[i].getField("NAME"))); + strOptions.append("</option>"); + } + return strOptions.toString(); + } + /** * Method to replace special characters to print properly in an html. Changes are: ">" to ">" * and "<" to "<" diff -r e28f59d8ece5 -r bfbc83480241 src-db/database/model/functions/C_ORDER_POST1.xml --- a/src-db/database/model/functions/C_ORDER_POST1.xml Wed Oct 31 13:53:12 2012 +0100 +++ b/src-db/database/model/functions/C_ORDER_POST1.xml Wed Oct 31 17:37:37 2012 +0100 @@ -420,33 +420,87 @@ /** * Close Order - prepare */ - IF (v_DocAction='CL') THEN - -- Cancel undelivered Items - IF (v_isSoTrx='Y') THEN --Sales orders - UPDATE C_ORDERLINE - SET QtyOrdered=(CASE WHEN (qtyinvoiced = 0) THEN QtyDelivered ELSE - (CASE WHEN (QtyDelivered = 0) THEN qtyinvoiced ELSE - (CASE WHEN (QtyDelivered < 0 AND qtyinvoiced < 0) THEN LEAST(QtyDelivered, qtyinvoiced) ELSE GREATEST(QtyDelivered, qtyinvoiced) END) END) END), - --MODIFIED BY P.SAROBE - linenetamt=(CASE WHEN (qtyinvoiced = 0) THEN QtyDelivered ELSE - (CASE WHEN (QtyDelivered = 0) THEN qtyinvoiced ELSE - (CASE WHEN (QtyDelivered < 0 AND qtyinvoiced < 0) THEN LEAST(QtyDelivered, qtyinvoiced) ELSE GREATEST(QtyDelivered, qtyinvoiced) END) END) END) * priceactual, - QuantityOrder= CASE WHEN M_PRODUCT_UOM_ID IS NULL THEN QuantityOrder - ELSE (c_uom_convert((CASE WHEN (qtyinvoiced = 0) THEN QtyDelivered ELSE - (CASE WHEN (QtyDelivered = 0) THEN qtyinvoiced ELSE - (CASE WHEN (QtyDelivered < 0 AND qtyinvoiced < 0) THEN LEAST(QtyDelivered, qtyinvoiced) ELSE GREATEST(QtyDelivered, qtyinvoiced) END) END) END), C_UOM_ID, (SELECT UOM.C_UOM_ID FROM M_PRODUCT_UOM UOM WHERE UOM.M_PRODUCT_UOM_ID=C_ORDERLINE.M_PRODUCT_UOM_ID),'Y')) END, - Updated=now() - WHERE C_Order_ID=v_Record_ID - AND QtyOrdered <> (SELECT (CASE WHEN (qtyinvoiced = 0) THEN QtyDelivered ELSE - (CASE WHEN (QtyDelivered = 0) THEN qtyinvoiced ELSE + DECLARE + Cur_Inventory RECORD; + v_QtyOrdered NUMBER; + v_QuantityOrder NUMBER; + v_linenetamt NUMBER; + v_ProductUOM M_PRODUCT_UOM.C_UOM_ID%TYPE; + BEGIN + + -- When closing the order it calculates the difference between the ordered and received/delivered quantities ant it + -- updates the m_storage_pending. + IF (v_DocAction='CL') THEN + -- Cancel undelivered Items + IF (v_isSoTrx='Y') THEN --Sales orders + FOR Cur_Inventory IN ( + SELECT QtyInvoiced, QtyDelivered ,QtyOrdered, QuantityOrder, priceactual, + + C_ORDERLINE_ID AS ID, + M_Product_ID, + M_Warehouse_ID, + M_AttributeSetInstance_ID, + C_UOM_ID, + M_PRODUCT_UOM_ID, + C_Currency_ID + FROM C_ORDERLINE + WHERE C_Order_ID=v_Record_ID + AND QtyOrdered <> (SELECT (CASE WHEN (qtyinvoiced = 0) THEN QtyDelivered ELSE + (CASE WHEN (QtyDelivered = 0) THEN qtyinvoiced ELSE (CASE WHEN (QtyDelivered < 0 AND qtyinvoiced < 0) THEN LEAST(QtyDelivered, qtyinvoiced) ELSE GREATEST(QtyDelivered, qtyinvoiced) END) END) END) - FROM C_ORDERLINE COL - WHERE COL.C_ORDERLINE_ID = C_ORDERLINE.C_ORDERLINE_ID); - -- For Purchase orders, M_MatchPO table used. Notice that only delivered lines(C_Invoiceline_Id is null) using - ELSE - UPDATE C_ORDERLINE - SET QTYORDERED=COALESCE(( - SELECT (CASE WHEN (SUM(CASE WHEN M_MATCHPO.M_INOUTLINE_ID IS NULL THEN M_MATCHPO.QTY ELSE 0 END) = 0) + FROM C_ORDERLINE COL + WHERE COL.C_ORDERLINE_ID = C_ORDERLINE.C_ORDERLINE_ID) + ) + LOOP + v_QtyOrdered := CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END; + v_linenetamt := ROUND((CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END) * Cur_Inventory.priceactual, + C_GET_CURRENCY_PRECISION(Cur_Inventory.C_Currency_ID, 'A')); + SELECT MAX(UOM.C_UOM_ID) + INTO v_ProductUOM + FROM M_PRODUCT_UOM UOM + WHERE UOM.M_PRODUCT_UOM_ID=Cur_Inventory.M_PRODUCT_UOM_ID; + v_QuantityOrder := CASE WHEN Cur_Inventory.M_PRODUCT_UOM_ID IS NULL THEN Cur_Inventory.QuantityOrder + ELSE (c_uom_convert((CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END), + Cur_Inventory.C_UOM_ID, v_ProductUOM,'Y')) END; + + IF (Cur_Inventory.QtyOrdered <> v_QtyOrdered) THEN + M_UPDATE_STORAGE_PENDING(v_Client_ID, v_Org_ID, v_UpdatedBy, Cur_Inventory.M_Product_ID, Cur_Inventory.M_Warehouse_ID, Cur_Inventory.M_AttributeSetInstance_ID, + Cur_Inventory.C_UOM_ID, Cur_Inventory.M_PRODUCT_UOM_ID, -(Cur_Inventory.QtyOrdered - v_QtyOrdered), -(Cur_Inventory.QuantityOrder - v_QuantityOrder), 0, null); + END IF; + + -- UPDATE C_ORDERLINE + UPDATE C_ORDERLINE + SET QtyOrdered=v_QtyOrdered, + linenetamt=v_linenetamt, + QuantityOrder=v_QuantityOrder, + Updated=now() + WHERE C_ORDERLINE_ID = Cur_Inventory.ID; + END LOOP; + -- For Purchase orders, M_MatchPO table used. Notice that only delivered lines(C_Invoiceline_Id is null) using + ELSE + FOR Cur_Inventory IN ( + SELECT + COALESCE((SELECT SUM(CASE WHEN M_MATCHPO.M_INOUTLINE_ID IS NULL THEN M_MATCHPO.QTY ELSE 0 END) + FROM M_MATCHPO + WHERE M_MATCHPO.C_ORDERLINE_ID=C_ORDERLINE.C_ORDERLINE_ID), 0) AS QtyDelivered, + COALESCE((SELECT SUM(CASE WHEN M_MATCHPO.C_INVOICELINE_ID IS NULL THEN M_MATCHPO.QTY ELSE 0 END) + FROM M_MATCHPO + WHERE M_MATCHPO.C_ORDERLINE_ID=C_ORDERLINE.C_ORDERLINE_ID), 0) AS QtyInvoiced, + QtyOrdered, + QuantityOrder, + priceactual, + linenetamt, + C_ORDERLINE_ID AS ID, + M_Product_ID, + M_Warehouse_ID, + M_AttributeSetInstance_ID, + C_UOM_ID, + M_PRODUCT_UOM_ID, ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
