Meta specifications where not reported into search
This commit is contained in:
parent
1c4662a01c
commit
6568acbae7
|
@ -1229,7 +1229,8 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
||||||
std::vector<wxString>::iterator it;
|
std::vector<wxString>::iterator it;
|
||||||
std::vector<Account>::iterator accountIt;
|
std::vector<Account>::iterator accountIt;
|
||||||
std::vector<Operation>* res = new std::vector<Operation>;
|
std::vector<Operation>* res = new std::vector<Operation>;
|
||||||
|
int i;
|
||||||
|
|
||||||
wxString dayFrom, monthFrom, yearFrom;
|
wxString dayFrom, monthFrom, yearFrom;
|
||||||
wxString dayTo, monthTo, yearTo;
|
wxString dayTo, monthTo, yearTo;
|
||||||
wxString desc;
|
wxString desc;
|
||||||
|
@ -1311,19 +1312,20 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
||||||
|
|
||||||
if (accounts.size())
|
if (accounts.size())
|
||||||
{
|
{
|
||||||
req += wxT("account IN ('");
|
req += wxT("(account IN ('");
|
||||||
it = accounts.begin();
|
it = accounts.begin();
|
||||||
req += *it;
|
req += *it;
|
||||||
it++;
|
it++;
|
||||||
|
|
||||||
for (; it != categories.end(); it++)
|
for (; it != accounts.end(); it++)
|
||||||
req += wxT("', '") + *it ;
|
req += wxT("', '") + *it ;
|
||||||
|
|
||||||
req += wxT("')");
|
req += wxT("')");
|
||||||
|
req += wxT(" OR user ='") + user->_id + wxT("')");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
req += wxT("account IN ('");
|
req += wxT("(account IN ('");
|
||||||
accountIt = user->_accounts.begin();
|
accountIt = user->_accounts.begin();
|
||||||
req += accountIt->id;
|
req += accountIt->id;
|
||||||
accountIt++;
|
accountIt++;
|
||||||
|
@ -1332,6 +1334,7 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
||||||
req += wxT("', '") + accountIt->id ;
|
req += wxT("', '") + accountIt->id ;
|
||||||
}
|
}
|
||||||
req += wxT("')");
|
req += wxT("')");
|
||||||
|
req += wxT(" OR user ='") + user->_id + wxT("')");
|
||||||
}
|
}
|
||||||
|
|
||||||
req += wxT(" ORDER BY year ") ;
|
req += wxT(" ORDER BY year ") ;
|
||||||
|
@ -1347,6 +1350,7 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
||||||
{
|
{
|
||||||
Operation op;
|
Operation op;
|
||||||
op.id = set.GetAsString(wxT("id"));
|
op.id = set.GetAsString(wxT("id"));
|
||||||
|
op.parent = set.GetAsString(wxT("parent"));
|
||||||
op.account = set.GetAsString(wxT("account"));
|
op.account = set.GetAsString(wxT("account"));
|
||||||
op.day = set.GetInt(wxT("day"));
|
op.day = set.GetInt(wxT("day"));
|
||||||
op.month = set.GetInt(wxT("month"));
|
op.month = set.GetInt(wxT("month"));
|
||||||
|
@ -1356,9 +1360,16 @@ std::vector<Operation>* Database::Search(User* user, wxString* description, wxDa
|
||||||
op.category = set.GetAsString(wxT("category"));
|
op.category = set.GetAsString(wxT("category"));
|
||||||
op.fix_cost = set.GetBool(wxT("fix_cost"));
|
op.fix_cost = set.GetBool(wxT("fix_cost"));
|
||||||
op.checked = set.GetBool(wxT("checked"));
|
op.checked = set.GetBool(wxT("checked"));
|
||||||
|
op.transfert = set.GetAsString(wxT("transfert"));
|
||||||
|
op.formula = set.GetAsString(wxT("formula"));
|
||||||
|
op.meta = set.GetBool(wxT("meta"));
|
||||||
res->push_back(op);
|
res->push_back(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(i=0; i < (int)res->size(); i++)
|
||||||
|
if ((*res)[i].parent.Length())
|
||||||
|
user->Group(res, (*res)[i]);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,12 +181,12 @@ void User::LinkOrUnlinkOperation(Operation& op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void User::Group(const Operation& op)
|
bool User::Group(std::vector<Operation>* ops, const Operation& op)
|
||||||
{
|
{
|
||||||
std::vector<Operation>::iterator it;
|
std::vector<Operation>::iterator it;
|
||||||
std::vector<wxString>::iterator it2;
|
std::vector<wxString>::iterator it2;
|
||||||
|
|
||||||
for (it = (*_operations[op.year])[op.month].begin(); it != (*_operations[op.year])[op.month].end(); it++)
|
for (it = ops->begin(); it != ops->end(); it++)
|
||||||
{
|
{
|
||||||
if (it->id == op.parent)
|
if (it->id == op.parent)
|
||||||
{
|
{
|
||||||
|
@ -194,13 +194,22 @@ void User::Group(const Operation& op)
|
||||||
if (*it2 == op.id)
|
if (*it2 == op.id)
|
||||||
break;
|
break;
|
||||||
// Already into childs
|
// Already into childs
|
||||||
if (it2 != it->childs.end()) return;
|
if (it2 != it->childs.end()) return true;
|
||||||
it->childs.push_back(op.id);
|
it->childs.push_back(op.id);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_db->LoadOperation(this, op.parent))
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void User::Group(const Operation& op)
|
||||||
|
{
|
||||||
|
std::vector<Operation>::iterator it;
|
||||||
|
std::vector<wxString>::iterator it2;
|
||||||
|
|
||||||
|
if (!Group(&(*_operations[op.year])[op.month], op)
|
||||||
|
&& _db->LoadOperation(this, op.parent))
|
||||||
{
|
{
|
||||||
(*_operations[op.year])[op.month][(*_operations[op.year])[op.month].size()-1].childs.push_back(op.id);
|
(*_operations[op.year])[op.month][(*_operations[op.year])[op.month].size()-1].childs.push_back(op.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
wxLanguage GetLanguage();
|
wxLanguage GetLanguage();
|
||||||
void LinkOrUnlinkOperation(Operation& op);
|
void LinkOrUnlinkOperation(Operation& op);
|
||||||
void Group(const Operation& op);
|
void Group(const Operation& op);
|
||||||
|
bool Group(std::vector<Operation>* ops, const Operation& op);
|
||||||
void UnGroup(const Operation& op);
|
void UnGroup(const Operation& op);
|
||||||
void ResolveGroups(int year);
|
void ResolveGroups(int year);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user