Fix problems in export engine

This commit is contained in:
Grégory Soutadé 2014-11-12 20:48:45 +01:00
parent 628c4a4588
commit e9e0e35c12
2 changed files with 10 additions and 5 deletions

View File

@ -161,7 +161,7 @@ bool CSVExportEngine::SaveTags()
ESCAPE_CHARS(tag.name);
*_writer << QString::number(tag.id) << ";";
*_writer << "\"" << tag.name << "\"" << ";";
*_writer << "\"" << tag.name << "\"";
*_writer << endl;
}
@ -196,8 +196,8 @@ bool CSVExportEngine::SaveOperations(std::vector<Operation>* operations)
*_writer << QString::number(it->transfert) << ";";
*_writer << it->formula << ";";
*_writer << (it->meta ? "1" : "0") << ";";
*_writer << (it->_virtual ? "1" : "0");
*_writer << QString::number(it->tag) << ";";
*_writer << (it->_virtual ? "1" : "0") << ";";
*_writer << QString::number(it->tag);
*_writer << endl;
}

View File

@ -40,7 +40,7 @@ bool ExportEngine::HandleFile(const QString& path, User* user, Database* db, Kis
bool ExportEngine::SaveFile(std::vector<Operation>* operations)
{
int i;
int account, category;
int account, category, tag;
AccountAmount accountAmount;
int minMonth = -1, minYear = -1;
unsigned int maxMonth = -1, maxYear = -1;
@ -51,12 +51,14 @@ bool ExportEngine::SaveFile(std::vector<Operation>* operations)
_accounts.clear();
_categories.clear();
_tags.clear();
_accountAmounts.clear();
for(i=0; i<(int)operations->size(); i++)
{
account = (*operations)[i].account;
category = (*operations)[i].category;
tag = (*operations)[i].tag;
if (minYear == -1 || (int)(*operations)[i].year < minYear)
maxYear = minYear = (*operations)[i].year;
@ -78,7 +80,10 @@ bool ExportEngine::SaveFile(std::vector<Operation>* operations)
if (category && !_categories.count(category))
_categories[category]++;
}
if (tag && !_tags.count(tag))
_tags[tag]++;
}
for(it=_accounts.begin(); it!=_accounts.end(); it++)
{