Author: dcosse Date: 2014-07-31 17:40:32 +0200 (Thu, 31 Jul 2014) New Revision: 3884 Url: http://forge.chorem.org/projects/lima/repository/revisions/3884 Log: refs #1032 correction sur l'import des ?\195?\169critures depuis EBP Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-31 15:10:21 UTC (rev 3883) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/NewImportServiceImpl.java 2014-07-31 15:40:32 UTC (rev 3884) @@ -693,6 +693,7 @@ //financialTransaction = null; // create it entryBook = entryBookService.createEntryBook(entryBook); + indexedEntryBooks.put(entryBook.getCode(), entryBook); } try { Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-07-31 15:10:21 UTC (rev 3883) +++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-07-31 15:40:32 UTC (rev 3884) @@ -98,7 +98,7 @@ lima-business.import.accountadded=SUCCES \: Account %s - %s added\n lima-business.import.accountalreadyexist=FAILED \: Account %s already exist \n lima-business.import.closedperiodicentrybookupdated=SUCCESS \: The blockClosedPeriodicEntryBook %s - %s - %s is updated \! \n -lima-business.import.ebpmissingaccount=FAILED \: Account %s already exist, import aborted. \nCreate all accounts before import entries. +lima-business.import.ebpmissingaccount=FAILED \: Account %s doesn't exist.\nCreate all accounts before import entries. lima-business.import.ebpnoentry=FAILED \: This file contains no entries. lima-business.import.ebpnoheader=FAILED \: This file has no header datas. lima-business.import.entries.error.FinancialPeriod= Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-31 15:10:21 UTC (rev 3883) +++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-07-31 15:40:32 UTC (rev 3884) @@ -96,7 +96,7 @@ lima-business.import.closedPeriodicEntryBook.error.unfilled=Impossible de bloquer la période financière / il manque des éléments dans des transactions lima-business.import.closedPeriodicEntryBook.error.withoutEntryBook=Impossible de bloquer la période financière / il manque un journal dans une transaction (%1$te/%1$tm/%1$tY) lima-business.import.closedperiodicentrybookupdated=Succès \: La période financière %s - %s - %s est ajoutée \! \n -lima-business.import.ebpmissingaccount=Échec \: Compte %s inexistant. \nImportation annulée. \nCréer tous les comptes avant d'importer les écritures. +lima-business.import.ebpmissingaccount=Échec \: Compte %s inexistant. \nCréer tous les comptes avant d'importer les écritures. lima-business.import.ebpnoentry=Échec \: Ce fichier ne contient aucune entrée. lima-business.import.ebpnoheader=Échec \: Ce fichier ne contient aucun entête. lima-business.import.entries.error.lockedEntryBook= Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-31 15:10:21 UTC (rev 3883) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/NewImportExportServiceTest.java 2014-07-31 15:40:32 UTC (rev 3884) @@ -27,6 +27,7 @@ import org.apache.commons.io.IOUtils; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.AccountImpl; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialStatement; @@ -360,13 +361,22 @@ public void testImportEntriesFromEBP() throws Exception { // create fiscal period (mandatory for import) FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); - fiscalPeriod.setBeginDate(df.parse("January 1, 2012")); - fiscalPeriod.setEndDate(df.parse("December 31, 2012")); + fiscalPeriod.setBeginDate(df.parse("January 1, 2010")); + fiscalPeriod.setEndDate(df.parse("December 31, 2010")); fiscalPeriodService.createFiscalPeriod(fiscalPeriod); + String [] accountNumbers = {"62610000","44566000","40104200","62510000","40100000","401TEEMP","51200000","60630000","411TECLI"}; + for (String accountNumber : accountNumbers) { + Account account = new AccountImpl(); + account.setAccountNumber(accountNumber); + accountService.createAccount(account); + } + InputStream entriesStream = NewImportExportServiceTest.class.getResourceAsStream("/ebp/ecritures.txt"); String entriesData = IOUtils.toString(entriesStream, "ISO-8859-1"); ImportResult result = newImportService.importEntriesFromEbp(entriesData); + Assert.assertTrue(result.getException().getAllExceptionsByLine().isEmpty()); + Assert.assertEquals(19, result.getNbCreated()); entriesStream.close(); } }