mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add KVP Association property to GncInvoice
This commit is contained in:
parent
1b8cad0086
commit
69aeacb621
@ -84,6 +84,7 @@ static QofLogModule log_module = GNC_MOD_BUSINESS;
|
||||
#define _GNC_MOD_NAME GNC_ID_INVOICE
|
||||
|
||||
#define GNC_INVOICE_IS_CN "credit-note"
|
||||
#define GNC_INVOICE_ASSOC "assoc_uri"
|
||||
|
||||
#define SET_STR(obj, member, str) { \
|
||||
char * tmp; \
|
||||
@ -537,6 +538,23 @@ void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes)
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetAssociation (GncInvoice *invoice, const char *assoc)
|
||||
{
|
||||
if (!invoice || !assoc) return;
|
||||
gncInvoiceBeginEdit (invoice);
|
||||
if (g_strcmp0 (assoc, "") == 0)
|
||||
qof_instance_set_kvp (QOF_INSTANCE (invoice), NULL, 1, GNC_INVOICE_ASSOC);
|
||||
else
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
g_value_set_string (&v, assoc);
|
||||
qof_instance_set_kvp (QOF_INSTANCE (invoice), &v, 1, GNC_INVOICE_ASSOC);
|
||||
}
|
||||
qof_instance_set_dirty (QOF_INSTANCE(invoice));
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetActive (GncInvoice *invoice, gboolean active)
|
||||
{
|
||||
if (!invoice) return;
|
||||
@ -847,6 +865,16 @@ const char * gncInvoiceGetNotes (const GncInvoice *invoice)
|
||||
return invoice->notes;
|
||||
}
|
||||
|
||||
const char * gncInvoiceGetAssociation (const GncInvoice *invoice)
|
||||
{
|
||||
GValue v = G_VALUE_INIT;
|
||||
if (!invoice) return NULL;
|
||||
qof_instance_get_kvp (QOF_INSTANCE (invoice), &v, 1, GNC_INVOICE_ASSOC);
|
||||
if (G_VALUE_HOLDS_STRING (&v))
|
||||
return g_value_get_string (&v);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GncOwnerType gncInvoiceGetOwnerType (const GncInvoice *invoice)
|
||||
{
|
||||
const GncOwner *owner;
|
||||
@ -2214,6 +2242,7 @@ gboolean gncInvoiceRegister (void)
|
||||
{ INVOICE_IS_PAID, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceIsPaid, NULL },
|
||||
{ INVOICE_BILLINGID, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetBillingID, (QofSetterFunc)gncInvoiceSetBillingID },
|
||||
{ INVOICE_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetNotes, (QofSetterFunc)gncInvoiceSetNotes },
|
||||
{ INVOICE_ASSOCIATION, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetAssociation, (QofSetterFunc)gncInvoiceSetAssociation },
|
||||
{ INVOICE_ACC, GNC_ID_ACCOUNT, (QofAccessFunc)gncInvoiceGetPostedAcc, (QofSetterFunc)gncInvoiceSetPostedAcc },
|
||||
{ INVOICE_POST_TXN, GNC_ID_TRANS, (QofAccessFunc)gncInvoiceGetPostedTxn, (QofSetterFunc)gncInvoiceSetPostedTxn },
|
||||
{ INVOICE_POST_LOT, GNC_ID_LOT, (QofAccessFunc)gncInvoiceGetPostedLot, NULL/*(QofSetterFunc)gncInvoiceSetPostedLot*/ },
|
||||
|
@ -108,6 +108,7 @@ void gncInvoiceSetDatePosted (GncInvoice *invoice, time64 date);
|
||||
void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms);
|
||||
void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id);
|
||||
void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes);
|
||||
void gncInvoiceSetAssociation (GncInvoice *invoice, const char *assoc);
|
||||
void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency);
|
||||
void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
|
||||
void gncInvoiceSetIsCreditNote (GncInvoice *invoice, gboolean credit_note);
|
||||
@ -143,6 +144,7 @@ time64 gncInvoiceGetDateDue (const GncInvoice *invoice);
|
||||
GncBillTerm * gncInvoiceGetTerms (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetBillingID (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetNotes (const GncInvoice *invoice);
|
||||
const char * gncInvoiceGetAssociation (const GncInvoice *invoice);
|
||||
GncOwnerType gncInvoiceGetOwnerType (const GncInvoice *invoice);
|
||||
GList * gncInvoiceGetTypeListForOwnerType (const GncOwnerType type);
|
||||
GncInvoiceType gncInvoiceGetType (const GncInvoice *invoice);
|
||||
@ -291,6 +293,7 @@ gboolean gncInvoiceIsPaid (const GncInvoice *invoice);
|
||||
#define INVOICE_TERMS "terms"
|
||||
#define INVOICE_BILLINGID "billing_id"
|
||||
#define INVOICE_NOTES "notes"
|
||||
#define INVOICE_ASSOCIATION "assoc"
|
||||
#define INVOICE_ACC "account"
|
||||
#define INVOICE_POST_TXN "posted_txn"
|
||||
#define INVOICE_POST_LOT "posted_lot"
|
||||
|
Loading…
Reference in New Issue
Block a user