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 01124814ae59b5e4f3c088da637410822e6be0fd Author: dcosse <cosse@codelutin.com> Date: Thu Sep 10 15:06:06 2015 +0200 refs #1290 A la création d'une transaction si aucune n'a été créée lors de la même session est qu'une transaction est sélectionnée alors la nouvelle trasaction prend la date de celle-ci --- .../FinancialTransactionViewHandler.java | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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 c4b7466..2ad6138 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 @@ -478,7 +478,7 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo table.changeSelection(index, 1, false, false); table.requestFocus(); table.scrollRowToVisible(Math.max(0, index - 5)); - table.scrollRowToVisible(Math.min(tableModel.size() -1 , index + transaction.sizeEntry() + 5)); + table.scrollRowToVisible(Math.min(tableModel.size() - 1, index + transaction.sizeEntry() + 5)); } catch (LockedFinancialPeriodException e) { errorHelper.showErrorMessage(t("lima.entries.paste.transaction.error.lockedFinancialPeriod", e.getFinancialPeriod().getBeginDate(), @@ -983,7 +983,11 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo } } - public Date getUseDate() { + /** + * + * @return the last edited transaction, if none the selected transaction date, if none the begin date. + */ + protected Date getUseDate() { FinancialPeriod financialPeriod = (FinancialPeriod)view.getFinancialPeriodComboBox().getSelectedItem(); Date beginDate = financialPeriod.getBeginDate(); @@ -992,12 +996,25 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo if (lastAssignDate == null || lastAssignDate.before(beginDate) || lastAssignDate.after(endDate) ) { - lastAssignDate = beginDate; + + FinancialTransaction selectedTransaction = getSelectedFinancialTransaction(); + lastAssignDate = selectedTransaction == null ? beginDate : selectedTransaction.getTransactionDate(); } return lastAssignDate; } + protected FinancialTransaction getSelectedFinancialTransaction() { + FinancialTransactionTable table = view.getFinancialTransactionTable(); + FinancialTransactionTableModel tableModel = view.getFinancialTransactionTableModel(); + int indexSelectedRow = table.getSelectedRow(); + FinancialTransaction selectedTransaction = null; + if (indexSelectedRow != -1) { + selectedTransaction = tableModel.getTransactionAt(indexSelectedRow); + } + return selectedTransaction; + } + protected void computePeriodStatusText() { FinancialPeriod period = (FinancialPeriod) view.getFinancialPeriodComboBoxModel().getSelectedItem(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.