Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/storage/mymoneystoragemgr.cpp
Context not available. | |||||
668 | if (it_t == d->m_transactionList.end()) | 668 | if (it_t == d->m_transactionList.end()) | ||
---|---|---|---|---|---|
669 | throw MYMONEYEXCEPTION_CSTRING("invalid transaction key"); | 669 | throw MYMONEYEXCEPTION_CSTRING("invalid transaction key"); | ||
670 | 670 | | |||
671 | foreach (const auto split, (*it_t).splits()) { | 671 | // don't count transactions that served as input for matching | ||
672 | auto acc = d->m_accountList[split.accountId()]; | 672 | if (!((*it_t).origin() & eMyMoney::Transaction::Origin::MatchingInput)) { | ||
673 | // we only need to adjust non-investment accounts here | 673 | foreach (const auto split, (*it_t).splits()) { | ||
674 | // as for investment accounts the balance will be recalculated | 674 | auto acc = d->m_accountList[split.accountId()]; | ||
675 | // after the transaction has been added. | 675 | // we only need to adjust non-investment accounts here | ||
676 | if (!acc.isInvest()) { | 676 | // as for investment accounts the balance will be recalculated | ||
677 | d->adjustBalance(acc, split, true); | 677 | // after the transaction has been added. | ||
678 | acc.touch(); | 678 | if (!acc.isInvest()) { | ||
679 | d->m_accountList.modify(acc.id(), acc); | 679 | d->adjustBalance(acc, split, true); | ||
680 | acc.touch(); | ||||
681 | d->m_accountList.modify(acc.id(), acc); | ||||
682 | } | ||||
680 | } | 683 | } | ||
681 | } | 684 | } | ||
682 | 685 | | |||
Context not available. | |||||
688 | d->m_transactionList.insert(newKey, transaction); | 691 | d->m_transactionList.insert(newKey, transaction); | ||
689 | d->m_transactionKeys.modify(transaction.id(), newKey); | 692 | d->m_transactionKeys.modify(transaction.id(), newKey); | ||
690 | 693 | | |||
691 | // adjust account balances | 694 | // don't count transactions that served as input for matching | ||
692 | foreach (const auto split, transaction.splits()) { | 695 | if (!(transaction.origin() & eMyMoney::Transaction::Origin::MatchingInput)) { | ||
693 | auto acc = d->m_accountList[split.accountId()]; | 696 | // adjust account balances | ||
694 | d->adjustBalance(acc, split, false); | 697 | foreach (const auto split, transaction.splits()) { | ||
695 | acc.touch(); | 698 | auto acc = d->m_accountList[split.accountId()]; | ||
696 | d->m_accountList.modify(acc.id(), acc); | 699 | d->adjustBalance(acc, split, false); | ||
700 | acc.touch(); | ||||
701 | d->m_accountList.modify(acc.id(), acc); | ||||
702 | } | ||||
697 | } | 703 | } | ||
698 | } | 704 | } | ||
699 | 705 | | |||
Context not available. | |||||
1771 | 1777 | | |||
1772 | // now scan over all transactions and all splits and setup the balances | 1778 | // now scan over all transactions and all splits and setup the balances | ||
1773 | foreach (const auto transaction, d->m_transactionList) { | 1779 | foreach (const auto transaction, d->m_transactionList) { | ||
1780 | if (transaction.origin() & eMyMoney::Transaction::Origin::MatchingInput) | ||||
1781 | continue; | ||||
1774 | foreach (const auto split, transaction.splits()) { | 1782 | foreach (const auto split, transaction.splits()) { | ||
1775 | if (!split.shares().isZero()) { | 1783 | if (!split.shares().isZero()) { | ||
1776 | const QString& id = split.accountId(); | 1784 | const QString& id = split.accountId(); | ||
Context not available. |