mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add a notes field to the entry object.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6974 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -64,6 +64,7 @@ const gchar *entry_version_string = "2.0.0";
|
||||
#define entry_dateentered_string "entry:entered"
|
||||
#define entry_description_string "entry:description"
|
||||
#define entry_action_string "entry:action"
|
||||
#define entry_notes_string "entry:notes"
|
||||
#define entry_qty_string "entry:qty"
|
||||
#define entry_price_string "entry:price"
|
||||
#define entry_discount_string "entry:discount"
|
||||
@@ -115,6 +116,7 @@ entry_dom_tree_create (GncEntry *entry)
|
||||
maybe_add_string (ret, entry_description_string,
|
||||
gncEntryGetDescription (entry));
|
||||
maybe_add_string (ret, entry_action_string, gncEntryGetAction (entry));
|
||||
maybe_add_string (ret, entry_notes_string, gncEntryGetNotes (entry));
|
||||
|
||||
maybe_add_numeric (ret, entry_qty_string, gncEntryGetQuantity (entry));
|
||||
maybe_add_numeric (ret, entry_price_string, gncEntryGetPrice (entry));
|
||||
@@ -250,6 +252,14 @@ entry_action_handler (xmlNodePtr node, gpointer entry_pdata)
|
||||
return set_string(node, pdata->entry, gncEntrySetAction);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entry_notes_handler (xmlNodePtr node, gpointer entry_pdata)
|
||||
{
|
||||
struct entry_pdata *pdata = entry_pdata;
|
||||
|
||||
return set_string(node, pdata->entry, gncEntrySetNotes);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entry_qty_handler (xmlNodePtr node, gpointer entry_pdata)
|
||||
{
|
||||
@@ -406,6 +416,7 @@ static struct dom_tree_handler entry_handlers_v2[] = {
|
||||
{ entry_dateentered_string, entry_dateentered_handler, 1, 0 },
|
||||
{ entry_description_string, entry_description_handler, 0, 0 },
|
||||
{ entry_action_string, entry_action_handler, 0, 0 },
|
||||
{ entry_notes_string, entry_notes_handler, 0, 0 },
|
||||
{ entry_qty_string, entry_qty_handler, 0, 0 },
|
||||
{ entry_price_string, entry_price_handler, 0, 0 },
|
||||
{ entry_discount_string, entry_discount_handler, 0, 0 },
|
||||
|
||||
@@ -30,6 +30,7 @@ struct _gncEntry {
|
||||
Timespec date_entered;
|
||||
char * desc;
|
||||
char * action;
|
||||
char * notes;
|
||||
gnc_numeric quantity;
|
||||
gnc_numeric price;
|
||||
gnc_numeric discount;
|
||||
@@ -96,6 +97,7 @@ GncEntry *gncEntryCreate (GNCBook *book)
|
||||
|
||||
entry->desc = CACHE_INSERT ("");
|
||||
entry->action = CACHE_INSERT ("");
|
||||
entry->notes = CACHE_INSERT ("");
|
||||
|
||||
{
|
||||
gnc_numeric zero = gnc_numeric_zero ();
|
||||
@@ -125,6 +127,7 @@ void gncEntryDestroy (GncEntry *entry)
|
||||
|
||||
CACHE_REMOVE (entry->desc);
|
||||
CACHE_REMOVE (entry->action);
|
||||
CACHE_REMOVE (entry->notes);
|
||||
if (entry->tax_values)
|
||||
gncAccountValueDestroy (entry->tax_values);
|
||||
remObj (entry);
|
||||
@@ -172,6 +175,13 @@ void gncEntrySetAction (GncEntry *entry, const char *action)
|
||||
mark_entry (entry);
|
||||
}
|
||||
|
||||
void gncEntrySetNotes (GncEntry *entry, const char *notes)
|
||||
{
|
||||
if (!entry || !notes) return;
|
||||
SET_STR (entry->notes, notes);
|
||||
mark_entry (entry);
|
||||
}
|
||||
|
||||
void gncEntrySetQuantity (GncEntry *entry, gnc_numeric quantity)
|
||||
{
|
||||
if (!entry) return;
|
||||
@@ -284,6 +294,7 @@ void gncEntryCopy (const GncEntry *src, GncEntry *dest)
|
||||
dest->date_entered = src->date_entered; /* ??? */
|
||||
gncEntrySetDescription (dest, src->desc);
|
||||
gncEntrySetAction (dest, src->action);
|
||||
gncEntrySetNotes (dest, src->notes);
|
||||
dest->quantity = src->quantity;
|
||||
dest->price = src->price;
|
||||
dest->discount = src->discount;
|
||||
@@ -344,6 +355,12 @@ const char * gncEntryGetAction (GncEntry *entry)
|
||||
return entry->action;
|
||||
}
|
||||
|
||||
const char * gncEntryGetNotes (GncEntry *entry)
|
||||
{
|
||||
if (!entry) return NULL;
|
||||
return entry->notes;
|
||||
}
|
||||
|
||||
gnc_numeric gncEntryGetQuantity (GncEntry *entry)
|
||||
{
|
||||
if (!entry) return gnc_numeric_zero();
|
||||
@@ -804,6 +821,7 @@ gboolean gncEntryRegister (void)
|
||||
{ ENTRY_DATE, QUERYCORE_DATE, (QueryAccess)gncEntryGetDate },
|
||||
{ ENTRY_DESC, QUERYCORE_STRING, (QueryAccess)gncEntryGetDescription },
|
||||
{ ENTRY_ACTION, QUERYCORE_STRING, (QueryAccess)gncEntryGetAction },
|
||||
{ ENTRY_NOTES, QUERYCORE_STRING, (QueryAccess)gncEntryGetNotes },
|
||||
{ ENTRY_QTY, QUERYCORE_NUMERIC, (QueryAccess)gncEntryGetQuantity },
|
||||
{ ENTRY_PRICE, QUERYCORE_NUMERIC, (QueryAccess)gncEntryGetPrice },
|
||||
{ ENTRY_INVOICE, GNC_INVOICE_MODULE_NAME, (QueryAccess)gncEntryGetInvoice },
|
||||
|
||||
@@ -43,6 +43,7 @@ void gncEntrySetDate (GncEntry *entry, Timespec date);
|
||||
void gncEntrySetDateEntered (GncEntry *entry, Timespec date);
|
||||
void gncEntrySetDescription (GncEntry *entry, const char *desc);
|
||||
void gncEntrySetAction (GncEntry *entry, const char *action);
|
||||
void gncEntrySetNotes (GncEntry *entry, const char *notes);
|
||||
void gncEntrySetQuantity (GncEntry *entry, gnc_numeric quantity);
|
||||
void gncEntrySetPrice (GncEntry *entry, gnc_numeric price);
|
||||
void gncEntrySetDiscount (GncEntry *entry, gnc_numeric discount);
|
||||
@@ -62,6 +63,7 @@ Timespec gncEntryGetDate (GncEntry *entry);
|
||||
Timespec gncEntryGetDateEntered (GncEntry *entry);
|
||||
const char * gncEntryGetDescription (GncEntry *entry);
|
||||
const char * gncEntryGetAction (GncEntry *entry);
|
||||
const char * gncEntryGetNotes (GncEntry *notes);
|
||||
gnc_numeric gncEntryGetQuantity (GncEntry *entry);
|
||||
gnc_numeric gncEntryGetPrice (GncEntry *entry);
|
||||
gnc_numeric gncEntryGetDiscount (GncEntry *entry);
|
||||
@@ -115,6 +117,7 @@ int gncEntryCompare (GncEntry *a, GncEntry *b);
|
||||
#define ENTRY_DATE "date"
|
||||
#define ENTRY_DESC "desc"
|
||||
#define ENTRY_ACTION "action"
|
||||
#define ENTRY_NOTES "notes"
|
||||
#define ENTRY_QTY "qty"
|
||||
#define ENTRY_PRICE "price"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user