diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 925ad8ba2b..7b9da77e38 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -42,7 +42,7 @@ /* - * If the "force_double_entry" flag determines how + * The "force_double_entry" flag determines how * the splits in a transaction will be balanced. * * The following values have significance: @@ -185,6 +185,21 @@ xaccFreeSplit( Split *split ) /********************************************************************\ \********************************************************************/ +void +xaccConfigSetForceDoubleEntry (int force) +{ + force_double_entry = force; +} + +int +xaccConfigGetForceDoubleEntry (void) +{ + return (force_double_entry); +} + +/********************************************************************\ +\********************************************************************/ + #define MARK_SPLIT(split) { \ Account *acc = (Account *) ((split)->acc); \ if (acc) acc->changed = 1; \ diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index b0de2f4f2f..dad252614e 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -72,6 +72,27 @@ struct timespec64 { typedef struct timespec64 Timespec; /** PROTOTYPES ******************************************************/ + +/* + * The xaccConfigSetForceDoubleEntry() and xaccConfigGetForceDoubleEntry() + * set and get the "force_double_entry" flag. This flag determines how + * the splits in a transaction will be balanced. + * + * The following values have significance: + * 0 -- anything goes + * 1 -- The sum of all splits in a transaction will be + * forced to be zero, even if this requires the + * creation of additional splits. Note that a split + * whose value is zero (e.g. a stock price) can exist + * by itself. Otherwise, all splits must come in at + * least pairs. + * 2 -- splits without parents will be forced into a + * lost & found account. (Not implemented) + */ + +void xaccConfigSetForceDoubleEntry (int force); +int xaccConfigGetForceDoubleEntry (void); + /* * The xaccMallocTransaction() will malloc memory and initilize it. * Once created, it is usually unsafe to merely "free" this memory;