details: https://code.openbravo.com/erp/stable/2.50/rev/41e1494a6020
changeset: 9659:41e1494a6020
user: Mikel Irurita <mikel.irurita <at> openbravo.com>
date: Tue Sep 20 16:21:44 2011 +0200
summary: Fixes issue 18568: Posting financial invoice - Process Failed during
execution.
It was not raised before, because it happens only if the client has more than
one accounting schema.
diffstat:
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java | 25 +++++++++------
src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql | 21 ++++++++----
2 files changed, 29 insertions(+), 17 deletions(-)
diffs (74 lines):
diff -r 53340ebbc635 -r 41e1494a6020
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Tue Sep 20
11:13:01 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Tue Sep 20
16:21:44 2011 +0200
@@ -754,21 +754,26 @@
setStatus(STATUS_DocumentDisabled);
return false;
}
- try {
- data = DocInvoiceData.selectFinInvCount(conn, strRecordId);
- if (data.length > 0) {
- if (Integer.parseInt(data[0].fininvcount) == 0)
- return true;
- else if (Integer.parseInt(data[0].fininvcount) ==
Integer.parseInt(data[0].finacctcount))
- return true;
- else {
+
+ AcctSchema acct = null;
+ for (int i = 0; i < m_as.length; i++) {
+ acct = m_as[i];
+ try {
+ data = DocInvoiceData.selectFinInvCount(conn, strRecordId,
acct.m_C_AcctSchema_ID);
+ int countFinInv = Integer.parseInt(data[0].fininvcount);
+ int countGLItemAcct = Integer.parseInt(data[0].finacctcount);
+ // For any GL Item used in financial invoice lines debit/credit
accounts must be defined
+ if (countFinInv != 0 && (countFinInv != countGLItemAcct)) {
+ log4jDocInvoice.debug("DocInvoice - getDocumentConfirmation - GL
Item used in financial "
+ + "invoice lines debit/credit accounts must be defined.");
setStatus(STATUS_Error);
return false;
}
+ } catch (Exception e) {
+ log4jDocInvoice.error("Exception in getDocumentConfirmation method: "
+ e);
}
- } catch (ServletException e) {
- log4jDocInvoice.error("Exception in getDocumentConfirmation method: " +
e);
}
+
return true;
}
diff -r 53340ebbc635 -r 41e1494a6020
src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql Tue Sep 20
11:13:01 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql Tue Sep 20
16:21:44 2011 +0200
@@ -159,16 +159,23 @@
<SqlMethodComment></SqlMethodComment>
<Sql>
<![CDATA[
- SELECT (SELECT COUNT(*) FROM C_INVOICELINE WHERE
FINANCIAL_INVOICE_LINE='Y'
- AND C_INVOICE_ID=?) AS FININVCOUNT,
- (SELECT COUNT(*) FROM C_INVOICELINE invln LEFT JOIN C_GLITEM_ACCT
glact ON
- invln.ACCOUNT_ID = glact.C_GLITEM_ID WHERE
invln.FINANCIAL_INVOICE_LINE='Y' AND
- invln.C_INVOICE_ID=? AND
- glact.GLITEM_DEBIT_ACCT IS NOT NULL AND
- glact.GLITEM_CREDIT_ACCT IS NOT NULL) AS FINACCTCOUNT FROM DUAL
+ SELECT (SELECT count(distinct account_id)
+ FROM c_invoiceline
+ WHERE financial_invoice_line='Y'
+ AND c_invoice_id = ?) AS FININVCOUNT,
+ (SELECT count(distinct glact.c_glitem_id)
+ FROM c_invoiceline invline JOIN c_glitem_acct glact ON
(invline.account_id = glact.c_glitem_id)
+ JOIN c_acctschema acctschema on (glact.c_acctschema_id =
acctschema.c_acctschema_id)
+ WHERE invline.financial_invoice_line = 'Y' AND
+ invline.c_invoice_id = ? AND
+ acctschema.c_acctschema_id = ? AND
+ glact.glitem_debit_acct IS NOT NULL AND
+ glact.glitem_credit_acct IS NOT NULL) AS FINACCTCOUNT
+ FROM DUAL
]]>
</Sql>
<Parameter name="invoiceId"/>
<Parameter name="invoiceId"/>
+ <Parameter name="acctschemaId"/>
</SqlMethod>
</SqlClass>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits