* Fix some Group operations bugs. Still a buggy version with Group management !
This commit is contained in:
@@ -219,7 +219,7 @@ std::map<int, std::vector<int> > KissCount::GetAllOperations()
|
||||
|
||||
void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo)
|
||||
{
|
||||
std::vector<Operation>::iterator it;
|
||||
std::vector<Operation>::iterator it, it2;
|
||||
std::map<wxString, wxString> meta;
|
||||
Operation op;
|
||||
|
||||
@@ -233,28 +233,40 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year
|
||||
LoadYear(yearFrom, false);
|
||||
|
||||
for(it = (*_user->_operations[yearFrom])[monthFrom].begin();
|
||||
it != (*_user->_operations[yearFrom])[monthFrom].end()
|
||||
&& it->fix_cost;
|
||||
it++)
|
||||
it != (*_user->_operations[yearFrom])[monthFrom].end();
|
||||
it++)
|
||||
{
|
||||
if (!it->fix_cost) continue;
|
||||
op = *it;
|
||||
op.month = monthTo;
|
||||
op.year = yearTo;
|
||||
op.checked = false;
|
||||
op.id = AddOperation(op);
|
||||
op.childs.clear();
|
||||
if (op.meta)
|
||||
meta[it->id] = op.id;
|
||||
(*_user->_operations[yearTo])[monthTo].push_back(op);
|
||||
}
|
||||
|
||||
// Re Generate parents
|
||||
for(it = (*_user->_operations[yearFrom])[monthFrom].begin();
|
||||
it != (*_user->_operations[yearFrom])[monthFrom].end()
|
||||
&& it->fix_cost;
|
||||
it++)
|
||||
for(it = (*_user->_operations[yearFrom])[monthTo].begin();
|
||||
it != (*_user->_operations[yearFrom])[monthTo].end();
|
||||
it++)
|
||||
{
|
||||
if (it->parent.Length())
|
||||
{
|
||||
it->parent = meta[it->parent];
|
||||
UpdateOperation(*it);
|
||||
|
||||
for(it2 = (*_user->_operations[yearFrom])[monthTo].begin();
|
||||
it2 != (*_user->_operations[yearFrom])[monthTo].end();
|
||||
it2++)
|
||||
if (it2->id == it->parent)
|
||||
{
|
||||
it2->childs.push_back(&(*it));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_wxUI->GenerateMonth(monthTo, yearTo);
|
||||
|
Reference in New Issue
Block a user