Fix a bug : Childs where not linked during import
This commit is contained in:
@@ -182,6 +182,7 @@ bool GrisbiImportEngine::HandleFile(const QString& path, User* user, Database* d
|
||||
try
|
||||
{
|
||||
res = _sax.parse(&file);
|
||||
LinkChilds();
|
||||
}
|
||||
catch (const char* s)
|
||||
{
|
||||
|
@@ -323,3 +323,19 @@ const std::map<AccountAmount, double, AccountAmount>& ImportEngine::GetAccountAm
|
||||
{
|
||||
return _accountAmounts;
|
||||
}
|
||||
|
||||
void ImportEngine::LinkChilds()
|
||||
{
|
||||
std::vector<Operation>::iterator it, it2;
|
||||
|
||||
for(it=_operations.begin(); it!=_operations.end(); it++)
|
||||
{
|
||||
if (!it->meta) continue;
|
||||
for(it2=_operations.begin(); it2!=_operations.end(); it2++)
|
||||
{
|
||||
if (it == it2 || it2->meta) continue;
|
||||
if (it2->parent == it->id)
|
||||
it->childs.push_back(it2->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,6 +81,7 @@ protected:
|
||||
|
||||
void ApplyPattern(ImportPattern& pattern, Operation& op);
|
||||
QString FindPattern(QString& s1, QString& s2);
|
||||
void LinkChilds();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -148,7 +148,13 @@ OFXImportEngine::~OFXImportEngine()
|
||||
|
||||
bool OFXImportEngine::HandleFile(const QString& path, User* user, Database* db, KissCount* kiss)
|
||||
{
|
||||
int res;
|
||||
if (!ImportEngine::HandleFile(path, user, db, kiss)) return false;
|
||||
|
||||
return !libofx_proc_file(_ctx, path.toStdString().c_str(), AUTODETECT);
|
||||
res = !libofx_proc_file(_ctx, path.toStdString().c_str(), AUTODETECT);
|
||||
|
||||
if (res)
|
||||
LinkChilds();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@@ -54,6 +54,7 @@ bool XMLImportEngine::HandleFile(const QString& path, User* user, Database* db,
|
||||
try
|
||||
{
|
||||
res = _sax.parse(&file);
|
||||
LinkChilds();
|
||||
}
|
||||
catch (const char* s)
|
||||
{
|
||||
|
Reference in New Issue
Block a user