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 d5f467ad3f5497a56313d3871156d301a74bd78f Author: dcosse <cosse@codelutin.com> Date: Fri Sep 25 11:17:40 2015 +0200 refs #1295 Le tableau de la saisie des écritures n'est pas éditable si la période est cloturé pour le journal sélectionné --- .../financialtransaction/FinancialTransactionView.css | 15 ++++++++------- .../FinancialTransactionViewHandler.java | 19 ++++++++++++++++++- .../main/resources/i18n/lima-swing_en_GB.properties | 3 ++- .../main/resources/i18n/lima-swing_fr_FR.properties | 3 ++- 4 files changed, 30 insertions(+), 10 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 97f3fa5..28ed709 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,12 +26,13 @@ #addTransaction { actionIcon : "add-financial-transaction"; toolTipText : "lima.entries.addTransaction"; + enabled : "{getFinancialTransactionTable().isEditable()}"; } #removeTransaction { actionIcon : "delete-financial-transaction"; toolTipText : "lima.entries.remove.transaction"; - enabled : "{isSelectedRow()}"; + enabled : "{isSelectedRow() && getFinancialTransactionTable().isEditable()}"; } #copyTransaction { @@ -43,19 +44,19 @@ #pastTransaction { actionIcon : "paste"; toolTipText : "lima.entries.paste.transaction"; - enabled : "{isTransactionInClipBoard()}"; + enabled : "{isTransactionInClipBoard() && getFinancialTransactionTable().isEditable()}"; } #addEntry { actionIcon : "add-entry"; toolTipText : "lima.entries.addEntry"; - enabled : "{isSelectedRow()}"; + enabled : "{isSelectedRow() && getFinancialTransactionTable().isEditable()}"; } #removeEntry { actionIcon : "delete-entry"; toolTipText : "lima.entries.remove.entry"; - enabled : "{isSelectedRow()}"; + enabled : "{isSelectedRow() && getFinancialTransactionTable().isEditable()}"; } #copyEntry { @@ -67,19 +68,19 @@ #pasteEntry { actionIcon : "paste"; toolTipText : "lima.entries.paste.entry"; - enabled : "{isEntryInClipBoard() && isSelectedRow()}"; + enabled : "{isEntryInClipBoard() && isSelectedRow() && getFinancialTransactionTable().isEditable()}"; } #assignEntries { actionIcon : "assign-all-entries-in-transaction"; toolTipText : "lima.entries.assign.entries"; - enabled : "{isAssignableInAllEntries() && isSelectedRow()}"; + enabled : "{isAssignableInAllEntries() && isSelectedRow() && getFinancialTransactionTable().isEditable()}"; } #balanceButton { actionIcon : "balance"; toolTipText : "lima.entries.balance"; - enabled : "{!isBalance()}"; + enabled : "{!isBalance() && getFinancialTransactionTable().isEditable()}"; } #fiscalPeriodLabel { 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 78b66f0..ab68e55 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 @@ -39,6 +39,7 @@ import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException; import org.chorem.lima.business.exceptions.LockedEntryBookException; import org.chorem.lima.business.exceptions.LockedFinancialPeriodException; import org.chorem.lima.business.exceptions.NoFiscalPeriodFoundException; +import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryImpl; @@ -335,6 +336,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo public void entryBookSelected(ItemEvent event) { if ( event.getStateChange() == ItemEvent.SELECTED ) { updateFinancialTransactions(); + computePeriodStatusText(); } } @@ -365,7 +367,20 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); table.exit(); tableModel.setTransactions(transactions); + + boolean isLock = isTableLock(financialPeriod, entryBook); + table.setEditable(!isLock); + //view.setEditable(!isLock); + } + } + + protected boolean isTableLock(FinancialPeriod financialPeriod, EntryBook entryBook) { + boolean result = false; + if (financialPeriod != null && entryBook != null) { + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod); + result = closedPeriodicEntryBook.isLocked(); } + return result; } public void selectionChanged() { @@ -1030,8 +1045,10 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo protected void computePeriodStatusText() { FinancialPeriod period = (FinancialPeriod) view.getFinancialPeriodComboBoxModel().getSelectedItem(); + EntryBook entryBook = (EntryBook) view.getEntryBookComboBoxModel().getSelectedItem(); + boolean isLock = isTableLock(period, entryBook); - String result = t("lima.financialTransaction.statusTextPeriod", period.getBeginDate(), period.getEndDate()); + String result = isLock ? t("lima.financialTransaction.statusTextPeriod.close", period.getBeginDate(), period.getEndDate(), entryBook.getCode()) : t("lima.financialTransaction.statusTextPeriod.open", period.getBeginDate(), period.getEndDate()); view.getPeriodStatusLabel().setText(result); 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 6851f9c..812704f 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 @@ -291,7 +291,8 @@ 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.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 lima.financialTransaction.update.error.lockedEntryBook=Update financial transaction failed, locked entry book. 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 d560eb3..70f6df5 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 @@ -302,7 +302,8 @@ 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=<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.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.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>.