details: /erp/stable/2.50/rev/7637f8adeeed changeset: 9557:7637f8adeeed user: David Alsasua <david.alsasua <at> openbravo.com> date: Tue Jun 21 17:25:50 2011 +0200 summary: Fixes issue 17319: wrong accounting with multicurrency
details: /erp/stable/2.50/rev/8bd21b2c2bc8 changeset: 9558:8bd21b2c2bc8 user: David Alsasua <david.alsasua <at> openbravo.com> date: Thu Jun 30 18:40:09 2011 +0200 summary: Fixes issue 17236. Fixes issue 17666. Fixes issue 17535. Fixes issue 17847. Fixes issue 17845. diffstat: src-db/database/model/triggers/AD_ORG_ACCTSCHEMA_TRG3.xml | 33 ++ src-db/database/sourcedata/AD_MESSAGE.xml | 22 + src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.html | 113 +++++++++- src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.java | 108 ++++++--- src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.xml | 5 +- src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct_data.xsql | 53 ++++- src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct.html | 16 +- src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct.java | 36 +- src/org/openbravo/erpCommon/ad_actionButton/DropRegFactAcct_data.xsql | 4 +- src/org/openbravo/erpCommon/ad_forms/DocPayment.java | 19 +- 10 files changed, 341 insertions(+), 68 deletions(-) diffs (truncated from 777 to 300 lines): diff -r 01aceb67e830 -r 8bd21b2c2bc8 src-db/database/model/triggers/AD_ORG_ACCTSCHEMA_TRG3.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src-db/database/model/triggers/AD_ORG_ACCTSCHEMA_TRG3.xml Thu Jun 30 18:40:09 2011 +0200 @@ -0,0 +1,33 @@ +<?xml version="1.0"?> + <database name="TRIGGER AD_ORG_ACCTSCHEMA_TRG3"> + <trigger name="AD_ORG_ACCTSCHEMA_TRG3" table="AD_ORG_ACCTSCHEMA" fires="before" insert="true" update="true" delete="false" foreach="row"> + <body><![CDATA[ +/************************************************************************* +* The contents of this file are subject to the Openbravo Public License +* Version 1.1 (the "License"), being the Mozilla Public License +* Version 1.1 with a permitted attribution clause; you may not use this +* file except in compliance with the License. You may obtain a copy of +* the License at http://www.openbravo.com/legal/license.html +* Software distributed under the License is distributed on an "AS IS" +* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +* License for the specific language governing rights and limitations +* under the License. +* The Original Code is Openbravo ERP. +* The Initial Developer of the Original Code is Openbravo SLU +* All portions are Copyright (C) 2011 Openbravo SLU +* All Rights Reserved. +* Contributor(s): ______________________________________. +************************************************************************/ + +BEGIN + + IF AD_isTriggerEnabled()='N' THEN RETURN; + END IF; + + IF(:NEW.AD_ORG_ID = '0') THEN + RAISE_APPLICATION_ERROR(-20000, '@CannotCreateAcctSchemaFor0Org@'); + END IF; +END AD_ORG_ACCTSCHEMA_TRG3 +]]></body> + </trigger> + </database> diff -r 01aceb67e830 -r 8bd21b2c2bc8 src-db/database/sourcedata/AD_MESSAGE.xml --- a/src-db/database/sourcedata/AD_MESSAGE.xml Mon Jul 04 16:44:45 2011 +0200 +++ b/src-db/database/sourcedata/AD_MESSAGE.xml Thu Jun 30 18:40:09 2011 +0200 @@ -33776,6 +33776,28 @@ <!--CC679C56C5FC47E9B4D06F0FF7ABFCEE--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> <!--CC679C56C5FC47E9B4D06F0FF7ABFCEE--></AD_MESSAGE> +<!--CD52439830DC7B310130DC7FDF1B0008--><AD_MESSAGE> +<!--CD52439830DC7B310130DC7FDF1B0008--> <AD_MESSAGE_ID><![CDATA[CD52439830DC7B310130DC7FDF1B0008]]></AD_MESSAGE_ID> +<!--CD52439830DC7B310130DC7FDF1B0008--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--CD52439830DC7B310130DC7FDF1B0008--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--CD52439830DC7B310130DC7FDF1B0008--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--CD52439830DC7B310130DC7FDF1B0008--> <VALUE><![CDATA[0OrgShouldNotHaveAcctSchema]]></VALUE> +<!--CD52439830DC7B310130DC7FDF1B0008--> <MSGTEXT><![CDATA[* Organization should NOT have any accounting schema associated, otherwise closing entry will not be possible to calculate. Please go to Org Schema sub tab of Organization window, and check that there is no accounting schema there for the * Organization]]></MSGTEXT> +<!--CD52439830DC7B310130DC7FDF1B0008--> <MSGTYPE><![CDATA[E]]></MSGTYPE> +<!--CD52439830DC7B310130DC7FDF1B0008--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--CD52439830DC7B310130DC7FDF1B0008--></AD_MESSAGE> + +<!--CD52439830DC7B310130DC88BEC60033--><AD_MESSAGE> +<!--CD52439830DC7B310130DC88BEC60033--> <AD_MESSAGE_ID><![CDATA[CD52439830DC7B310130DC88BEC60033]]></AD_MESSAGE_ID> +<!--CD52439830DC7B310130DC88BEC60033--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--CD52439830DC7B310130DC88BEC60033--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--CD52439830DC7B310130DC88BEC60033--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--CD52439830DC7B310130DC88BEC60033--> <VALUE><![CDATA[CannotCreateAcctSchemaFor0Org]]></VALUE> +<!--CD52439830DC7B310130DC88BEC60033--> <MSGTEXT><![CDATA[Accounting Schemas cannot be associated to * Organization]]></MSGTEXT> +<!--CD52439830DC7B310130DC88BEC60033--> <MSGTYPE><![CDATA[E]]></MSGTYPE> +<!--CD52439830DC7B310130DC88BEC60033--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--CD52439830DC7B310130DC88BEC60033--></AD_MESSAGE> + <!--CF72BCDFFF044C1D8007B907D8B64DF3--><AD_MESSAGE> <!--CF72BCDFFF044C1D8007B907D8B64DF3--> <AD_MESSAGE_ID><![CDATA[CF72BCDFFF044C1D8007B907D8B64DF3]]></AD_MESSAGE_ID> <!--CF72BCDFFF044C1D8007B907D8B64DF3--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 01aceb67e830 -r 8bd21b2c2bc8 src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.html --- a/src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.html Mon Jul 04 16:44:45 2011 +0200 +++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.html Thu Jun 30 18:40:09 2011 +0200 @@ -45,6 +45,13 @@ } function submitThisPage(strCommand) { + var organization = document.getElementById("inpadOrgId"); + + if (organization.value == null || organization.value == "") { + setWindowElementFocus(organization); + showJSMessage(7); + return false; + } submitCommandForm(strCommand, false, null, null, '_top'); return true; } @@ -127,6 +134,108 @@ <tr> <td> + <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxyy"> + <tbody> + <tr class="MessageBox_TopMargin"> + <td class="MessageBox_LeftMargin"></td> + <td></td> + <td class="MessageBox_RightMargin"></td> + </tr> + <tr> + <td class="MessageBox_LeftMargin"></td> + <td> + + <table cellpadding="0" cellspacing="0" class="MessageBox_Container"> + <tbody> + <tr> + <td class="MessageBox_LeftTrans"> + <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="MessageBox_TopLeft"></td> + </tr> + <tr> + <td class="MessageBox_Left"></td> + </tr> + </tbody> + </table> + </td> + <td class="MessageBox_bg"> + + <table class="MessageBox_Top"> + <tbody> + <tr> + <td> + <span> + <table cellpadding="0" cellspacing="0" class="MessageBox_Body_ContentCell"> + <tbody> + <tr> + <td class="MessageBox_Icon_ContentCell"> + <div class="MessageBox_Icon"></div> + </td> + <td style="vertical-align: top;" id="messageBoxIDContent"> + <span> + <div class="MessageBox_TextTitle" id="messageBoxIDTitle"> + xxInfo: AccessTableWithNoView + </div> + <div class="MessageBox_TextDescription" id="messageBoxIDMessage"> + xxThe current information is empty. + </div> + <div class="MessageBox_TextSeparator"></div> + </span> + </td> + </tr> + </tbody> + </table> + </span> + </td> + </tr> + </tbody> + </table> + + </td> + <td class="MessageBox_RightTrans"> + <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="MessageBox_TopRight"></td> + </tr> + <tr> + <td class="MessageBox_Right"></td> + </tr> + </tbody> + </table> + </td> + </tr> + <tr> + <td rowspan="2" class="MessageBox_BottomLeft"> + </td> + <td class="MessageBox_BottomTrans MessageBox_bg"> + </td> + <td rowspan="2" class="MessageBox_BottomRight"> + </td> + </tr> + <tr> + <td class="MessageBox_Bottom"> + </td> + </tr> + </tbody> + </table> + + </td> + <td class="MessageBox_RightMargin"></td> + </tr> + <tr class="MessageBox_BottomMargin"> + <td class="MessageBox_LeftMargin"></td> + <td></td> + <td class="MessageBox_RightMargin"></td> + </tr> + </tbody> + </table> + </td> + </tr> + <tr> + <td> <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client"> <table cellspacing="0" cellpadding="0" class="Popup_Client_TablePopup"> @@ -140,8 +249,8 @@ <tr> <td class="TitleCell"><span class="LabelText">Organization</span></td> <td class="Combo_ContentCell" colspan="2"> - <select name="inpadOrgId" id="inpadOrgId" class="Combo Combo_TwoCells_width"> - <option value=""></option><div id="reportadOrgId"></div> + <select name="inpadOrgId" id="inpadOrgId" class="ComboKey Combo_TwoCell_width Combo_focus"> + <div id="reportadOrgId"></div> </select> </td> <td></td> diff -r 01aceb67e830 -r 8bd21b2c2bc8 src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.java --- a/src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.java Mon Jul 04 16:44:45 2011 +0200 +++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateRegFactAcct.java Thu Jun 30 18:40:09 2011 +0200 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2001-2009 Openbravo SLU + * All portions are Copyright (C) 2001-2011 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -82,21 +82,23 @@ OBError myError = new OBError(); try { conn = this.getTransactionConnection(); + CreateRegFactAcctData[] dataOrgs = CreateRegFactAcctData.treeOrg(this, vars.getClient(), + strOrgId); + CreateRegFactAcctData[] dataOrgAcctSchemas = CreateRegFactAcctData.treeOrgAcctSchemas(this, + vars.getClient(), strOrgId); + CreateRegFactAcctData[] acctSchema = CreateRegFactAcctData.treeAcctSchema(this, vars + .getClient()); + for (int j = 0; j < acctSchema.length; j++) { String strRegId = SequenceIdData.getUUID(); String strCloseId = SequenceIdData.getUUID(); String strOpenId = SequenceIdData.getUUID(); String strDivideUpId = SequenceIdData.getUUID(); - CreateRegFactAcctData[] data = CreateRegFactAcctData - .treeOrg(this, vars.getClient(), strOrgId); - CreateRegFactAcctData[] acctSchema = CreateRegFactAcctData.treeAcctSchema(this, vars - .getClient()); - for (int j = 0; j < acctSchema.length; j++) { - for (int i = 0; i < data.length; i++) { + for (int i = 0; i < dataOrgs.length; i++) { if (log4j.isDebugEnabled()) log4j.debug("Output: Before buttonReg"); String strPediodId = CreateRegFactAcctData.getLastPeriod(this, strKey); - String regCount = CreateRegFactAcctData.getRegCount(this, vars.getClient(), data[i].org, - acctSchema[j].id, strPediodId); + String regCount = CreateRegFactAcctData.getRegCount(this, vars.getClient(), + dataOrgs[i].org, acctSchema[j].id, strPediodId); if (new Integer(regCount).intValue() > 0) { myError.setType("Error"); myError.setTitle(""); @@ -104,9 +106,9 @@ .getLanguage())); return myError; } - String strRegOut = processButtonReg(conn, vars, strKey, windowId, data[i].org, strRegId, - acctSchema[j].id); - String strCloseOut = processButtonClose(conn, vars, strKey, windowId, data[i].org, + String strRegOut = processButtonReg(conn, vars, strKey, windowId, dataOrgs[i].org, + strRegId, acctSchema[j].id); + String strCloseOut = processButtonClose(conn, vars, strKey, windowId, dataOrgs[i].org, strCloseId, strOpenId, strDivideUpId, acctSchema[j].id); if (log4j.isDebugEnabled()) log4j.debug("Output: After buttonClose - strRegOut:" + strRegOut); @@ -122,17 +124,18 @@ ExpenseAmtCr = new BigDecimal("0"); RevenueAmtDr = new BigDecimal("0"); RevenueAmtCr = new BigDecimal("0"); - String strOrgSchemaId = CreateRegFactAcctData.orgAcctschema(this, data[i].org, - acctSchema[j].id); + } + for (int i = 0; i < dataOrgAcctSchemas.length; i++) { + String strOrgSchemaId = CreateRegFactAcctData.orgAcctschema(this, + dataOrgAcctSchemas[i].org, acctSchema[j].id); if (strOrgSchemaId != null && !strOrgSchemaId.equals("")) { - if (CreateRegFactAcctData.insertOrgClosing(conn, this, vars.getClient(), data[i].org, - vars.getUser(), strKey, strOrgSchemaId, strRegId, strCloseId, strDivideUpId, - strOpenId) == 0 - || CreateRegFactAcctData.updateClose(conn, this, vars.getUser(), strKey, - data[i].org) == 0) + if (CreateRegFactAcctData.insertOrgClosing(conn, this, vars.getClient(), strOrgId, vars + .getUser(), strKey, strOrgSchemaId, strRegId, strCloseId, strDivideUpId, strOpenId) == 0) return Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError"); } } + if (CreateRegFactAcctData.updateClose(conn, this, vars.getUser(), strKey, strOrgId) == 0) + return Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError"); } releaseCommitConnection(conn); myError.setType("Success"); @@ -251,7 +254,9 @@ .subtract(RevenueAmtCr).subtract(ExpenseAmtCr).toString(), "0", ExpenseAmtDr.add( RevenueAmtDr).subtract(RevenueAmtCr).subtract(ExpenseAmtCr).toString(), "0", strDivideUpId, "10", "C", account[0].name, account[0].value, account[0].cBpartnerId, - account[0].recordId2, account[0].mProductId, account[0].aAssetId, strClosingEntry); + account[0].recordId2, account[0].mProductId, account[0].aAssetId, strClosingEntry, + account[0].cTaxId, account[0].cProjectId, account[0].cActivityId, account[0].user1Id, + account[0].user2Id, account[0].cCampaignId, account[0].cSalesregionId); Fact_Acct_ID = SequenceIdData.getUUID(); CreateRegFactAcctData .insertClose(conn, this, Fact_Acct_ID, vars.getClient(), stradOrgId, vars.getUser(), ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
