Skip to content

Commit e5b41fb

Browse files
committed
Allow any AccountTransaction linked to a Security to have an ex-date
Issue: portfolio-performance#5439
1 parent 362d0b3 commit e5b41fb

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/onvista/OnvistaPDFExtractorTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import static org.hamcrest.CoreMatchers.hasItem;
3939
import static org.hamcrest.CoreMatchers.is;
4040
import static org.hamcrest.MatcherAssert.assertThat;
41-
import static org.hamcrest.Matchers.nullValue;
4241
import static org.hamcrest.collection.IsEmptyCollection.empty;
4342
import static org.junit.Assert.assertNull;
4443

@@ -3105,7 +3104,7 @@ public void testDividende15()
31053104
assertThat(transaction.getType(), is(AccountTransaction.Type.TAXES));
31063105

31073106
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2017-10-20T00:00")));
3108-
assertThat(transaction.getExDate(), is(nullValue()));
3107+
assertThat(transaction.getExDate(), is(LocalDateTime.parse("2017-10-06T00:00")));
31093108
assertThat(transaction.getShares(), is(Values.Share.factorize(0.4512)));
31103109
assertThat(transaction.getSource(), is("Dividende15.txt"));
31113110
assertThat(transaction.getNote(), is("Abrechnungs-Nr. 12345678 | Ertrag für 2017"));

name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/viewers/ExDateEditingSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ExDateEditingSupport extends ColumnEditingSupport
3131
public boolean canEdit(Object element)
3232
{
3333
var tx = Adaptor.adapt(AccountTransaction.class, element);
34-
return tx != null && tx.getType() == AccountTransaction.Type.DIVIDENDS;
34+
return tx != null && tx.getSecurity() != null;
3535
}
3636

3737
@Override

name.abuchen.portfolio/META-INF/services/name.abuchen.portfolio.checks.Check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ name.abuchen.portfolio.checks.impl.FixWrongTransfersCheck
1414
name.abuchen.portfolio.checks.impl.FixDepositsWithSecurityCheck
1515
name.abuchen.portfolio.checks.impl.NegativeExchangeRateCheck
1616
name.abuchen.portfolio.checks.impl.MissingTransactionDateCheck
17-
name.abuchen.portfolio.checks.impl.OnlyDividendsCanHaveExDateCheck
17+
name.abuchen.portfolio.checks.impl.OnlyAccountTransactionsWithSecurityCanHaveExDateCheck

name.abuchen.portfolio/src/name/abuchen/portfolio/checks/impl/OnlyDividendsCanHaveExDateCheck.java renamed to name.abuchen.portfolio/src/name/abuchen/portfolio/checks/impl/OnlyAccountTransactionsWithSecurityCanHaveExDateCheck.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55

66
import name.abuchen.portfolio.checks.Check;
77
import name.abuchen.portfolio.checks.Issue;
8-
import name.abuchen.portfolio.model.AccountTransaction;
98
import name.abuchen.portfolio.model.Client;
109

11-
public class OnlyDividendsCanHaveExDateCheck implements Check
10+
public class OnlyAccountTransactionsWithSecurityCanHaveExDateCheck implements Check
1211
{
1312
@Override
1413
public List<Issue> execute(Client client)
@@ -19,7 +18,7 @@ public List<Issue> execute(Client client)
1918
{
2019
for (var tx : account.getTransactions())
2120
{
22-
if (tx.getExDate() != null && tx.getType() != AccountTransaction.Type.DIVIDENDS)
21+
if (tx.getExDate() != null && tx.getSecurity() == null)
2322
{
2423
tx.setExDate(null);
2524
}

name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/pdf/OnvistaPDFExtractor.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -916,13 +916,6 @@ private void addDividendeTransaction()
916916
if (ctx.getString(FAILURE) != null)
917917
item.setFailureMessage(ctx.getString(FAILURE));
918918

919-
// ex-date is only supported for dividend
920-
// transactions. if there is a
921-
// 'Ertragsthesaurierung', then we have a tax
922-
// transaction without ex-date.
923-
if (t.getType() != AccountTransaction.Type.DIVIDENDS && t.getExDate() != null)
924-
t.setExDate(null);
925-
926919
return item;
927920
});
928921

0 commit comments

Comments
 (0)