mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
change to use qofinstance as well
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9467 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -48,7 +48,8 @@
|
||||
#include "gnc-address-xml-v2.h"
|
||||
#include "gnc-engine-util.h"
|
||||
|
||||
#include "gncObject.h"
|
||||
#include "qofobject.h"
|
||||
#include "qofinstance.h"
|
||||
|
||||
#define _GNC_MOD_NAME GNC_CUSTOMER_MODULE_NAME
|
||||
|
||||
@@ -140,7 +141,7 @@ customer_dom_tree_create (GncCustomer *cust)
|
||||
gncTaxTableGetGUID (taxtable)));
|
||||
|
||||
kvpnode = kvp_frame_to_dom_tree (cust_slots_string,
|
||||
gncCustomerGetSlots (cust));
|
||||
qof_instance_get_slots (QOF_INSTANCE(cust)));
|
||||
if (kvpnode) xmlAddChild (ret, kvpnode);
|
||||
|
||||
return ret;
|
||||
@@ -376,7 +377,8 @@ static gboolean
|
||||
customer_slots_handler (xmlNodePtr node, gpointer cust_pdata)
|
||||
{
|
||||
struct customer_pdata *pdata = cust_pdata;
|
||||
return dom_tree_to_kvp_frame_given (node, gncCustomerGetSlots (pdata->customer));
|
||||
return dom_tree_to_kvp_frame_given (node,
|
||||
qof_instance_get_slots (QOF_INSTANCE(pdata->customer)));
|
||||
}
|
||||
|
||||
static struct dom_tree_handler customer_handlers_v2[] = {
|
||||
@@ -494,7 +496,7 @@ static int
|
||||
customer_get_count (GNCBook *book)
|
||||
{
|
||||
int count = 0;
|
||||
gncObjectForeach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
|
||||
qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -517,7 +519,7 @@ xml_add_customer (gpointer cust_p, gpointer out_p)
|
||||
static void
|
||||
customer_write (FILE *out, GNCBook *book)
|
||||
{
|
||||
gncObjectForeach (_GNC_MOD_NAME, book, xml_add_customer, (gpointer) out);
|
||||
qof_object_foreach (_GNC_MOD_NAME, book, xml_add_customer, (gpointer) out);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -533,7 +535,7 @@ gnc_customer_xml_initialize (void)
|
||||
NULL, /* scrub */
|
||||
};
|
||||
|
||||
gncObjectRegisterBackend (_GNC_MOD_NAME,
|
||||
qof_object_register_backend (_GNC_MOD_NAME,
|
||||
GNC_FILE_BACKEND,
|
||||
&be_data);
|
||||
}
|
||||
|
||||
@@ -16,21 +16,23 @@
|
||||
#include "qofobject.h"
|
||||
#include "gnc-event-p.h"
|
||||
#include "gnc-be-utils.h"
|
||||
#include "kvp_frame.h"
|
||||
|
||||
#include "qofbook.h"
|
||||
#include "qofclass.h"
|
||||
#include "qofid-p.h"
|
||||
#include "qofid.h"
|
||||
#include "qofinstance.h"
|
||||
#include "qofquerycore.h"
|
||||
#include "qofquery.h"
|
||||
#include "qofclass.h"
|
||||
|
||||
#include "gncBusiness.h"
|
||||
#include "gncCustomer.h"
|
||||
#include "gncCustomerP.h"
|
||||
#include "gncAddress.h"
|
||||
|
||||
struct _gncCustomer {
|
||||
struct _gncCustomer
|
||||
{
|
||||
QofInstance inst;
|
||||
QofBook * book;
|
||||
GUID guid;
|
||||
char * id;
|
||||
@@ -43,7 +45,6 @@ struct _gncCustomer {
|
||||
gnc_numeric discount;
|
||||
gnc_numeric credit;
|
||||
GncTaxIncluded taxincluded;
|
||||
KvpFrame *kvp_data;
|
||||
|
||||
gboolean active;
|
||||
GList * jobs;
|
||||
@@ -85,6 +86,7 @@ GncCustomer *gncCustomerCreate (QofBook *book)
|
||||
if (!book) return NULL;
|
||||
|
||||
cust = g_new0 (GncCustomer, 1);
|
||||
qof_instance_init (&cust->inst);
|
||||
cust->book = book;
|
||||
cust->dirty = FALSE;
|
||||
cust->id = CACHE_INSERT ("");
|
||||
@@ -97,7 +99,6 @@ GncCustomer *gncCustomerCreate (QofBook *book)
|
||||
cust->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
|
||||
cust->active = TRUE;
|
||||
cust->jobs = NULL;
|
||||
cust->kvp_data = kvp_frame_new();
|
||||
|
||||
qof_entity_guid_new (qof_book_get_entity_table (book),&cust->guid);
|
||||
addObj (cust);
|
||||
@@ -126,7 +127,7 @@ static void gncCustomerFree (GncCustomer *cust)
|
||||
gncAddressDestroy (cust->addr);
|
||||
gncAddressDestroy (cust->shipaddr);
|
||||
g_list_free (cust->jobs);
|
||||
kvp_frame_delete (cust->kvp_data);
|
||||
qof_instance_release (&cust->inst);
|
||||
|
||||
remObj (cust);
|
||||
|
||||
@@ -425,12 +426,6 @@ GncTaxTable* gncCustomerGetTaxTable (GncCustomer *customer)
|
||||
return customer->taxtable;
|
||||
}
|
||||
|
||||
KvpFrame* gncCustomerGetSlots (GncCustomer *customer)
|
||||
{
|
||||
if (!customer) return NULL;
|
||||
return customer->kvp_data;
|
||||
}
|
||||
|
||||
GList * gncCustomerGetJoblist (GncCustomer *cust, gboolean show_all)
|
||||
{
|
||||
if (!cust) return NULL;
|
||||
|
||||
Reference in New Issue
Block a user