diff --git a/model/Database.cpp b/model/Database.cpp index 019d0e0..1d8d48a 100644 --- a/model/Database.cpp +++ b/model/Database.cpp @@ -262,6 +262,8 @@ void Database::LoadYear(User* user, int year) if (user->_operations[year] == NULL) user->_operations[year] = new std::map >(); + if (!user->_accounts.size()) return; + it = user->_accounts.begin(); req = _("SELECT * FROM operation WHERE account IN('") + it->id; it++; diff --git a/view/PreferencesPanel.cpp b/view/PreferencesPanel.cpp index 33078bf..f149f93 100644 --- a/view/PreferencesPanel.cpp +++ b/view/PreferencesPanel.cpp @@ -246,6 +246,11 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) if (col == ACCOUNT_DELETE) { + if (user->_accounts.size() == 1) + { + wxMessageBox(_("It must be at least one account"), _("Error"), wxICON_ERROR | wxOK); + return; + } wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+new_account.name, _("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) { @@ -447,7 +452,7 @@ void PreferencesPanel::OnKillMe(wxCommandEvent& event) { User* user = _kiss->GetUser(); - wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+user->_name+_(" account ?"), _("KissCount"), wxYES_NO); + wxMessageDialog dialog(_wxUI, _("Are you sure want to delete ")+user->_name+_(" profil ?"), _("KissCount"), wxYES_NO); if (dialog.ShowModal() == wxID_NO) { return;