QSF Import of gncCustomer and gncInvoice

Derek Atkins warlord at MIT.EDU
Wed May 31 15:42:03 EDT 2006


No, this is not okay.  You should indirect yourself through the owner
interfaces.  The invoice should not need to know what kind of owner
it is.

-derek

Quoting Georgi Mirchev <manager at mirchevideas.com>:

> Hi,
>
> I have managed to import gncInvoice and set its owner to be a 
> gncCustomer. To do that I needed to do some changes in gncInvoice. 
> Could someone review the following and let me know if this is ok for 
> future inclusion in the main source. Also could someone explain to me 
> why the INVOICE_OWNER param doesn't have setter.
>
> Index: gncInvoice.c
> ===================================================================
> --- gncInvoice.c        (revision 14209)
> +++ gncInvoice.c        (working copy)
> @@ -457,8 +459,10 @@
> static QofEntity*
> qofInvoiceGetOwner (GncInvoice *invoice)
> {
>        if(!invoice) { return NULL; }
> -       return (QofEntity*)&invoice->owner;
> +       return qofOwnerGetOwner(&invoice->owner);
> }
>
> static QofEntity*
> @@ -1543,6 +1548,7 @@
> {
>   static QofParam params[] = {
>     { INVOICE_ID,      QOF_TYPE_STRING, 
> (QofAccessFunc)gncInvoiceGetID,     (QofSetterFunc)gncInvoiceSetID },
> +    { INVOICE_OWNER_CUSTOMER, GNC_ID_CUSTOMER, 
> (QofAccessFunc)qofInvoiceGetOwner, (QofSetterFunc)qofInvoiceSetOwner 
> },
>     { INVOICE_OWNER,   GNC_ID_OWNER, 
> (QofAccessFunc)gncInvoiceGetOwner, NULL },
>     { INVOICE_OPENED,  QOF_TYPE_DATE,   
> (QofAccessFunc)gncInvoiceGetDateOpened, 
> (QofSetterFunc)gncInvoiceSetDateOpened },
>     { INVOICE_DUE,     QOF_TYPE_DATE,   
> (QofAccessFunc)gncInvoiceGetDateDue, NULL },
> Index: gncInvoice.h
> ===================================================================
> --- gncInvoice.h        (revision 14209)
> +++ gncInvoice.h        (working copy)
> @@ -173,6 +173,7 @@
>
> #define INVOICE_ID     "id"
> #define INVOICE_OWNER  "owner"
> +#define INVOICE_OWNER_CUSTOMER "owner-customer"
> #define INVOICE_OPENED "date_opened"
> #define INVOICE_POSTED "date_posted"
> #define INVOICE_DUE    "date_due"
>
>



-- 
       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