From ab176b9fc3a3f04b2e514dea91d2505519d9e6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Wed, 9 Feb 2011 21:36:29 +0100 Subject: [PATCH] Possibility to find operations with unknown category/account --- ChangeLog | 3 ++- src/model/Database.cpp | 6 +++--- src/view/SearchPanel.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c823bfa..8e01e19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.2_dev (29/01/2011) +v0.2_dev (09/02/2011) ** User ** Better use of sizers (so better interface!) @@ -6,6 +6,7 @@ v0.2_dev (29/01/2011) Better fit of interface when displaying grouped operations Show stats for current month even if next month has not been generated Possibility to choose a replacement when deleting accounts and categories + Possibility to find operations with unknown category/account ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 29b0abd..7543b48 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1421,8 +1421,8 @@ std::vector* Database::Search(User* user, wxString* description, wxDa for (; it != accounts.end(); it++) req += wxT("', '") + *it ; - req += wxT("')"); - req += wxT(" OR user ='") + user->_id + wxT("')"); + req += wxT("'))"); + // req += wxT(" OR user ='") + user->_id + wxT("')"); } else { @@ -1443,7 +1443,7 @@ std::vector* Database::Search(User* user, wxString* description, wxDa req += wxT(", month ") + user->_preferences[wxT("operation_order")] ; req += wxT(", day ") + user->_preferences[wxT("operation_order")] ; - // std::cout << req.mb_str() << "\n"; + std::cout << req.mb_str() << "\n"; EXECUTE_SQL_QUERY(req, set, res); diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 28df4c8..d7ed322 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -70,6 +70,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _amountTo = new wxTextCtrl(this, wxID_ANY); _category = new wxCheckListBox(this, wxID_ANY); + _category->Append(_("Unknown")); for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) _category->Append(categoryIt->name); @@ -77,6 +78,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); _account = new wxCheckListBox(this, wxID_ANY); + _account->Append(_("Unknown")); for(accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++) _account->Append(accountIt->name); @@ -223,7 +225,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) for(i=0; iGetCategoriesNumber(); i++) if (_category->IsChecked(i)) - categories.push_back(user->_categories[i].id); + categories.push_back((i) ? user->_categories[i].id : wxT("0")); types |= (_optype->IsChecked(0)) ? FIX_OP : 0; types |= (_optype->IsChecked(1)) ? NON_FIX_OP : 0; @@ -232,7 +234,7 @@ void SearchPanel::OnButtonSearch(wxCommandEvent& event) for(i=0; iGetAccountsNumber(); i++) if (_account->IsChecked(i)) - accounts.push_back(user->_accounts[i].id); + accounts.push_back((i) ? user->_accounts[i].id : wxT("0")); if (_operations) delete _operations;