r3783 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/java/org/chorem/lima/entity lima-swing/src/main/java/org/chorem/lima/ui/lettering lima-swing/src/main/resources/i18n
Author: dcosse Date: 2014-05-06 18:47:18 +0200 (Tue, 06 May 2014) New Revision: 3783 Url: http://forge.chorem.org/projects/lima/repository/revisions/3783 Log: fixes #1022 possibilit?\195?\169 de s?\195?\169l?\195?\169ctionner tous les comptes Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-05-06 15:41:32 UTC (rev 3782) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-05-06 16:47:18 UTC (rev 3783) @@ -441,7 +441,7 @@ try { EntryDAO entryDAO = getDaoHelper().getEntryDAO(); - entries = entryDAO.findAllEntryByAccountAndLettering(filter); + entries = entryDAO.findAllEntryByFilter(filter); } catch (Exception ex) { throw new LimaException("Can't get entries", ex); } Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2014-05-06 15:41:32 UTC (rev 3782) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2014-05-06 16:47:18 UTC (rev 3783) @@ -190,11 +190,25 @@ * @param filter filtre sur les entrees, selon le compte, les dates de debut et de fin, et le lettrage * @throws TopiaException * */ - public List<Entry> findAllEntryByAccountAndLettering(LetteringFilter filter) throws TopiaException { + public List<Entry> findAllEntryByFilter(LetteringFilter filter) throws TopiaException { + List<Entry> entries; + Account account = filter.getAccount(); + if (account != null && account.getTopiaId() == null) { + // case user want to see all accounts + entries = getAllEntryByLetteringAndDateForEntryBook(filter); + } else { + entries = getAllEntryByAccountLetteringAndDateForEntryBook(filter); + } + return entries; + } + + public List<Entry> getAllEntryByAccountLetteringAndDateForEntryBook(LetteringFilter filter) throws TopiaException { + List<Entry> entries; + String query = "Select E from " + Entry.class.getName() + " E " + - " where E.account.accountNumber like :account "; + " where E.account.accountNumber like :account "; if (!filter.getDisplayLettered() && filter.getDisplayUnlettred()){ @@ -204,13 +218,35 @@ } query += " and E.financialTransaction.transactionDate between :beginDate and :endDate " + - " order by E.financialTransaction.transactionDate, E.financialTransaction." + FinancialTransaction.TOPIA_CREATE_DATE; + " order by E.financialTransaction.transactionDate, E.financialTransaction." + FinancialTransaction.TOPIA_CREATE_DATE; - log.info("Query:" + query); + entries = context.findAll(query, "account", filter.getAccount().getAccountNumber() + "%", "beginDate", filter.getDateStart(), "endDate", filter.getDateEnd()); + return entries; } + public List<Entry> getAllEntryByLetteringAndDateForEntryBook(LetteringFilter filter) throws TopiaException { + List<Entry> entries; + + String query = "Select E from " + Entry.class.getName() + " E "; + + query += " WHERE E.financialTransaction.transactionDate BETWEEN :beginDate and :endDate "; + + if (!filter.getDisplayLettered() && filter.getDisplayUnlettred()){ + query += " and (E.lettering is null or E.lettering = '') "; + } else if (filter.getDisplayLettered() && !filter.getDisplayUnlettred()){ + query += " and (E.lettering is not null or E.lettering !='') "; + } + + query += " order by E.financialTransaction.transactionDate, E.financialTransaction." + FinancialTransaction.TOPIA_CREATE_DATE; + + entries = context.findAll(query, "beginDate", filter.getDateStart(), "endDate", filter.getDateEnd()); + + return entries; + } + + /** * Retourne la dernière entrée d'une transaction * @param financialTransaction transaction sur laquelle la derniere entree est selectionnee Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2014-05-06 15:41:32 UTC (rev 3782) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2014-05-06 16:47:18 UTC (rev 3783) @@ -35,6 +35,7 @@ import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.AccountImpl; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; @@ -48,7 +49,9 @@ import java.util.Date; import java.util.List; +import static org.nuiton.i18n.I18n.t; + /** * Handler associated with financial transaction view. * @@ -302,6 +305,11 @@ public void loadComboAndRows(){ List<Account> allAccounts = accountService.getAllAccounts(); + Account seeAllAccounts = new AccountImpl(); + seeAllAccounts.setAccountNumber("-"); + seeAllAccounts.setLabel(t("lima.ui.list.seeAll")); + allAccounts.add(seeAllAccounts); + view.getAccountComboBoxModel().setObjects(allAccounts); if (!allAccounts.isEmpty()) { @@ -320,7 +328,7 @@ if (fiscalPeriod != null){ defaultDateBegFiscalPeriod = fiscalPeriodService.getLastFiscalPeriod().getBeginDate(); - }else{ + } else{ defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant); } Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-05-06 15:41:32 UTC (rev 3782) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2014-05-06 16:47:18 UTC (rev 3783) @@ -499,6 +499,7 @@ lima.ui.lettering.selectDebit= lima.ui.lettering.selectEntry=Actual selection lima.ui.lettering.selectSolde=Balance +lima.ui.list.seeAll=ALL lima.ui.locale= lima.ui.mainview.title=Lutin Invoice Monitoring and Accounting lima.ui.nonaffect= Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-05-06 15:41:32 UTC (rev 3782) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2014-05-06 16:47:18 UTC (rev 3783) @@ -476,6 +476,7 @@ lima.ui.lettering.selectDebit=Débit lima.ui.lettering.selectEntry=Sélection courante lima.ui.lettering.selectSolde=Solde +lima.ui.list.seeAll=TOUS lima.ui.mainview.title=Lutin Invoice Monitoring and Accounting lima.ui.nonaffect=N.R lima.ui.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
participants (1)
-
dcosse@users.chorem.org