r18580 - gnucash/trunk/src/business/business-core/sql - Use correct routine to add a newly loaded entry to the correct bill. r18302 fixed the entry

Phil Longstaff plongstaff at code.gnucash.org
Thu Jan 21 20:02:50 EST 2010


Author: plongstaff
Date: 2010-01-21 20:02:49 -0500 (Thu, 21 Jan 2010)
New Revision: 18580
Trac: http://svn.gnucash.org/trac/changeset/18580

Modified:
   gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c
Log:
Use correct routine to add a newly loaded entry to the correct bill.  r18302 fixed the entry
loading problem for invoices, this extends it to bills.


Modified: gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c	2010-01-22 00:08:55 UTC (rev 18579)
+++ gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c	2010-01-22 01:02:49 UTC (rev 18580)
@@ -61,6 +61,7 @@
 #define MAX_DISCHOW_LEN 2048
 
 static void entry_set_invoice( gpointer pObject, gpointer val );
+static void entry_set_bill( gpointer pObject, gpointer val );
 
 static GncSqlColumnTableEntry col_table[] =
 {
@@ -86,7 +87,7 @@
 	{ "b_acct",        CT_ACCOUNTREF,  0,                   0,        			NULL, ENTRY_BACCT },
 	{ "b_price",       CT_NUMERIC,     0,                   0,        			NULL, ENTRY_BPRICE },
 	{ "bill",          CT_INVOICEREF,  0,                   0,        			NULL, NULL,
-			(QofAccessFunc)gncEntryGetBill, (QofSetterFunc)gncEntrySetBill },
+			(QofAccessFunc)gncEntryGetBill, (QofSetterFunc)entry_set_bill },
 	{ "b_taxable",     CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILL_TAXABLE },
 	{ "b_taxincluded", CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILL_TAX_INC },
 	{ "b_taxtable",    CT_TAXTABLEREF, 0,                   0,        			NULL, NULL,
@@ -117,6 +118,23 @@
 	gncInvoiceAddEntry( invoice, entry );
 }
 
+static void
+entry_set_bill( gpointer pObject, gpointer val )
+{
+	GncEntry* entry;
+	GncInvoice* bill;
+
+	g_return_if_fail( pObject != NULL );
+	g_return_if_fail( GNC_IS_ENTRY(pObject) );
+	g_return_if_fail( val != NULL );
+	g_return_if_fail( GNC_IS_INVOICE(val) );
+
+	entry = GNC_ENTRY(pObject);
+	bill = GNC_INVOICE(val);
+
+	gncBillAddEntry( bill, entry );
+}
+
 static GncEntry*
 load_single_entry( GncSqlBackend* be, GncSqlRow* row )
 {



More information about the gnucash-changes mailing list