Lots and SQL backend

Derek Atkins warlord at MIT.EDU
Mon Sep 8 14:47:48 EDT 2008


Phil,

Phil Longstaff <plongstaff at rogers.com> writes:

> I don't know enough about how lots are used in the system.
>
> There is a problem with the SQL backend when you unpost an invoice.
> The problem is that the lot table is defined to disallow a null
> value for the account.  However, when you unpost an unpaid invoice,
> the posting transaction is deleted, so all splits associated with
> the lot are deleted.  In gnc_lot_remove_split(), when the last split
> is removed from the lot, the lot is removed from the account and
> lot->account is set to NULL.  The lot is then saved.  This causes
> the SQL UPDATE to fail because the account can't be NULL.
>
> I assume it would be OK to delete the lot at this point.  Derek?
> You know the business stuff best.

I think it might be safe to delete the lot IFF the lot really is
empty.  It might not be empty, because there might be a payment
attached to it.  So you can't just delete the lot when you unpost
the invoice.

However I think it would be safe to delete the lot if you check
that the lot is empty first.

> Phil

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list