Author: mallon Date: 2012-08-09 13:13:20 +0200 (Thu, 09 Aug 2012) New Revision: 3592 Url: http://chorem.org/repositories/revision/lima/3592 Log: refs #751 Correction sur le fonctionnement des filtres de dates, meme si aucun montant n'est saisie. Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java trunk/lima-swing/src/main/resources/log4j.properties 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 2012-08-09 08:28:08 UTC (rev 3591) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-08-09 11:13:20 UTC (rev 3592) @@ -212,6 +212,7 @@ * */ public Entry getLastEntry(FinancialTransaction financialTransaction) throws TopiaException { List<Entry> entries; + Entry lastEntry = null; String query = "Select E from " + Entry.class.getName() + " E" + " where E.financialTransaction.transactionDate = :financialTransactionDate " + " and E.financialTransaction = :financialTransaction" + @@ -219,10 +220,10 @@ entries = context.findAll(query, "financialTransactionDate", financialTransaction.getTransactionDate(), "financialTransaction", financialTransaction); - Entry lastEntry = entries.get(0); - if (log.isDebugEnabled()) { - log.debug("Last entry description : " + lastEntry.getDescription() ); + if (entries.size() > 0) { + lastEntry = entries.get(0); } + return lastEntry; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2012-08-09 08:28:08 UTC (rev 3591) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/combobox/FiscalPeriodComboBoxModel.java 2012-08-09 11:13:20 UTC (rev 3592) @@ -44,7 +44,7 @@ private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(FinancialPeriodTableModel.class); + private static final Log log = LogFactory.getLog(FiscalPeriodComboBoxModel.class); protected Object selectedFiscalPeriod; @@ -60,6 +60,11 @@ LimaServiceFactory.addServiceListener(FiscalPeriodService.class, this); LimaServiceFactory.addServiceListener(ImportService.class, this); datasCache = getDataList(); + + if (log.isDebugEnabled()) { + log.debug("Size of datasCache : " + datasCache.size()); + log.debug("Beginning and end dates of first fiscal period in datasCache: " + ((FiscalPeriod)getElementAt(0)).getBeginDate() + ", " + ((FiscalPeriod)getElementAt(0)).getEndDate()); + } } //constructor for all fiscal period @@ -85,7 +90,12 @@ @Override public void setSelectedItem(Object anItem) { - selectedFiscalPeriod = anItem; + + if (log.isDebugEnabled()) { + log.debug("Beginning and end dates of first fiscal period : " + ((FiscalPeriod)getElementAt(0)).getBeginDate() + ", " + ((FiscalPeriod)getElementAt(0)).getEndDate()); + } + + selectedFiscalPeriod = (FiscalPeriod)anItem; } @Override @@ -103,6 +113,11 @@ log.debug("Can't get list accounts", eee); } } + if (log.isDebugEnabled()) { + log.debug("Size of result : " + result.size()); + log.debug("Beginning and end dates of first fiscal period : " + result.get(0).getBeginDate() + ", " + result.get(0).getEndDate()); + } + return result; } @@ -117,6 +132,11 @@ log.debug("Can't get list accounts", eee); } } + if (log.isDebugEnabled()) { + log.debug("Size of result : " + result); + log.debug("Beginning and end dates of first fiscal period : " + result.get(0).getBeginDate() + ", " + result.get(0).getEndDate()); + } + return result; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2012-08-09 08:28:08 UTC (rev 3591) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionPeriodSearchPanel.java 2012-08-09 11:13:20 UTC (rev 3592) @@ -49,8 +49,7 @@ public class FinancialTransactionPeriodSearchPanel extends JPanel { - private static final Log log = - LogFactory.getLog(FinancialTransactionPeriodSearchPanel.class); + private static final Log log = LogFactory.getLog(FinancialTransactionPeriodSearchPanel.class); protected FinancialTransactionSearchViewHandler handler; @@ -90,12 +89,6 @@ // set begindate to JAN 1 - 0:00.000 of this years Date beginDate = calendarBegin.getTime(); beginDate = DateUtils.truncate(beginDate, Calendar.YEAR); - //handler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - //handler().setEndDate(endDate); JLabel beginDateLabel = new JLabel(_("lima.common.begindate")); final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); ActionListener beginDateActionListener = new ActionListener() { @@ -108,6 +101,9 @@ handler.setBeginDate(beginDatePicker.getDate()); beginDatePicker.addActionListener(beginDateActionListener); + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); JLabel endDateLabel = new JLabel(_("lima.common.enddate")); final JXDatePicker endDatePicker = new JXDatePicker(endDate); ActionListener endDateActionListener = new ActionListener() { @@ -119,6 +115,7 @@ }; handler.setEndDate(endDatePicker.getDate()); endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); removeAll(); @@ -135,6 +132,9 @@ final JComboBox fiscalPeriod = new JComboBox(fiscalModel); fiscalPeriod.setRenderer(renderer); fiscalPeriod.setEditable(false); + if (log.isDebugEnabled()) { + log.debug("Fiscal period of combo box : " + ((FiscalPeriod)fiscalPeriod.getItemAt(0)).getBeginDate() + " - " + ((FiscalPeriod)fiscalPeriod.getItemAt(0)).getEndDate() ); + } ActionListener fiscalPeriodActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -142,10 +142,12 @@ handler.setBeginDate(fPeriod.getBeginDate()); handler.setEndDate(fPeriod.getEndDate()); handler.refresh(); + if (log.isDebugEnabled()) { + log.debug("Refreshing with this Fiscal period : " + fPeriod.getBeginDate() + " - " + fPeriod.getEndDate()); + } } }; fiscalPeriod.addActionListener(fiscalPeriodActionListener); - removeAll(); add(fiscalPeriod); break; @@ -157,6 +159,12 @@ final JComboBox financialPeriod = new JComboBox(financialModel); financialPeriod.setRenderer(renderer); financialPeriod.setEditable(false); + + if (log.isDebugEnabled()) { + log.debug("First financial period of combo box : " + ((FinancialPeriod)financialPeriod.getItemAt(0)).getBeginDate() + " - " + ((FinancialPeriod)financialPeriod.getItemAt(0)).getEndDate() ); + log.debug("Second financial period of combo box : " + ((FinancialPeriod)financialPeriod.getItemAt(1)).getBeginDate() + " - " + ((FinancialPeriod)financialPeriod.getItemAt(1)).getEndDate() ); + } + ActionListener financialPeriodActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-08-09 08:28:08 UTC (rev 3591) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTableModel.java 2012-08-09 11:13:20 UTC (rev 3592) @@ -110,13 +110,8 @@ */ protected List<Object> getDataList(FinancialTransactionSearch financialTransactionSearch) { List<Object> results = null; - //prevent to much result - if (financialTransactionSearch != null && (financialTransactionSearch.getVoucher() != null || financialTransactionSearch.getDescription() != null - || financialTransactionSearch.getLettering() != null || financialTransactionSearch.getAccountList() != null - || financialTransactionSearch.getAccount() != null || financialTransactionSearch.getEntryBook() != null - || financialTransactionSearch.getAmount() != null && financialTransactionSearch.getOperator() != null - || financialTransactionSearch.getAmount() != null && financialTransactionSearch.getAmount2() != null)) { + if (financialTransactionSearch != null) { results = financialTransactionService.searchFinancialTransaction(financialTransactionSearch); } @@ -353,7 +348,6 @@ selectedFiscalPeriod.getEndDate()); FinancialPeriod financialPeriod = financialPeriodsList.get(0); - //financialTransaction.setSelectedFinancialPeriod(selectedFiscalPeriod); // get today Calendar actualCalendar = Calendar.getInstance(); // get the financial period date @@ -386,7 +380,6 @@ cacheDataList = getDataList(financialTransactionSearch); index = cacheDataList.indexOf(fTransaction); fireTableRowsInserted(index, index); - //fireTableDataChanged(); } return index; } Modified: trunk/lima-swing/src/main/resources/log4j.properties =================================================================== --- trunk/lima-swing/src/main/resources/log4j.properties 2012-08-09 08:28:08 UTC (rev 3591) +++ trunk/lima-swing/src/main/resources/log4j.properties 2012-08-09 11:13:20 UTC (rev 3592) @@ -50,4 +50,6 @@ log4j.logger.org.chorem.lima.business.ui.financialtransaction.FinancialTransactionTableModel=DEBUG log4j.logger.org.chorem.lima.entity.EntryDAOImpl=DEBUG log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionViewHandler=DEBUG -log4j.logger.org.chorem.lima.entity.FinancialTransactionDAOImpl=DEBUG \ No newline at end of file +log4j.logger.org.chorem.lima.entity.FinancialTransactionDAOImpl=DEBUG +log4j.logger.org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel=DEBUG +log4j.logger.org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionPeriodSearchPanel=DEBUG \ No newline at end of file
participants (1)
-
mallon@users.chorem.org