Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0005446Openbravo ERP02. Master data managementpublic2008-10-06 19:352009-03-03 17:16
CrosiarCM 
vmromanos 
normalmajoralways
closedfixed 
20Debian Unstable
pi 
 
Core
No
0005446: 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.
blocks defect 0005375 closed vmromanos Import Account fails 
Issue History
2008-10-06 19:35vmromanosNew Issue
2008-10-06 19:35vmromanosAssigned To => vmromanos
2008-10-06 19:35vmromanosStatusnew => scheduled
2008-10-06 20:21svnbotCheckin
2008-10-06 20:21svnbotNote Added: 0009400
2008-10-06 20:21svnbotStatusscheduled => resolved
2008-10-06 20:21svnbotResolutionopen => fixed
2008-10-06 20:21svnbotsvn_revision8282 => 8291
2008-10-07 07:54svnbotCheckin
2008-10-07 07:54svnbotNote Added: 0009413
2008-10-07 07:54svnbotsvn_revision8291 => 8307
2009-02-02 16:48rafarodaNote Deleted: 0009413
2009-03-03 17:16psarobeStatusresolved => closed

Notes
(0009400)
svnbot   
2008-10-06 20:21   
Repository: openbravo
Revision: 8291
Author: vmromanos
Date: 2008-10-06 20:21:51 +0200 (Mon, 06 Oct 2008)

Fixed bug 0005446: Import Account fails

---
U branches/r2.40/src/org/openbravo/erpCommon/ad_process/ImportAccount.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_process/ImportAccount_data.xsql
---

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