Beispiel #1
0
static gboolean
invoice_guid_handler (xmlNodePtr node, gpointer invoice_pdata)
{
    struct invoice_pdata* pdata = static_cast<decltype (pdata)> (invoice_pdata);
    GncGUID* guid;
    GncInvoice* invoice;

    guid = dom_tree_to_guid (node);
    g_return_val_if_fail (guid, FALSE);
    invoice = gncInvoiceLookup (pdata->book, guid);
    if (invoice)
    {
        gncInvoiceDestroy (pdata->invoice);
        pdata->invoice = invoice;
        gncInvoiceBeginEdit (invoice);
    }
    else
    {
        gncInvoiceSetGUID (pdata->invoice, guid);
    }

    g_free (guid);

    return TRUE;
}
Beispiel #2
0
static gboolean
entry_bill_handler (xmlNodePtr node, gpointer entry_pdata)
{
    struct entry_pdata *pdata = entry_pdata;
    GncGUID *guid;
    GncInvoice *invoice;

    guid = dom_tree_to_guid (node);
    g_return_val_if_fail (guid, FALSE);
    invoice = gncInvoiceLookup (pdata->book, guid);
    if (!invoice)
    {
        invoice = gncInvoiceCreate (pdata->book);
        gncInvoiceBeginEdit (invoice);
        gncInvoiceSetGUID (invoice, guid);
        gncInvoiceCommitEdit (invoice);
    }
    gncInvoiceBeginEdit (invoice);
    gncBillAddEntry (invoice, pdata->entry);
    gncInvoiceCommitEdit (invoice);

    g_free(guid);
    return TRUE;
}