Commit 8c1f883f authored by Allan Anderson's avatar Allan Anderson
Browse files

BUG:328776 - CSV importer may import certain investment transactions

without assigning a brokerage or checking account.
Also, improve wording of heading label of symboltabledlg.ui.
BUG:328127 - Fix matching problem on import when securities have different names but same symbol.
parent 8901699c
......@@ -565,6 +565,9 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
if (brokerageactid.isEmpty()) {
brokerageactid = file->nameToAccount(statementTransactionUnderImport.m_strBrokerageAccount);
}
if (brokerageactid.isEmpty()) {
brokerageactid = file->nameToAccount(thisaccount.brokerageName());
}
// find the security transacted, UNLESS this transaction didn't
// involve any security.
......@@ -630,7 +633,7 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
QList<MyMoneySecurity> list = MyMoneyFile::instance()->securityList();
QList<MyMoneySecurity>::ConstIterator it = list.constBegin();
while (it != list.constEnd() && security.id().isEmpty()) {
if (statementTransactionUnderImport.m_strSecurity.toLower() == (*it).tradingSymbol().toLower()
if (statementTransactionUnderImport.m_strSymbol.toLower() == (*it).tradingSymbol().toLower()
|| statementTransactionUnderImport.m_strSecurity.toLower() == (*it).name().toLower()) {
security = *it;
}
......@@ -1016,9 +1019,6 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
s.setValue(-s1.value());
s.setAccountId(payeeObj.defaultAccountId());
transactionUnderImport.addSplit(s);
MyMoneyFile* file = MyMoneyFile::instance();
MyMoneyAccount category = file->account(payeeObj.defaultAccountId());
file->addVATSplit(transactionUnderImport, m_account, category, statementTransactionUnderImport.m_amount);
} else if (statementTransactionUnderImport.m_listSplits.isEmpty() && !d->m_skipCategoryMatching) {
MyMoneyTransactionFilter filter(thisaccount.id());
filter.addPayee(payeeid);
......@@ -1091,7 +1091,8 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
// Add the 'account' split if it's needed
if (! transfervalue.isZero()) {
// in case the transaction has a reference to the brokerage account, we use it
if (!statementTransactionUnderImport.m_strBrokerageAccount.isEmpty()) {
// but if brokerageactid has already been set, keep that.
if (!statementTransactionUnderImport.m_strBrokerageAccount.isEmpty() && brokerageactid.isEmpty()) {
brokerageactid = file->nameToAccount(statementTransactionUnderImport.m_strBrokerageAccount);
}
if (brokerageactid.isEmpty()) {
......
......@@ -1329,6 +1329,7 @@ int InvestProcessing::processInvestLine(const QString& inBuffer)
name = m_columnList[m_detailColumn].toLower();
}
m_trInvestData.symbol = symbol;
m_trInvestData.security = name;
}
......@@ -1384,12 +1385,16 @@ int InvestProcessing::processInvestLine(const QString& inBuffer)
//
// A brokerage type could have been changed in m_redefine->checkValid() above, so no longer brokerage.
//
if ((m_trInvestData.type == "buy") || (m_trInvestData.type == "sell") || (m_trInvestData.type == "reinvdiv") ||
(m_trInvestData.type == "divx") || (m_trInvestData.type == "intinc") ||
(m_trInvestData.type == "shrsin") || (m_trInvestData.type == "shrsout")) {
if ((m_trInvestData.type == "buy") || (m_trInvestData.type == "sell") ||
(m_trInvestData.type == "divx") || (m_trInvestData.type == "intinc")) {
if (m_redefine->accountName().isEmpty()) {
m_redefine->setAccountName(accountName(i18n("Enter the name of the Brokerage or Checking Account used for the transfer of funds:")));
}
m_trInvestData.brokerageAccnt = m_redefine->accountName();
m_tempBuffer += "L[" + m_redefine->accountName() + ']' + '\n';
m_brokerage = false;
} else if ((m_trInvestData.type == "reinvdiv") || (m_trInvestData.type == "shrsin") || (m_trInvestData.type == "shrsout")) {
m_brokerage = false;
}
if (m_brokerage) { // brokerage items
......@@ -1574,7 +1579,6 @@ void InvestProcessing::investCsvImport(MyMoneyStatement& st)
QList<MyMoneyStatement::Security>::const_iterator it_s = m_listSecurities.constBegin();
while (it_s != m_listSecurities.constEnd()) {
st.m_listSecurities << (*it_s);
tr.m_strSymbol = (*it_s).m_strSymbol;
++it_s;
}
......@@ -1610,6 +1614,7 @@ void InvestProcessing::investCsvImport(MyMoneyStatement& st)
s2.m_amount = MyMoneyMoney(-s1.m_amount);
tr.m_strInterestCategory = m_csvSplit.m_strCategoryName;
tr.m_strSecurity = m_trInvestData.security;
tr.m_strSymbol = m_trInvestData.symbol;
s2.m_accountId = checkCategory(m_csvSplit.m_strCategoryName, s1.m_amount, s2.m_amount);
if ((tr.m_eAction == (MyMoneyStatement::Transaction::eaCashDividend)) ||
......
......@@ -420,6 +420,7 @@ private:
MyMoneyMoney fee;
QString payee;
QString security;
QString symbol;
QString brokerageAccnt;
QString type;
QDate date;
......
......@@ -29,7 +29,7 @@
</font>
</property>
<property name="text">
<string>Securities and Symbols</string>
<string>Edit Securities and Symbols</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
......@@ -42,9 +42,11 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:''; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The following symbols and securities are present in the import file.&lt;/p&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The following symbols and securities are present in the import file.&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Existing securities will be flagged in the 'Exists' column.&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;If necessary, edit security names to match your existing File,&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;and add missing symbols, which are necessary for import.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;For new securities, edit the name in one of its rows, and that name will apply to its other rows, if any.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment