details: https://code.openbravo.com/erp/devel/pi/rev/571d5fd06a6c changeset: 14820:571d5fd06a6c user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Wed Dec 07 19:54:26 2011 +0100 summary: Removes previos commit done by error.
details: https://code.openbravo.com/erp/devel/pi/rev/e79feecf2699 changeset: 14821:e79feecf2699 user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Wed Dec 07 19:56:40 2011 +0100 summary: Fixes bug 19262: An error appears when you add a transaction in Financial Account diffstat: src-util/buildvalidation/src/org/openbravo/buildvalidation/CTaxTaxbase.java | 84 ------ src-util/buildvalidation/src/org/openbravo/buildvalidation/CTaxTaxbase_data.xsql | 132 ---------- src/org/openbravo/erpCommon/ad_callouts/SE_CalculateExchangeRate.java | 2 +- src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java | 36 +- src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java | 29 +- src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java | 35 +- 6 files changed, 26 insertions(+), 292 deletions(-) diffs (truncated from 392 to 300 lines): diff -r 8d4cd33eb7ca -r e79feecf2699 src-util/buildvalidation/src/org/openbravo/buildvalidation/CTaxTaxbase.java --- a/src-util/buildvalidation/src/org/openbravo/buildvalidation/CTaxTaxbase.java Wed Dec 07 19:56:18 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - ************************************************************************* - * 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): ______________________________________. - ************************************************************************ - */ -package org.openbravo.buildvalidation; - -import java.util.ArrayList; -import java.util.List; - -import org.openbravo.database.ConnectionProvider; - -/** - * This validation is related to this issue: https://issues.openbravo.com/view.php?id=12277 - * A new check constrain was added to ensure that whenever a tax is defined usinga base amount - * which depends on a tax base, this tax base is not null - */ -public class CTaxTaxbase extends BuildValidation { - - @Override - public List<String> execute() { - ConnectionProvider cp = getConnectionProvider(); - ArrayList<String> errors = new ArrayList<String>(); - try { - int a = Integer.parseInt(CTaxTaxbaseData.count(cp)); - if (a > 0) { - errors - .add("You can not apply this MP because your instance fails in a pre-validation: Some taxes are not properly configured. Please ensure taxe base field contains a value as it is mandatory for taxes which tax base amount is one of the following: Alternate Tax Base Amount + Tax Amount, Line Net Amount + Tax Amount or Tax Amount. To fix this problem in your instance, you can know the wrong entries by reviewing Alerts in your system (Alert Rule: Wrong tax rate definition). Once you find the wrong entries you should fix the wrong ones. Once it is fixed you should be able to apply this MP."); - String alertRuleId = CTaxTaxbaseData.getUUID(cp); - if (CTaxTaxbaseData.existsAlertRule(cp).equals("0")) { - CTaxTaxbaseData.insertAlertRule(cp, alertRuleId); - processAlert(alertRuleId, cp); - } - } - } catch (Exception e) { - return handleError(e); - } - return errors; - } - - /** - * @param alertRule - * @param conn - * @throws Exception - */ - private void processAlert(String adAlertruleId, ConnectionProvider cp) throws Exception { - CTaxTaxbaseData[] alertRule = CTaxTaxbaseData.select(cp, adAlertruleId); - CTaxTaxbaseData[] alert = null; - if (!alertRule[0].sql.equals("")) { - try { - alert = CTaxTaxbaseData.selectAlert(cp, alertRule[0].sql); - } catch (Exception ex) { - return; - } - } - // Insert - if (alert != null && alert.length != 0) { - StringBuilder msg = new StringBuilder(); - ; - - for (int i = 0; i < alert.length; i++) { - if (CTaxTaxbaseData.existsReference(cp, adAlertruleId, alert[i].referencekeyId).equals( - "0")) { - CTaxTaxbaseData.insertAlert(cp, alert[i].description, alertRule[0].adAlertruleId, - alert[i].recordId, alert[i].referencekeyId); - } - } - } - } - -} diff -r 8d4cd33eb7ca -r e79feecf2699 src-util/buildvalidation/src/org/openbravo/buildvalidation/CTaxTaxbase_data.xsql --- a/src-util/buildvalidation/src/org/openbravo/buildvalidation/CTaxTaxbase_data.xsql Wed Dec 07 19:56:18 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ************************************************************************* - * 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): ______________________________________. - ************************************************************************ ---> - - -<SqlClass name="CTaxTaxbaseData" package="org.openbravo.buildvalidation"> - <SqlMethod name="select" type="preparedStatement" return="multiple"> - <SqlMethodComment></SqlMethodComment> - <Sql><![CDATA[ - SELECT AD_CLIENT_ID, - AD_ORG_ID, - CREATED, - CREATEDBY, - UPDATED, - UPDATEDBY, - ISACTIVE, - '' as RECORD_ID, - '' as DESCRIPTION, - '' as REFERENCEKEY_ID, - '' as AD_ROLE_ID, - AD_ALERTRULE_ID, - SQL, - NAME - FROM AD_ALERTRULE - WHERE AD_ALERTRULE_ID = ? - ]]></Sql> - <Parameter name="alertRule"/> - </SqlMethod> - <SqlMethod name="existsAlertRule" type="preparedStatement" return="string"> - <SqlMethodComment></SqlMethodComment> - <Sql><![CDATA[ - SELECT COUNT(*) AS EXISTING - FROM AD_ALERTRULE - WHERE NAME LIKE 'Wrong tax rate definition' - AND ISACTIVE = 'Y' - ]]></Sql> - </SqlMethod> - <SqlMethod name="existsReference" type="preparedStatement" return="string"> - <SqlMethodComment></SqlMethodComment> - <Sql><![CDATA[ - SELECT COUNT(*) AS EXISTING - FROM AD_ALERT - WHERE AD_ALERTRULE_ID = ? - AND REFERENCEKEY_ID = ? - AND STATUS != 'SOLVED' - ]]></Sql> - <Parameter name="alertRule"/> - <Parameter name="ref"/> - </SqlMethod> - <SqlMethod name="getUUID" type="preparedStatement" return="string"> - <SqlMethodComment></SqlMethodComment> - <Sql><![CDATA[ - SELECT get_uuid() - FROM dual - ]]></Sql> - </SqlMethod> - <SqlMethod name="count" type="preparedStatement" return="string"> - <SqlMethodComment>This query counts the number of rows in c_bp_vendor_acct</SqlMethodComment> - <Sql><![CDATA[ - SELECT count(*) as count - FROM c_tax - where baseamount IN ('TBATAX', 'LNATAX', 'TAX') - AND c_taxbase_id IS NULL - ]]> - </Sql> - </SqlMethod> - <SqlMethod name="insertAlertRule" type="preparedStatement" return="rowcount"> - <SqlMethodComment></SqlMethodComment> - <Sql><![CDATA[ - INSERT INTO AD_ALERTRULE ( - AD_ALERTRULE_ID, - AD_CLIENT_ID , - AD_ORG_ID , - ISACTIVE , - CREATED , - CREATEDBY , - UPDATED , - UPDATEDBY , - NAME , - AD_TAB_ID , - FILTERCLAUSE , - SQL , - TYPE - ) - VALUES (?, '0', '0', 'Y', now(), '100', now(), '100', 'Wrong tax rate definition', '174', '', - 'select c_tax_id as referencekey_id, ad_column_identifier(''C_Tax'',c_tax_id,''en_US'') as record_id, 0 as ad_role_id, null as ad_user_id, ''Wrong tax rate configuration. Please ensure taxe base field contains a value as it is mandatory for taxes which tax base amount is one of the following: Alternate Tax Base Amount + Tax Amount, Line Net Amount + Tax Amount or Tax Amount'' as description, ''Y'' as isActive, ad_org_id, ad_client_id, now() as created, 0 as createdBy, now() as updated, 0 as updatedBy from c_tax p where baseamount IN (''TBATAX'', ''LNATAX'', ''TAX'') AND c_taxbase_id IS NULL' - , 'D') - ]]> - </Sql> - <Parameter name="alertRuleId"/> - </SqlMethod> - <SqlMethod name="insertAlert" type="preparedStatement" - return="rowcount"> - <SqlMethodComment></SqlMethodComment> - <Sql> - <![CDATA[ - INSERT INTO AD_Alert (AD_Alert_ID, AD_Client_ID, AD_Org_ID, IsActive, - Created, CreatedBy, Updated, UpdatedBy, Description, AD_AlertRule_ID, Record_Id, Referencekey_ID, - status) - VALUES (get_uuid(), '0', '0', 'Y', NOW(), '0', NOW(), '0', ?, ?, ?, ?, 'NEW') - ]]> - </Sql> - <Parameter name="description" /> - <Parameter name="adAlertRuleId" /> - <Parameter name="recordId" /> - <Parameter name="referencekey_id" /> - </SqlMethod> - - <SqlMethod name="selectAlert" type="preparedStatement" return="multiple"> - <SqlMethodComment></SqlMethodComment> - <Sql><![CDATA[ - SELECT AAA.* - FROM (SELECT '' AS DESCRIPTION, '' AS RECORD_ID, '' AS REFERENCEKEY_ID FROM DUAL) AAA - ]]></Sql> - <Parameter name="sql" type="replace" optional="true" after="FROM (" text="SELECT '' AS DESCRIPTION, '' AS RECORD_ID, '' AS REFERENCEKEY_ID FROM DUAL"/> - </SqlMethod> -</SqlClass> diff -r 8d4cd33eb7ca -r e79feecf2699 src/org/openbravo/erpCommon/ad_callouts/SE_CalculateExchangeRate.java --- a/src/org/openbravo/erpCommon/ad_callouts/SE_CalculateExchangeRate.java Wed Dec 07 19:56:18 2011 +0100 +++ b/src/org/openbravo/erpCommon/ad_callouts/SE_CalculateExchangeRate.java Wed Dec 07 19:56:40 2011 +0100 @@ -60,7 +60,7 @@ String strfinTransactionId = info.vars.getStringParameter("inpaprmFinaccTransactionVId"); APRM_FinaccTransactionV transaction = OBDal.getInstance().get( APRM_FinaccTransactionV.class, strfinTransactionId); - originalAmt = transaction.getDepositAmount().subtract(transaction.getWithdrawalAmount()); + originalAmt = transaction.getForeignAmount(); } if (strLastFieldChanged.equals("inprate")) { foreignAmt = originalAmt.multiply(rate); diff -r 8d4cd33eb7ca -r e79feecf2699 src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java --- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java Wed Dec 07 19:56:18 2011 +0100 +++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java Wed Dec 07 19:56:40 2011 +0100 @@ -51,7 +51,6 @@ import org.openbravo.model.financialmgmt.payment.FIN_Payment; import org.openbravo.model.financialmgmt.payment.FIN_PaymentDetail; import org.openbravo.model.financialmgmt.payment.FIN_PaymentMethod; -import org.openbravo.model.financialmgmt.payment.FIN_Payment_Credit; import org.openbravo.model.financialmgmt.payment.FinAccPaymentMethod; import org.openbravo.service.db.DalConnectionProvider; @@ -483,33 +482,18 @@ } // Pre-payment is consumed when Used Credit Amount not equals Zero. When consuming Credit no // credit is generated + // FIXME: WHEN RELATION BETWEEN GENERATION OF CREDIT AND CONSUMPTION IS CREATED IN DATABASE + // THEN I CAN CONVERT TO CALCULATE DIFFERENCES if (transaction.getFinPayment().getUsedCredit().compareTo(ZERO) != 0 && transaction.getFinPayment().getGeneratedCredit().compareTo(ZERO) == 0) { - List<FIN_Payment_Credit> creditPayments = transaction.getFinPayment() - .getFINPaymentCreditList(); - for (FIN_Payment_Credit creditPayment : creditPayments) { - boolean isReceiptPayment = creditPayment.getCreditPaymentUsed().isReceipt(); - String creditAmountConverted = convertAmount(creditPayment.getAmount(), isReceiptPayment, - DateAcct, TABLEID_Payment, creditPayment.getCreditPaymentUsed().getId(), - creditPayment.getCreditPaymentUsed().getCurrency().getId(), as.m_C_Currency_ID, null, - as, fact, Fact_Acct_Group_ID, nextSeqNo(SeqNo), conn).toString(); - fact.createLine(null, - getAccountBPartner(C_BPartner_ID, as, isReceiptPayment, true, conn), creditPayment - .getCreditPaymentUsed().getCurrency().getId(), - (isReceiptPayment ? creditAmountConverted : ""), (isReceiptPayment ? "" - : creditAmountConverted), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, - conn); - } - if (creditPayments.isEmpty()) { - fact.createLine( - null, - getAccountBPartner(C_BPartner_ID, as, transaction.getFinPayment().isReceipt(), true, - conn), paymentCurrency.getId(), - (transaction.getFinPayment().isReceipt() ? transaction.getFinPayment() - .getUsedCredit().toString() : ""), (transaction.getFinPayment().isReceipt() ? "" - : transaction.getFinPayment().getUsedCredit().toString()), Fact_Acct_Group_ID, - nextSeqNo(SeqNo), DocumentType, conn); - } + fact.createLine( + null, + getAccountBPartner(C_BPartner_ID, as, transaction.getFinPayment().isReceipt(), true, + conn), paymentCurrency.getId(), + (transaction.getFinPayment().isReceipt() ? transaction.getFinPayment().getUsedCredit() + .toString() : ""), (transaction.getFinPayment().isReceipt() ? "" : transaction + .getFinPayment().getUsedCredit().toString()), Fact_Acct_Group_ID, nextSeqNo(SeqNo), + DocumentType, conn); } } else { BigDecimal convertedAmount = convertAmount(transaction.getFinPayment().getAmount(), diff -r 8d4cd33eb7ca -r e79feecf2699 src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java --- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java Wed Dec 07 19:56:18 2011 +0100 +++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java Wed Dec 07 19:56:40 2011 +0100 @@ -48,7 +48,6 @@ import org.openbravo.model.financialmgmt.payment.FIN_Payment; import org.openbravo.model.financialmgmt.payment.FIN_PaymentDetail; import org.openbravo.model.financialmgmt.payment.FIN_PaymentMethod; -import org.openbravo.model.financialmgmt.payment.FIN_Payment_Credit; ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
