Fix problems in export engine
This commit is contained in:
parent
628c4a4588
commit
e9e0e35c12
|
@ -161,7 +161,7 @@ bool CSVExportEngine::SaveTags()
|
||||||
ESCAPE_CHARS(tag.name);
|
ESCAPE_CHARS(tag.name);
|
||||||
|
|
||||||
*_writer << QString::number(tag.id) << ";";
|
*_writer << QString::number(tag.id) << ";";
|
||||||
*_writer << "\"" << tag.name << "\"" << ";";
|
*_writer << "\"" << tag.name << "\"";
|
||||||
*_writer << endl;
|
*_writer << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ bool CSVExportEngine::SaveOperations(std::vector<Operation>* operations)
|
||||||
*_writer << QString::number(it->transfert) << ";";
|
*_writer << QString::number(it->transfert) << ";";
|
||||||
*_writer << it->formula << ";";
|
*_writer << it->formula << ";";
|
||||||
*_writer << (it->meta ? "1" : "0") << ";";
|
*_writer << (it->meta ? "1" : "0") << ";";
|
||||||
*_writer << (it->_virtual ? "1" : "0");
|
*_writer << (it->_virtual ? "1" : "0") << ";";
|
||||||
*_writer << QString::number(it->tag) << ";";
|
*_writer << QString::number(it->tag);
|
||||||
*_writer << endl;
|
*_writer << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ bool ExportEngine::HandleFile(const QString& path, User* user, Database* db, Kis
|
||||||
bool ExportEngine::SaveFile(std::vector<Operation>* operations)
|
bool ExportEngine::SaveFile(std::vector<Operation>* operations)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int account, category;
|
int account, category, tag;
|
||||||
AccountAmount accountAmount;
|
AccountAmount accountAmount;
|
||||||
int minMonth = -1, minYear = -1;
|
int minMonth = -1, minYear = -1;
|
||||||
unsigned int maxMonth = -1, maxYear = -1;
|
unsigned int maxMonth = -1, maxYear = -1;
|
||||||
|
@ -51,12 +51,14 @@ bool ExportEngine::SaveFile(std::vector<Operation>* operations)
|
||||||
|
|
||||||
_accounts.clear();
|
_accounts.clear();
|
||||||
_categories.clear();
|
_categories.clear();
|
||||||
|
_tags.clear();
|
||||||
_accountAmounts.clear();
|
_accountAmounts.clear();
|
||||||
|
|
||||||
for(i=0; i<(int)operations->size(); i++)
|
for(i=0; i<(int)operations->size(); i++)
|
||||||
{
|
{
|
||||||
account = (*operations)[i].account;
|
account = (*operations)[i].account;
|
||||||
category = (*operations)[i].category;
|
category = (*operations)[i].category;
|
||||||
|
tag = (*operations)[i].tag;
|
||||||
|
|
||||||
if (minYear == -1 || (int)(*operations)[i].year < minYear)
|
if (minYear == -1 || (int)(*operations)[i].year < minYear)
|
||||||
maxYear = minYear = (*operations)[i].year;
|
maxYear = minYear = (*operations)[i].year;
|
||||||
|
@ -78,7 +80,10 @@ bool ExportEngine::SaveFile(std::vector<Operation>* operations)
|
||||||
|
|
||||||
if (category && !_categories.count(category))
|
if (category && !_categories.count(category))
|
||||||
_categories[category]++;
|
_categories[category]++;
|
||||||
}
|
|
||||||
|
if (tag && !_tags.count(tag))
|
||||||
|
_tags[tag]++;
|
||||||
|
}
|
||||||
|
|
||||||
for(it=_accounts.begin(); it!=_accounts.end(); it++)
|
for(it=_accounts.begin(); it!=_accounts.end(); it++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user