mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Free TaxTable and BillTerms on book close
This commit is contained in:
parent
5ced0d932a
commit
c2a6f1e911
@ -838,14 +838,28 @@ static void _gncBillTermCreate (QofBook *book)
|
|||||||
qof_book_set_data (book, _GNC_MOD_NAME, bi);
|
qof_book_set_data (book, _GNC_MOD_NAME, bi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
destroy_billterm_on_book_close (QofInstance *ent, gpointer data)
|
||||||
|
{
|
||||||
|
GncBillTerm *term = GNC_BILLTERM(ent);
|
||||||
|
|
||||||
|
gncBillTermBeginEdit (term);
|
||||||
|
gncBillTermDestroy (term);
|
||||||
|
}
|
||||||
|
|
||||||
static void _gncBillTermDestroy (QofBook *book)
|
static void _gncBillTermDestroy (QofBook *book)
|
||||||
{
|
{
|
||||||
struct _book_info *bi;
|
struct _book_info *bi;
|
||||||
|
QofCollection *col;
|
||||||
|
|
||||||
if (!book) return;
|
if (!book) return;
|
||||||
|
|
||||||
bi = qof_book_get_data (book, _GNC_MOD_NAME);
|
bi = qof_book_get_data (book, _GNC_MOD_NAME);
|
||||||
|
|
||||||
|
col = qof_book_get_collection (book, GNC_ID_BILLTERM);
|
||||||
|
qof_collection_foreach (col, destroy_billterm_on_book_close, NULL);
|
||||||
|
|
||||||
g_list_free (bi->terms);
|
g_list_free (bi->terms);
|
||||||
g_free (bi);
|
g_free (bi);
|
||||||
}
|
}
|
||||||
|
@ -1015,14 +1015,27 @@ static void _gncTaxTableCreate (QofBook *book)
|
|||||||
qof_book_set_data (book, _GNC_MOD_NAME, bi);
|
qof_book_set_data (book, _GNC_MOD_NAME, bi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
destroy_taxtable_on_book_close (QofInstance *ent, gpointer data)
|
||||||
|
{
|
||||||
|
GncTaxTable *table = GNC_TAXTABLE(ent);
|
||||||
|
|
||||||
|
gncTaxTableBeginEdit (table);
|
||||||
|
gncTaxTableDestroy (table);
|
||||||
|
}
|
||||||
|
|
||||||
static void _gncTaxTableDestroy (QofBook *book)
|
static void _gncTaxTableDestroy (QofBook *book)
|
||||||
{
|
{
|
||||||
struct _book_info *bi;
|
struct _book_info *bi;
|
||||||
|
QofCollection *col;
|
||||||
|
|
||||||
if (!book) return;
|
if (!book) return;
|
||||||
|
|
||||||
bi = qof_book_get_data (book, _GNC_MOD_NAME);
|
bi = qof_book_get_data (book, _GNC_MOD_NAME);
|
||||||
|
|
||||||
|
col = qof_book_get_collection (book, GNC_ID_TAXTABLE);
|
||||||
|
qof_collection_foreach (col, destroy_taxtable_on_book_close, NULL);
|
||||||
|
|
||||||
g_list_free (bi->tables);
|
g_list_free (bi->tables);
|
||||||
g_free (bi);
|
g_free (bi);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user