Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0005375Openbravo ERP02. Master data managementpublic2008-10-02 08:002008-12-16 09:42
CrosiarCM 
vmromanos 
normalmajoralways
closedfixed 
20Debian Unstable
pi 
 
Core
No
0005375: Import Account fails
There are actually 2 issues here. The first is a bug when processing operands.

1. In the ImportAccountData.insertOperands method the sign is passed as a parameter as a string when the field is a numeric which raises a SQL exception.

2. I suspect the next issue is a Postgres only problem. Here is the code snippet in question from ImportAccount.java:

        if (log4j.isDebugEnabled()) log4j.debug("I_ElementValue_ID=" + I_ElementValue_ID + ", elementValue=" + elementValue);
        try {
          String [][] strOperand = operandProcess(ImportAccountData.selectOperands(conn, I_ElementValue_ID));
          String strSeqNo = "10";
          for(int j=0;strOperand!=null && j<strOperand.length;j++){
              String C_ElementValue_Operand_ID = SequenceIdData.getSequence(conn, "C_ElementValue_Operand", vars.getClient());
              String strAccount = ImportAccountData.selectAccount(con, conn, strOperand[j][0], vars.getClient());
              String strElementValue = ImportAccountData.selectAccount(con, conn, elementValue, vars.getClient());
              if(strAccount!=null && !strAccount.equals("")){
                ImportAccountData.insertOperands(con, conn, C_ElementValue_Operand_ID, (strOperand[j][1].equals("+")?"1":"-1"), strElementValue, strAccount, strSeqNo, vars.getClient(), vars.getUser());
                strSeqNo = nextSeqNo(strSeqNo);
              } else {
                  if (log4j.isDebugEnabled()) log4j.debug("Operand not inserted - Value = " + strOperand[j][0]);
              }
          }
        } catch (ServletException ex) {
            log4j.warn("ServletException I_ElementValue_ID=" + I_ElementValue_ID);
            continue;
        }

It is clear that the original intention was for an error to affect only the current element being processed, but in fact, on Postgres, all subsequent SQL commands will fail with a transaction aborted message. These will effectively be ignored in this loop, but the next query outside the loop will fail, aborting the account import.
Master Data Management || Import Data || Import Account || Import Account
For problem 1 the solution is easy, just change the parameter type. But for the second issue I'm not sure how to get Postgres to continue after the first error is encountered and the transaction has been aborted.
No tags attached.
depends on backport 0005446 closed vmromanos Import Account fails 
Issue History
2008-10-02 08:00CrosiarCMNew Issue
2008-10-02 08:00CrosiarCMAssigned To => cromero
2008-10-02 08:00CrosiarCMsf_bug_id0 => 2141809
2008-10-02 08:01CrosiarCMIssue Monitored: CrosiarCM
2008-10-06 12:36psarobeStatusnew => scheduled
2008-10-06 12:36psarobeAssigned Tocromero => vmromanos
2008-10-06 12:36psarobefix_in_branch => trunk
2008-10-06 16:47svnbotCheckin
2008-10-06 16:47svnbotNote Added: 0009392
2008-10-06 16:47svnbotsvn_revision => 8282
2008-10-06 19:35vmromanosStatusscheduled => feedback
2008-10-06 19:35vmromanosStatusfeedback => scheduled
2008-10-06 19:52svnbotCheckin
2008-10-06 19:52svnbotNote Added: 0009399
2008-10-06 19:52svnbotStatusscheduled => resolved
2008-10-06 19:52svnbotResolutionopen => fixed
2008-10-06 19:52svnbotsvn_revision8282 => 8290
2008-12-16 09:42psarobeRegression testing => No
2008-12-16 09:42psarobeStatusresolved => closed

Notes
(0009392)
svnbot   
2008-10-06 16:47   
Repository: openbravo
Revision: 8282
Author: vmromanos
Date: 2008-10-06 16:47:38 +0200 (Mon, 06 Oct 2008)

Issue 0005375: Iteration 1; added TO_NUMBER() function for the numeric fields.

---
U trunk/src/org/openbravo/erpCommon/ad_process/ImportAccount_data.xsql
---

https://dev.openbravo.com/websvn/openbravo/?rev=8282&sc=1 [^]
(0009399)
svnbot   
2008-10-06 19:52   
Repository: openbravo
Revision: 8290
Author: vmromanos
Date: 2008-10-06 19:52:14 +0200 (Mon, 06 Oct 2008)

Fixed bug 0005375: Iteration 2, Import Account fails.

---
U trunk/src/org/openbravo/erpCommon/ad_process/ImportAccount.java
U trunk/src/org/openbravo/erpCommon/ad_process/ImportAccount_data.xsql
---

https://dev.openbravo.com/websvn/openbravo/?rev=8290&sc=1 [^]