This is an automated email from the git hooks/post-receive script. New commit to branch feature/1293-addAccountViewerTab in repository lima. See http://git.chorem.org/lima.git commit 96ee9412c49ca5540455c9331545a601e76e6c64 Author: dcosse <cosse@codelutin.com> Date: Thu Sep 24 14:19:40 2015 +0200 refs #1293 corrections pour le cas ou aucune données existe dans Lima --- .../ui/accountViewer/AccountViewerViewHandler.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java index fd53279..be14b20 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/accountViewer/AccountViewerViewHandler.java @@ -341,8 +341,10 @@ public class AccountViewerViewHandler { public void updateAllEntriesForFiscalPeriodChoice(FiscalPeriod fiscalPeriod) { - setFilter(fiscalPeriod, null, fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate(), PeriodChoice.FISCAL_PERIOD); - updateAllEntries(); + if (fiscalPeriod != null) { + setFilter(fiscalPeriod, null, fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate(), PeriodChoice.FISCAL_PERIOD); + updateAllEntries(); + } } public void updateAllEntriesForFinancialPeriodChoice(FinancialPeriod financialPeriod) { @@ -531,8 +533,8 @@ public class AccountViewerViewHandler { } protected void updateFinancialPeriodCombo(FinancialPeriod defaultFinancialPeriod, List<FinancialPeriod> financialPeriods) { - view.getFinancialPeriodComboBoxModel().setObjects(financialPeriods); - if (defaultFinancialPeriod != null) { + if (CollectionUtils.isNotEmpty(financialPeriods)) { + view.getFinancialPeriodComboBoxModel().setObjects(financialPeriods); view.getFinancialPeriodComboBoxModel().setSelectedItem(defaultFinancialPeriod); } } @@ -540,16 +542,22 @@ public class AccountViewerViewHandler { protected void initFiscalPeriodCombo() { List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); view.getFiscalPeriodComboBoxModel().setObjects(fiscalPeriods); - view.getFiscalPeriodComboBoxModel().setSelectedItem(fiscalPeriods.get(fiscalPeriods.size() - 1)); + if (CollectionUtils.isNotEmpty(fiscalPeriods)) { + view.getFiscalPeriodComboBoxModel().setSelectedItem(fiscalPeriods.get(fiscalPeriods.size() - 1)); + } view.getFiscalPeriodComboBox().setVisible(true); } protected void initSoldPeriodView() { - view.getBeginPeriodSummary().setText(String.format(t("lima.accountingView.summaryLabel"), getDateFormat().format(filter.getFiscalPeriod().getBeginDate()), getDateFormat().format(getDayMinus1Calendar(filter.getFinancialPeriod().getBeginDate()).getTime()))); + Date ppbd = filter.getFiscalPeriod() != null ? filter.getFiscalPeriod().getBeginDate() : new Date(); + Date pped = filter.getFinancialPeriod() != null ? getDayMinus1Calendar(filter.getFinancialPeriod().getBeginDate()).getTime() : new Date(); + view.getBeginPeriodSummary().setText(String.format(t("lima.accountingView.summaryLabel"), getDateFormat().format(ppbd), getDateFormat().format(pped))); view.getBeginDebit().setText(BigDecimalToString.format(BigDecimal.ZERO)); view.getBeginCredit().setText(BigDecimalToString.format(BigDecimal.ZERO)); view.getBeginSold().setText(BigDecimalToString.format(BigDecimal.ZERO)); - view.getEndPeriodSummary().setText(String.format(t("lima.accountingView.summaryLabel"), getDateFormat().format(filter.getFiscalPeriod().getBeginDate()), getDateFormat().format(filter.getFinancialPeriod().getEndDate()))); + + Date aped = filter.getFinancialPeriod() != null ? filter.getFinancialPeriod().getEndDate() : new Date(); + view.getEndPeriodSummary().setText(String.format(t("lima.accountingView.summaryLabel"), getDateFormat().format(ppbd), getDateFormat().format(aped))); view.getEndDebit().setText(BigDecimalToString.format(BigDecimal.ZERO)); view.getEndCredit().setText(BigDecimalToString.format(BigDecimal.ZERO)); view.getEndSold().setText(BigDecimalToString.format(BigDecimal.ZERO)); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.