QSF Import of gncCustomer and gncInvoice

Georgi Mirchev manager at mirchevideas.com
Wed May 31 16:36:45 EDT 2006


Well, I can see several solutions to this:
1. Make gncOwner first class object
2. Do not make gncOwner first class object, but make a special hack in 
QSF code for the gncOwner.
3. hmm, running out of ideas - any suggestions :-)

Also any ideas why the INVOICE_OWNER param doesn't have setter?

Regards,
Georgi

Derek Atkins wrote:

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

-- 
*Mirchev Ideas Ltd.*
1111 Sofia, Bulgaria
Golash 18

( + 359 2 ) 870 55 66
manager at mirchevideas.com <mailto:manager at mirchevideas.com>

ICQ: 77517413
Yahoo: mirchevideas
MSN: manager at mirchevideas.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: manager.vcf
Type: text/x-vcard
Size: 527 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20060531/5e4f38a9/manager.vcf


More information about the gnucash-devel mailing list