示例#1
0
static void
set_invisible (gpointer data, gboolean value)
{
    GncBillTerm* term = GNC_BILLTERM (data);

    g_return_if_fail (term != NULL);

    if (value)
    {
        gncBillTermMakeInvisible (term);
    }
}
示例#2
0
static void
compare_single_billterm( QofInstance* inst, gpointer user_data )
{
    CompareInfoStruct* info = (CompareInfoStruct*)user_data;
    GncBillTerm* bt_1 = GNC_BILLTERM(inst);
    GncBillTerm* bt_2 = gncBillTermLookup( info->book_2, qof_instance_get_guid(inst) );

    if (!gncBillTermEqual( bt_1, bt_2 ))
    {
        info->result = FALSE;
    }
}
示例#3
0
文件: gncCustomer.c 项目: 573/gnucash
/** Does this object refer to a specific object */
static gboolean
impl_refers_to_object(const QofInstance* inst, const QofInstance* ref)
{
    GncCustomer* cust;

    g_return_val_if_fail(inst != NULL, FALSE);
    g_return_val_if_fail(GNC_IS_CUSTOMER(inst), FALSE);

    cust = GNC_CUSTOMER(inst);

    if (GNC_IS_BILLTERM(ref))
    {
        return (cust->terms == GNC_BILLTERM(ref));
    }
    else if (GNC_IS_TAXTABLE(ref))
    {
        return (cust->taxtable == GNC_TAXTABLE(ref));
    }

    return FALSE;
}
示例#4
0
static void
gnc_billterm_get_property (GObject         *object,
                           guint            prop_id,
                           GValue          *value,
                           GParamSpec      *pspec)
{
    GncBillTerm *bt;

    g_return_if_fail(GNC_IS_BILLTERM(object));

    bt = GNC_BILLTERM(object);
    switch (prop_id)
    {
    case PROP_NAME:
        g_value_set_string(value, bt->name);
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}
示例#5
0
static void
bt_set_parent (gpointer data, gpointer value)
{
    GncBillTerm* billterm;
    GncBillTerm* parent;
    QofBook* pBook;
    GncGUID* guid = (GncGUID*)value;

    g_return_if_fail (data != NULL);
    g_return_if_fail (GNC_IS_BILLTERM (data));

    billterm = GNC_BILLTERM (data);
    pBook = qof_instance_get_book (QOF_INSTANCE (billterm));
    if (guid != NULL)
    {
        parent = gncBillTermLookup (pBook, guid);
        if (parent != NULL)
        {
            gncBillTermSetParent (billterm, parent);
            gncBillTermSetChild (parent, billterm);
        }
    }
}
示例#6
0
static  gpointer
bt_get_parent (gpointer pObject)
{
    const GncBillTerm* billterm;
    const GncBillTerm* pParent;
    const GncGUID* parent_guid;

    g_return_val_if_fail (pObject != NULL, NULL);
    g_return_val_if_fail (GNC_IS_BILLTERM (pObject), NULL);

    billterm = GNC_BILLTERM (pObject);
    pParent = gncBillTermGetParent (billterm);
    if (pParent == NULL)
    {
        parent_guid = NULL;
    }
    else
    {
        parent_guid = qof_instance_get_guid (QOF_INSTANCE (pParent));
    }

    return (gpointer)parent_guid;
}
示例#7
0
static void
gnc_billterm_set_property (GObject         *object,
                           guint            prop_id,
                           const GValue          *value,
                           GParamSpec      *pspec)
{
    GncBillTerm *bt;

    g_return_if_fail(GNC_IS_BILLTERM(object));

    bt = GNC_BILLTERM(object);
    g_assert (qof_instance_get_editlevel(bt));

    switch (prop_id)
    {
    case PROP_NAME:
        gncBillTermSetName(bt, g_value_get_string(value));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}
示例#8
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);
        }
    }
}