Exemplo n.º 1
0
static
void qofBillTermSetType (GncBillTerm *term, const char *type_label)
{
    GncBillTermType type;

    type = GncBillTermTypefromString(type_label);
    gncBillTermSetType(term, type);
}
Exemplo n.º 2
0
static gboolean
billterm_prox_data_handler (xmlNodePtr node, gpointer billterm_pdata)
{
    struct billterm_pdata *pdata = billterm_pdata;

    g_return_val_if_fail (node, FALSE);
    g_return_val_if_fail (gncBillTermGetType (pdata->term) == 0, FALSE);

    gncBillTermSetType (pdata->term, GNC_TERM_TYPE_PROXIMO);
    return dom_tree_to_prox_data (node, pdata);
}
Exemplo n.º 3
0
static gboolean
billterm_days_data_handler (xmlNodePtr node, gpointer billterm_pdata)
{
    struct billterm_pdata* pdata = static_cast<decltype (pdata)> (billterm_pdata);

    g_return_val_if_fail (node, FALSE);
    g_return_val_if_fail (gncBillTermGetType (pdata->term) == 0, FALSE);

    gncBillTermSetType (pdata->term, GNC_TERM_TYPE_DAYS);
    return dom_tree_to_days_data (node, pdata);
}
Exemplo n.º 4
0
/* build a list of bill terms that are grandchildren or bogus (empty entry list). */
static void
billterm_scrub_cb (QofInstance *term_p, gpointer list_p)
{
    GncBillTerm *term = GNC_BILLTERM(term_p);
    GList **list = list_p;

    if (billterm_is_grandchild(term))
    {
        *list = g_list_prepend(*list, term);

    }
    else if (!gncBillTermGetType(term))
    {
        GncBillTerm *t = gncBillTermGetParent(term);
        if (t)
        {
            /* Fix up the broken "copy" function */
            gchar guidstr[GUID_ENCODING_LENGTH+1];
            guid_to_string_buff(qof_instance_get_guid(QOF_INSTANCE(term)),guidstr);
            PWARN("Fixing broken child billterm: %s", guidstr);

            gncBillTermBeginEdit(term);
            gncBillTermSetType(term, gncBillTermGetType(t));
            gncBillTermSetDueDays (term, gncBillTermGetDueDays(t));
            gncBillTermSetDiscountDays (term, gncBillTermGetDiscountDays(t));
            gncBillTermSetDiscount (term, gncBillTermGetDiscount(t));
            gncBillTermSetCutoff (term, gncBillTermGetCutoff(t));
            gncBillTermCommitEdit(term);

        }
        else
        {
            /* No parent?  Must be a standalone */
            *list = g_list_prepend(*list, term);
        }
    }
}