static void gncCustomerFree (GncCustomer *cust) { if (!cust) return; qof_event_gen (&cust->inst, QOF_EVENT_DESTROY, NULL); CACHE_REMOVE (cust->id); CACHE_REMOVE (cust->name); CACHE_REMOVE (cust->notes); gncAddressBeginEdit (cust->addr); gncAddressDestroy (cust->addr); gncAddressBeginEdit (cust->shipaddr); gncAddressDestroy (cust->shipaddr); g_list_free (cust->jobs); if (cust->terms) gncBillTermDecRef (cust->terms); if (cust->taxtable) { gncTaxTableDecRef (cust->taxtable); } /* qof_instance_release (&cust->inst); */ g_object_unref (cust); }
static void gncEntryFree (GncEntry *entry) { if (!entry) return; qof_event_gen (&entry->inst, QOF_EVENT_DESTROY, NULL); CACHE_REMOVE (entry->desc); CACHE_REMOVE (entry->action); CACHE_REMOVE (entry->notes); if (entry->i_tax_values) gncAccountValueDestroy (entry->i_tax_values); if (entry->b_tax_values) gncAccountValueDestroy (entry->b_tax_values); if (entry->i_tax_table) gncTaxTableDecRef (entry->i_tax_table); if (entry->b_tax_table) gncTaxTableDecRef (entry->b_tax_table); /* qof_instance_release (&entry->inst); */ g_object_unref (entry); }
void gncEntrySetBillTaxTable (GncEntry *entry, GncTaxTable *table) { if (!entry) return; if (entry->b_tax_table == table) return; gncEntryBeginEdit (entry); if (entry->b_tax_table) gncTaxTableDecRef (entry->b_tax_table); if (table) gncTaxTableIncRef (table); entry->b_tax_table = table; entry->values_dirty = TRUE; mark_entry (entry); gncEntryCommitEdit (entry); }
static inline gboolean set_taxtable (xmlNodePtr node, struct entry_pdata *pdata, void (*func)(GncEntry *entry, GncTaxTable *taxtable)) { GncGUID *guid; GncTaxTable *taxtable; guid = dom_tree_to_guid (node); g_return_val_if_fail (guid, FALSE); taxtable = gncTaxTableLookup (pdata->book, guid); if (!taxtable) { taxtable = gncTaxTableCreate (pdata->book); gncTaxTableBeginEdit (taxtable); gncTaxTableSetGUID (taxtable, guid); gncTaxTableCommitEdit (taxtable); } else gncTaxTableDecRef (taxtable); func (pdata->entry, taxtable); g_free(guid); return TRUE; }
static gboolean customer_taxtable_handler (xmlNodePtr node, gpointer cust_pdata) { struct customer_pdata *pdata = cust_pdata; GncGUID *guid; GncTaxTable *taxtable; guid = dom_tree_to_guid (node); g_return_val_if_fail (guid, FALSE); taxtable = gncTaxTableLookup (pdata->book, guid); if (!taxtable) { taxtable = gncTaxTableCreate (pdata->book); gncTaxTableBeginEdit (taxtable); gncTaxTableSetGUID (taxtable, guid); gncTaxTableCommitEdit (taxtable); } else gncTaxTableDecRef (taxtable); gncCustomerSetTaxTable (pdata->customer, taxtable); g_free(guid); return TRUE; }
static gboolean vendor_taxtable_handler (xmlNodePtr node, gpointer vendor_pdata) { struct vendor_pdata* pdata = static_cast<decltype (pdata)> (vendor_pdata); GncGUID* guid; GncTaxTable* taxtable; guid = dom_tree_to_guid (node); g_return_val_if_fail (guid, FALSE); taxtable = gncTaxTableLookup (pdata->book, guid); if (!taxtable) { taxtable = gncTaxTableCreate (pdata->book); gncTaxTableBeginEdit (taxtable); gncTaxTableSetGUID (taxtable, guid); gncTaxTableCommitEdit (taxtable); } else gncTaxTableDecRef (taxtable); gncVendorSetTaxTable (pdata->vendor, taxtable); g_free (guid); return TRUE; }