This is an automated email from the git hooks/post-receive script. New change to branch develop in repository lima. See http://git.chorem.org/lima.git from a0857b1 Mise à jour de la déclaration de licences new d5f467a refs #1295 Le tableau de la saisie des écritures n'est pas éditable si la période est cloturé pour le journal sélectionné new 4a1b1d5 refs #1158 Ajout de commentaires + désactivation du boutton de création d'une transaction new 253998b refs #1158 Sur l'onglet lettrage il n'est pas possible de modifier une selection comportant une entrée vérouillée. Ajout d'une colonne 'clos' indiquant les entrées vérouillées. new 9957610 Merge branch 'feature/1158-NotEditableTableForClose' into develop The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 9957610abb440a267846ca956de2cd0f5452cb4c Merge: a0857b1 253998b Author: dcosse <cosse@codelutin.com> Date: Mon Nov 30 10:45:23 2015 +0100 Merge branch 'feature/1158-NotEditableTableForClose' into develop commit 253998babea7a288c1df81a9be793e2bad937459 Author: dcosse <cosse@codelutin.com> Date: Mon Sep 28 16:24:18 2015 +0200 refs #1158 Sur l'onglet lettrage il n'est pas possible de modifier une selection comportant une entrée vérouillée. Ajout d'une colonne 'clos' indiquant les entrées vérouillées. commit 4a1b1d576c5378110831420f13b1b67e86447c2b 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 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é Summary of changes: .../business/api/FinancialTransactionService.java | 7 ++ .../ejb/FinancialTransactionServiceImpl.java | 12 +++ .../java/org/chorem/lima/entity/EntryTopiaDao.java | 24 ++++++ .../FinancialTransactionView.css | 15 ++-- .../FinancialTransactionView.jaxx | 2 +- .../FinancialTransactionViewHandler.java | 50 ++++++++---- .../lima/ui/lettering/LetteringEditModel.java | 80 +++++++++---------- ...tionModel.java => LetteringSelectionModel.java} | 31 ++------ .../lima/ui/lettering/LetteringTableModel.java | 38 +++++++++ .../org/chorem/lima/ui/lettering/LetteringView.css | 6 +- .../chorem/lima/ui/lettering/LetteringView.jaxx | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 85 +++++++++++---------- .../resources/i18n/lima-swing_en_GB.properties | 5 ++ .../resources/i18n/lima-swing_fr_FR.properties | 7 +- .../icons/action-financialPeriod-close.png | Bin 715 -> 452 bytes lima-swing/src/main/resources/log4j.properties | 2 +- 16 files changed, 234 insertions(+), 132 deletions(-) rename lima-swing/src/main/java/org/chorem/lima/ui/lettering/{LettringSelectionModel.java => LetteringSelectionModel.java} (82%) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop 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>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 4a1b1d576c5378110831420f13b1b67e86447c2b 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 ab68e55..d8ac8b8 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; @@ -165,7 +166,9 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo initializationComplete = true; updateFinancialTransactions(); + computePeriodStatusText(); + setAddEntryAllowed(); } protected void initShortCuts() { @@ -349,20 +352,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(); @@ -370,7 +363,6 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo boolean isLock = isTableLock(financialPeriod, entryBook); table.setEditable(!isLock); - //view.setEditable(!isLock); } } @@ -1048,7 +1040,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); @@ -1085,4 +1088,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 812704f..16a060f 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,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 70f6df5..77c6a6f 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,8 +302,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>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 253998babea7a288c1df81a9be793e2bad937459 Author: dcosse <cosse@codelutin.com> Date: Mon Sep 28 16:24:18 2015 +0200 refs #1158 Sur l'onglet lettrage il n'est pas possible de modifier une selection comportant une entrée vérouillée. Ajout d'une colonne 'clos' indiquant les entrées vérouillées. --- .../business/api/FinancialTransactionService.java | 7 ++ .../ejb/FinancialTransactionServiceImpl.java | 12 +++ .../java/org/chorem/lima/entity/EntryTopiaDao.java | 24 ++++++ .../lima/ui/lettering/LetteringEditModel.java | 80 +++++++++---------- ...tionModel.java => LetteringSelectionModel.java} | 31 ++------ .../lima/ui/lettering/LetteringTableModel.java | 38 +++++++++ .../org/chorem/lima/ui/lettering/LetteringView.css | 6 +- .../chorem/lima/ui/lettering/LetteringView.jaxx | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 85 +++++++++++---------- .../resources/i18n/lima-swing_en_GB.properties | 1 + .../resources/i18n/lima-swing_fr_FR.properties | 1 + .../icons/action-financialPeriod-close.png | Bin 715 -> 452 bytes lima-swing/src/main/resources/log4j.properties | 2 +- 13 files changed, 179 insertions(+), 110 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java index d268005..d46ef99 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java @@ -126,6 +126,13 @@ public interface FinancialTransactionService { List<Entry> getAllEntrieByDatesAndAccountAndLettering(LetteringFilter filter); /** + * + * @param filter filter define: starting date, ending date, account + * @return All Entries related to an unclosed entry book according to the filter. + */ + List<Entry> getAllUnlockEntriesByFilter(LetteringFilter filter); + + /** * Retourne la dernière entrée d'une transaction * @param financialTransaction transaction sur laquelle la derniere entree est selectionnee * */ diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java index 89f8825..9dedbfb 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java @@ -474,6 +474,18 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme } @Override + public List<Entry> getAllUnlockEntriesByFilter(LetteringFilter filter) { + EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); + List<Entry> entries = entryTopiaDao.findAllUnlockEntriesByFilter(filter); + + if (log.isDebugEnabled()) { + log.debug("Entries size : " + entries.size()); + } + + return entries; + } + + @Override public Entry getLastEntry(FinancialTransaction financialTransaction) { EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); diff --git a/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java b/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java index f0922c4..9f5aeef 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java @@ -29,7 +29,9 @@ import org.chorem.lima.beans.LetteringFilter; import org.nuiton.topia.persistence.HqlAndParametersBuilder; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class EntryTopiaDao extends AbstractEntryTopiaDao<Entry> { @@ -232,6 +234,28 @@ public class EntryTopiaDao extends AbstractEntryTopiaDao<Entry> { return entries; } + public List<Entry> findAllUnlockEntriesByFilter(LetteringFilter filter) { + Map<String, Object> params = new HashMap<>(); + String req = "SELECT E FROM " + Entry.class.getName() + " E, " + ClosedPeriodicEntryBook.class.getName() + " CPEB " + + " WHERE E." + PROPERTY_TRANSACTION_DATE + ">= :ds " + + " AND E." + PROPERTY_TRANSACTION_DATE + "<= :de "; + Account account = filter.getAccount(); + if (account == null || account.getTopiaId() != null) { + req += " AND E." + Entry.PROPERTY_ACCOUNT + " = :a"; + params.put("a", account); + } + req +=" AND E." + Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_ENTRY_BOOK + " = CPEB." + ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK + + " AND CPEB." + ClosedPeriodicEntryBook.PROPERTY_LOCKED + " = FALSE" + + " AND CPEB." + ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD + "." + FinancialPeriod.PROPERTY_BEGIN_DATE + " <= E." + Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_TRANSACTION_DATE + + " AND CPEB." + ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD + "." + FinancialPeriod.PROPERTY_END_DATE + " >= E." + Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_TRANSACTION_DATE; + params.put("ds", filter.getDateStart()); + params.put("de", filter.getDateEnd()); + + List<Entry> entries = findAll(req, params); + + return entries; + } + /** * Retourne la dernière entrée d'une transaction * @param financialTransaction transaction sur laquelle la derniere entree est selectionnee diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java index c400009..35e6237 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java @@ -31,24 +31,27 @@ import java.math.BigDecimal; */ public class LetteringEditModel implements Serializable { + public static final String PROPERTY_EDITABLE = "editable"; + public static final String PROPERTY_DEBIT = "debit"; public static final String PROPERTY_CREDIT = "credit"; public static final String PROPERTY_SOLD = "sold"; - public static final String PROPERTY_LETTRED = "lettred"; + public static final String PROPERTY_LETTERED = "lettered"; - public static final String PROPERTY_UNLETTRED = "unLettred"; + public static final String PROPERTY_UNLETTERED = "unLettered"; public static final String PROPERTY_EQUALIZED = "equalized"; protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this); protected LetteringTableModel model; - protected boolean lettred; - protected boolean unLettred; + protected boolean lettered; + protected boolean unLettered; protected boolean equalized; + protected boolean editable; protected BigDecimal debit = BigDecimal.ZERO; protected BigDecimal credit = BigDecimal.ZERO; protected BigDecimal sold = BigDecimal.ZERO; @@ -63,28 +66,24 @@ public class LetteringEditModel implements Serializable { firePropertyChange(PROPERTY_EQUALIZED, oldEqualized, this.equalized); } - public boolean isLettred() { - return lettred; + public boolean isLettered() { + return lettered; } - public void setLettred(boolean lettred) { - boolean oldLettrer = isLettred(); - if(lettred && (sold == BigDecimal.ZERO || sold.doubleValue() == 0)){ - this.lettred = lettred; - }else{ - this.lettred = false; - } - firePropertyChange(PROPERTY_LETTRED, oldLettrer, this.lettred); + public void setLettered(boolean lettered) { + boolean oldLettrer = isLettered(); + this.lettered = lettered && (BigDecimal.ZERO.equals(sold) || sold.doubleValue() == 0) && lettered; + firePropertyChange(PROPERTY_LETTERED, oldLettrer, this.lettered); } - public boolean isUnLettred() { - return unLettred; + public boolean isUnLettered() { + return unLettered; } - public void setUnLettred(boolean unLettred) { - boolean oldDelettrer = isUnLettred(); - this.unLettred = unLettred; - firePropertyChange(PROPERTY_UNLETTRED, oldDelettrer, this.unLettred); + public void setUnLettered(boolean unLettered) { + boolean oldDeletterer = isUnLettered(); + this.unLettered = unLettered; + firePropertyChange(PROPERTY_UNLETTERED, oldDeletterer, this.unLettered); } public BigDecimal getDebit() { @@ -94,9 +93,9 @@ public class LetteringEditModel implements Serializable { public void setDebit(BigDecimal debit) { BigDecimal oldDebit = getDebit(); - if (debit != BigDecimal.ZERO){ + if (!BigDecimal.ZERO.equals(debit)){ this.debit = debit.add(oldDebit); - }else{ + } else { this.debit = BigDecimal.ZERO; } @@ -110,7 +109,7 @@ public class LetteringEditModel implements Serializable { public void setCredit(BigDecimal credit) { BigDecimal oldCredit = getCredit(); - if (credit != BigDecimal.ZERO){ + if (!BigDecimal.ZERO.equals(credit)){ this.credit = credit.add(oldCredit); }else{ this.credit=BigDecimal.ZERO; @@ -123,39 +122,26 @@ public class LetteringEditModel implements Serializable { return sold; } - public void setSolde(BigDecimal solde, boolean credit) { - BigDecimal oldSolde = getSold(); + public void setSold(BigDecimal solde, boolean credit) { + BigDecimal oldSold = getSold(); - if (solde != BigDecimal.ZERO){ + if (!BigDecimal.ZERO.equals(solde)){ if (credit){ - this.sold = oldSolde.subtract(solde); + this.sold = oldSold.subtract(solde); }else{ - this.sold = oldSolde.add(solde); + this.sold = oldSold.add(solde); } }else{ this.sold =BigDecimal.ZERO; } - firePropertyChange(PROPERTY_SOLD, oldSolde, this.sold); - } - - public void resetDebitCreditBalance(){ - setDebit(BigDecimal.ZERO); - setCredit(BigDecimal.ZERO); - setSolde(BigDecimal.ZERO, false); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - pcs.addPropertyChangeListener(listener); + firePropertyChange(PROPERTY_SOLD, oldSold, this.sold); } public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { pcs.addPropertyChangeListener(propertyName, listener); } - public void removePropertyChangeListener(PropertyChangeListener listener) { - pcs.removePropertyChangeListener(listener); - } public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { pcs.removePropertyChangeListener(propertyName, listener); @@ -168,4 +154,14 @@ public class LetteringEditModel implements Serializable { protected void firePropertyChange(String propertyName, Object newValue) { firePropertyChange(propertyName, null, newValue); } + + public boolean isEditable() { + return editable; + } + + public void setEditable(boolean editable) { + boolean oldEditable = this.editable; + this.editable = editable; + firePropertyChange(PROPERTY_EDITABLE, oldEditable, this.editable); + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java similarity index 82% rename from lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java rename to lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java index 8fae31a..d4b2f53 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringSelectionModel.java @@ -25,21 +25,20 @@ import org.apache.commons.lang3.StringUtils; import org.chorem.lima.entity.Entry; import javax.swing.*; -import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.List; /** * @author sletellier <letellier@codelutin.com> */ -public class LettringSelectionModel extends DefaultListSelectionModel{ +public class LetteringSelectionModel extends DefaultListSelectionModel{ protected LetteringTableModel letteringTableModel; protected Entry entry; protected int lineSelected; protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this); - public LettringSelectionModel(LetteringTableModel letteringTableModel){ + public LetteringSelectionModel(LetteringTableModel letteringTableModel){ this.letteringTableModel = letteringTableModel; } @@ -52,16 +51,16 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ public void setSelectionInterval(int row, int column) { if (!letteringNotExist(row)) { - //lettred entries + //lettered entries if ( isSelectionEmpty() || !isSelectedIndex(row)){ clearSelection(); lineSelected = row; - String currentLettring = getCurrentLettring(); + String currentLettering = getCurrentLettering(); //select entries with the same letter of the selected entry for(Entry entry : getEntries()){ if (StringUtils.isNotBlank(entry.getLettering())){ - if (entry.getLettering().equals(currentLettring)){ + if (entry.getLettering().equals(currentLettering)){ int entryToSelect = letteringTableModel.indexOf(entry); super.addSelectionInterval(entryToSelect, entryToSelect); } @@ -71,7 +70,7 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ } else { - //unlettred entries + //unlettered entries //To clear the selection when it changes from lettered entry to unlettered for(Entry entry : getEntries()){ if (!StringUtils.isBlank(entry.getLettering())) { @@ -105,7 +104,7 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ return letteringTableModel.getValues(); } - public String getCurrentLettring(){ + public String getCurrentLettering(){ return getCurrentEntrySelected().getLettering(); } @@ -132,22 +131,6 @@ public class LettringSelectionModel extends DefaultListSelectionModel{ return MULTIPLE_INTERVAL_SELECTION; } - public void addPropertyChangeListener(PropertyChangeListener listener) { - pcs.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcs.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - pcs.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcs.removePropertyChangeListener(propertyName, listener); - } - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { pcs.firePropertyChange(propertyName, oldValue, newValue); } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java index c89fffa..d209b32 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java @@ -28,8 +28,14 @@ import org.chorem.lima.entity.EntryBook; import org.chorem.lima.ui.common.AbstractColumn; import org.chorem.lima.ui.common.AbstractLimaTableModel; +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.io.IOException; +import java.io.InputStream; import java.math.BigDecimal; import java.util.Date; +import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -44,9 +50,20 @@ public class LetteringTableModel extends AbstractLimaTableModel<Entry> { /** serialVersionUID. */ private static final long serialVersionUID = 1L; + protected ImageIcon lockedImageIcon; + protected List<Entry> unlockedEntries; @Override protected void initColumn() { + addColumn(new AbstractColumn<LetteringTableModel>(ImageIcon.class, t("lima.table.locked"), false) { + @Override + public Object getValueAt(int row) { + Entry entry = tableModel.get(row); + ImageIcon imageIcon = unlockedEntries.contains(entry) ? null: getLockedImageIcon(); + return imageIcon; + } + }); + addColumn(new AbstractColumn<LetteringTableModel>(Date.class, t("lima.table.date"), false) { @Override public Object getValueAt(int row) { @@ -113,4 +130,25 @@ public class LetteringTableModel extends AbstractLimaTableModel<Entry> { } + public List<Entry> getUnlockedEntries() { + return unlockedEntries; + } + + public void setUnlockedEntries(List<Entry> unlockedEntries) { + this.unlockedEntries = unlockedEntries; + } + + protected ImageIcon getLockedImageIcon() { + if (lockedImageIcon == null) { + InputStream stream = LetteringTableModel.class.getResourceAsStream("/icons/action-financialPeriod-close.png"); + Image lockedIcon; + try { + lockedIcon = ImageIO.read(stream); + lockedImageIcon = new ImageIcon(lockedIcon); + } catch (IOException e) { + e.printStackTrace(); + } + } + return lockedImageIcon; + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css index 2663ad9..f5c7736 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.css @@ -25,19 +25,19 @@ #lettered { toolTipText : "lima.lettering.lettered"; - enabled : {editModel.isLettred()}; + enabled : {editModel.isLettered() && editModel.isEditable()}; actionIcon : "lettering"; } #noLettered { toolTipText : "lima.lettering.unLettered"; - enabled : {editModel.isUnLettred()}; + enabled : {editModel.isUnLettered() && editModel.isEditable()}; actionIcon : "un-lettering"; } #round { toolTipText : "lima.lettering.equalize"; - enabled : {editModel.isEqualized()}; + enabled : {editModel.isEqualized() && editModel.isEditable()}; actionIcon : "balance"; } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx index 76ee663..9491b8f 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx @@ -98,7 +98,7 @@ </JToolBar> <JScrollPane constraints="BorderLayout.CENTER"> <LetteringTableModel id="tableModel"/> - <LettringSelectionModel id='letteringSelectionModel' constructorParams='tableModel' + <LetteringSelectionModel id='letteringSelectionModel' constructorParams='tableModel' onValueChanged="handler.balanceAndActions()"/> <LetteringTable id="table" diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index fd77b1a..68fa963 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -25,6 +25,7 @@ package org.chorem.lima.ui.lettering; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import jaxx.runtime.SwingUtil; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -77,7 +78,6 @@ import static org.nuiton.i18n.I18n.t; public class LetteringViewHandler{ protected LetteringView view; - protected LetteringTable table; /** Transaction service. */ protected FiscalPeriodService fiscalPeriodService; @@ -88,15 +88,14 @@ public class LetteringViewHandler{ protected LetteringFilterImpl filter; - protected BigDecimal debit = BigDecimal.ZERO; - protected BigDecimal credit = BigDecimal.ZERO; - protected BigDecimal solde = BigDecimal.ZERO; - protected LettringSelectionModel lettringSelectionModel; + protected LetteringSelectionModel letteringSelectionModel; protected LetteringEditModel editModel; + protected List<Entry> unlockedEntries; + protected ErrorHelper errorHelper; - protected enum ButtonMode {DELETTRED, LETTRED, EQUALIZED, ALL} + protected enum ButtonMode {DELETTERED, LETTERED, EQUALIZED, ALL} private static final Log log = LogFactory.getLog(LetteringViewHandler.class); @@ -120,7 +119,7 @@ public class LetteringViewHandler{ public void init() { filter = new LetteringFilterImpl(); editModel = view.getEditModel(); - lettringSelectionModel = view.getLetteringSelectionModel(); + letteringSelectionModel = view.getLetteringSelectionModel(); loadComboAndRows(); editModel.addPropertyChangeListener(LetteringEditModel.PROPERTY_DEBIT, new PropertyChangeListener() { @@ -145,10 +144,11 @@ public class LetteringViewHandler{ }); initializationComplete = true; + SwingUtil.fixTableColumnWidth(view.getTable(), 0, 40); + updateSoldStatus(); updateAllEntries(); - } public void updateSoldStatus() { @@ -225,15 +225,15 @@ public class LetteringViewHandler{ onBalanceChanged(null); } else if (!letteringNotExist(view.getTable().getSelectedRow())) { - //lettred entries + //lettered entries onBalanceChanged(null); setValuesForSelectedEntries(); //For U.I. buttons (Lettering and unlettering) - onButtonModeChanged(ButtonMode.DELETTRED); + onButtonModeChanged(ButtonMode.DELETTERED); } else { if (log.isDebugEnabled()) { - log.debug("unlettred entries"); + log.debug("unlettered entries"); } int[] selectedRows = view.getTable().getSelectedRows(); if (selectedRows.length == 2) { @@ -261,15 +261,15 @@ public class LetteringViewHandler{ onButtonModeChanged(ButtonMode.ALL); } - //Unlettred entries + //Unlettered entries onBalanceChanged(null); - //treatment unuseful if no rows are selected + //treatment useful if no rows are selected if (!view.getLetteringSelectionModel().isSelectionEmpty()) { if (log.isDebugEnabled()) { log.debug("Rows selected"); } setValuesForSelectedEntries(); - onButtonModeChanged(ButtonMode.LETTRED); + onButtonModeChanged(ButtonMode.LETTERED); } else { if (log.isDebugEnabled()) { log.debug("No Rows selected"); @@ -296,41 +296,46 @@ public class LetteringViewHandler{ public void onButtonModeChanged(ButtonMode buttonMode) { switch (buttonMode) { - case DELETTRED : - editModel.setLettred(false); - editModel.setUnLettred(true); + case DELETTERED: + editModel.setLettered(false); + editModel.setUnLettered(true); break; - case LETTRED: - editModel.setUnLettred(false); - editModel.setLettred(true); + case LETTERED: + editModel.setUnLettered(false); + editModel.setLettered(true); break; case EQUALIZED: editModel.setEqualized(true); break; default: - editModel.setLettred(false); - editModel.setUnLettred(false); + editModel.setLettered(false); + editModel.setUnLettered(false); editModel.setEqualized(false); } } public void setValuesForSelectedEntries() { + boolean isEditable = true; Entry selectedEntry; LetteringTableModel tableModel = view.getTableModel(); for (int i = 0; i < tableModel.getRowCount(); i ++){ if (view.getLetteringSelectionModel().isSelectedIndex(i)){ selectedEntry = tableModel.get(i); //Set values for calculation (By LetteringEditModel) of balance + if (!view.getTableModel().getUnlockedEntries().contains(selectedEntry)) { + isEditable = false; + } onBalanceChanged(selectedEntry); } } + editModel.setEditable(isEditable); } public void onBalanceChanged(Entry balance) { if (balance == null) { editModel.setCredit(BigDecimal.ZERO); editModel.setDebit(BigDecimal.ZERO); - editModel.setSolde(BigDecimal.ZERO, false); + editModel.setSold(BigDecimal.ZERO, false); } else { balanceCalculation(balance.getAmount(), balance.isDebit()); } @@ -354,11 +359,11 @@ public class LetteringViewHandler{ if (!creditVal.equals(BigDecimal.ZERO)){ editModel.setCredit(creditVal); - editModel.setSolde(creditVal, true); + editModel.setSold(creditVal, true); } }else if (creditVal.equals(BigDecimal.ZERO)){ editModel.setDebit(debitVal); - editModel.setSolde(debitVal, false); + editModel.setSold(debitVal, false); }else{ onBalanceChanged(null); } @@ -372,16 +377,16 @@ public class LetteringViewHandler{ Date defaultDateBegFiscalPeriod; Calendar calendar = Calendar.getInstance(); - int dernierJourMoisCourant = calendar.getActualMaximum(Calendar.DATE); - int premierJourMoisCourant = calendar.getActualMinimum(Calendar.DATE); + int lastCurrentMonthDay = calendar.getActualMaximum(Calendar.DATE); + int firstCurrentMonthDay = calendar.getActualMinimum(Calendar.DATE); if (fiscalPeriod != null){ defaultDateBegFiscalPeriod = fiscalPeriod.getBeginDate(); } else{ - defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant); + defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), firstCurrentMonthDay); } - Date defaultDateEndCurrent = DateUtils.setDays(new Date(), dernierJourMoisCourant); + Date defaultDateEndCurrent = DateUtils.setDays(new Date(), lastCurrentMonthDay); view.getBeginPeriodPicker().setDate(defaultDateBegFiscalPeriod); @@ -433,7 +438,9 @@ public class LetteringViewHandler{ && filter.getDateEnd() != null) { List<Entry> entries = financialTransactionService.getAllEntrieByDatesAndAccountAndLettering(filter); - + List<Entry> unlockEntries = financialTransactionService.getAllUnlockEntriesByFilter(filter); + view.getTableModel().setUnlockedEntries(unlockEntries); + this.unlockedEntries = unlockEntries; view.getTableModel().setValues(entries); } @@ -520,14 +527,14 @@ public class LetteringViewHandler{ /**Add a group of three letters to n entries*/ public void addLetter() { - if (editModel.isLettred()) { - int[] entrieSelected = view.getTable().getSelectedRows(); + if (editModel.isLettered()) { + int[] entriesSelected = view.getTable().getSelectedRows(); LetteringTableModel tableModel = view.getTableModel(); List<Entry> entries = Lists.newLinkedList(); - for (int indexEntry : entrieSelected) { + for (int indexEntry : entriesSelected) { Entry entry = tableModel.get(indexEntry); @@ -556,21 +563,21 @@ public class LetteringViewHandler{ errorHelper.showErrorMessage(t("lima.entries.letter.unbalanced.error")); } - onButtonModeChanged(ButtonMode.DELETTRED); + onButtonModeChanged(ButtonMode.DELETTERED); } } /**Remove a group of three letters to n entries*/ public void removeLetter() { - if (editModel.isUnLettred()) { + if (editModel.isUnLettered()) { - int[] entrieSelected = view.getTable().getSelectedRows(); + int[] entriesSelected = view.getTable().getSelectedRows(); LetteringTableModel tableModel = view.getTableModel(); - if (entrieSelected.length > 0) { + if (entriesSelected.length > 0) { - Entry firstEntry = tableModel.get(entrieSelected[0]); + Entry firstEntry = tableModel.get(entriesSelected[0]); String letter = firstEntry.getLettering(); @@ -579,7 +586,7 @@ public class LetteringViewHandler{ updateEntries(entries); } - onButtonModeChanged(ButtonMode.LETTRED); + onButtonModeChanged(ButtonMode.LETTERED); } } 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 16a060f..a6a4484 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 @@ -503,6 +503,7 @@ lima.table.description=Description lima.table.entryBook=Entry book lima.table.label=Label lima.table.letter=Letter +lima.table.locked=Loked lima.table.number=Account Number lima.table.provisionDeprecation=Provision Deprecation lima.table.voucher=Voucher 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 77c6a6f..d10862e 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 @@ -510,6 +510,7 @@ lima.table.description=Description lima.table.entryBook=Journal lima.table.label=Libellé lima.table.letter=Lettre +lima.table.locked=Clos lima.table.number=Numéro de compte lima.table.provisionDeprecation=Amortissements et provisions lima.table.voucher=Pièce comptable diff --git a/lima-swing/src/main/resources/icons/action-financialPeriod-close.png b/lima-swing/src/main/resources/icons/action-financialPeriod-close.png index 08f2493..ac2fd6f 100644 Binary files a/lima-swing/src/main/resources/icons/action-financialPeriod-close.png and b/lima-swing/src/main/resources/icons/action-financialPeriod-close.png differ diff --git a/lima-swing/src/main/resources/log4j.properties b/lima-swing/src/main/resources/log4j.properties index 4581abe..48b1758 100644 --- a/lima-swing/src/main/resources/log4j.properties +++ b/lima-swing/src/main/resources/log4j.properties @@ -55,7 +55,7 @@ log4j.appender.C.layout=org.apache.log4j.SimpleLayout log4j.logger.org.chorem.lima=INFO log4j.logger.org.chorem.lima.ui.financialtransaction.FinancialTransactionTable=INFO log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=INFO -log4j.logger.org.chorem.lima.ui.lettering.LettringSelectionModel=INFO +log4j.logger.org.chorem.lima.ui.lettering.LetteringSelectionModel=INFO log4j.logger.org.chorem.lima.ui.lettering.LetteringEditModel=INFO log4j.logger.org.chorem.lima.ui.common.FinancialTransactionTableModel=INFO log4j.logger.org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor=INFO -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 9957610abb440a267846ca956de2cd0f5452cb4c Merge: a0857b1 253998b Author: dcosse <cosse@codelutin.com> Date: Mon Nov 30 10:45:23 2015 +0100 Merge branch 'feature/1158-NotEditableTableForClose' into develop .../business/api/FinancialTransactionService.java | 7 ++ .../ejb/FinancialTransactionServiceImpl.java | 12 +++ .../java/org/chorem/lima/entity/EntryTopiaDao.java | 24 ++++++ .../FinancialTransactionView.css | 15 ++-- .../FinancialTransactionView.jaxx | 2 +- .../FinancialTransactionViewHandler.java | 50 ++++++++---- .../lima/ui/lettering/LetteringEditModel.java | 80 +++++++++---------- ...tionModel.java => LetteringSelectionModel.java} | 31 ++------ .../lima/ui/lettering/LetteringTableModel.java | 38 +++++++++ .../org/chorem/lima/ui/lettering/LetteringView.css | 6 +- .../chorem/lima/ui/lettering/LetteringView.jaxx | 2 +- .../lima/ui/lettering/LetteringViewHandler.java | 85 +++++++++++---------- .../resources/i18n/lima-swing_en_GB.properties | 5 ++ .../resources/i18n/lima-swing_fr_FR.properties | 7 +- .../icons/action-financialPeriod-close.png | Bin 715 -> 452 bytes lima-swing/src/main/resources/log4j.properties | 2 +- 16 files changed, 234 insertions(+), 132 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm