2005-11-01 21:32:36 -06:00
|
|
|
/********************************************************************\
|
2006-02-03 15:29:06 -06:00
|
|
|
* gnc-budget.c -- Implementation of the top level Budgeting API. *
|
2005-11-01 21:32:36 -06:00
|
|
|
* Copyright (C) 04 sep 2003 Darin Willits <darin@willits.ca> *
|
2006-02-03 15:29:06 -06:00
|
|
|
* Copyright (C) 2005-2006 Chris Shoemaker <c.shoemaker@cox.net> *
|
2005-11-01 21:32:36 -06:00
|
|
|
* *
|
|
|
|
* 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-01 21:32:36 -06:00
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2014-05-07 08:37:14 -05:00
|
|
|
#include <config.h>
|
2005-11-01 21:32:36 -06:00
|
|
|
#include <glib.h>
|
|
|
|
#include <glib/gprintf.h>
|
2005-12-23 16:19:08 -06:00
|
|
|
#include <glib/gi18n.h>
|
2006-02-04 09:12:09 -06:00
|
|
|
#include <time.h>
|
2014-05-07 08:37:14 -05:00
|
|
|
#include <qof.h>
|
|
|
|
#include <qofbookslots.h>
|
|
|
|
#include <gnc-gdate-utils.h>
|
|
|
|
#include <qofinstance-p.h>
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
#include "Account.h"
|
|
|
|
|
|
|
|
#include "gnc-budget.h"
|
|
|
|
#include "gnc-commodity.h"
|
|
|
|
|
|
|
|
static QofLogModule log_module = GNC_MOD_ENGINE;
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2014-05-07 08:37:14 -05:00
|
|
|
PROP_NAME, /* Table */
|
|
|
|
PROP_DESCRIPTION, /* Table */
|
|
|
|
PROP_NUM_PERIODS, /* Table */
|
|
|
|
PROP_RUNTIME_0,
|
|
|
|
PROP_RECURRENCE, /* Cached pointer; Recurrence table holds budget guid */
|
2008-08-01 11:02:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct budget_s
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
QofInstance inst;
|
2008-08-01 11:02:07 -05:00
|
|
|
};
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
typedef struct
|
|
|
|
{
|
2008-08-01 11:02:07 -05:00
|
|
|
QofInstanceClass parent_class;
|
|
|
|
} BudgetClass;
|
2005-11-01 21:32:36 -06:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
typedef struct BudgetPrivate
|
|
|
|
{
|
2008-08-01 11:02:07 -05:00
|
|
|
/* The name is an arbitrary string assigned by the user. */
|
2005-11-01 21:32:36 -06:00
|
|
|
gchar* name;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
/* The description is an arbitrary string assigned by the user. */
|
2005-11-01 21:32:36 -06:00
|
|
|
gchar* description;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
/* Recurrence (period info) for the budget */
|
2005-11-01 21:32:36 -06:00
|
|
|
Recurrence recurrence;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
/* Number of periods */
|
2005-11-01 21:32:36 -06:00
|
|
|
guint num_periods;
|
2008-08-01 11:02:07 -05:00
|
|
|
} BudgetPrivate;
|
|
|
|
|
|
|
|
#define GET_PRIVATE(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_BUDGET, BudgetPrivate))
|
2005-11-01 21:32:36 -06:00
|
|
|
|
2007-04-04 19:24:09 -05:00
|
|
|
struct _GncBudgetClass
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
QofInstanceClass parent_class;
|
2007-04-04 19:24:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/* GObject Initialization */
|
2008-08-01 11:02:07 -05:00
|
|
|
G_DEFINE_TYPE(GncBudget, gnc_budget, QOF_TYPE_INSTANCE)
|
2007-04-04 19:24:09 -05:00
|
|
|
|
|
|
|
static void
|
|
|
|
gnc_budget_init(GncBudget* budget)
|
|
|
|
{
|
2008-08-01 11:02:07 -05:00
|
|
|
BudgetPrivate* priv;
|
|
|
|
GDate date;
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
priv = GET_PRIVATE(budget);
|
|
|
|
priv->name = CACHE_INSERT(_("Unnamed Budget"));
|
|
|
|
priv->description = CACHE_INSERT("");
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
priv->num_periods = 12;
|
2012-12-01 16:44:53 -06:00
|
|
|
gnc_gdate_set_today (&date);
|
2010-03-02 15:40:28 -06:00
|
|
|
g_date_subtract_days(&date, g_date_get_day(&date) - 1);
|
2008-11-26 15:17:30 -06:00
|
|
|
recurrenceSet(&priv->recurrence, 1, PERIOD_MONTH, &date, WEEKEND_ADJ_NONE);
|
2008-08-01 11:02:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gnc_budget_dispose (GObject *budgetp)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS(gnc_budget_parent_class)->dispose(budgetp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gnc_budget_finalize(GObject* budgetp)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS(gnc_budget_parent_class)->finalize(budgetp);
|
2007-04-04 19:24:09 -05:00
|
|
|
}
|
|
|
|
|
2007-04-04 22:10:26 -05:00
|
|
|
static void
|
2008-08-01 11:02:07 -05:00
|
|
|
gnc_budget_get_property( GObject* object,
|
2010-03-02 15:40:28 -06:00
|
|
|
guint prop_id,
|
|
|
|
GValue* value,
|
|
|
|
GParamSpec* pspec)
|
2007-04-04 22:10:26 -05:00
|
|
|
{
|
2008-08-01 11:02:07 -05:00
|
|
|
GncBudget* budget;
|
2010-03-02 15:40:28 -06:00
|
|
|
BudgetPrivate* priv;
|
|
|
|
|
|
|
|
g_return_if_fail(GNC_IS_BUDGET(object));
|
|
|
|
|
|
|
|
budget = GNC_BUDGET(object);
|
|
|
|
priv = GET_PRIVATE(budget);
|
|
|
|
switch ( prop_id )
|
|
|
|
{
|
|
|
|
case PROP_NAME:
|
|
|
|
g_value_set_string(value, priv->name);
|
|
|
|
break;
|
|
|
|
case PROP_DESCRIPTION:
|
|
|
|
g_value_set_string(value, priv->description);
|
|
|
|
break;
|
|
|
|
case PROP_NUM_PERIODS:
|
|
|
|
g_value_set_uint(value, priv->num_periods);
|
|
|
|
break;
|
|
|
|
case PROP_RECURRENCE:
|
|
|
|
/* TODO: Make this a BOXED type */
|
|
|
|
g_value_set_pointer(value, &priv->recurrence);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2007-04-04 22:10:26 -05:00
|
|
|
}
|
|
|
|
|
2007-04-04 19:24:09 -05:00
|
|
|
static void
|
2008-08-01 11:02:07 -05:00
|
|
|
gnc_budget_set_property( GObject* object,
|
2010-03-02 15:40:28 -06:00
|
|
|
guint prop_id,
|
|
|
|
const GValue* value,
|
|
|
|
GParamSpec* pspec)
|
2007-04-04 19:24:09 -05:00
|
|
|
{
|
2008-08-01 11:02:07 -05:00
|
|
|
GncBudget* budget;
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
g_return_if_fail(GNC_IS_BUDGET(object));
|
|
|
|
|
|
|
|
budget = GNC_BUDGET(object);
|
2014-05-07 08:37:14 -05:00
|
|
|
if (prop_id < PROP_RUNTIME_0)
|
|
|
|
g_assert (qof_instance_get_editlevel(budget));
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
switch ( prop_id )
|
|
|
|
{
|
|
|
|
case PROP_NAME:
|
|
|
|
gnc_budget_set_name(budget, g_value_get_string(value));
|
|
|
|
break;
|
|
|
|
case PROP_DESCRIPTION:
|
|
|
|
gnc_budget_set_description(budget, g_value_get_string(value));
|
|
|
|
break;
|
|
|
|
case PROP_NUM_PERIODS:
|
|
|
|
gnc_budget_set_num_periods(budget, g_value_get_uint(value));
|
|
|
|
break;
|
|
|
|
case PROP_RECURRENCE:
|
|
|
|
gnc_budget_set_recurrence(budget, g_value_get_pointer(value));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2008-08-01 11:02:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gnc_budget_class_init(GncBudgetClass* klass)
|
|
|
|
{
|
|
|
|
GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
gobject_class->dispose = gnc_budget_dispose;
|
|
|
|
gobject_class->finalize = gnc_budget_finalize;
|
|
|
|
gobject_class->get_property = gnc_budget_get_property;
|
|
|
|
gobject_class->set_property = gnc_budget_set_property;
|
|
|
|
|
|
|
|
g_type_class_add_private(klass, sizeof(BudgetPrivate));
|
|
|
|
|
|
|
|
g_object_class_install_property(
|
|
|
|
gobject_class,
|
|
|
|
PROP_NAME,
|
|
|
|
g_param_spec_string( "name",
|
|
|
|
"Budget Name",
|
|
|
|
"The name is an arbitrary string "
|
|
|
|
"assigned by the user. It is intended "
|
|
|
|
"to be a short, 5 to 30 character long string "
|
|
|
|
"that is displayed by the GUI as the "
|
|
|
|
"budget mnemonic",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
g_object_class_install_property(
|
|
|
|
gobject_class,
|
|
|
|
PROP_DESCRIPTION,
|
|
|
|
g_param_spec_string( "description",
|
|
|
|
"Budget Description",
|
|
|
|
"The description is an arbitrary string "
|
|
|
|
"assigned by the user. It is intended "
|
|
|
|
"to be a longer, 1-5 sentence description of "
|
|
|
|
"what the budget is all about.",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
g_object_class_install_property(
|
|
|
|
gobject_class,
|
|
|
|
PROP_NUM_PERIODS,
|
|
|
|
g_param_spec_uint( "num-periods",
|
|
|
|
"Number of Periods",
|
|
|
|
"The number of periods for this budget.",
|
|
|
|
0,
|
|
|
|
G_MAXUINT32,
|
|
|
|
12,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
g_object_class_install_property(
|
|
|
|
gobject_class,
|
|
|
|
PROP_RECURRENCE,
|
|
|
|
g_param_spec_pointer( "recurrence",
|
|
|
|
"Budget Recurrence",
|
|
|
|
"about.",
|
|
|
|
G_PARAM_READWRITE));
|
2007-04-04 19:24:09 -05:00
|
|
|
}
|
|
|
|
|
2006-11-29 09:13:02 -06:00
|
|
|
static void commit_err (QofInstance *inst, QofBackendError errcode)
|
2006-05-07 21:54:03 -05:00
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
PERR ("Failed to commit: %d", errcode);
|
|
|
|
gnc_engine_signal_commit_error( errcode );
|
2006-05-07 21:54:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gnc_budget_free(QofInstance *inst)
|
|
|
|
{
|
2008-08-01 11:02:07 -05:00
|
|
|
GncBudget *budget;
|
2010-03-02 15:40:28 -06:00
|
|
|
BudgetPrivate* priv;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
|
|
|
if (inst == NULL)
|
2006-05-07 21:54:03 -05:00
|
|
|
return;
|
2008-08-01 11:02:07 -05:00
|
|
|
g_return_if_fail(GNC_IS_BUDGET(inst));
|
2006-05-07 21:54:03 -05:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
budget = GNC_BUDGET(inst);
|
|
|
|
priv = GET_PRIVATE(budget);
|
2006-05-07 21:54:03 -05:00
|
|
|
|
|
|
|
/* We first send the message that this object is about to be
|
|
|
|
* destroyed so that any GUI elements can remove it before it is
|
|
|
|
* actually gone. */
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_DESTROY, NULL);
|
2006-05-07 21:54:03 -05:00
|
|
|
|
2008-08-01 11:02:07 -05:00
|
|
|
CACHE_REMOVE(priv->name);
|
|
|
|
CACHE_REMOVE(priv->description);
|
2006-05-07 21:54:03 -05:00
|
|
|
|
2007-04-04 19:24:09 -05:00
|
|
|
/* qof_instance_release (&budget->inst); */
|
|
|
|
g_object_unref(budget);
|
2006-05-07 21:54:03 -05:00
|
|
|
}
|
|
|
|
|
2006-11-29 09:13:02 -06:00
|
|
|
static void noop (QofInstance *inst) {}
|
2006-05-07 21:54:03 -05:00
|
|
|
|
2007-04-09 18:26:43 -05:00
|
|
|
void
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(GncBudget *bgt)
|
|
|
|
{
|
|
|
|
qof_begin_edit(QOF_INSTANCE(bgt));
|
|
|
|
}
|
|
|
|
|
2007-04-09 18:26:43 -05:00
|
|
|
void
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(GncBudget *bgt)
|
|
|
|
{
|
|
|
|
if (!qof_commit_edit(QOF_INSTANCE(bgt))) return;
|
2010-02-20 07:57:10 -06:00
|
|
|
qof_commit_edit_part2(QOF_INSTANCE(bgt), commit_err,
|
2006-05-07 21:54:03 -05:00
|
|
|
noop, gnc_budget_free);
|
|
|
|
}
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
GncBudget*
|
|
|
|
gnc_budget_new(QofBook *book)
|
|
|
|
{
|
|
|
|
GncBudget* budget;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
g_return_val_if_fail(book, NULL);
|
|
|
|
|
|
|
|
ENTER(" ");
|
2007-04-04 19:24:09 -05:00
|
|
|
budget = g_object_new(GNC_TYPE_BUDGET, NULL);
|
|
|
|
qof_instance_init_data (&budget->inst, GNC_ID_BUDGET, book);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_CREATE , NULL);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
LEAVE(" ");
|
|
|
|
return budget;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_destroy(GncBudget *budget)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
g_return_if_fail(GNC_IS_BUDGET(budget));
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(budget);
|
2006-05-02 21:28:18 -05:00
|
|
|
qof_instance_set_dirty(&budget->inst);
|
2007-04-30 00:33:33 -05:00
|
|
|
qof_instance_set_destroying(budget, TRUE);
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(budget);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
2011-01-07 11:45:18 -06:00
|
|
|
/** Data structure for containing info while cloning budget values */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const GncBudget* old_b;
|
|
|
|
GncBudget* new_b;
|
|
|
|
guint num_periods;
|
|
|
|
} CloneBudgetData_t;
|
|
|
|
|
|
|
|
static void
|
|
|
|
clone_budget_values_cb(Account* a, gpointer user_data)
|
|
|
|
{
|
|
|
|
CloneBudgetData_t* data = (CloneBudgetData_t*)user_data;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for ( i = 0; i < data->num_periods; ++i )
|
|
|
|
{
|
|
|
|
if ( gnc_budget_is_account_period_value_set(data->old_b, a, i) )
|
|
|
|
{
|
|
|
|
gnc_budget_set_account_period_value(data->new_b, a, i,
|
2011-01-24 08:10:09 -06:00
|
|
|
gnc_budget_get_account_period_value(data->old_b, a, i));
|
2011-01-07 11:45:18 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GncBudget*
|
|
|
|
gnc_budget_clone(const GncBudget* old_b)
|
|
|
|
{
|
|
|
|
GncBudget* new_b;
|
|
|
|
Account* root;
|
|
|
|
CloneBudgetData_t clone_data;
|
|
|
|
|
|
|
|
g_return_val_if_fail(old_b != NULL, NULL);
|
|
|
|
|
|
|
|
ENTER(" ");
|
|
|
|
|
|
|
|
new_b = gnc_budget_new(qof_instance_get_book(old_b));
|
|
|
|
gnc_budget_begin_edit(new_b);
|
|
|
|
gnc_budget_set_name(new_b, gnc_budget_get_name(old_b));
|
|
|
|
gnc_budget_set_description(new_b, gnc_budget_get_description(old_b));
|
|
|
|
gnc_budget_set_recurrence(new_b, gnc_budget_get_recurrence(old_b));
|
|
|
|
gnc_budget_set_num_periods(new_b, gnc_budget_get_num_periods(old_b));
|
|
|
|
|
|
|
|
root = gnc_book_get_root_account(qof_instance_get_book(old_b));
|
|
|
|
clone_data.old_b = old_b;
|
|
|
|
clone_data.new_b = new_b;
|
|
|
|
clone_data.num_periods = gnc_budget_get_num_periods(new_b);
|
|
|
|
gnc_account_foreach_descendant(root, clone_budget_values_cb, &clone_data);
|
|
|
|
|
|
|
|
gnc_budget_commit_edit(new_b);
|
|
|
|
|
|
|
|
LEAVE(" ");
|
|
|
|
|
|
|
|
return new_b;
|
|
|
|
}
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
void
|
|
|
|
gnc_budget_set_name(GncBudget* budget, const gchar* name)
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
BudgetPrivate* priv;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2006-02-03 15:29:06 -06:00
|
|
|
g_return_if_fail(GNC_IS_BUDGET(budget) && name);
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
priv = GET_PRIVATE(budget);
|
|
|
|
if ( name == priv->name ) return;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(budget);
|
2008-08-01 11:02:07 -05:00
|
|
|
CACHE_REPLACE(priv->name, name);
|
2006-05-02 21:28:18 -05:00
|
|
|
qof_instance_set_dirty(&budget->inst);
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(budget);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const gchar*
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_name(const GncBudget* budget)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
2008-08-01 11:02:07 -05:00
|
|
|
return GET_PRIVATE(budget)->name;
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gnc_budget_set_description(GncBudget* budget, const gchar* description)
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
BudgetPrivate* priv;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
g_return_if_fail(GNC_IS_BUDGET(budget));
|
|
|
|
g_return_if_fail(description);
|
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
priv = GET_PRIVATE(budget);
|
|
|
|
if ( description == priv->description ) return;
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(budget);
|
2008-08-01 11:02:07 -05:00
|
|
|
CACHE_REPLACE(priv->description, description);
|
2006-05-02 21:28:18 -05:00
|
|
|
qof_instance_set_dirty(&budget->inst);
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(budget);
|
2006-02-03 15:29:06 -06:00
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const gchar*
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_description(const GncBudget* budget)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
2008-08-01 11:02:07 -05:00
|
|
|
return GET_PRIVATE(budget)->description;
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gnc_budget_set_recurrence(GncBudget *budget, const Recurrence *r)
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
BudgetPrivate* priv;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
g_return_if_fail(budget && r);
|
2010-03-02 15:40:28 -06:00
|
|
|
priv = GET_PRIVATE(budget);
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(budget);
|
2008-08-01 11:02:07 -05:00
|
|
|
priv->recurrence = *r;
|
2006-05-02 21:28:18 -05:00
|
|
|
qof_instance_set_dirty(&budget->inst);
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(budget);
|
2006-02-03 15:29:06 -06:00
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen(&budget->inst, QOF_EVENT_MODIFY, NULL);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const Recurrence *
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_recurrence(const GncBudget *budget)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
g_return_val_if_fail(budget, NULL);
|
2008-08-01 11:02:07 -05:00
|
|
|
return (&GET_PRIVATE(budget)->recurrence);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
2010-03-27 16:01:21 -05:00
|
|
|
const GncGUID*
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_guid(const GncBudget* budget)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
g_return_val_if_fail(budget, NULL);
|
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
|
2007-04-01 17:18:50 -05:00
|
|
|
return qof_instance_get_guid(QOF_INSTANCE(budget));
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gnc_budget_set_num_periods(GncBudget* budget, guint num_periods)
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
BudgetPrivate* priv;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
g_return_if_fail(GNC_IS_BUDGET(budget));
|
2006-05-07 21:54:03 -05:00
|
|
|
|
2010-03-02 15:40:28 -06:00
|
|
|
priv = GET_PRIVATE(budget);
|
|
|
|
if ( priv->num_periods == num_periods ) return;
|
2008-08-01 11:02:07 -05:00
|
|
|
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(budget);
|
2008-08-01 11:02:07 -05:00
|
|
|
priv->num_periods = num_periods;
|
2006-05-02 21:28:18 -05:00
|
|
|
qof_instance_set_dirty(&budget->inst);
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(budget);
|
2006-02-03 15:29:06 -06:00
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_num_periods(const GncBudget* budget)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget), 0);
|
2008-08-01 11:02:07 -05:00
|
|
|
return GET_PRIVATE(budget)->num_periods;
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BUF_SIZE (10 + GUID_ENCODING_LENGTH + \
|
|
|
|
GNC_BUDGET_MAX_NUM_PERIODS_DIGITS)
|
|
|
|
|
2006-10-11 15:55:20 -05:00
|
|
|
/* period_num is zero-based */
|
|
|
|
/* What happens when account is deleted, after we have an entry for it? */
|
|
|
|
void
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_unset_account_period_value(GncBudget *budget, const Account *account,
|
2010-03-02 15:40:28 -06:00
|
|
|
guint period_num)
|
2006-10-11 15:55:20 -05:00
|
|
|
{
|
2010-03-27 16:01:21 -05:00
|
|
|
const GncGUID *guid;
|
2006-10-11 15:55:20 -05:00
|
|
|
KvpFrame *frame;
|
|
|
|
gchar path[BUF_SIZE];
|
|
|
|
gchar *bufend;
|
|
|
|
|
|
|
|
gnc_budget_begin_edit(budget);
|
|
|
|
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
|
|
|
guid = xaccAccountGetGUID(account);
|
|
|
|
bufend = guid_to_string_buff(guid, path);
|
|
|
|
g_sprintf(bufend, "/%d", period_num);
|
|
|
|
|
|
|
|
kvp_frame_set_value(frame, path, NULL);
|
|
|
|
qof_instance_set_dirty(&budget->inst);
|
|
|
|
gnc_budget_commit_edit(budget);
|
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
|
2006-10-11 15:55:20 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/* period_num is zero-based */
|
|
|
|
/* What happens when account is deleted, after we have an entry for it? */
|
|
|
|
void
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
|
2005-11-01 21:32:36 -06:00
|
|
|
guint period_num, gnc_numeric val)
|
|
|
|
{
|
2010-03-27 16:01:21 -05:00
|
|
|
const GncGUID *guid;
|
2005-11-01 21:32:36 -06:00
|
|
|
KvpFrame *frame;
|
|
|
|
gchar path[BUF_SIZE];
|
|
|
|
gchar *bufend;
|
|
|
|
|
2013-10-26 03:40:06 -05:00
|
|
|
/* Watch out for an off-by-one error here:
|
|
|
|
* period_num starts from 0 while num_periods starts from 1 */
|
2013-10-31 17:22:53 -05:00
|
|
|
if (period_num >= GET_PRIVATE(budget)->num_periods)
|
|
|
|
{
|
2013-10-26 03:38:44 -05:00
|
|
|
PWARN("Period %i does not exist", period_num);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_begin_edit(budget);
|
2005-11-01 21:32:36 -06:00
|
|
|
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
|
|
|
guid = xaccAccountGetGUID(account);
|
|
|
|
bufend = guid_to_string_buff(guid, path);
|
|
|
|
g_sprintf(bufend, "/%d", period_num);
|
|
|
|
|
2006-10-11 15:55:20 -05:00
|
|
|
if (gnc_numeric_check(val))
|
|
|
|
kvp_frame_set_value(frame, path, NULL);
|
|
|
|
else
|
|
|
|
kvp_frame_set_numeric(frame, path, val);
|
2006-05-02 21:28:18 -05:00
|
|
|
qof_instance_set_dirty(&budget->inst);
|
2006-05-07 21:54:03 -05:00
|
|
|
gnc_budget_commit_edit(budget);
|
2006-02-03 15:29:06 -06:00
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
qof_event_gen( &budget->inst, QOF_EVENT_MODIFY, NULL);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We don't need these here, but maybe they're useful somewhere else?
|
|
|
|
Maybe this should move to Account.h */
|
|
|
|
|
2006-10-11 15:55:20 -05:00
|
|
|
gboolean
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_is_account_period_value_set(const GncBudget *budget, const Account *account,
|
2006-10-11 15:55:20 -05:00
|
|
|
guint period_num)
|
|
|
|
{
|
|
|
|
gchar path[BUF_SIZE];
|
|
|
|
gchar *bufend;
|
|
|
|
KvpFrame *frame;
|
|
|
|
|
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget), FALSE);
|
|
|
|
g_return_val_if_fail(account, FALSE);
|
|
|
|
|
|
|
|
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
|
|
|
bufend = guid_to_string_buff(xaccAccountGetGUID(account), path);
|
|
|
|
g_sprintf(bufend, "/%d", period_num);
|
|
|
|
return (kvp_frame_get_value(frame, path) != NULL);
|
|
|
|
}
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
gnc_numeric
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_account_period_value(const GncBudget *budget, const Account *account,
|
2005-11-01 21:32:36 -06:00
|
|
|
guint period_num)
|
|
|
|
{
|
|
|
|
gnc_numeric numeric;
|
|
|
|
gchar path[BUF_SIZE];
|
|
|
|
gchar *bufend;
|
|
|
|
KvpFrame *frame;
|
|
|
|
|
|
|
|
numeric = gnc_numeric_zero();
|
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget), numeric);
|
|
|
|
g_return_val_if_fail(account, numeric);
|
|
|
|
|
|
|
|
frame = qof_instance_get_slots(QOF_INSTANCE(budget));
|
2005-11-17 22:37:26 -06:00
|
|
|
bufend = guid_to_string_buff(xaccAccountGetGUID(account), path);
|
2005-11-01 21:32:36 -06:00
|
|
|
g_sprintf(bufend, "/%d", period_num);
|
2006-10-11 15:55:20 -05:00
|
|
|
|
|
|
|
numeric = kvp_frame_get_numeric(frame, path);
|
|
|
|
/* This still returns zero if unset, but callers can check for that. */
|
2005-11-01 21:32:36 -06:00
|
|
|
return numeric;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Timespec
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_period_start_date(const GncBudget *budget, guint period_num)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
2014-10-13 15:05:18 -05:00
|
|
|
Timespec ts = {0, 0};
|
|
|
|
g_return_val_if_fail (GNC_IS_BUDGET(budget), ts);
|
2012-12-01 16:44:53 -06:00
|
|
|
timespecFromTime64(
|
|
|
|
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence,
|
2013-10-31 17:22:53 -05:00
|
|
|
period_num, FALSE));
|
2005-11-01 21:32:36 -06:00
|
|
|
return ts;
|
|
|
|
}
|
|
|
|
|
2009-10-26 15:15:18 -05:00
|
|
|
Timespec
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_get_period_end_date(const GncBudget *budget, guint period_num)
|
2009-10-26 15:15:18 -05:00
|
|
|
{
|
2014-10-13 15:05:18 -05:00
|
|
|
Timespec ts = {0, 0};
|
|
|
|
g_return_val_if_fail (GNC_IS_BUDGET(budget), ts);
|
2012-12-01 16:44:53 -06:00
|
|
|
timespecFromTime64(
|
2009-10-26 15:15:18 -05:00
|
|
|
&ts, recurrenceGetPeriodTime(&GET_PRIVATE(budget)->recurrence, period_num, TRUE));
|
|
|
|
return ts;
|
|
|
|
}
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
gnc_numeric
|
|
|
|
gnc_budget_get_account_period_actual_value(
|
2011-01-07 11:45:18 -06:00
|
|
|
const GncBudget *budget, Account *acc, guint period_num)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
// FIXME: maybe zero is not best error return val.
|
2006-02-04 09:12:09 -06:00
|
|
|
g_return_val_if_fail(GNC_IS_BUDGET(budget) && acc, gnc_numeric_zero());
|
2010-02-20 07:57:10 -06:00
|
|
|
return recurrenceGetAccountPeriodValue(&GET_PRIVATE(budget)->recurrence,
|
2006-02-04 09:12:09 -06:00
|
|
|
acc, period_num);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
GncBudget*
|
2011-01-07 11:45:18 -06:00
|
|
|
gnc_budget_lookup (const GncGUID *guid, const QofBook *book)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
QofCollection *col;
|
|
|
|
|
|
|
|
g_return_val_if_fail(guid, NULL);
|
|
|
|
g_return_val_if_fail(book, NULL);
|
|
|
|
col = qof_book_get_collection (book, GNC_ID_BUDGET);
|
|
|
|
return GNC_BUDGET(qof_collection_lookup_entity (col, guid));
|
|
|
|
}
|
|
|
|
|
2007-04-01 17:18:50 -05:00
|
|
|
static void just_get_one(QofInstance *ent, gpointer data)
|
2005-11-01 21:32:36 -06:00
|
|
|
{
|
|
|
|
GncBudget **bgt = (GncBudget**)data;
|
|
|
|
if (bgt && !*bgt) *bgt = GNC_BUDGET(ent);
|
|
|
|
}
|
|
|
|
|
|
|
|
GncBudget*
|
|
|
|
gnc_budget_get_default (QofBook *book)
|
|
|
|
{
|
|
|
|
QofCollection *col;
|
|
|
|
GncBudget *bgt = NULL;
|
2014-05-07 08:37:14 -05:00
|
|
|
const GncGUID *default_budget_guid = NULL;
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
g_return_val_if_fail(book, NULL);
|
2010-05-06 04:01:46 -05:00
|
|
|
|
|
|
|
/* See if there is a budget selected in the KVP perferences */
|
|
|
|
|
2014-05-07 08:37:14 -05:00
|
|
|
qof_instance_get (QOF_INSTANCE (book),
|
|
|
|
"default-budget", &default_budget_guid,
|
|
|
|
NULL);
|
|
|
|
if (default_budget_guid != NULL)
|
2010-06-25 13:44:40 -05:00
|
|
|
{
|
2014-05-07 08:37:14 -05:00
|
|
|
col = qof_book_get_collection(book, GNC_ID_BUDGET);
|
|
|
|
bgt = (GncBudget *) qof_collection_lookup_entity(col,
|
|
|
|
default_budget_guid);
|
2010-05-06 04:01:46 -05:00
|
|
|
}
|
|
|
|
|
2014-05-07 08:37:14 -05:00
|
|
|
/* Revert to 2.2.x behavior if the book has no default budget. */
|
2010-05-06 04:01:46 -05:00
|
|
|
|
2010-06-25 13:44:40 -05:00
|
|
|
if ( bgt == NULL )
|
|
|
|
{
|
|
|
|
col = qof_book_get_collection(book, GNC_ID_BUDGET);
|
|
|
|
if (qof_collection_count(col) > 0)
|
|
|
|
{
|
|
|
|
qof_collection_foreach(col, just_get_one, &bgt);
|
|
|
|
}
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|
2010-05-06 04:01:46 -05:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
return bgt;
|
|
|
|
}
|
|
|
|
|
2010-12-28 19:43:28 -06:00
|
|
|
static void
|
|
|
|
destroy_budget_on_book_close(QofInstance *ent, gpointer data)
|
|
|
|
{
|
|
|
|
GncBudget* bgt = GNC_BUDGET(ent);
|
|
|
|
|
|
|
|
gnc_budget_destroy(bgt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Handles book end - frees all budgets from the book
|
|
|
|
*
|
|
|
|
* @param book Book being closed
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gnc_budget_book_end(QofBook* book)
|
|
|
|
{
|
|
|
|
QofCollection *col;
|
|
|
|
|
|
|
|
col = qof_book_get_collection(book, GNC_ID_BUDGET);
|
|
|
|
qof_collection_foreach(col, destroy_budget_on_book_close, NULL);
|
|
|
|
}
|
|
|
|
|
2010-02-27 12:41:49 -06:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
/* MSVC compiler doesn't have C99 "designated initializers"
|
|
|
|
* so we wrap them in a macro that is empty on MSVC. */
|
|
|
|
# define DI(x) /* */
|
|
|
|
#else
|
|
|
|
# define DI(x) x
|
|
|
|
#endif
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/* Define the QofObject. */
|
|
|
|
static QofObject budget_object_def =
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
DI(.interface_version = ) QOF_OBJECT_VERSION,
|
|
|
|
DI(.e_type = ) GNC_ID_BUDGET,
|
|
|
|
DI(.type_label = ) "Budget",
|
|
|
|
DI(.create = ) (gpointer)gnc_budget_new,
|
|
|
|
DI(.book_begin = ) NULL,
|
2010-12-28 19:43:28 -06:00
|
|
|
DI(.book_end = ) gnc_budget_book_end,
|
2010-03-02 15:40:28 -06:00
|
|
|
DI(.is_dirty = ) qof_collection_is_dirty,
|
|
|
|
DI(.mark_clean = ) qof_collection_mark_clean,
|
|
|
|
DI(.foreach = ) qof_collection_foreach,
|
|
|
|
DI(.printable = ) (const char * (*)(gpointer)) gnc_budget_get_name,
|
|
|
|
DI(.version_cmp = ) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
2005-11-01 21:32:36 -06:00
|
|
|
};
|
|
|
|
|
2005-11-17 22:37:26 -06:00
|
|
|
|
|
|
|
/* Static wrapper getters for the recurrence params */
|
2010-02-20 07:57:10 -06:00
|
|
|
static PeriodType gnc_budget_get_rec_pt(const GncBudget *bgt)
|
2010-03-02 15:40:28 -06:00
|
|
|
{
|
|
|
|
return recurrenceGetPeriodType(&(GET_PRIVATE(bgt)->recurrence));
|
|
|
|
}
|
2010-02-20 07:57:10 -06:00
|
|
|
static guint gnc_budget_get_rec_mult(const GncBudget *bgt)
|
2010-03-02 15:40:28 -06:00
|
|
|
{
|
|
|
|
return recurrenceGetMultiplier(&(GET_PRIVATE(bgt)->recurrence));
|
|
|
|
}
|
2010-02-20 07:57:10 -06:00
|
|
|
static GDate gnc_budget_get_rec_date(const GncBudget *bgt)
|
2010-03-02 15:40:28 -06:00
|
|
|
{
|
|
|
|
return recurrenceGetDate(&(GET_PRIVATE(bgt)->recurrence));
|
|
|
|
}
|
2005-11-17 22:37:26 -06:00
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/* Register ourselves with the engine. */
|
|
|
|
gboolean gnc_budget_register (void)
|
|
|
|
{
|
2010-03-02 15:40:28 -06:00
|
|
|
static QofParam params[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"name", QOF_TYPE_STRING,
|
|
|
|
(QofAccessFunc) gnc_budget_get_name,
|
|
|
|
(QofSetterFunc) gnc_budget_set_name
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description", QOF_TYPE_STRING,
|
|
|
|
(QofAccessFunc) gnc_budget_get_description,
|
|
|
|
(QofSetterFunc) gnc_budget_set_description
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"recurrence_period_type", QOF_TYPE_INT32,
|
|
|
|
(QofAccessFunc) gnc_budget_get_rec_pt, NULL
|
|
|
|
},
|
2005-11-17 22:37:26 -06:00
|
|
|
/* Signedness problem: Should be unsigned. */
|
2010-03-02 15:40:28 -06:00
|
|
|
{
|
|
|
|
"recurrence_multiplier", QOF_TYPE_INT32,
|
|
|
|
(QofAccessFunc) gnc_budget_get_rec_mult, NULL
|
|
|
|
},
|
2005-11-17 22:37:26 -06:00
|
|
|
/* This is the same way that SchedXaction.c uses QOF_TYPE_DATE
|
|
|
|
but I don't think QOF actually supports a GDate, so I think
|
|
|
|
this is wrong. */
|
2010-03-02 15:40:28 -06:00
|
|
|
{
|
|
|
|
"recurrence_date", QOF_TYPE_DATE,
|
|
|
|
(QofAccessFunc) gnc_budget_get_rec_date, NULL
|
|
|
|
},
|
2005-11-17 22:37:26 -06:00
|
|
|
/* Signedness problem: Should be unsigned. */
|
2010-03-02 15:40:28 -06:00
|
|
|
{
|
|
|
|
"num_periods", QOF_TYPE_INT32,
|
|
|
|
(QofAccessFunc) gnc_budget_get_num_periods,
|
|
|
|
(QofSetterFunc) gnc_budget_set_num_periods
|
|
|
|
},
|
|
|
|
{
|
|
|
|
QOF_PARAM_BOOK, QOF_ID_BOOK,
|
|
|
|
(QofAccessFunc) qof_instance_get_book, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
QOF_PARAM_GUID, QOF_TYPE_GUID,
|
|
|
|
(QofAccessFunc) qof_instance_get_guid, NULL
|
|
|
|
},
|
2005-11-17 22:37:26 -06:00
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
qof_class_register(GNC_ID_BUDGET, (QofSortFunc) NULL, params);
|
|
|
|
return qof_object_register(&budget_object_def);
|
2005-11-01 21:32:36 -06:00
|
|
|
}
|