Ejemplo n.º 1
0
static xmlNodePtr
vendor_dom_tree_create (GncVendor* vendor)
{
    xmlNodePtr ret;
    GncBillTerm* term;
    GncTaxTable* taxtable;

    ret = xmlNewNode (NULL, BAD_CAST gnc_vendor_string);
    xmlSetProp (ret, BAD_CAST "version", BAD_CAST vendor_version_string);

    xmlAddChild (ret, guid_to_dom_tree (vendor_guid_string,
                                        qof_instance_get_guid (QOF_INSTANCE (vendor))));

    xmlAddChild (ret, text_to_dom_tree (vendor_name_string,
                                        gncVendorGetName (vendor)));

    xmlAddChild (ret, text_to_dom_tree (vendor_id_string,
                                        gncVendorGetID (vendor)));

    xmlAddChild (ret, gnc_address_to_dom_tree (vendor_addr_string,
                                               gncVendorGetAddr (vendor)));

    maybe_add_string (ret, vendor_notes_string, gncVendorGetNotes (vendor));

    term = gncVendorGetTerms (vendor);
    if (term)
        xmlAddChild (ret, guid_to_dom_tree (vendor_terms_string,
                                            qof_instance_get_guid (QOF_INSTANCE (term))));

    xmlAddChild (ret, text_to_dom_tree (vendor_taxincluded_string,
                                        gncTaxIncludedTypeToString (
                                            gncVendorGetTaxIncluded (vendor))));

    xmlAddChild (ret, int_to_dom_tree (vendor_active_string,
                                       gncVendorGetActive (vendor)));

    xmlAddChild
    (ret,
     commodity_ref_to_dom_tree (vendor_currency_string,
                                gncVendorGetCurrency (vendor)));

    xmlAddChild (ret, int_to_dom_tree (vendor_taxtableoverride_string,
                                       gncVendorGetTaxTableOverride (vendor)));
    taxtable = gncVendorGetTaxTable (vendor);
    if (taxtable)
        xmlAddChild (ret, guid_to_dom_tree (vendor_taxtable_string,
                                            qof_instance_get_guid (QOF_INSTANCE (taxtable))));

    /* xmlAddChild won't do anything with a NULL, so tests are superfluous. */
    xmlAddChild (ret, qof_instance_slots_to_dom_tree (vendor_slots_string,
                                                      QOF_INSTANCE (vendor)));
    return ret;
}
Ejemplo n.º 2
0
static void
billterm_scrub_vendor (QofInstance * vendor_p, gpointer ht_p)
{
    GHashTable *ht = ht_p;
    GncVendor *vendor = GNC_VENDOR(vendor_p);
    GncBillTerm *term;
    gint32 count;

    term = gncVendorGetTerms(vendor);
    if (term)
    {
        count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
        count++;
        g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
        if (billterm_is_grandchild(term))
            PWARN("vendor %s has grandchild billterm %s\n",
                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(vendor))),
                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
    }
}
Ejemplo n.º 3
0
static void
billterm_scrub_vendor (QofInstance* vendor_p, gpointer ht_p)
{
    GHashTable* ht = static_cast<decltype (ht)> (ht_p);
    GncVendor* vendor = GNC_VENDOR (vendor_p);
    GncBillTerm* term;
    gint32 count;

    term = gncVendorGetTerms (vendor);
    if (term)
    {
        count = GPOINTER_TO_INT (g_hash_table_lookup (ht, term));
        count++;
        g_hash_table_insert (ht, term, GINT_TO_POINTER (count));
        if (billterm_is_grandchild (term))
        {
            gchar vendstr[GUID_ENCODING_LENGTH + 1];
            gchar termstr[GUID_ENCODING_LENGTH + 1];
            guid_to_string_buff (qof_instance_get_guid (QOF_INSTANCE (vendor)), vendstr);
            guid_to_string_buff (qof_instance_get_guid (QOF_INSTANCE (term)), termstr);
            PWARN ("vendor %s has grandchild billterm %s\n", vendstr, termstr);
        }
    }
}