HomeBudget: Fixed crash in category update, fixed disabling category grid when delete last group (thanks porto and mr_ped!)

git-svn-id: svn://ultimatepp.org/upp/trunk@2771 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2010-10-12 19:34:09 +00:00
parent d5f2a72424
commit ee2c657d8c

View file

@ -295,15 +295,14 @@ void HomeBudget::RemoveGroup()
if(categories.IsEmpty())
{
SQL & Delete(GROUPS).Where(ID == groups(ID));
if(groups.GetCount() == 1)
categories.Disable();
}
else
{
PromptOK(t_("You can't remove this group. It is not empty."));
groups.CancelRemove();
}
if(groups.GetCount() == 1)
categories.Disable();
}
struct AddNewCat : WithNewCategoryLayout<TopWindow>
@ -745,6 +744,9 @@ void HomeBudget::SetRest(StaticText &rest, float r)
void HomeBudget::UpdateValue()
{
if(money.IsEmpty())
return;
try
{
SQL & Select(DEFVALUE).From(CATEGORIES).Where(ID == money.Get(CAT_ID));