mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 21:19:16 -06:00
shuffling to get periods to work
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9478 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ae5bc7217d
commit
fa3805db4c
@ -72,7 +72,8 @@ static short module = MOD_BUSINESS;
|
||||
static void add_or_rem_object (GncBillTerm *term, gboolean add);
|
||||
static void maybe_resort_list (GncBillTerm *term);
|
||||
|
||||
static void gncBillTermRemoveChild (GncBillTerm *table, GncBillTerm *child);
|
||||
/* ============================================================== */
|
||||
/* Misc inl;ine utilities */
|
||||
|
||||
G_INLINE_FUNC void mark_term (GncBillTerm *term);
|
||||
G_INLINE_FUNC void
|
||||
@ -96,6 +97,29 @@ static inline void remObj (GncBillTerm *term)
|
||||
add_or_rem_object (term, FALSE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gncBillTermAddChild (GncBillTerm *table, GncBillTerm *child)
|
||||
{
|
||||
g_return_if_fail(table);
|
||||
g_return_if_fail(child);
|
||||
g_return_if_fail(table->inst.do_free == FALSE);
|
||||
|
||||
table->children = g_list_prepend(table->children, child);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gncBillTermRemoveChild (GncBillTerm *table, GncBillTerm *child)
|
||||
{
|
||||
g_return_if_fail(table);
|
||||
g_return_if_fail(child);
|
||||
|
||||
if (table->inst.do_free)
|
||||
return;
|
||||
|
||||
table->children = g_list_remove(table->children, child);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
|
||||
/* Create/Destroy Functions */
|
||||
GncBillTerm * gncBillTermCreate (QofBook *book)
|
||||
@ -151,29 +175,37 @@ static void gncBillTermFree (GncBillTerm *term)
|
||||
g_free (term);
|
||||
}
|
||||
|
||||
static void
|
||||
gncBillTermAddChild (GncBillTerm *table, GncBillTerm *child)
|
||||
{
|
||||
g_return_if_fail(table);
|
||||
g_return_if_fail(child);
|
||||
g_return_if_fail(table->inst.do_free == FALSE);
|
||||
|
||||
table->children = g_list_prepend(table->children, child);
|
||||
}
|
||||
|
||||
static void
|
||||
gncBillTermRemoveChild (GncBillTerm *table, GncBillTerm *child)
|
||||
{
|
||||
g_return_if_fail(table);
|
||||
g_return_if_fail(child);
|
||||
|
||||
if (table->inst.do_free)
|
||||
return;
|
||||
|
||||
table->children = g_list_remove(table->children, child);
|
||||
GncBillTerm *
|
||||
gncCloneBillTerm (GncBillTerm *from, QofBook *book)
|
||||
{
|
||||
GncBillTerm *term;
|
||||
|
||||
if (!book) return NULL;
|
||||
|
||||
term = g_new0 (GncBillTerm, 1);
|
||||
qof_instance_init(&term->inst, book);
|
||||
qof_instance_gemini (&term->inst, &from->inst);
|
||||
|
||||
term->name = CACHE_INSERT (from->name);
|
||||
term->desc = CACHE_INSERT (from->desc);
|
||||
term->type = from->type;
|
||||
term->due_days = from->due_days;
|
||||
term->disc_days = from->disc_days;
|
||||
term->discount = from->discount;
|
||||
term->cutoff = from->cutoff;
|
||||
|
||||
/** xxx I don't know what to do about parent, children, disconnect ...
|
||||
* FIXME XXX */
|
||||
|
||||
addObj (term);
|
||||
gnc_engine_generate_event (&term->inst.guid, _GNC_MOD_NAME, GNC_EVENT_CREATE);
|
||||
return term;
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
/* Set Functions */
|
||||
|
||||
void gncBillTermSetGUID (GncBillTerm *term, const GUID *guid)
|
||||
{
|
||||
if (!term || !guid) return;
|
||||
|
@ -1,6 +1,28 @@
|
||||
/********************************************************************\
|
||||
* gncBillTermP.h -- the Gnucash Billing Term private interface *
|
||||
* *
|
||||
* 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 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
/*
|
||||
* gncBillTermP.h -- the Gnucash Billing Term interface: private interface
|
||||
* Copyright (C) 2002 Derek Atkins
|
||||
* Copyright (C) 2003 Linas Vepstas <linas@linas.org>
|
||||
* Author: Derek Atkins <warlord@MIT.EDU>
|
||||
*/
|
||||
|
||||
@ -19,4 +41,14 @@ void gncBillTermMakeInvisible (GncBillTerm *term);
|
||||
|
||||
gboolean gncBillTermGetInvisible (GncBillTerm *term);
|
||||
|
||||
/** The gncCloneBillTerm() routine makes a copy of the indicated
|
||||
* bill term, placing it in the indicated book. It copies
|
||||
* the etc.
|
||||
* It does not copy parent/child relationships ???
|
||||
* XXX the above need fixin....
|
||||
* It then adds a pair of 'gemini' kvp pointers so that each copy
|
||||
* can be found from the other.
|
||||
*/
|
||||
|
||||
GncBillTerm * gncCloneBillTerm (GncBillTerm *from, QofBook *);
|
||||
#endif /* GNC_BILLTERMP_H_ */
|
||||
|
@ -77,11 +77,21 @@ static short module = MOD_BUSINESS;
|
||||
|
||||
#define _GNC_MOD_NAME GNC_CUSTOMER_MODULE_NAME
|
||||
|
||||
/* ============================================================== */
|
||||
/* misc inline funcs */
|
||||
|
||||
#define CACHE_INSERT(str) g_cache_insert(gnc_engine_get_string_cache(), (gpointer)(str));
|
||||
#define CACHE_REMOVE(str) g_cache_remove(gnc_engine_get_string_cache(), (str));
|
||||
|
||||
static void addObj (GncCustomer *cust);
|
||||
static void remObj (GncCustomer *cust);
|
||||
static inline void addObj (GncCustomer *cust)
|
||||
{
|
||||
gncBusinessAddObject (cust->inst.book, _GNC_MOD_NAME, cust, &cust->inst.guid);
|
||||
}
|
||||
|
||||
static inline void remObj (GncCustomer *cust)
|
||||
{
|
||||
gncBusinessRemoveObject (cust->inst.book, _GNC_MOD_NAME, &cust->inst.guid);
|
||||
}
|
||||
|
||||
G_INLINE_FUNC void mark_customer (GncCustomer *customer);
|
||||
G_INLINE_FUNC void
|
||||
@ -93,6 +103,7 @@ mark_customer (GncCustomer *customer)
|
||||
gnc_engine_generate_event (&customer->inst.guid, _GNC_MOD_NAME, GNC_EVENT_MODIFY);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
/* Create/Destroy Functions */
|
||||
|
||||
GncCustomer *gncCustomerCreate (QofBook *book)
|
||||
@ -183,6 +194,7 @@ static void gncCustomerFree (GncCustomer *cust)
|
||||
g_free (cust);
|
||||
}
|
||||
|
||||
/* ============================================================== */
|
||||
/* Set Functions */
|
||||
|
||||
#define SET_STR(obj, member, str) { \
|
||||
@ -525,16 +537,6 @@ int gncCustomerCompare (GncCustomer *a, GncCustomer *b)
|
||||
|
||||
/* Package-Private functions */
|
||||
|
||||
static void addObj (GncCustomer *cust)
|
||||
{
|
||||
gncBusinessAddObject (cust->inst.book, _GNC_MOD_NAME, cust, &cust->inst.guid);
|
||||
}
|
||||
|
||||
static void remObj (GncCustomer *cust)
|
||||
{
|
||||
gncBusinessRemoveObject (cust->inst.book, _GNC_MOD_NAME, &cust->inst.guid);
|
||||
}
|
||||
|
||||
static void _gncCustomerCreate (QofBook *book)
|
||||
{
|
||||
gncBusinessCreate (book, _GNC_MOD_NAME);
|
||||
|
Loading…
Reference in New Issue
Block a user