This is an automated email from the git hooks/post-receive script. New commit to branch feature/1158-NotEditableTableForClose in repository lima. See http://git.chorem.org/lima.git commit d5544bc1085d3dcc03cc959d44ffd7950192e30e Author: dcosse <cosse@codelutin.com> Date: Fri Sep 25 15:43:32 2015 +0200 refs #1158 Ajout de commentaires + désactivation du boutton de création d'une transaction --- .../FinancialTransactionView.css | 2 +- .../FinancialTransactionView.jaxx | 2 +- .../FinancialTransactionViewHandler.java | 35 +++++++++++++--------- .../resources/i18n/lima-swing_en_GB.properties | 3 ++ .../resources/i18n/lima-swing_fr_FR.properties | 7 +++-- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css index 28ed709..86eca7f 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.css @@ -26,7 +26,7 @@ #addTransaction { actionIcon : "add-financial-transaction"; toolTipText : "lima.entries.addTransaction"; - enabled : "{getFinancialTransactionTable().isEditable()}"; + enabled : "{isAddEntryAllowed()}"; } #removeTransaction { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx index 0d2b9c0..b1e4784 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx @@ -43,7 +43,7 @@ onValueChanged="handler.selectionChanged()"/> <Boolean id="selectedRow" javaBean="false"/> - + <Boolean id="addEntryAllowed" javaBean="true"/> <Boolean id="transactionInClipBoard" javaBean="false"/> <Boolean id="entryInClipBoard" javaBean="false"/> <Boolean id="balance" javaBean="true"/> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java index 3a1a6d7..1cd225e 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java @@ -22,6 +22,7 @@ package org.chorem.lima.ui.financialtransaction; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import jaxx.runtime.SwingUtil; import org.apache.commons.lang.StringUtils; @@ -164,7 +165,9 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo initializationComplete = true; updateFinancialTransactions(); + computePeriodStatusText(); + setAddEntryAllowed(); } protected void initShortCuts() { @@ -348,20 +351,10 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo FinancialPeriod financialPeriod = (FinancialPeriod) view.getFinancialPeriodComboBox().getSelectedItem(); EntryBook entryBook = (EntryBook) view.getEntryBookComboBox().getSelectedItem(); - // la selection de la financialPeriod est obligatoire - // sinon, tout un exercice, c'est trop lourd - // l'entry book par contre, est facultatif - if (financialPeriod == null) { - return; - } - - List<FinancialTransaction> transactions; - if (entryBook == null) { - transactions = financialTransactionService.getAllFinancialTransactions(financialPeriod); - } else { + List<FinancialTransaction> transactions = Lists.newArrayList(); + if (entryBook != null && financialPeriod != null) { transactions = financialTransactionService.getAllFinancialTransactions(financialPeriod, entryBook); } - FinancialTransactionTable table = view.getFinancialTransactionTable(); FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); table.exit(); @@ -369,7 +362,6 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo boolean isLock = isTableLock(financialPeriod, entryBook); table.setEditable(!isLock); - //view.setEditable(!isLock); } } @@ -1019,7 +1011,18 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo EntryBook entryBook = (EntryBook) view.getEntryBookComboBoxModel().getSelectedItem(); boolean isLock = isTableLock(period, entryBook); - String result = isLock ? t("lima.financialTransaction.statusTextPeriod.close", period.getBeginDate(), period.getEndDate(), entryBook.getCode()) : t("lima.financialTransaction.statusTextPeriod.open", period.getBeginDate(), period.getEndDate()); + String subText = ""; + if (period == null) { + subText = t("lima.financialTransaction.statusTextPeriod.noFiscalPeriodFound"); + } + if (entryBook == null) { + String noEntryBookSubText = t("lima.financialTransaction.statusTextPeriod.noEntryBookFound"); + subText = subText.length() > 0 ? subText + "," + noEntryBookSubText : subText + noEntryBookSubText; + } + if (period != null && entryBook != null){ + subText = subText + (isLock ? t("lima.financialTransaction.statusTextPeriod.close", period.getBeginDate(), period.getEndDate(), entryBook.getCode()) : t("lima.financialTransaction.statusTextPeriod.open", period.getBeginDate(), period.getEndDate())); + } + String result = String.format(t("lima.financialTransaction.statusTextPeriod"), subText); view.getPeriodStatusLabel().setText(result); @@ -1056,4 +1059,8 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo } + protected void setAddEntryAllowed() { + view.setAddEntryAllowed(view.getFinancialTransactionTable().isEditable() && view.getEntryBookComboBoxModel().getSelectedItem() != null); + } + } diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index 3f620f7..d51bbba 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -289,7 +289,10 @@ lima.financialTransaction.previousFinancialPeriod=Previous financial period lima.financialTransaction.remove.confirm=Do you really want to remove this financial transaction? lima.financialTransaction.statusTextDebitCredit=<html>Debit\: <b>%s</b> - Credit\: <b>%s</b> - Balance\: <b>%s</b> lima.financialTransaction.statusTextDebitCreditError=<html>Debit\: <b>%s</b> - Credit\: <b>%s</b> - Balance\: <b><font color\=\#ff4000>%s</font></b> +lima.financialTransaction.statusTextPeriod= lima.financialTransaction.statusTextPeriod.close=<html>For period from <b>%1$td %1$tB %1$tY</b> to <b>%2$td %2$tB %2$tY</b> - <b><FONT COLOR\="red">ENTRY BOOK %3$s IS CLOSE FOR THIS PERIOD</FONT></b> -</html> +lima.financialTransaction.statusTextPeriod.noEntryBookFound= +lima.financialTransaction.statusTextPeriod.noFiscalPeriodFound= lima.financialTransaction.statusTextPeriod.open=<html>For period from <b>%1$td %1$tB %1$tY</b> to <b>%2$td %2$tB %2$tY</b></html> lima.financialTransaction.update.error.afterLastFiscalPeriod=Update financial transaction failed, financial transaction date is after last fiscal period date lima.financialTransaction.update.error.beforeFirstFiscalPeriod=Update financial transaction failed, financial transaction date is before first fiscal period date diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index bcff828..b560fe4 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -300,8 +300,11 @@ lima.financialTransaction.previousFinancialPeriod=Période précédente lima.financialTransaction.remove.confirm=Voulez-vous supprimer cette transaction? lima.financialTransaction.statusTextDebitCredit=<html>Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Balance\: <b>%s</b></html> lima.financialTransaction.statusTextDebitCreditError=<html>Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Balance\: <b><font color\=\#ff4000>%s</font></b></html>; -lima.financialTransaction.statusTextPeriod.close=<html>Période du <b>%1$td %1$tB %1$tY</b> au <b>%2$td %2$tB %2$tY</b> - <b><FONT COLOR\="red">LE JOURNAL %3$s EST CLOTURÉ POUR CETTE PÉRIODE</FONT></b> -</html> -lima.financialTransaction.statusTextPeriod.open=<html>Période du <b>%1$td %1$tB %1$tY</b> au <b>%2$td %2$tB %2$tY</b></html> +lima.financialTransaction.statusTextPeriod=<html>%s</html> +lima.financialTransaction.statusTextPeriod.close=- <b><FONT COLOR\="red">LE JOURNAL %3$s EST CLOTURÉ POUR CETTE PÉRIODE</FONT></b> - +lima.financialTransaction.statusTextPeriod.noEntryBookFound=<b><FONT COLOR\="red"> AUCUN JOURNAL PRÉSENT </FONT></b> +lima.financialTransaction.statusTextPeriod.noFiscalPeriodFound=<b><FONT COLOR\="red"> AUCUNE PÉRIODE FISCAL DE CRÉÉE </FONT></b> +lima.financialTransaction.statusTextPeriod.open=Période du <b>%1$td %1$tB %1$tY</b> au <b>%2$td %2$tB %2$tY</b> lima.financialTransaction.update.error.afterLastFiscalPeriod=Impossible de déplacer une transaction après le %1$te %1$tB %1$tY fin du dernier exercice. lima.financialTransaction.update.error.beforeFirstFiscalPeriod=Impossible de déplacer une transaction avant le %1$te %1$tB %1$tY début du premier exercice. lima.financialTransaction.update.error.lockedEntryBook=Impossible de déplacer une transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY. -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.