Display virtual accounts at the end

Fix a bug in LonkOrUnlinkOperation (when year was not previously loaded)
Translate categories in PreferencesPanel
This commit is contained in:
Grégory Soutadé 2011-04-03 19:11:34 +02:00
parent d0b537d6c9
commit d6ade299e3
4 changed files with 11 additions and 4 deletions

View File

@ -230,7 +230,7 @@ User* Database::LoadUser(const wxString& name)
set.Finalize();
req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, blocked, virtual, name ASC");
req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, virtual, blocked, name ASC");
EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;});
@ -248,7 +248,7 @@ User* Database::LoadUser(const wxString& name)
}
set.Finalize();
req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY blocked, virtual, name ASC");
req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY name, blocked, virtual ASC");
EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;});

View File

@ -170,6 +170,12 @@ void User::LinkOrUnlinkOperation(Operation& op)
std::vector<Operation>::iterator it;
Account account, account2;
if (!_operations[op.year])
_db->LoadYear(this, op.year);
if (!_operations[op.year])
return;
// Not Linked
if (!op.transfert.Length())
{

View File

@ -232,6 +232,7 @@ void PreferencesPanel::AddAccount(int line, Account ac)
_accountsGrid->SetCellRenderer(line, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(line, ACCOUNT_DELETE, new wxGridCellBoolEditor ());
_accountsGrid->SetCellValue(line, ACCOUNT_DEFAULT, (ac._default)?wxT("1"):wxT("0"));
_accountsGrid->SetCellValue(line, ACCOUNT_VIRTUAL, (ac._virtual)?wxT("1"):wxT("0"));
_accountsGrid->SetCellValue(line, ACCOUNT_BLOCKED, (ac.blocked)?wxT("1"):wxT("0"));
_accountsGrid->SetCellAlignment(line, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
@ -702,7 +703,7 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event)
a = 0;
for(i=0; i < user->GetCategoriesNumber(); i++)
if (user->_categories[i].id != new_cat.id)
categories[++a] = user->_categories[i].name;
categories[++a] = wxGetTranslation(user->_categories[i].name);
wxSingleChoiceDialog dialog(_wxUI, _("Wich category will replace this one ?"), wxT("KissCount"), user->GetCategoriesNumber(), categories);
if (dialog.ShowModal() == wxID_CANCEL)
{

View File

@ -346,7 +346,7 @@ void SearchPanel::OnButtonChangeCategory(wxCommandEvent& event)
categories[0] = _("None");
a = 0;
for(i=0; i < user->GetCategoriesNumber(); i++)
categories[++a] = user->_categories[i].name;
categories[++a] = wxGetTranslation(user->_categories[i].name);
wxSingleChoiceDialog dialog(_wxUI, _("Choose a new category"), wxT("KissCount"), user->GetCategoriesNumber()+1, categories);