2005-11-07 09:45:58 -06:00
|
|
|
/********************************************************************\
|
|
|
|
* qofbook.h -- Encapsulate all the information about a dataset. *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
2005-11-16 23:35:02 -06:00
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
2005-11-07 09:45:58 -06:00
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
/** @addtogroup Object
|
|
|
|
@{ */
|
|
|
|
/** @addtogroup Book
|
2006-01-08 11:51:29 -06:00
|
|
|
A QOF Book is a dataset. It provides a single handle
|
2005-11-07 09:45:58 -06:00
|
|
|
through which all the various collections of entities
|
|
|
|
can be found. In particular, given only the type of
|
|
|
|
the entity, the collection can be found.
|
2006-01-08 11:51:29 -06:00
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
Books also provide the 'natural' place to working with
|
2006-01-08 11:51:29 -06:00
|
|
|
a storage backend, as a book can encapsulate everything
|
2005-11-07 09:45:58 -06:00
|
|
|
held in storage.
|
|
|
|
@{ */
|
|
|
|
/** @file qofbook.h
|
|
|
|
* @brief Encapsulate all the information about a dataset.
|
|
|
|
*
|
|
|
|
* @author Copyright (c) 1998, 1999, 2001, 2003 Linas Vepstas <linas@linas.org>
|
|
|
|
* @author Copyright (c) 2000 Dave Peticolas
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QOF_BOOK_H
|
|
|
|
#define QOF_BOOK_H
|
|
|
|
|
2014-04-25 15:41:11 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2010-01-08 22:54:02 -06:00
|
|
|
/* We only want a few things exported to Guile */
|
|
|
|
#ifndef SWIG
|
|
|
|
|
2007-04-03 17:30:58 -05:00
|
|
|
typedef struct _QofBookClass QofBookClass;
|
2015-07-09 11:15:15 -05:00
|
|
|
#ifndef __KVP_VALUE
|
2015-06-14 16:52:25 -05:00
|
|
|
typedef struct KvpValueImpl KvpValue;
|
2015-07-09 11:15:15 -05:00
|
|
|
#define __KVP_VALUE
|
|
|
|
#endif
|
2007-04-03 17:30:58 -05:00
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
#include "qofid.h"
|
2007-04-03 17:30:58 -05:00
|
|
|
#include "qofinstance.h"
|
2016-06-05 12:30:47 -05:00
|
|
|
#include "qofbackend.h"
|
2007-04-03 17:30:58 -05:00
|
|
|
|
|
|
|
/* --- type macros --- */
|
|
|
|
#define QOF_TYPE_BOOK (qof_book_get_type ())
|
|
|
|
#define QOF_BOOK(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((o), QOF_TYPE_BOOK, QofBook))
|
|
|
|
#define QOF_BOOK_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((k), QOF_TYPE_BOOK, QofBookClass))
|
|
|
|
#define QOF_IS_BOOK(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((o), QOF_TYPE_BOOK))
|
|
|
|
#define QOF_IS_BOOK_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((k), QOF_TYPE_BOOK))
|
|
|
|
#define QOF_BOOK_GET_CLASS(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((o), QOF_TYPE_BOOK, QofBookClass))
|
|
|
|
|
|
|
|
typedef void (*QofBookDirtyCB) (QofBook *, gboolean dirty, gpointer user_data);
|
|
|
|
|
2014-05-07 08:37:14 -05:00
|
|
|
typedef struct gnc_option_db GNCOptionDB;
|
|
|
|
|
2015-06-12 17:19:45 -05:00
|
|
|
typedef void (*GNCOptionSave) (GNCOptionDB*, QofBook*, gboolean);
|
|
|
|
typedef void (*GNCOptionLoad) (GNCOptionDB*, QofBook*);
|
2014-05-07 08:37:14 -05:00
|
|
|
|
2007-04-03 17:30:58 -05:00
|
|
|
/* Book structure */
|
|
|
|
struct _QofBook
|
|
|
|
{
|
2009-09-18 14:40:57 -05:00
|
|
|
QofInstance inst; /* Unique guid for this book. */
|
|
|
|
|
2012-01-09 17:10:20 -06:00
|
|
|
/* Boolean indicates that the session is dirty -- that is, it has
|
|
|
|
* not yet been written out to disk after the last time the
|
|
|
|
* backend ran commit_edit(). This is distinct from the inherited
|
|
|
|
* QofInstance::dirty, which indicates that some persisitent
|
|
|
|
* property of the book object itself has been edited and not
|
|
|
|
* committed. Some backends write data out as part of
|
|
|
|
* commit_edit() and so don't use this flag.
|
|
|
|
*/
|
|
|
|
gboolean session_dirty;
|
|
|
|
|
2009-09-18 14:40:57 -05:00
|
|
|
/* The time when the book was first dirtied. This is a secondary
|
2012-01-09 17:10:20 -06:00
|
|
|
* indicator. It should only be used when session_saved is FALSE. */
|
2012-12-01 16:44:13 -06:00
|
|
|
time64 dirty_time;
|
2009-09-18 14:40:57 -05:00
|
|
|
|
|
|
|
/* This callback function is called any time the book dirty flag
|
|
|
|
* changes state. Both clean->dirty and dirty->clean transitions
|
|
|
|
* trigger a callback. */
|
|
|
|
QofBookDirtyCB dirty_cb;
|
|
|
|
|
|
|
|
/* This is the user supplied data that is returned in the dirty
|
|
|
|
* callback function.*/
|
|
|
|
gpointer dirty_data;
|
|
|
|
|
|
|
|
/* The entity table associates the GUIDs of all the objects
|
|
|
|
* belonging to this book, with their pointers to the respective
|
2017-01-16 16:03:50 -06:00
|
|
|
* objects. This allows a lookup of objects based on their guid.
|
2009-09-18 14:40:57 -05:00
|
|
|
*/
|
|
|
|
GHashTable * hash_of_collections;
|
|
|
|
|
|
|
|
/* In order to store arbitrary data, for extensibility, add a table
|
|
|
|
* that will be used to hold arbitrary pointers.
|
|
|
|
*/
|
|
|
|
GHashTable *data_tables;
|
|
|
|
|
|
|
|
/* Hash table of destroy callbacks for the data table. */
|
|
|
|
GHashTable *data_table_finalizers;
|
|
|
|
|
2011-01-14 17:25:27 -06:00
|
|
|
/* Boolean indicates whether book is safe to write to (true means
|
2012-01-09 17:10:20 -06:00
|
|
|
* that it isn't). The usual reason will be a database version
|
2011-01-14 17:25:27 -06:00
|
|
|
* mismatch with the running instance of Gnucash.
|
|
|
|
*/
|
|
|
|
gboolean read_only;
|
|
|
|
|
2009-09-18 14:40:57 -05:00
|
|
|
/* state flag: 'y' means 'open for editing',
|
|
|
|
* 'n' means 'book is closed'
|
|
|
|
* xxxxx shouldn't this be replaced by the instance editlevel ???
|
|
|
|
*/
|
|
|
|
char book_open;
|
|
|
|
|
|
|
|
/* a flag denoting whether the book is closing down, used to
|
|
|
|
* help the QOF objects shut down cleanly without maintaining
|
|
|
|
* internal consistency.
|
|
|
|
* XXX shouldn't this be replaced by instance->do_free ???
|
|
|
|
*/
|
|
|
|
gboolean shutting_down;
|
|
|
|
|
|
|
|
/* version number, used for tracking multiuser updates */
|
|
|
|
gint32 version;
|
|
|
|
|
|
|
|
/* To be technically correct, backends belong to sessions and
|
|
|
|
* not books. So the pointer below "really shouldn't be here",
|
|
|
|
* except that it provides a nice convenience, avoiding a lookup
|
|
|
|
* from the session. Better solutions welcome ... */
|
|
|
|
QofBackend *backend;
|
2018-06-22 15:17:38 -05:00
|
|
|
|
2018-08-25 05:08:32 -05:00
|
|
|
/* A cached value of the OPTION_NAME_NUM_FIELD_SOURCE option value
|
|
|
|
* because it is queried quite a lot, so we want to avoid a KVP
|
|
|
|
* lookup on each query */
|
2018-06-22 15:17:38 -05:00
|
|
|
gboolean cached_num_field_source;
|
|
|
|
/* Whether the above cached value is valid. */
|
|
|
|
gboolean cached_num_field_source_isvalid;
|
2018-08-24 10:57:58 -05:00
|
|
|
|
2018-08-25 05:08:32 -05:00
|
|
|
/* A cahed value of the "autoreadonly-days" option value because
|
|
|
|
* it is queried quite a lot, so we want to avoid a KVP lookup on
|
|
|
|
* each query */
|
2018-08-24 10:57:58 -05:00
|
|
|
gint cached_num_days_autoreadonly;
|
|
|
|
/* Whether the above cached value is valid. */
|
|
|
|
gboolean cached_num_days_autoreadonly_isvalid;
|
2007-04-03 17:30:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _QofBookClass
|
|
|
|
{
|
2009-09-18 14:40:57 -05:00
|
|
|
QofInstanceClass parent_class;
|
2007-04-03 17:30:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
GType qof_book_get_type(void);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
/** @brief Encapsulates all the information about a dataset
|
2006-01-08 11:51:29 -06:00
|
|
|
* manipulated by QOF. This is the top-most structure
|
2005-11-07 09:45:58 -06:00
|
|
|
* used for anchoring data.
|
|
|
|
*/
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
/** This macro looks up an entity by GncGUID and returns a pointer to the
|
2010-03-06 05:01:37 -06:00
|
|
|
* entity by ending with a "return" statement. Hence, this macro can
|
|
|
|
* only be used as the last statement in the definition of a function,
|
|
|
|
* but not somewhere inline in the code. */
|
|
|
|
#define QOF_BOOK_RETURN_ENTITY(book,guid,e_type,c_type) { \
|
|
|
|
QofInstance *val = NULL; \
|
2018-08-25 05:08:32 -05:00
|
|
|
if ((guid != NULL) && (book != NULL)) { \
|
2010-03-06 05:01:37 -06:00
|
|
|
const QofCollection *col; \
|
2005-11-07 09:45:58 -06:00
|
|
|
col = qof_book_get_collection (book, e_type); \
|
|
|
|
val = qof_collection_lookup_entity (col, guid); \
|
|
|
|
} \
|
2010-03-06 05:01:37 -06:00
|
|
|
return (c_type *) val; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
/** GList of QofBook */
|
2018-08-25 05:08:32 -05:00
|
|
|
typedef GList QofBookList;
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
typedef void (*QofBookFinalCB) (QofBook *, gpointer key, gpointer user_data);
|
|
|
|
|
|
|
|
/** Register the book object with the QOF object system. */
|
|
|
|
gboolean qof_book_register (void);
|
2006-01-08 11:51:29 -06:00
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
/** Allocate, initialise and return a new QofBook. Books contain references
|
|
|
|
* to all of the top-level object containers. */
|
|
|
|
QofBook * qof_book_new (void);
|
|
|
|
|
2006-01-08 11:51:29 -06:00
|
|
|
/** End any editing sessions associated with book, and free all memory
|
2005-11-07 09:45:58 -06:00
|
|
|
associated with it. */
|
2018-08-25 05:08:32 -05:00
|
|
|
void qof_book_destroy (QofBook *book);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
/** Close a book to editing.
|
|
|
|
|
|
|
|
It is up to the application to check this flag,
|
|
|
|
and once marked closed, books cannnot be marked as open.
|
|
|
|
*/
|
|
|
|
void qof_book_mark_closed (QofBook *book);
|
|
|
|
|
2006-01-08 11:51:29 -06:00
|
|
|
/** Return The table of entities of the given type.
|
2005-11-07 09:45:58 -06:00
|
|
|
*
|
|
|
|
* When an object's constructor calls qof_instance_init(), a
|
|
|
|
* reference to the object is stored in the book. The book stores
|
|
|
|
* all the references to initialized instances, sorted by type. This
|
|
|
|
* function returns a collection of the references for the specified
|
|
|
|
* type.
|
2006-01-08 11:51:29 -06:00
|
|
|
*
|
2005-11-07 09:45:58 -06:00
|
|
|
* If the collection doesn't yet exist for the indicated type,
|
|
|
|
* it is created. Thus, this routine is gaurenteed to return
|
2006-01-08 11:51:29 -06:00
|
|
|
* a non-NULL value. (Unless the system malloc failed (out of
|
2005-11-07 09:45:58 -06:00
|
|
|
* memory) in which case what happens??).
|
|
|
|
*/
|
2009-09-18 14:40:57 -05:00
|
|
|
/*@ dependent @*/
|
|
|
|
QofCollection * qof_book_get_collection (const QofBook *, QofIdType);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
/** Invoke the indicated callback on each collection in the book. */
|
|
|
|
typedef void (*QofCollectionForeachCB) (QofCollection *, gpointer user_data);
|
2006-08-17 23:48:18 -05:00
|
|
|
void qof_book_foreach_collection (const QofBook *, QofCollectionForeachCB, gpointer);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
2006-01-08 11:51:29 -06:00
|
|
|
/** The qof_book_set_data() allows arbitrary pointers to structs
|
|
|
|
* to be stored in QofBook. This is the "preferred" method for
|
2005-11-07 09:45:58 -06:00
|
|
|
* extending QofBook to hold new data types. This is also
|
2006-01-08 11:51:29 -06:00
|
|
|
* the ideal location to store other arbitrary runtime data
|
2005-11-07 09:45:58 -06:00
|
|
|
* that the application may need.
|
|
|
|
*/
|
2006-04-07 13:50:08 -05:00
|
|
|
void qof_book_set_data (QofBook *book, const gchar *key, gpointer data);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
/** Same as qof_book_set_data(), except that the callback will be called
|
2006-01-08 11:51:29 -06:00
|
|
|
* when the book is destroyed. The argument to the callback will be
|
2005-11-07 09:45:58 -06:00
|
|
|
* the book followed by the data pointer.
|
|
|
|
*/
|
2009-09-18 14:40:57 -05:00
|
|
|
void qof_book_set_data_fin (QofBook *book, const gchar *key, gpointer data,
|
2005-11-07 12:23:46 -06:00
|
|
|
QofBookFinalCB);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
|
|
|
/** Retrieves arbitrary pointers to structs stored by qof_book_set_data. */
|
2006-08-17 23:48:18 -05:00
|
|
|
gpointer qof_book_get_data (const QofBook *book, const gchar *key);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
2011-01-14 17:25:27 -06:00
|
|
|
/** Return whether the book is read only. */
|
|
|
|
gboolean qof_book_is_readonly(const QofBook *book);
|
|
|
|
|
|
|
|
/** Mark the book as read only. */
|
|
|
|
void qof_book_mark_readonly(QofBook *book);
|
|
|
|
|
2018-09-23 18:30:30 -05:00
|
|
|
/** Check if the book has had anything loaded into it. */
|
|
|
|
gboolean qof_book_empty(const QofBook *book);
|
|
|
|
|
2010-01-08 22:54:02 -06:00
|
|
|
#endif /* SWIG */
|
|
|
|
|
Bug #537476: Implement currency trading accounts optionally, to be enabled per-book.
Patch by Mike Alexander:
This patch implements trading accounts somewhat as described in Peter
Selinger's document at
<http://www.mathstat.dal.ca/~selinger/accounting/gnucash.html>. Although he
describes it as a multiple currency problem, it really applies to any
transactions involving multiple commodities (for example buying or selling a
stock) Hence I've called the trading accounts "commodity exchange accounts"
which seems more descriptive.
In summary these patches add an option to use commodity exchange accounts and
if it is on a transaction must be balanced both in value (in the transaction
currency) and in each commodity or currency used in any split in the
transaction. If a transaction only contains splits in the transaction currency
then this is the same rule as Gnucash has always enforced.
In this patch, the option to use trading accounts has been moved from
Edit->Preferences to File->Properties and is now associated with the active
book instead of being a global option. If you have set the global value on in
a previous version you will need to set it on again in each file for which you
want trading accounts, the previous global setting will be ignored.
A more detailed list of changes follows:
1. Added a "Use commodity exchange accounts" per-book option.
2. Added gnc_monetary and MonetaryList data types.
3. Renamed xaccTransGetImbalance to xaccTransGetImbalanceValue and added a new
xaccTransGetImbalance that returns a MonetaryList. Also added
xaccTransIsBalanced to see if the transaction is balanced without returning a
GList that needs to be freed. It calls both xaccTransGetImbalance and
xaccTransGetImbalanceValue since a transaction may be unbalanced with regard to
either without being unbalanced with regard to the other.
4. Changed gnc_split_register_get_debcred_bg_color to use xaccTransIsBalanced.
5. Changed gnc_split_register_balance_trans to not offer to adjust an existing
split if there imbalances in multiple currencies. Because of bugs in the
register code this is rarely called.
6. Changed importers to use xaccTransGetImbalanceValue to check for imbalance,
assuming that they won't create multiple currency trasactions.
7. Changed xaccTransScrubImbalance to create a balancing split for each
imbalanced commodity in the transaction. Also balances the transaction value.
The commodity balancing splits go into accounts in the hierarchy
Trading:NAMESPACE:COMMODITY. The value balancing splits go into
Imbalance-CURRENCY as before.
8. Changed xaccSplitConvertAmount to use xaccTransIsBalanced instead of
xaccTransGetImbalance.
9. Changed gnc_split_register_get_debcred_entry to sometimes use the split
amount instead of value if using currency accounts.
If the register is a stock register (i.e., shows shares and prices), it uses
the value if the split is in the register commodity (i.e. is for the stock) and
the amount otherwise. It shows the currency symbol unless the commodity is the
default currency.
If the register is not a stock register it always uses the amount and shows the
currency symbol if the split is not in the register commodity.
Also changed it to not return a value for a null split unless the transaction
is unbalanced in exactly one currency. This is what goes in a blank split as
the proposed value.
10. Changed refresh_model_row to use xaccTransGetImbalanceValue to get the
imbalance, assuming that importers don't create transactions in multiple
currencies. Also same change in gnc_import_process_trans_item,
downloaded_transaction_append, and gnc_import_TransInfo_is_balanced.
11. Changed the TRANS_IMBALANCE accessor method in xaccTransRegister to use
xaccTransGetImbalanceValue. As far as I can tell this is only used by the
"pd-balance" query type in gnc_scm2query_term_query_v1() defined in
engine-helpers.c. This query type only tests the result for zero/non-zero.
12. Changed xaccTransGetAccountConvRate to accept any split into the correct
commodity instead of insisting on one into the provided account. Then can use
it in xaccTransScrubImbalance to set the value of the imbalance split from its
amount, however later changed xaccTransScrubImbalance to not use it. Instead
it sets the value for the new split correctly to keep the value of the whole
transaction balanced.
13. Changed the balance sheet report to include a new option to not compute
unrealized gains and losses.
14. Related to 9 above, changed gnc_split_register_auto_calc to not do anything
if given a stock register where the value cell doesn't contain the value.
15. Also related to 9, changed gnc_split_register_save_amount_values to set the
amount and value fields in the split correctly when using trading accounts.
16. Changed the new account and edit account dialogs to allow any commodity or
currency for an income account if using trading accounts. It would be better
to add a new account type for trading accounts, but that's a big deal and I'll
leave that for later after we see whether this set of changes is going to be
accepted or rejected.
17. Change gnc_xfer_dialog_run_exchange_dialog to understand that the new value
is really the split's amount if using trading accounts.
18. Changed xaccSplitGetOtherSplit to ignore trading splits if using commodity
exchange accounts.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18429 57a11ea4-9604-0410-9ed3-97b8803252fd
2009-11-20 14:11:03 -06:00
|
|
|
/** Returns flag indicating whether this book uses trading accounts */
|
|
|
|
gboolean qof_book_use_trading_accounts (const QofBook *book);
|
|
|
|
|
2015-06-27 18:06:56 -05:00
|
|
|
/** Returns pointer to book-currency name for book, if one exists in the
|
|
|
|
* KVP, or NULL; does not validate contents nor determine if there is a valid
|
|
|
|
* default gain/loss policy, both of which are required, for the
|
|
|
|
* 'book-currency' currency accounting method to apply. Use instead
|
2016-06-17 15:48:03 -05:00
|
|
|
* 'gnc_book_get_book_currency_name' which does these validations. */
|
|
|
|
const gchar * qof_book_get_book_currency_name (QofBook *book);
|
2015-06-27 18:06:56 -05:00
|
|
|
|
|
|
|
/** Returns pointer to default gain/loss policy for book, if one exists in the
|
|
|
|
* KVP, or NULL; does not validate contents nor determine if there is a valid
|
|
|
|
* book-currency, both of which are required, for the 'book-currency'
|
|
|
|
* currency accounting method to apply. Use instead
|
|
|
|
* 'gnc_book_get_default_gains_policy' which does these validations. */
|
|
|
|
const gchar * qof_book_get_default_gains_policy (QofBook *book);
|
2015-02-28 18:39:34 -06:00
|
|
|
|
2016-06-17 15:48:03 -05:00
|
|
|
/** Returns pointer to default gain/loss account GUID for book, if one exists in
|
|
|
|
* the KVP, or NULL; does not validate contents nor determine if there is a
|
|
|
|
* valid book-currency, both of which are required, for the 'book-currency'
|
|
|
|
* currency accounting method to apply. Use instead
|
|
|
|
* 'gnc_book_get_default_gain_loss_acct' which does these validations. */
|
2018-09-09 10:43:05 -05:00
|
|
|
GncGUID * qof_book_get_default_gain_loss_acct_guid (QofBook *book);
|
2016-06-17 15:48:03 -05:00
|
|
|
|
2012-03-24 17:34:59 -05:00
|
|
|
/** Returns TRUE if the auto-read-only feature should be used, otherwise
|
|
|
|
* FALSE. This is just a wrapper on qof_book_get_num_days_autoreadonly() == 0. */
|
|
|
|
gboolean qof_book_uses_autoreadonly (const QofBook *book);
|
2012-03-21 17:18:29 -05:00
|
|
|
|
2012-03-24 17:34:59 -05:00
|
|
|
/** Returns the number of days for auto-read-only transactions. If zero,
|
|
|
|
* the auto-read-only feature should be disabled (and qof_book_uses_autoreadonly()
|
2012-03-21 17:18:29 -05:00
|
|
|
* returns FALSE). */
|
2012-03-24 17:34:59 -05:00
|
|
|
gint qof_book_get_num_days_autoreadonly (const QofBook *book);
|
2012-03-21 17:18:29 -05:00
|
|
|
|
2012-03-24 17:34:59 -05:00
|
|
|
/** Returns the GDate that is the threshold for auto-read-only. Any txn
|
|
|
|
* with posted-date lesser than this date should be considered read-only.
|
|
|
|
*
|
|
|
|
* If the auto-read-only feature is not used (qof_book_uses_autoreadonly()
|
|
|
|
* returns FALSE), NULL is returned here.
|
2012-03-21 17:18:29 -05:00
|
|
|
*
|
|
|
|
* The returned object was allocated newly; the caller must
|
|
|
|
* g_date_free() the object afterwards. */
|
2012-03-24 17:34:59 -05:00
|
|
|
GDate* qof_book_get_autoreadonly_gdate (const QofBook *book);
|
2012-03-21 17:18:29 -05:00
|
|
|
|
Implement a Book Option to give users the choice to use the transaction number field (default and current behaviour) or, alternatively, the split action field of the anchor split for 'Num' column on registers, reports, import and export, where applicable. The difference between the two is that with the default, the same 'Num' is displayed for a given transaction regardless of what register it is viewed in and with the new option, a different 'Num' can be entered/displayed for a given transaction in each register it is viewed in. In both cases, the 'next number logic' of the 'Num' cell is based on the account of the register the transaction is entered/viewed from but in one case it fills the transaction number, in the other, it fills the split action field of the anchor split (with the transaction number field displayed in the register cell labeled 'T-Num'). In both cases, both fields are visible and can be used as free-form text in double-line mode for any value the user wants. If the new option is not selected, there should be no change in Gnucash's behaviour with the exception of displaying the book options dialog in 'new book' situations.
The changes made are:
1. Implement the new book option to select source for 'num' cell:
libqof/qof/qofbookslots.h - define num source option
engine/engine.i - define 'NUM-FIELD-SOURCE' as an option name and
'SPLIT-ACTION' as a term for sorting queries
app-utils/business-prefs.scm - define book option for num-field-source
app-utils/app-utils.scm - define and export book option for num-field-source
2. Implement functions to get book option setting and to test:
libqof/qof/qofbook.c & .h - define function to get number source book option
libqof/qof/test/test-qofbook.c - test function to get number source book option
3. Implement a notification mechanism for book option changes:
engine/engine-helpers.c & .h - define functions to register callbacks,
define function to remove callbacks and
define function to initiate callbacks on book num-source option changes
core-utils/gnc-features.c & .h - define feature for num-source
app-utils/gnc-ui-util.c & .h - define gnc_book_option_num_field_source_change_cb;
include setting of feature flag on initial use
gnome-utils/gnc-main-window.c - change name of gnc_options_dialog_apply_cb
function to gnc_book_options_dialog_apply_cb and adjust function to
call function gnc_book_option_num_field_source_change_cb when book
option for num-field-source changes; change name of
gnc_options_dialog_close_cb to gnc_book_options_dialog_close_cb
4. Implement 'help' button response on Book Option Dialog:
gnome-utils/gnc-ui.h - define "book-options" section of help manual
gnome-utils/gnc-gnome-utils.c & .h - implement Book Options help callback
gnome-utils/gnc-main-window.c - use gnc_options_dialog_set_book_options_help_cb
to make help button active
5. Implement utility functions to get/set number/action based on book option:
engine/engine-helpers.c & .h - define 'gnc_get_num_action' function
define 'gnc_get_action_num' function
define 'gnc_set_num_action' function
engine/engine.i - make get/set num/action functions available to guile &
allow #f to be used in place of NULL from guile
engine/Transaction.h - add reference to utility functions in comments to
xaccTransSetNum and xaccTransGetNum functions
engine/Split.h - add reference to utility functions in comments to
xaccSplitSetAction and xaccSplitGetAction functions
6. Implement register use of num source book option; for General, Income and Search
Ledgers, since there is no anchor split, always show tran-num in transaction
cursor, but vary label to correspond to book option:
register/ledger-core/split-register.h - define TNUM_CELL
define CURSOR_DOUBLE_LEDGER_NUM_ACTN cursor name to use TNUM_CELL
define CURSOR_DOUBLE_JOURNAL_NUM_ACTN cursor name to use TNUM_CELL
add boolean to split_reg structure to hold num source book option
register/ledger-core/split-register-layout.c -
add logic to define and set up new ledger/journal cursors with TNUM_CELLs
add logic to add the new cursors to a layout
add logic to add TNUM_CELL to a layout
register/ledger-core/split-register-model.c -
define function to get TNUM_CELL label
add logic to recognize ledger/journal cursors with TNUM_CELL
modify function to get NUM_CELL value based on book option and register
type
define function to get TNUM_CELL value
adjust num help text to reflect book option choice
define function to get TNUM_CELL help
modify function to get action help to reflect book option choice
set up handlers for TNUM_CELL
register/ledger-core/split-register-model-save.c -
use 'gnc_set_num_action' function to set num/action for NUM_CELL based
on book option
define function to save TNUM_CELL using 'gnc_set_num_action' function
set save handler for TNUM_CELL
register/ledger-core/split-register-util.c -
modify logic to recognize ledger/journal cursors with tnum_cell
register/ledger-core/split-register.c -
define split_register_book_option_changed function
register split_register_book_option_changed function in register init
initialize register structure setting to book option
remove split_register_book_option_changed function in register destroy
modify gnc_split_register_save_to_scm to handle TNUM_CELL
7. Enhance transaction copy/duplicate logic to accommodate new book option:
gnome/gtkbuilder/gnc-plugin-page-register.glade -
add widgets to handle trans number and/or split action based on book option
gnome-utils/dialog-dup-trans.c & .h -
add capability to display and handle 'Num' field according to book option
gnome/gnc-plugin-page-register.c - define gnc_find_register_by_account
register/ledger-core/split-register.c -
modify gnc_split_register_duplicate_current to accomodate book option
setting
register/ledger-core/Makefile.am - add GNOME_CFLAGS
register/ledger-core/test/Makefile.am - add libgnc-gnome.la
8. Adjust register sort and sort labels related to Num/Action radio buttons to
correspond to book option for clarity:
gnome/gnc-plugin-page-register.c -
define gnc_plugin_page_register_sort_book_option_changed to adjust labels
register function in gnc_plugin_page_register_cmd_view_sort_by
and save num and action radio widgets
initialize radio widget labels to correspond to book option
remove function in gnc_plugin_page_register_sort_response_cb
and clear num and action radio widgets
gnome/gnc-split-reg.c & h. -
create versions of gnc_split_reg_sort and gnc_split_reg_set_sort to force
a re-sort to be used when num-source book option changes
engine/Transaction.c & .h -
modify default sort to use split action in place of tran num per book
option if called from xaccSplitOrder
engine/Split.c -
modify xaccSplitOrder to call xaccTransOrder_num_action to switch use of
split action and tran num per book option
engine/test/utest-Split.c -
modify test_xaccSplitOrder to call xaccTransOrder_num_action based on
book option
9. Adjust transaction find labels related to Num/Action to correspond to book option
for clarity:
gnome/dialog-find-transactions.c - adjust labels in search criteria based
on book option
gnome-search/dialog-search.c -
define gnc_search_dialog_book_option_changed to adjust labels
register function in gnc_search_dialog_init_widgets when searching
for splits
remove function in gnc_search_dialog_close_cb if registered
10. Modify new file process to allow setting of num-source (actually, all) book
option(s) during New Account Hierarchy Setup:
gnome-utils/gtkbuilder/dialog-preferences.glade - add a user preference for
the default setting for 'num-source' for new books
core-utils/gnc-gconf-utils.h - define KEY_NUM_SOURCE
gnome-utils/gnc-gnome-utils.c & h. -
define gnc_options_dialog_set_new_book_option_values to retrieve
preference values
gnome-utils/dialog-options.c & .h - define gnc_options_dialog_new_modal to
surpress apply button
gnome-utils/gnc-main-window.c - define function gnc_book_options_dialog_cb
with arguments so that the window can be called in modal mode and the
title changed and return dialog widget; call gnc_options_dialog_new_modal
instead of gnc_options_dialog_new; call this function from
gnc_main_window_cmd_file_properties with new arguments; for modal mode,
call gnc-options-dialog-set-new-book-option-values to initialize values
from preferences
app-utils/gnc-ui-util.c & h. - create function gnc_is_new_book for
determining when a new book is being created
gnome-utils/dialog-utils.c & h. - define gnc_new_book_option_display to
display book options dialog in modal mode
gnome/gtkbuilder/assistant-hierarchy.glade - add notification about book
options to currency page
gnome/assistant-hierarchy.c - add ability to set book option initialized
from preferences value for new books by using functions gnc_is_new_book
and gnc_new_book_option_display
11. Modify Import QIF process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/qif-import/assistant-qif-import.glade - add notification about
book options to currency page
import-export/qif-import/assistant-qif-import.c - using function
gnc_is_new_book to identify 'new book' situation and set flag; add
logic to handle 'new-book' situation by calling
gnc_new_book_option_display function
import-export/qif-import/qif-to-gnc.scm - use 'gnc_set_num_action' function
to import number to correct field based on book option
12. Modify Import OFX/QFX process to recognize a new-book situation and allow setting
of book options during first import into a new book; also follow book option
setting for num source in importing number whether new book or not:
import-export/ofx/gnc-ofx-import.c - use 'gnc_set_num_action' function to import
number based on book option; identify 'new book' situation using function
gnc_is_new_book and set flag; add logic to handle 'new-book' situation
by raising book options dialog by calling gnc_new_book_option_display
function
import-export/import-backend.c - use 'gnc_get_num_action' function to
retrieve number from transactions to be matched based on book option
13. Modify Import AqBanking process to recognize a new-book situation and allow
setting of book options during first import into a new book; also follow
book option setting for num source in importing number:
import-export/aqbanking/gnc-file-aqb-import.c - identify 'new book'
situation using function gnc_is_new_book and handle by raising book
options dialog by calling gnc_new_book_option_display function
import-export/aqbanking/gnc-ab-utils.c - use 'gnc_set_num_action' function
to set number based on book option
14. Modify Import Transactions from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book; also
follow book option setting for num source in importing number whether new
book or not:
import-export/csv-import/assistant-csv-trans-import.glade - modify
commments to alert user of raising book options dialog in cases of csv
import into a new book
import-export/csv-import/gnc-csv-model.c & h. - use 'gnc_set_num_action'
function to import number based on book option
import-export/csv-import/assistant-csv-trans-import.c - add logic to handle
'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
15. Modify Import Accounts from CSV process to recognize a new-book situation
and allow setting of book options during first import into a new book
import-export/csv-import/assistant-csv-account-import.c & .h - add logic to
handle 'new-book' situation by raising book options dialog by calling
gnc_new_book_option_display function; identify 'new book' situation
using function gnc_is_new_book and set flag
16. Modify Export Transactions to CSV process to follow book option setting
for num source in exporting transactions:
import-export/csv-export/csv-transactions-export.c - modify headings to
reflect num-source book option and use 'gnc_get_num_action' function
to retrieve number and action
17. Modify register reporting to reflect book option setting for num source:
gnome/gnc-plugin-page-register.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
gnome/gnc-plugin-page-register2.c - determine and pass along ledger-type?
argument to gnc:register-report-create function
report/standard-reports/standard-reports.scm - add ledger-type? argument
to gnc:register-report-create function; pass it along to
gnc:register-report-create-internal function
report/standard-reports/register.scm - add ledger-type? argument to
gnc:register-report-create-internal function; use 'gnc-get-num-action'
function in place of xaccTransGetNum and 'gnc-get-action-num' function
in place of xaccSplitGetAction and modify report headings and option
text accordingly
18. Modify all places that use xaccTransSetNum and/or xaccSplitSetAction to use
'gnc_set_num_action' function to set number based on book option except
engine/Transaction.c & .h, engine/test-core/test-engine-stuff.c,
engine/Split.c & .h, engine/test/utest-Split.c, engine/engine-helpers.c & .h,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/io-gncxml-v1.c, import-export/log-replay/gnc-log-replay.c:
engine/gncOwner.c - use 'gnc_set_num_action' function to set number based
on book option
engine/gncInvoice.c - use 'gnc_set_num_action' function to set number based
on book option
engine/SchedXaction.c - use 'gnc_set_num_action' function to set number and
action
engine/cap-gains.c - use 'gnc_set_num_action' function to set split-action
gnome-utils/dialog-transfer.c - use 'gnc_set_num_action' function to set
number based on book option
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_set_num_action' function
to set number/action based on book option
gnome/assistant-stock-split.c - use 'gnc_set_num_action' function to set
split-action
19. Modify all places that use xaccTransGetNum and/or xaccSplitGetAction to use
'gnc_get_num_action' or 'gnc_get_action_num' functions to get number based
on book option except engine/Transaction.c & .h,
engine/test-core/test-engine-stuff.c, engine/Split.c & h.,
engine/test/utest-Split.c, engine/engine-helpers.c,
engine/engine-interface.scm, backend/xml/gnc-transaction-xml-v2.c,
backend/xml/test/test-xml-transaction.c:
gnome/dialog-lot-viewer.c - use 'gnc_get_num_action' function to retrieve
number based on book option
gnome/dialog-sx-from-trans.c - use 'gnc_get_num_action' function to
retrieve number and action
gnome/dialog-print-check.c - use 'gnc_get_num_action' function to
retrieve number and 'gnc_get_action_num' function to retrieve action
register/ledger-core/split-register-model.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-load.c - use 'gnc_get_num_action'
function to retrieve number based on book option
register/ledger-core/split-register-control.c - use 'gnc_get_num_action'
function to retrieve action
register/ledger-core/split-register.c - use 'gnc_get_num_action'
function to retrieve transaction-num
engine/cap-gains.c - use 'gnc_get_num_action' function to get split-action
gnome-utils/gnc-tree-view-split-reg.c - use 'gnc_get_num_action' function
to retrieve number and 'gnc_get_action_num' function to retrieve action
gnome-utils/gnc-tree-model-split-reg.c - use 'gnc_get_num_action' function
to retrieve transaction-number but may not be getting what is expected
if book option to use split-action for 'num' is set
report/locale-specific/us/taxtxf.scm - use 'gnc-get-num-action' function in
place of xaccTransGetNum and 'gnc-get-action-num' function in place of
xaccSplitGetAction and modify report headings and option text accordingly
report/standard-reports/transaction.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum, adjust sorting based on book option and
modify report headings and option text accordingly; add 'SPLIT-ACTION'
as a term for sorting queries
report/business-reports/customer-summary.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/owner-report.scm - use 'gnc-get-num-action'
function in place of xaccTransGetNum
report/business-reports/job-report.scm - use 'gnc-get-num-action' function
in place of xaccTransGetNum
business/business-gnome/dialog-payment.c - use 'gnc_get_num_action'
function to retrieve number based on book option
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22681 57a11ea4-9604-0410-9ed3-97b8803252fd
2012-12-22 00:00:54 -06:00
|
|
|
/** Returns TRUE if this book uses split action field as the 'Num' field, FALSE
|
|
|
|
* if it uses transaction number field */
|
|
|
|
gboolean qof_book_use_split_action_for_num_field (const QofBook *book);
|
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
/** Is the book shutting down? */
|
2006-08-17 23:48:18 -05:00
|
|
|
gboolean qof_book_shutting_down (const QofBook *book);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
2012-01-09 17:10:20 -06:00
|
|
|
/** qof_book_not_saved() returns the value of the session_dirty flag,
|
|
|
|
* set when changes to any object in the book are committed
|
|
|
|
* (qof_backend->commit_edit has been called) and the backend hasn't
|
|
|
|
* yet written out the changes. (Note that SQL backends write commits
|
|
|
|
* out immediately; file backends don't, and use the flag to control
|
|
|
|
* an autosave timer.)
|
2005-11-07 09:45:58 -06:00
|
|
|
*/
|
2012-01-09 17:10:20 -06:00
|
|
|
gboolean qof_book_session_not_saved (const QofBook *book);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
2010-01-08 22:54:02 -06:00
|
|
|
/* The following functions are not useful in scripting languages */
|
|
|
|
#ifndef SWIG
|
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
/** The qof_book_mark_saved() routine marks the book as having been
|
|
|
|
* saved (to a file, to a database). Used by backends to mark the
|
2009-09-18 14:40:57 -05:00
|
|
|
* notsaved flag as FALSE just after loading. Can also be used
|
2006-01-08 11:51:29 -06:00
|
|
|
* by the frontend when the used has said to abandon any changes.
|
2005-11-07 09:45:58 -06:00
|
|
|
*/
|
2012-01-09 17:10:20 -06:00
|
|
|
void qof_book_mark_session_saved(QofBook *book);
|
2006-05-06 16:09:59 -05:00
|
|
|
|
|
|
|
/** The qof_book_mark_dirty() routine marks the book as having been
|
|
|
|
* modified. It can be used by frontend when the used has made a
|
|
|
|
* change at the book level.
|
|
|
|
*/
|
2012-01-09 17:10:20 -06:00
|
|
|
void qof_book_mark_session_dirty(QofBook *book);
|
2006-05-06 16:09:59 -05:00
|
|
|
|
|
|
|
/** Retrieve the earliest modification time on the book. */
|
2012-12-01 16:44:13 -06:00
|
|
|
time64 qof_book_get_session_dirty_time(const QofBook *book);
|
2006-05-06 16:09:59 -05:00
|
|
|
|
|
|
|
/** Set the function to call when a book transitions from clean to
|
|
|
|
* dirty, or vice versa.
|
|
|
|
*/
|
|
|
|
void qof_book_set_dirty_cb(QofBook *book, QofBookDirtyCB cb, gpointer user_data);
|
|
|
|
|
2011-01-10 15:38:54 -06:00
|
|
|
/** This will get the named counter for this book. The return value is
|
|
|
|
* -1 on error or the current value of the counter.
|
2005-11-07 09:45:58 -06:00
|
|
|
*/
|
2010-04-19 11:56:40 -05:00
|
|
|
gint64 qof_book_get_counter (QofBook *book, const char *counter_name);
|
2005-11-07 09:45:58 -06:00
|
|
|
|
2011-01-10 15:39:06 -06:00
|
|
|
/** This will increment the named counter for this book and format it.
|
|
|
|
* The return value is NULL on error or the formatted (new) value of
|
|
|
|
* the counter. The caller should free the result with g_gree.
|
2011-01-10 15:38:54 -06:00
|
|
|
*/
|
2011-01-10 15:39:06 -06:00
|
|
|
gchar *qof_book_increment_and_format_counter (QofBook *book, const char *counter_name);
|
2011-01-10 15:38:54 -06:00
|
|
|
|
2016-03-17 16:37:15 -05:00
|
|
|
/** Validate a counter format string. If valid, returns a normalized format string,
|
|
|
|
* that is whatever long int specifier was used will be replaced with the value of
|
|
|
|
* the posix "PRIx64" macro.
|
|
|
|
* If not valid returns NULL and optionally set an error message is a non-null
|
|
|
|
* err_msg parameter was passed.
|
|
|
|
* The caller should free the returned format string and error message with g_free.
|
2011-01-10 15:39:29 -06:00
|
|
|
*/
|
2016-03-17 16:37:15 -05:00
|
|
|
gchar * qof_book_normalize_counter_format(const gchar *format, gchar **err_msg);
|
2011-01-10 15:39:29 -06:00
|
|
|
|
2011-01-10 15:39:18 -06:00
|
|
|
/** Get the format string to use for the named counter.
|
|
|
|
* The return value is NULL on error or the format string of the
|
2016-03-19 09:07:33 -05:00
|
|
|
* counter. The returned string should be freed by the caller.
|
2011-01-10 15:39:18 -06:00
|
|
|
*/
|
2016-03-19 08:56:12 -05:00
|
|
|
char *qof_book_get_counter_format (const QofBook *book,
|
|
|
|
const char *counter_name);
|
2011-01-10 15:39:18 -06:00
|
|
|
|
2010-01-31 14:03:23 -06:00
|
|
|
const char* qof_book_get_string_option(const QofBook* book, const char* opt_name);
|
|
|
|
void qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_val);
|
|
|
|
|
2014-05-07 08:37:14 -05:00
|
|
|
/** Access functions for reading and setting the used-features on this book.
|
|
|
|
*/
|
|
|
|
GHashTable *qof_book_get_features (QofBook *book);
|
|
|
|
void qof_book_set_feature (QofBook *book, const gchar *key, const gchar *descr);
|
|
|
|
|
2010-01-30 16:59:37 -06:00
|
|
|
void qof_book_begin_edit(QofBook *book);
|
|
|
|
void qof_book_commit_edit(QofBook *book);
|
|
|
|
|
2015-06-12 17:19:45 -05:00
|
|
|
/* Access functions for options. */
|
2015-07-03 18:14:00 -05:00
|
|
|
/** @ingroup KVP
|
|
|
|
@{
|
|
|
|
*/
|
2015-06-12 17:19:45 -05:00
|
|
|
/** Load a GNCOptionsDB from KVP data.
|
|
|
|
* @param book: The book.
|
|
|
|
* @param load_cb: A callback function that does the loading.
|
|
|
|
* @param odb: The GNCOptionDB to load.
|
|
|
|
*/
|
2014-05-07 08:37:14 -05:00
|
|
|
void qof_book_load_options (QofBook *book, GNCOptionLoad load_cb,
|
2018-08-25 05:08:32 -05:00
|
|
|
GNCOptionDB *odb);
|
2015-06-12 17:19:45 -05:00
|
|
|
/** Save a GNCOptionsDB back to the book's KVP.
|
|
|
|
* @param book: The book.
|
|
|
|
* @param save_cb: A callback function that does the saving.
|
|
|
|
* @param odb: The GNCOptionsDB to save from.
|
|
|
|
* @param clear: Should the GNCOptionsDB be emptied after the save?
|
|
|
|
*/
|
|
|
|
void qof_book_save_options (QofBook *book, GNCOptionSave save_cb,
|
|
|
|
GNCOptionDB* odb, gboolean clear);
|
|
|
|
/** Save a single option value.
|
|
|
|
* Used from Scheme, the KvpValue<-->SCM translation is handled by the functions
|
|
|
|
* in kvp-scm.c and automated by SWIG. The starting element is set as
|
|
|
|
* KVP_OPTION_PATH in qofbookslots.h.
|
|
|
|
* @param book: The book.
|
|
|
|
* @param value: The KvpValue to store.
|
|
|
|
* @param path: A GSList of keys which form a path under KVP_OPTION_PATH.
|
|
|
|
*/
|
|
|
|
void qof_book_set_option (QofBook *book, KvpValue *value, GSList *path);
|
|
|
|
|
|
|
|
/** Read a single option value.
|
|
|
|
* Used from Scheme, the KvpValue<-->SCM translation is handled by the functions
|
|
|
|
* in kvp-scm.c and automated by SWIG. The starting element is set as
|
|
|
|
* KVP_OPTION_PATH in qofbookslots.h.
|
|
|
|
* @param book: The book.
|
|
|
|
* @param path: A GSList of keys which form a path under KVP_OPTION_PATH.
|
|
|
|
*/
|
|
|
|
KvpValue* qof_book_get_option (QofBook *book, GSList *path);
|
2014-05-07 08:37:14 -05:00
|
|
|
|
2015-06-12 17:19:45 -05:00
|
|
|
/** Delete the options.
|
|
|
|
* Primarily used from Scheme to clear out the options before saving a new set.
|
|
|
|
* @param book: The book.
|
|
|
|
* @param list: A GList of keys which from a path under KVP_OPTION_PATH.
|
2016-11-28 13:39:10 -06:00
|
|
|
* If GList is Null, the whole option is deleted.
|
2015-06-12 17:19:45 -05:00
|
|
|
*/
|
2016-11-28 13:39:10 -06:00
|
|
|
void qof_book_options_delete (QofBook *book, GSList *path);
|
2015-07-03 18:14:00 -05:00
|
|
|
/** @} End of Doxygen Include */
|
2005-11-07 09:45:58 -06:00
|
|
|
/** deprecated */
|
2007-06-25 12:18:28 -05:00
|
|
|
#define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X))
|
2005-11-07 09:45:58 -06:00
|
|
|
|
2010-01-08 22:54:02 -06:00
|
|
|
#endif /* SWIG */
|
2014-04-25 15:41:11 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2010-01-08 22:54:02 -06:00
|
|
|
|
2005-11-07 09:45:58 -06:00
|
|
|
#endif /* QOF_BOOK_H */
|
|
|
|
/** @} */
|
|
|
|
/** @} */
|