mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/business/business-core/file/* -- don't save half-built data.
Make sure that we're only saving the items that have been fully created (not half-created). Fixes the cause of bug #102776. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7798 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2003-01-07 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* src/business/business-core/file/* -- don't save half-built data.
|
||||
Make sure that we're only saving the items that have been fully
|
||||
created (not half-created). Fixes the cause of bug #102776.
|
||||
|
||||
2003-01-06 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* macros/Makefile.am: include the rest of the macros in the dist.
|
||||
|
||||
@@ -455,11 +455,25 @@ customer_sixtp_parser_create(void)
|
||||
return sixtp_dom_parser_new(gnc_customer_end_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
customer_should_be_saved (GncCustomer *customer)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* make sure this is a valid customer before we save it -- should have an ID */
|
||||
id = gncCustomerGetID (customer);
|
||||
if (id == NULL || *id == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
do_count (gpointer cust_p, gpointer count_p)
|
||||
{
|
||||
int *count = count_p;
|
||||
(*count)++;
|
||||
if (customer_should_be_saved (cust_p))
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -477,6 +491,9 @@ xml_add_customer (gpointer cust_p, gpointer out_p)
|
||||
GncCustomer *cust = cust_p;
|
||||
FILE *out = out_p;
|
||||
|
||||
if (!customer_should_be_saved (cust_p))
|
||||
return;
|
||||
|
||||
node = customer_dom_tree_create (cust);
|
||||
xmlElemDump(out, NULL, node);
|
||||
fprintf(out, "\n");
|
||||
|
||||
@@ -341,11 +341,25 @@ employee_sixtp_parser_create(void)
|
||||
return sixtp_dom_parser_new(gnc_employee_end_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
employee_should_be_saved (GncEmployee *employee)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* make sure this is a valid employee before we save it -- should have an ID */
|
||||
id = gncEmployeeGetID (employee);
|
||||
if (id == NULL || *id == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
do_count (gpointer employee_p, gpointer count_p)
|
||||
{
|
||||
int *count = count_p;
|
||||
(*count)++;
|
||||
if (employee_should_be_saved (employee_p))
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -363,6 +377,9 @@ xml_add_employee (gpointer employee_p, gpointer out_p)
|
||||
GncEmployee *employee = employee_p;
|
||||
FILE *out = out_p;
|
||||
|
||||
if (!employee_should_be_saved (employee))
|
||||
return;
|
||||
|
||||
node = employee_dom_tree_create (employee);
|
||||
xmlElemDump(out, NULL, node);
|
||||
fprintf(out, "\n");
|
||||
|
||||
@@ -470,11 +470,25 @@ invoice_sixtp_parser_create(void)
|
||||
return sixtp_dom_parser_new(gnc_invoice_end_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
invoice_should_be_saved (GncInvoice *invoice)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* make sure this is a valid invoice before we save it -- should have an ID */
|
||||
id = gncInvoiceGetID (invoice);
|
||||
if (id == NULL || *id == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
do_count (gpointer invoice_p, gpointer count_p)
|
||||
{
|
||||
int *count = count_p;
|
||||
(*count)++;
|
||||
if (invoice_should_be_saved (invoice_p))
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -492,6 +506,9 @@ xml_add_invoice (gpointer invoice_p, gpointer out_p)
|
||||
GncInvoice *invoice = invoice_p;
|
||||
FILE *out = out_p;
|
||||
|
||||
if (!invoice_should_be_saved (invoice))
|
||||
return;
|
||||
|
||||
node = invoice_dom_tree_create (invoice);
|
||||
xmlElemDump(out, NULL, node);
|
||||
fprintf(out, "\n");
|
||||
|
||||
@@ -275,11 +275,25 @@ job_sixtp_parser_create(void)
|
||||
return sixtp_dom_parser_new(gnc_job_end_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
job_should_be_saved (GncJob *job)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* make sure this is a valid job before we save it -- should have an ID */
|
||||
id = gncJobGetID (job);
|
||||
if (id == NULL || *id == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
do_count (gpointer job_p, gpointer count_p)
|
||||
{
|
||||
int *count = count_p;
|
||||
(*count)++;
|
||||
if (job_should_be_saved (job_p))
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -297,6 +311,9 @@ xml_add_job (gpointer job_p, gpointer out_p)
|
||||
GncJob *job = job_p;
|
||||
FILE *out = out_p;
|
||||
|
||||
if (!job_should_be_saved (job))
|
||||
return;
|
||||
|
||||
node = job_dom_tree_create (job);
|
||||
xmlElemDump(out, NULL, node);
|
||||
fprintf(out, "\n");
|
||||
|
||||
@@ -313,11 +313,25 @@ order_sixtp_parser_create(void)
|
||||
return sixtp_dom_parser_new(gnc_order_end_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
order_should_be_saved (GncOrder *order)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* make sure this is a valid order before we save it -- should have an ID */
|
||||
id = gncOrderGetID (order);
|
||||
if (id == NULL || *id == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
do_count (gpointer order_p, gpointer count_p)
|
||||
{
|
||||
int *count = count_p;
|
||||
(*count)++;
|
||||
if (order_should_be_saved (order_p))
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -335,6 +349,9 @@ xml_add_order (gpointer order_p, gpointer out_p)
|
||||
GncOrder *order = order_p;
|
||||
FILE *out = out_p;
|
||||
|
||||
if (!order_should_be_saved (order))
|
||||
return;
|
||||
|
||||
node = order_dom_tree_create (order);
|
||||
xmlElemDump(out, NULL, node);
|
||||
fprintf(out, "\n");
|
||||
|
||||
@@ -399,11 +399,25 @@ vendor_sixtp_parser_create(void)
|
||||
return sixtp_dom_parser_new(gnc_vendor_end_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
vendor_should_be_saved (GncVendor *vendor)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* make sure this is a valid vendor before we save it -- should have an ID */
|
||||
id = gncVendorGetID (vendor);
|
||||
if (id == NULL || *id == '\0')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
do_count (gpointer vendor_p, gpointer count_p)
|
||||
{
|
||||
int *count = count_p;
|
||||
(*count)++;
|
||||
if (vendor_should_be_saved (vendor_p))
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -421,6 +435,9 @@ xml_add_vendor (gpointer vendor_p, gpointer out_p)
|
||||
GncVendor *vendor = vendor_p;
|
||||
FILE *out = out_p;
|
||||
|
||||
if (!vendor_should_be_saved (vendor))
|
||||
return;
|
||||
|
||||
node = vendor_dom_tree_create (vendor);
|
||||
xmlElemDump(out, NULL, node);
|
||||
fprintf(out, "\n");
|
||||
|
||||
Reference in New Issue
Block a user