Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/converter/mymoneystatementreader.cpp
Show First 20 Lines • Show All 691 Lines • ▼ Show 20 Line(s) | 689 | if ((statementTransactionUnderImport.m_eAction != eMyMoney::Transaction::Action::None) | |||
---|---|---|---|---|---|
692 | && (statementTransactionUnderImport.m_eAction != eMyMoney::Transaction::Action::Fees)) { | 692 | && (statementTransactionUnderImport.m_eAction != eMyMoney::Transaction::Action::Fees)) { | ||
693 | // the correct account is the stock account which matches two criteria: | 693 | // the correct account is the stock account which matches two criteria: | ||
694 | // (1) it is a sub-account of the selected investment account, and | 694 | // (1) it is a sub-account of the selected investment account, and | ||
695 | // (2a) the symbol of the underlying security matches the security of the | 695 | // (2a) the symbol of the underlying security matches the security of the | ||
696 | // transaction, or | 696 | // transaction, or | ||
697 | // (2b) the name of the security matches the name of the security of the transaction. | 697 | // (2b) the name of the security matches the name of the security of the transaction. | ||
698 | 698 | | |||
699 | // search through each subordinate account | 699 | // search through each subordinate account | ||
700 | bool found = false; | 700 | auto found = false; | ||
701 | QStringList accounts = thisaccount.accountList(); | | |||
702 | QStringList::const_iterator it_account = accounts.constBegin(); | | |||
703 | QString currencyid; | 701 | QString currencyid; | ||
704 | while (!found && it_account != accounts.constEnd()) { | 702 | foreach (const auto sAccount, thisaccount.accountList()) { | ||
705 | currencyid = file->account(*it_account).currencyId(); | 703 | currencyid = file->account(sAccount).currencyId(); | ||
706 | MyMoneySecurity security = file->security(currencyid); | 704 | auto security = file->security(currencyid); | ||
707 | if (matchNotEmpty(statementTransactionUnderImport.m_strSymbol, security.tradingSymbol()) || | 705 | if (matchNotEmpty(statementTransactionUnderImport.m_strSymbol, security.tradingSymbol()) || | ||
708 | matchNotEmpty(statementTransactionUnderImport.m_strSecurity, security.name())) { | 706 | matchNotEmpty(statementTransactionUnderImport.m_strSecurity, security.name())) { | ||
709 | thisaccount = file->account(*it_account); | 707 | thisaccount = file->account(sAccount); | ||
710 | found = true; | 708 | found = true; | ||
709 | break; | ||||
711 | } | 710 | } | ||
712 | | ||||
713 | ++it_account; | | |||
714 | } | 711 | } | ||
715 | 712 | | |||
716 | // If there was no stock account under the m_acccount investment account, | 713 | // If there was no stock account under the m_acccount investment account, | ||
717 | // add one using the security. | 714 | // add one using the security. | ||
718 | if (!found) { | 715 | if (!found) { | ||
719 | // The security should always be available, because the statement file | 716 | // The security should always be available, because the statement file | ||
720 | // should separately list all the securities referred to in the file, | 717 | // should separately list all the securities referred to in the file, | ||
721 | // and when we found a security, we added it to the file. | 718 | // and when we found a security, we added it to the file. | ||
▲ Show 20 Lines • Show All 831 Lines • Show Last 20 Lines |