r21407 - gnucash/trunk/src/engine - Prepare internal post-to code to handle credit notes

Derek Atkins warlord at MIT.EDU
Sun Oct 9 22:34:34 EDT 2011


Geert Janssens <gjanssens at code.gnucash.org> writes:

> +gboolean gncInvoiceAmountPositive (GncInvoice *invoice)
> +{
> +    switch (gncInvoiceGetType (invoice))
> +    {
> +        case GNC_INVOICE_CUST_INVOICE:
> +        case GNC_INVOICE_VEND_CREDIT_NOTE:
> +        case GNC_INVOICE_EMPL_CREDIT_NOTE:
> +            return TRUE;
> +        case GNC_INVOICE_CUST_CREDIT_NOTE:
> +        case GNC_INVOICE_VEND_INVOICE:
> +        case GNC_INVOICE_EMPL_INVOICE:

I think that GNC_INVOICE_UNDEFINED below here should be part of the
default case, and I think there should be a g_assert() as well to signal
that there's a bug that this switch statement doesn't contain everything
or there was invalid input.

> +        case GNC_INVOICE_UNDEFINED:
> +            return FALSE;
> +        default:
> +            return FALSE;
> +    }
> +}
> +

-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