details: https://code.openbravo.com/erp/devel/pi/rev/5eb93b083e35
changeset: 13805:5eb93b083e35
user: Mikel Irurita <mikel.irurita <at> openbravo.com>
date: Tue Sep 20 13:33:32 2011 +0200
summary: Fixes issue 18546: Posting financial invoice - Process Failed during
execution
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 3d04bbbd7ec5 -r 5eb93b083e35
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Tue Sep 20
12:03:29 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Tue Sep 20
13:33:32 2011 +0200
@@ -757,21 +757,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 (ServletException e) {
+ log4jDocInvoice.error("Exception in getDocumentConfirmation method: "
+ e);
}
- } catch (ServletException e) {
- log4jDocInvoice.error("Exception in getDocumentConfirmation method: " +
e);
}
+
return true;
}
diff -r 3d04bbbd7ec5 -r 5eb93b083e35
src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql Tue Sep 20
12:03:29 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql Tue Sep 20
13:33:32 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