mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* add a BillTo owner in the GncInvoice object. Save it in XML if
it's non-empty. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7113 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
6cc1fe88c1
commit
c80c5f7a49
@ -5,6 +5,9 @@
|
||||
* add a Billable column to Bill register
|
||||
|
||||
* add gncQueryAddBooleanMatch() convenience function
|
||||
|
||||
* add a BillTo owner in the GncInvoice object. Save it in XML if
|
||||
it's non-empty.
|
||||
|
||||
2002-07-09 Derek Atkins <derek@ihftp.com>
|
||||
|
||||
|
@ -70,6 +70,7 @@ const gchar *invoice_version_string = "2.0.0";
|
||||
#define invoice_postlot_string "invoice:postlot"
|
||||
#define invoice_postacc_string "invoice:postacc"
|
||||
#define invoice_commodity_string "invoice:commodity"
|
||||
#define invoice_billto_string "invoice:billto"
|
||||
|
||||
static void
|
||||
maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
|
||||
@ -94,6 +95,7 @@ invoice_dom_tree_create (GncInvoice *invoice)
|
||||
GNCLot *lot;
|
||||
Account *acc;
|
||||
GncBillTerm *term;
|
||||
GncOwner *billto;
|
||||
|
||||
ret = xmlNewNode(NULL, gnc_invoice_string);
|
||||
xmlSetProp(ret, "version", invoice_version_string);
|
||||
@ -145,6 +147,10 @@ invoice_dom_tree_create (GncInvoice *invoice)
|
||||
commodity_ref_to_dom_tree(invoice_commodity_string,
|
||||
gncInvoiceGetCommonCommodity (invoice)));
|
||||
|
||||
billto = gncInvoiceGetBillTo (invoice);
|
||||
if (billto && billto->type != GNC_OWNER_NONE)
|
||||
xmlAddChild (ret, gnc_owner_to_dom_tree (invoice_billto_string, billto));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -359,6 +365,20 @@ invoice_commodity_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
invoice_billto_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||
{
|
||||
struct invoice_pdata *pdata = invoice_pdata;
|
||||
GncOwner owner;
|
||||
gboolean ret;
|
||||
|
||||
ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
|
||||
if (ret)
|
||||
gncInvoiceSetBillTo (pdata->invoice, &owner);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct dom_tree_handler invoice_handlers_v2[] = {
|
||||
{ invoice_guid_string, invoice_guid_handler, 1, 0 },
|
||||
{ invoice_id_string, invoice_id_handler, 1, 0 },
|
||||
@ -373,6 +393,7 @@ static struct dom_tree_handler invoice_handlers_v2[] = {
|
||||
{ invoice_postlot_string, invoice_postlot_handler, 0, 0 },
|
||||
{ invoice_postacc_string, invoice_postacc_handler, 0, 0 },
|
||||
{ invoice_commodity_string, invoice_commodity_handler, 1, 0 },
|
||||
{ invoice_billto_string, invoice_billto_handler, 0, 0 },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -38,6 +38,7 @@ struct _gncInvoice {
|
||||
GncBillTerm * terms;
|
||||
GList * entries;
|
||||
GncOwner owner;
|
||||
GncOwner billto;
|
||||
GncJob * job;
|
||||
Timespec date_opened;
|
||||
Timespec date_posted;
|
||||
@ -97,6 +98,7 @@ GncInvoice *gncInvoiceCreate (GNCBook *book)
|
||||
invoice->notes = CACHE_INSERT ("");
|
||||
invoice->billing_id = CACHE_INSERT ("");
|
||||
|
||||
invoice->billto.type = GNC_OWNER_NONE;
|
||||
invoice->active = TRUE;
|
||||
|
||||
xaccGUIDNew (&invoice->guid, book);
|
||||
@ -211,6 +213,15 @@ void gncInvoiceSetCommonCommodity (GncInvoice *invoice, gnc_commodity *com)
|
||||
mark_invoice (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto)
|
||||
{
|
||||
if (!invoice || !billto) return;
|
||||
if (gncOwnerEqual (&invoice->billto, billto)) return;
|
||||
|
||||
gncOwnerCopy (billto, &invoice->billto);
|
||||
mark_invoice (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetDirty (GncInvoice *invoice, gboolean dirty)
|
||||
{
|
||||
if (!invoice) return;
|
||||
@ -391,6 +402,12 @@ gnc_commodity * gncInvoiceGetCommonCommodity (GncInvoice *invoice)
|
||||
return invoice->common_commodity;
|
||||
}
|
||||
|
||||
GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return NULL;
|
||||
return &invoice->billto;
|
||||
}
|
||||
|
||||
GNCLot * gncInvoiceGetPostedLot (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return NULL;
|
||||
@ -912,6 +929,7 @@ gboolean gncInvoiceRegister (void)
|
||||
{ INVOICE_POST_TXN, GNC_ID_TRANS, (QueryAccess)gncInvoiceGetPostedTxn },
|
||||
{ INVOICE_TYPE, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetType },
|
||||
{ INVOICE_TERMS, GNC_BILLTERM_MODULE_NAME, (QueryAccess)gncInvoiceGetTerms },
|
||||
{ INVOICE_BILLTO, GNC_OWNER_MODULE_NAME, (QueryAccess)gncInvoiceGetBillTo },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncInvoiceGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncInvoiceGetGUID },
|
||||
{ NULL },
|
||||
|
@ -33,6 +33,7 @@ void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id);
|
||||
void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes);
|
||||
void gncInvoiceSetCommonCommodity (GncInvoice *invoice, gnc_commodity *com);
|
||||
void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
|
||||
void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto);
|
||||
|
||||
void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry);
|
||||
void gncInvoiceRemoveEntry (GncInvoice *invoice, GncEntry *entry);
|
||||
@ -55,6 +56,7 @@ const char * gncInvoiceGetBillingID (GncInvoice *invoice);
|
||||
const char * gncInvoiceGetNotes (GncInvoice *invoice);
|
||||
const char * gncInvoiceGetType (GncInvoice *invoice);
|
||||
gnc_commodity * gncInvoiceGetCommonCommodity (GncInvoice *invoice);
|
||||
GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice);
|
||||
gboolean gncInvoiceGetActive (GncInvoice *invoice);
|
||||
|
||||
GNCLot * gncInvoiceGetPostedLot (GncInvoice *invoice);
|
||||
@ -103,6 +105,7 @@ gboolean gncInvoiceIsPaid (GncInvoice *invoice);
|
||||
#define INVOICE_ACC "account"
|
||||
#define INVOICE_POST_TXN "posted_txn"
|
||||
#define INVOICE_TYPE "type"
|
||||
#define INVOICE_BILLTO "bill-to"
|
||||
|
||||
#define INVOICE_FROM_LOT "invoice-from-lot"
|
||||
#define INVOICE_FROM_TXN "invoice-from-txn"
|
||||
|
Loading…
Reference in New Issue
Block a user