mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add Query system hooks for invoice-from-lot, invoice-from-txn and
owner-from-lot. Wrap some of the business query-param names. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7042 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
8f63db0411
commit
c9d24dac4f
@ -848,6 +848,30 @@ static GncObject_t gncInvoiceDesc = {
|
||||
_gncInvoicePrintable,
|
||||
};
|
||||
|
||||
static void
|
||||
reg_lot (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
{ INVOICE_FROM_LOT, _GNC_MOD_NAME,
|
||||
(QueryAccess)gncInvoiceGetInvoiceFromLot },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
gncQueryObjectRegister (GNC_ID_LOT, NULL, params);
|
||||
}
|
||||
|
||||
static void
|
||||
reg_txn (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
{ INVOICE_FROM_TXN, _GNC_MOD_NAME,
|
||||
(QueryAccess)gncInvoiceGetInvoiceFromTxn },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
gncQueryObjectRegister (GNC_ID_TRANS, NULL, params);
|
||||
}
|
||||
|
||||
gboolean gncInvoiceRegister (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
@ -869,6 +893,8 @@ gboolean gncInvoiceRegister (void)
|
||||
};
|
||||
|
||||
gncQueryObjectRegister (_GNC_MOD_NAME, (QuerySort)gncInvoiceCompare, params);
|
||||
reg_lot ();
|
||||
reg_txn ();
|
||||
|
||||
return gncObjectRegister (&gncInvoiceDesc);
|
||||
}
|
||||
|
@ -100,4 +100,7 @@ gboolean gncInvoiceIsPaid (GncInvoice *invoice);
|
||||
#define INVOICE_POST_TXN "posted_txn"
|
||||
#define INVOICE_TYPE "type"
|
||||
|
||||
#define INVOICE_FROM_LOT "invoice-from-lot"
|
||||
#define INVOICE_FROM_TXN "invoice-from-txn"
|
||||
|
||||
#endif /* GNC_INVOICE_H_ */
|
||||
|
@ -277,6 +277,32 @@ gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner)
|
||||
return (owner->owner.undefined != NULL);
|
||||
}
|
||||
|
||||
/* XXX: Yea, this is broken, but it should work fine for Queries.
|
||||
* We're single-threaded, right?
|
||||
*/
|
||||
static GncOwner *
|
||||
owner_from_lot (GNCLot *lot)
|
||||
{
|
||||
static GncOwner owner;
|
||||
|
||||
if (!lot) return NULL;
|
||||
if (gncOwnerGetOwnerFromLot (lot, &owner))
|
||||
return &owner;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
reg_lot (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
{ OWNER_FROM_LOT, _GNC_MOD_NAME, (QueryAccess)owner_from_lot },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
gncQueryObjectRegister (GNC_ID_LOT, NULL, params);
|
||||
}
|
||||
|
||||
gboolean gncOwnerRegister (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
@ -293,6 +319,7 @@ gboolean gncOwnerRegister (void)
|
||||
};
|
||||
|
||||
gncQueryObjectRegister (_GNC_MOD_NAME, (QuerySort)gncOwnerCompare, params);
|
||||
reg_lot ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner);
|
||||
#define OWNER_PARENTG "parent-guid"
|
||||
#define OWNER_NAME "name"
|
||||
|
||||
#define OWNER_FROM_LOT "owner-from-lot"
|
||||
|
||||
/*
|
||||
* These two functions are mainly for the convenience of scheme code.
|
||||
* Normal C code has no need to ever use these two functions, and rather
|
||||
|
@ -90,6 +90,17 @@
|
||||
(gw:enum-add-value! wt "GNC_TERM_TYPE_PROXIMO" 'gnc-term-type-proximo)
|
||||
#t)
|
||||
|
||||
;;
|
||||
;; Define business Query parameters
|
||||
;;
|
||||
|
||||
(gw:wrap-value ws 'gnc:invoice-from-lot '<gnc:id-type> "INVOICE_FROM_LOT")
|
||||
(gw:wrap-value ws 'gnc:invoice-from-txn '<gnc:id-type> "INVOICE_FROM_TXN")
|
||||
(gw:wrap-value ws 'gnc:invoice-owner '<gnc:id-type> "INVOICE_OWNER")
|
||||
|
||||
(gw:wrap-value ws 'gnc:owner-from-lot '<gnc:id-type> "OWNER_FROM_LOT")
|
||||
(gw:wrap-value ws 'gnc:owner-parentg '<gnc:id-type> "OWNER_PARENTG")
|
||||
|
||||
;;
|
||||
;; gncAddress.h
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user