r3382 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
Author: echatellier Date: 2012-04-24 15:06:38 +0200 (Tue, 24 Apr 2012) New Revision: 3382 Url: http://chorem.org/repositories/revision/lima/3382 Log: Fix ebp account import Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 12:41:53 UTC (rev 3381) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2012-04-24 13:06:38 UTC (rev 3382) @@ -44,7 +44,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.TreeMap; import javax.ejb.EJB; import javax.ejb.Local; @@ -60,8 +59,6 @@ import org.chorem.lima.FinancialStatementWayEnum; import org.chorem.lima.beans.AccountEBP; import org.chorem.lima.beans.AccountEBPImpl; -import org.chorem.lima.beans.AccountImport; -import org.chorem.lima.beans.AccountImportImpl; import org.chorem.lima.beans.ClosedPeriodicEntryBookImport; import org.chorem.lima.beans.ClosedPeriodicEntryBookImportImpl; import org.chorem.lima.beans.EntryEBP; @@ -229,8 +226,7 @@ for (EntryEBP entryEBP : list) { // create entry Entry entry = new EntryImpl(); - Account account = accountDAO.findByAccountNumber(entryEBP - .getCompte()); + Account account = accountDAO.findByAccountNumber(entryEBP.getCompte()); Date date = epbDateFormat.parse(entryEBP.getDatEcr()); Date beginDate = fiscalPeriods.get(0).getBeginDate(); @@ -340,6 +336,8 @@ _("lima-business.import.noaccount")); } + // FIXME echatellier 20120424 read csv line by line without + // creating beans instance CsvToBean<AccountEBPImpl> csv = new CsvToBean<AccountEBPImpl>(); List<AccountEBPImpl> list = csv.parse(strat, csvReader); Collections.sort(list, new AccountEBPComparator()); @@ -355,42 +353,8 @@ Account account = new AccountImpl(); account.setAccountNumber(accountNumber); account.setLabel(label); - - // if is thirdPart account - if (!StringUtils.isNumeric(accountNumber)) { - Account masterAccount = null; - int i = 1; - while (masterAccount == null) { - String masterAccountNumber = accountNumber - .substring(0, accountNumber.length() - i); - masterAccount = accountDAO - .findByAccountNumber(masterAccountNumber); - i++; - } - accountService.createAccount(account); - result.append(_("lima-business.import.accountadded", accountNumber, label)); - } - // else if account and exclude account start with 0 (fix from error on EBP) - else if (!accountNumber.startsWith("0")) { - // if account is class account : 1, 2, 3, 4, 5, 6, 7,… - int nbCharAccountNumber = accountNumber.length(); - if (nbCharAccountNumber == 1) { - accountService.createAccount(account); - result.append(_("lima-business.import.accountadded", accountNumber, label)); - } else { - Account masterAccount = null; - int i = 1; - while (masterAccount == null) { - String masterAccountNumber = accountNumber - .substring(0, accountNumber.length() - i); - masterAccount = accountDAO - .findByAccountNumber(masterAccountNumber); - i++; - } - accountService.createAccount(account); - result.append(_("lima-business.import.accountadded", accountNumber, label)); - } - } + accountService.createAccount(account); + result.append(_("lima-business.import.accountadded", accountNumber, label)); } }
participants (1)
-
echatellier@users.chorem.org