mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add Transaction Notes field.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3200 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
35cfe984f5
commit
3bee72d5d5
@ -30,16 +30,16 @@
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "date.h"
|
||||
#include "gnc-commodity.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "GNCIdP.h"
|
||||
#include "Group.h"
|
||||
#include "GroupP.h"
|
||||
#include "kvp_frame.h"
|
||||
#include "messages.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
#include "date.h"
|
||||
#include "gnc-commodity.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "kvp_frame.h"
|
||||
#include "messages.h"
|
||||
|
||||
static short module = MOD_ENGINE;
|
||||
|
||||
@ -192,8 +192,8 @@ xaccAccountEqual(Account *aa, Account *ab, gboolean check_guids) {
|
||||
if(!ab) return FALSE;
|
||||
|
||||
if(aa->type != ab->type) {
|
||||
fprintf(stderr, "Account types don't match (%d != %d)\n",
|
||||
aa->type, ab->type);
|
||||
PERR ("Account types don't match (%d != %d)\n",
|
||||
aa->type, ab->type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -205,8 +205,8 @@ xaccAccountEqual(Account *aa, Account *ab, gboolean check_guids) {
|
||||
|
||||
if(check_guids) {
|
||||
if(!guid_equal(&aa->guid, &ab->guid)) {
|
||||
fprintf(stderr, "Account guids don't match for %s ?= %s\n",
|
||||
aa->accountName, ab->accountName);
|
||||
PERR ("Account guids don't match for %s ?= %s\n",
|
||||
aa->accountName, ab->accountName);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -285,9 +285,9 @@ xaccAccountCommitEdit (Account *acc) {
|
||||
if (!acc) return;
|
||||
acc->editlevel--;
|
||||
if(acc->editlevel < 0) {
|
||||
fprintf(stderr,
|
||||
"ERROR: unbalanced call to xaccAccountCommitEdit - resetting.\n");
|
||||
} else if(acc->editlevel == 0) {
|
||||
PERR ("unbalanced call to xaccAccountCommitEdit - resetting");
|
||||
}
|
||||
else if(acc->editlevel == 0) {
|
||||
xaccAccountBringUpToDate(acc);
|
||||
}
|
||||
}
|
||||
@ -868,7 +868,7 @@ xaccAccountSetCode (Account *acc, const char *str) {
|
||||
xaccAccountCommitEdit(acc);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
xaccAccountSetDescription (Account *acc, const char *str) {
|
||||
char * tmp;
|
||||
if ((!acc) || (!str)) return;
|
||||
@ -885,7 +885,7 @@ xaccAccountSetDescription (Account *acc, const char *str) {
|
||||
xaccAccountCommitEdit(acc);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
xaccAccountSetNotes (Account *acc, const char *str) {
|
||||
kvp_value *new_value;
|
||||
|
||||
@ -899,8 +899,9 @@ xaccAccountSetNotes (Account *acc, const char *str) {
|
||||
if(new_value) {
|
||||
kvp_frame_set_slot(xaccAccountGetSlots(acc), "notes", new_value);
|
||||
kvp_value_delete(new_value);
|
||||
} else {
|
||||
fprintf(stderr, "xaccAccountSetNotes: failed to allocate kvp.\n");
|
||||
}
|
||||
else {
|
||||
PERR ("failed to allocate kvp");
|
||||
}
|
||||
}
|
||||
xaccAccountCommitEdit(acc);
|
||||
@ -1217,7 +1218,7 @@ xaccAccountGetShareReconciledBalance (Account *acc)
|
||||
Split *
|
||||
xaccAccountGetSplit(Account *acc, int i) {
|
||||
GList *result;
|
||||
fprintf(stderr, "Calling xaccAccountGetSplit: welcome to pokeyland.\n");
|
||||
PWARN ("welcome to pokeyland");
|
||||
|
||||
if (!acc) return(NULL);
|
||||
result = g_list_nth(acc->splits, i);
|
||||
@ -1233,7 +1234,7 @@ xaccAccountGetSplitList (Account *acc) {
|
||||
|
||||
int
|
||||
xaccAccountGetNumSplits (Account *acc) {
|
||||
fprintf(stderr, "Calling xaccAccountGetNumSplits: welcome to pokeyland.\n");
|
||||
PWARN ("welcome to pokeyland");
|
||||
if (!acc) return 0;
|
||||
return g_list_length(acc->splits);
|
||||
}
|
||||
|
@ -43,11 +43,11 @@
|
||||
#include "gnc-numeric.h"
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
struct _account_group {
|
||||
struct _account_group
|
||||
{
|
||||
/* The flags: */
|
||||
unsigned int saved : 1;
|
||||
/* unsigned int new : 1; */
|
||||
|
||||
|
||||
Account *parent; /* back-pointer to parent */
|
||||
|
||||
int numAcc; /* number of accounts in array */
|
||||
|
@ -1927,6 +1927,27 @@ xaccTransSetDescription (Transaction *trans, const char *desc)
|
||||
MarkChanged (trans);
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetNotes (Transaction *trans, const char *notes)
|
||||
{
|
||||
kvp_value *new_value;
|
||||
|
||||
if (!trans || !notes) return;
|
||||
CHECK_OPEN (trans);
|
||||
|
||||
new_value = kvp_value_new_string(notes);
|
||||
|
||||
if (new_value)
|
||||
{
|
||||
kvp_frame_set_slot (xaccTransGetSlots (trans), "notes", new_value);
|
||||
kvp_value_delete (new_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
PERR ("failed to allocate kvp");
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
@ -1961,6 +1982,20 @@ xaccTransGetDescription (Transaction *trans)
|
||||
return (trans->description);
|
||||
}
|
||||
|
||||
const char *
|
||||
xaccTransGetNotes (Transaction *trans)
|
||||
{
|
||||
kvp_value *v;
|
||||
|
||||
if (!trans) return NULL;
|
||||
|
||||
v = kvp_frame_get_slot (xaccTransGetSlots (trans), "notes");
|
||||
if (!v)
|
||||
return NULL;
|
||||
|
||||
return kvp_value_get_string (v);
|
||||
}
|
||||
|
||||
time_t
|
||||
xaccTransGetDate (Transaction *trans)
|
||||
{
|
||||
|
@ -168,9 +168,10 @@ void xaccTransSetDateEnteredSecs (Transaction *trans, time_t time);
|
||||
void xaccTransSetDateEnteredTS (Transaction *trans,
|
||||
const Timespec *ts);
|
||||
|
||||
/* set the Num and Description fields ... */
|
||||
/* set the Num, Description, and Notes fields */
|
||||
void xaccTransSetNum (Transaction *trans, const char *num);
|
||||
void xaccTransSetDescription (Transaction *trans, const char *desc);
|
||||
void xaccTransSetNotes (Transaction *trans, const char *notes);
|
||||
|
||||
/* The xaccTransAppendSplit() method will append the indicated
|
||||
* split to the collection of splits in this transaction.
|
||||
@ -208,10 +209,11 @@ Split * xaccTransGetSplit (Transaction *trans, int i);
|
||||
GList * xaccTransGetSplitList (Transaction *trans);
|
||||
|
||||
/* These routines return the Num (or ID field), the description,
|
||||
* and the date field.
|
||||
* the notes, and the date field.
|
||||
*/
|
||||
const char * xaccTransGetNum (Transaction *trans);
|
||||
const char * xaccTransGetDescription (Transaction *trans);
|
||||
const char * xaccTransGetNotes (Transaction *trans);
|
||||
time_t xaccTransGetDate (Transaction *trans);
|
||||
#ifndef SWIG /* swig chokes on long long */
|
||||
long long xaccTransGetDateL (Transaction *trans);
|
||||
@ -496,6 +498,6 @@ int xaccIsPeerSplit (Split *split_1, Split *split_2);
|
||||
* This routine is needed by the perl swig wrappers, which
|
||||
* is unable to dereference on their own.
|
||||
*/
|
||||
Split * IthSplit (Split **sarray, int i);
|
||||
Split * IthSplit (Split **sarray, int i);
|
||||
|
||||
#endif /* __XACC_TRANSACTION_H__ */
|
||||
|
@ -44,8 +44,9 @@ Use: xaccSplitGetMemo, xaccSplitSetMemo
|
||||
|
||||
Name: notes
|
||||
Type: string
|
||||
Entities: Account
|
||||
Use: xaccAccountGetNotes, xaccAccountSetNotes
|
||||
Entities: Account, Transaction
|
||||
Use: xaccAccountGetNotes, xaccAccountSetNotes,
|
||||
xaccTransGetNotes, xaccTransSetNotes
|
||||
Store the 'Notes' string which was previously stored in
|
||||
the Account structure directly.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user