Patch to partially add recursion to budgets

Chris Shoemaker c.shoemaker at cox.net
Wed Oct 11 17:02:04 EDT 2006


On Tue, Oct 10, 2006 at 08:43:35AM -0500, Gregory Alexander wrote:
> Alright, I got the patch updated.  I like the idea of using the unset
> value.  I was just unfarmiliar with the value structure holding code.

Ok, I've committed this to trunk as 15009, with some slight tweaks.

> I will note that there will be minor migration problems from old
> versions, since values that are currently 0 will display as 0, and
> values that are currently unset will display as blank.  This shouldn't
> really break anyone, but it might be a little confusing.

I don't think that's a huge deal.  It's not incorrect behavior, just
inconvenient.

> On 10/3/06, Chris Shoemaker <c.shoemaker at cox.net> wrote:
> >On Mon, Oct 02, 2006 at 08:26:07PM -0500, Gregory Alexander wrote:
> >If the error value was the only way to convey "unset" I could see
> >adding a code for it, but I'm thinking it's better to handle it
> >at the budget-level.  E.g.
> >
> ...
> >
> >and then just "unset" the value if an error code is passed to
> >gnc_budget_set_account_period_value():
> >
> 
> Not that simple, because error values are not the same as blank
> values.  I still handle errors as errors, but also will display unset
> as unset.

I'm not sure the api should actually store gnc_numerics with errors,
so I don't know if the difference is that important, but I basically
left this as you had it.

> >> User interface changes:
> >>
> >> 1.) Budget values of 0/1 are now displayed when editing as $0.00 (as
> >> appropriate) instead of being left blank.
> >
> >okay, good.  Now, zero is a legit budget value.
> >
> >> 2.) If the user removes all text when editing a budget value entry, it
> >> will be initialized to GNC_ERROR_UNSET.
> >
> >With code above, any error code will do, and will actually _unset_ the 
> >value.
> 
> Agreed.  That code works better.
> 
> >> 3.) GNC_ERROR_UNSET is displayed when editing as a blank budget value.
> >
> >?? It should be just blank, right?
> 
> Isn't that what I said?

Sorry, I didn't parse it.

> >> 4.) cleanup/debug: Other errors display as "error" when editing.
> >
> >That's a good idea.
> 
> I preserved this behavior, while implementing using a "NULL" budget value.
> 
> >> 5.) In the existing budget report, entries with a value of
> >> GNC_ERROR_UNSET display as "." instead of a currency value.  Other
> >> errors continue to display as a single "$" (as appropriate.)
> >
> >I'd prefer that the report display and editor display were more
> >similar, like just "" and "error", but I might change my mind if I
> >actually saw it.
> 
> The problem is that as the tables get larger, and larger portions are
> blank, it gets hard to track the columns, especially since we use
> "boxless" tables.

Hmm, it looks ok, so I'll leave it as ".".

> >> What I haven't been able to figure out is how to have new budget
> >> entries default to GNC_ERROR_UNSET instead of 0.  I think changing the
> >> default to GNC_ERROR_UNSET would be the correct behavior, although
> >> again, this is open to discussion.
> >
> >Well, I think the default should be "unset" as per above, and I think
> >it's just automatic.  Nothing's there until it's set.
> 
> Yup, works great.  However, this is what introduces the weird upgrade 
> behavior.

Thanks for the patch!

-chris




More information about the gnucash-devel mailing list