|
|
|
|
@ -66,30 +66,30 @@ static QofLogModule log_module = QOF_MOD_ENGINE;
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
|
|
|
|
// PROP_ROOT_ACCOUNT, /* Table */
|
|
|
|
|
// PROP_ROOT_TEMPLATE, /* Table */
|
|
|
|
|
// PROP_ROOT_ACCOUNT, /* Table */
|
|
|
|
|
// PROP_ROOT_TEMPLATE, /* Table */
|
|
|
|
|
/* keep trading accounts property, while adding book-currency, default gains
|
|
|
|
|
policy and default gains account properties, so that files prior to 2.7 can
|
|
|
|
|
be read/processed; GUI changed to use all four properties as of 2.7.
|
|
|
|
|
Trading accounts, on the one hand, and book-currency plus default-gains-
|
|
|
|
|
policy, and optionally, default gains account, on the other, are mutually
|
|
|
|
|
exclusive */
|
|
|
|
|
PROP_OPT_TRADING_ACCOUNTS, /* KVP */
|
|
|
|
|
PROP_OPT_TRADING_ACCOUNTS, /* KVP */
|
|
|
|
|
/* Book currency and default gains policy properties only apply if currency
|
|
|
|
|
accounting method selected in GUI is 'book-currency'; both required and
|
|
|
|
|
both are exclusive with trading accounts */
|
|
|
|
|
PROP_OPT_BOOK_CURRENCY, /* KVP */
|
|
|
|
|
PROP_OPT_DEFAULT_GAINS_POLICY, /* KVP */
|
|
|
|
|
PROP_OPT_BOOK_CURRENCY, /* KVP */
|
|
|
|
|
PROP_OPT_DEFAULT_GAINS_POLICY, /* KVP */
|
|
|
|
|
/* Default gains account property only applies if currency accounting method
|
|
|
|
|
selected in GUI is 'book-currency'; its use is optional but exclusive with
|
|
|
|
|
trading accounts */
|
|
|
|
|
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID, /* KVP */
|
|
|
|
|
PROP_OPT_AUTO_READONLY_DAYS,/* KVP */
|
|
|
|
|
PROP_OPT_NUM_FIELD_SOURCE, /* KVP */
|
|
|
|
|
PROP_OPT_DEFAULT_BUDGET, /* KVP */
|
|
|
|
|
PROP_OPT_FY_END, /* KVP */
|
|
|
|
|
PROP_AB_TEMPLATES, /* KVP */
|
|
|
|
|
N_PROPERTIES /* Just a counter */
|
|
|
|
|
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID, /* KVP */
|
|
|
|
|
PROP_OPT_AUTO_READONLY_DAYS, /* KVP */
|
|
|
|
|
PROP_OPT_NUM_FIELD_SOURCE, /* KVP */
|
|
|
|
|
PROP_OPT_DEFAULT_BUDGET, /* KVP */
|
|
|
|
|
PROP_OPT_FY_END, /* KVP */
|
|
|
|
|
PROP_AB_TEMPLATES, /* KVP */
|
|
|
|
|
N_PROPERTIES /* Just a counter */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
@ -167,9 +167,9 @@ static const std::string str_OPTION_NAME_NUM_FIELD_SOURCE(OPTION_NAME_NUM_FIELD_
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
qof_book_get_property (GObject* object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue* value,
|
|
|
|
|
GParamSpec* pspec)
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue* value,
|
|
|
|
|
GParamSpec* pspec)
|
|
|
|
|
{
|
|
|
|
|
QofBook *book;
|
|
|
|
|
gchar *key;
|
|
|
|
|
@ -221,9 +221,9 @@ qof_book_get_property (GObject* object,
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
qof_book_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
QofBook *book;
|
|
|
|
|
gchar *key;
|
|
|
|
|
@ -288,9 +288,9 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
PROP_OPT_TRADING_ACCOUNTS,
|
|
|
|
|
g_param_spec_string("trading-accts",
|
|
|
|
|
"Use Trading Accounts",
|
|
|
|
|
"Scheme true ('t') or NULL. If 't', then the book "
|
|
|
|
|
"uses trading accounts for managing multiple-currency "
|
|
|
|
|
"transactions.",
|
|
|
|
|
"Scheme true ('t') or NULL. If 't', then the book "
|
|
|
|
|
"uses trading accounts for managing multiple-currency "
|
|
|
|
|
"transactions.",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
@ -299,9 +299,9 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
PROP_OPT_BOOK_CURRENCY,
|
|
|
|
|
g_param_spec_string("book-currency",
|
|
|
|
|
"Select Book Currency",
|
|
|
|
|
"The reference currency used to manage multiple-currency "
|
|
|
|
|
"transactions when 'book-currency' currency accounting method "
|
|
|
|
|
"selected; requires valid default gains/loss policy.",
|
|
|
|
|
"The reference currency used to manage multiple-currency "
|
|
|
|
|
"transactions when 'book-currency' currency accounting method "
|
|
|
|
|
"selected; requires valid default gains/loss policy.",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
@ -310,10 +310,10 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
PROP_OPT_DEFAULT_GAINS_POLICY,
|
|
|
|
|
g_param_spec_string("default-gains-policy",
|
|
|
|
|
"Select Default Gains Policy",
|
|
|
|
|
"The default policy to be used to calculate gains/losses on "
|
|
|
|
|
"dispositions of currencies/commodities other than "
|
|
|
|
|
"'book-currency' when 'book-currency' currency accounting "
|
|
|
|
|
"method selected; requires valid book-currency.",
|
|
|
|
|
"The default policy to be used to calculate gains/losses on "
|
|
|
|
|
"dispositions of currencies/commodities other than "
|
|
|
|
|
"'book-currency' when 'book-currency' currency accounting "
|
|
|
|
|
"method selected; requires valid book-currency.",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
@ -322,10 +322,10 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID,
|
|
|
|
|
g_param_spec_boxed("default-gain-loss-account-guid",
|
|
|
|
|
"Select Default Gain/Loss Account",
|
|
|
|
|
"The default account to be used for calculated gains/losses on "
|
|
|
|
|
"dispositions of currencies/commodities other than "
|
|
|
|
|
"'book-currency' when 'book-currency' currency accounting "
|
|
|
|
|
"method selected; requires valid book-currency.",
|
|
|
|
|
"The default account to be used for calculated gains/losses on "
|
|
|
|
|
"dispositions of currencies/commodities other than "
|
|
|
|
|
"'book-currency' when 'book-currency' currency accounting "
|
|
|
|
|
"method selected; requires valid book-currency.",
|
|
|
|
|
GNC_TYPE_GUID,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
@ -334,8 +334,8 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
PROP_OPT_NUM_FIELD_SOURCE,
|
|
|
|
|
g_param_spec_string(PARAM_NAME_NUM_FIELD_SOURCE,
|
|
|
|
|
"Use Split-Action in the Num Field",
|
|
|
|
|
"Scheme true ('t') or NULL. If 't', then the book "
|
|
|
|
|
"will put the split action value in the Num field.",
|
|
|
|
|
"Scheme true ('t') or NULL. If 't', then the book "
|
|
|
|
|
"will put the split action value in the Num field.",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
@ -344,11 +344,11 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
PROP_OPT_AUTO_READONLY_DAYS,
|
|
|
|
|
g_param_spec_double("autoreadonly-days",
|
|
|
|
|
"Transaction Auto-read-only Days",
|
|
|
|
|
"Prevent editing of transactions posted more than "
|
|
|
|
|
"this many days ago.",
|
|
|
|
|
0,
|
|
|
|
|
"Prevent editing of transactions posted more than "
|
|
|
|
|
"this many days ago.",
|
|
|
|
|
0,
|
|
|
|
|
G_MAXDOUBLE,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
@ -365,7 +365,7 @@ qof_book_class_init (QofBookClass *klass)
|
|
|
|
|
g_param_spec_boxed("fy-end",
|
|
|
|
|
"Book Fiscal Year End",
|
|
|
|
|
"A GDate with a bogus year having the last Month and "
|
|
|
|
|
"Day of the Fiscal year for the book.",
|
|
|
|
|
"Day of the Fiscal year for the book.",
|
|
|
|
|
G_TYPE_DATE,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
@ -561,7 +561,7 @@ qof_book_set_data_fin (QofBook *book, const char *key, gpointer data, QofBookFin
|
|
|
|
|
|
|
|
|
|
if (!cb) return;
|
|
|
|
|
g_hash_table_insert (book->data_table_finalizers, (gpointer)key,
|
|
|
|
|
reinterpret_cast<void*>(cb));
|
|
|
|
|
reinterpret_cast<void*>(cb));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gpointer
|
|
|
|
|
@ -979,8 +979,8 @@ qof_book_get_book_currency_name (QofBook *book)
|
|
|
|
|
{
|
|
|
|
|
const gchar *opt = NULL;
|
|
|
|
|
qof_instance_get (QOF_INSTANCE (book),
|
|
|
|
|
"book-currency", &opt,
|
|
|
|
|
NULL);
|
|
|
|
|
"book-currency", &opt,
|
|
|
|
|
NULL);
|
|
|
|
|
return opt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -994,8 +994,8 @@ qof_book_get_default_gains_policy (QofBook *book)
|
|
|
|
|
{
|
|
|
|
|
const gchar *opt = NULL;
|
|
|
|
|
qof_instance_get (QOF_INSTANCE (book),
|
|
|
|
|
"default-gains-policy", &opt,
|
|
|
|
|
NULL);
|
|
|
|
|
"default-gains-policy", &opt,
|
|
|
|
|
NULL);
|
|
|
|
|
return opt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1009,8 +1009,8 @@ qof_book_get_default_gain_loss_acct_guid (QofBook *book)
|
|
|
|
|
{
|
|
|
|
|
GncGUID *guid = NULL;
|
|
|
|
|
qof_instance_get (QOF_INSTANCE (book),
|
|
|
|
|
"default-gain-loss-account-guid", &guid,
|
|
|
|
|
NULL);
|
|
|
|
|
"default-gain-loss-account-guid", &guid,
|
|
|
|
|
NULL);
|
|
|
|
|
return guid;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1021,8 +1021,8 @@ qof_book_use_trading_accounts (const QofBook *book)
|
|
|
|
|
{
|
|
|
|
|
const char *opt = NULL;
|
|
|
|
|
qof_instance_get (QOF_INSTANCE (book),
|
|
|
|
|
"trading-accts", &opt,
|
|
|
|
|
NULL);
|
|
|
|
|
"trading-accts", &opt,
|
|
|
|
|
NULL);
|
|
|
|
|
if (opt && opt[0] == 't' && opt[1] == 0)
|
|
|
|
|
return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
@ -1225,7 +1225,7 @@ qof_book_load_options (QofBook *book, GNCOptionLoad load_cb, GNCOptionDB *odb)
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
qof_book_save_options (QofBook *book, GNCOptionSave save_cb,
|
|
|
|
|
GNCOptionDB* odb, gboolean clear)
|
|
|
|
|
GNCOptionDB* odb, gboolean clear)
|
|
|
|
|
{
|
|
|
|
|
/* Wrap this in begin/commit so that it commits only once instead of doing
|
|
|
|
|
* so for every option. Qof_book_set_option will take care of dirtying the
|
|
|
|
|
|