Author: ymartel Date: 2014-08-06 08:28:39 +0200 (Wed, 06 Aug 2014) New Revision: 424 Url: http://forge.chorem.org/projects/chorem/repository/revisions/424 Log: fix expenseAccountEntries save Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-07-31 14:01:05 UTC (rev 423) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-06 06:28:39 UTC (rev 424) @@ -23,6 +23,7 @@ * #L% */ +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -143,9 +144,10 @@ } expenseAccountWikitty.setBeginDate(expenseAccountBean.getStartDate()); expenseAccountWikitty.setEndDate(expenseAccountBean.getEndDate()); - Set<ExpenseAccountEntryBean> expenseAccountEntries = expenseAccountBean.getExpenseAccountEntries(); - if (expenseAccountEntries != null) { - for (ExpenseAccountEntryBean expenseAccountEntryBean : expenseAccountEntries) { + Set<ExpenseAccountEntryBean> expenseAccountEntryBeans = expenseAccountBean.getExpenseAccountEntries(); + if (expenseAccountEntryBeans != null) { + List<ExpenseAccountEntry> expenseAccountEntries = new ArrayList<>(expenseAccountEntryBeans.size()); + for (ExpenseAccountEntryBean expenseAccountEntryBean : expenseAccountEntryBeans) { ExpenseAccountEntry expenseAccountEntry = new ExpenseAccountEntryImpl(); expenseAccountEntry.setReference(expenseAccountEntryBean.getJustificationNumber()); expenseAccountEntry.setEmittedDate(new Date(expenseAccountEntryBean.getEmittedDate().getTime())); @@ -164,7 +166,9 @@ } expenseAccountWikitty.addExpenseAccountEntry(expenseAccountEntry); + //TODO ymartel 2014/07/16 : think about saving the entries ! } + client.store(expenseAccountEntries); } client.store(expenseAccountWikitty); }