Commit dc2f5219 authored by Stephane Mankowski's avatar Stephane Mankowski

Broken transaction group after CSV import

BUG:420557
parent 6be4aa02
skrooge (2.23.0)
*Correction bug 420557: Broken transaction group after CSV import
*Correction bug 412262: documentation references obsolete "Merge operations" menu item
*Correction: cryptocompare fails if too many values are requested (>2000)
*Correction: Change icon for trackers by a "crosshairs"
......
......@@ -711,7 +711,7 @@ SKGError SKGImportPluginCsv::importFile()
}
}
if (!err && idgroup != 0) {
if (mapGroup.contains(idgroup)) {
if (mapGroup.contains(idgroup) && currentOperation != mapGroup[idgroup]) {
err = currentOperation.setGroupOperation(mapGroup[idgroup]);
IFOKDO(err, currentOperation.save())
}
......
date;account;idgroup;idtransaction;value;unit
2020-04-04;A;1;2;1;€
2020-04-04;A;1;2;2;€
2020-04-04;B;1;0;3;Share
date;account;idgroup;idtransaction;value;unit
2020-04-04;B;1;0;3;Share
2020-04-04;A;1;2;1;€
2020-04-04;A;1;2;2;€
......@@ -810,6 +810,50 @@ int main(int argc, char** argv)
SKGTESTERROR(QStringLiteral("CSV.importFile"), imp1.importFile(), true)
}
}
{
// Test import BUG 420557
SKGDocumentBank document1;
SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
SKGError err;
{
// Scope of the transaction
SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT"), err)
SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportcsv/420557_1.csv"));
QMap<QString, QString> parameters = imp1.getImportParameters();
parameters[QStringLiteral("automatic_search_columns")] = 'N';
parameters[QStringLiteral("header_position")] = QStringLiteral("1");
parameters[QStringLiteral("columns_positions")] = QStringLiteral("date|account|idgroup|idtransaction|value|unit");
imp1.setImportParameters(parameters);
SKGTESTERROR(QStringLiteral("CSV.importFile"), imp1.importFile(), true)
}
int nb = 0;
SKGTESTERROR(QStringLiteral("OPERATION.getNbObjects"), document1.getNbObjects(QStringLiteral("operation"), QStringLiteral("i_group_id=1"), nb), true)
SKGTEST(QStringLiteral("OPERATION:nb"), nb, 2)
}
{
// Test import BUG 420557
SKGDocumentBank document1;
SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
SKGError err;
{
// Scope of the transaction
SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT"), err)
SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportcsv/420557_2.csv"));
QMap<QString, QString> parameters = imp1.getImportParameters();
parameters[QStringLiteral("automatic_search_columns")] = 'N';
parameters[QStringLiteral("header_position")] = QStringLiteral("1");
parameters[QStringLiteral("columns_positions")] = QStringLiteral("date|account|idgroup|idtransaction|value|unit");
imp1.setImportParameters(parameters);
SKGTESTERROR(QStringLiteral("CSV.importFile"), imp1.importFile(), true)
}
int nb = 0;
SKGTESTERROR(QStringLiteral("OPERATION.getNbObjects"), document1.getNbObjects(QStringLiteral("operation"), QStringLiteral("i_group_id=1"), nb), true)
SKGTEST(QStringLiteral("OPERATION:nb"), nb, 2)
}
// End test
SKGENDTEST()
} // NOLINT(readability/fn_size)
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