コード例 #1
0
ファイル: gncCustomer.c プロジェクト: 814ckf0x/gnucash
static void
gnc_customer_get_property (GObject         *object,
                           guint            prop_id,
                           GValue          *value,
                           GParamSpec      *pspec)
{
    GncCustomer *cust;
    gchar *key;
    g_return_if_fail(GNC_IS_CUSTOMER(object));

    cust = GNC_CUSTOMER(object);
    switch (prop_id)
    {
    case PROP_NAME:
        g_value_set_string(value, cust->name);
        break;
    case PROP_PDF_DIRNAME:
	key = OWNER_EXPORT_PDF_DIRNAME;
	qof_instance_get_kvp (QOF_INSTANCE (cust), key, value);
	break;
    case PROP_LAST_POSTED:
	key = LAST_POSTED_TO_ACCT;
	qof_instance_get_kvp (QOF_INSTANCE (cust), key, value);
	break;
    case PROP_PAYMENT_LAST_ACCT:
	key = GNC_PAYMENT "/" GNC_LAST_ACCOUNT;
	qof_instance_get_kvp (QOF_INSTANCE (cust), key, value);
	break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}
コード例 #2
0
ファイル: gnc-customer-sql.cpp プロジェクト: Isendir/gnucash
/* ================================================================= */
static gboolean
save_customer( GncSqlBackend* be, QofInstance* inst )
{
    g_return_val_if_fail( inst != NULL, FALSE );
    g_return_val_if_fail( GNC_CUSTOMER(inst), FALSE );
    g_return_val_if_fail( be != NULL, FALSE );

    return gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_CUSTOMER, col_table );
}
コード例 #3
0
static void
compare_single_customer( QofInstance* inst, gpointer user_data )
{
    CompareInfoStruct* info = (CompareInfoStruct*)user_data;
    GncCustomer* cust_1 = GNC_CUSTOMER(inst);
    GncCustomer* cust_2 = gncCustomerLookup( info->book_2, qof_instance_get_guid(inst) );

    if (!gncCustomerEqual( cust_1, cust_2 ))
    {
        info->result = FALSE;
    }
}
コード例 #4
0
ファイル: gncCustomer.c プロジェクト: 573/gnucash
/** Return display name for this object */
static gchar*
impl_get_display_name(const QofInstance* inst)
{
    GncCustomer* cust;

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

    cust = GNC_CUSTOMER(inst);
    /* XXX internationalization of "Customer" */
    return g_strdup_printf("Customer %s", cust->name);
}
コード例 #5
0
ファイル: gnc-customer-sql.cpp プロジェクト: Isendir/gnucash
static void
write_single_customer( QofInstance *term_p, gpointer data_p )
{
    write_customers_t* data = (write_customers_t*)data_p;

    g_return_if_fail( term_p != NULL );
    g_return_if_fail( GNC_IS_CUSTOMER(term_p) );
    g_return_if_fail( data_p != NULL );

    if ( customer_should_be_saved( GNC_CUSTOMER(term_p) ) && data->is_ok )
    {
        data->is_ok = save_customer( data->be, term_p );
    }
}
コード例 #6
0
static void
taxtable_scrub_cust (QofInstance * cust_p, gpointer ht_p)
{
    GHashTable *ht = ht_p;
    GncCustomer *cust = GNC_CUSTOMER(cust_p);
    GncTaxTable *table;
    gint32 count;

    table = gncCustomerGetTaxTable(cust);
    if (table)
    {
        count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
        count++;
        g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
    }
}
コード例 #7
0
static void
billterm_scrub_cust (QofInstance * cust_p, gpointer ht_p)
{
    GHashTable *ht = ht_p;
    GncCustomer *cust = GNC_CUSTOMER(cust_p);
    GncBillTerm *term;
    gint32 count;

    term = gncCustomerGetTerms(cust);
    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("customer %s has grandchild billterm %s\n",
                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(cust))),
                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
    }
}
コード例 #8
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;
}
コード例 #9
0
ファイル: gncCustomer.c プロジェクト: 573/gnucash
static void
gnc_customer_set_property (GObject         *object,
                           guint            prop_id,
                           const GValue          *value,
                           GParamSpec      *pspec)
{
    GncCustomer *cust;

    g_return_if_fail(GNC_IS_CUSTOMER(object));

    cust = GNC_CUSTOMER(object);
    switch (prop_id)
    {
    case PROP_NAME:
        gncCustomerSetName(cust, g_value_get_string(value));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}
コード例 #10
0
static void
billterm_scrub_cust (QofInstance* cust_p, gpointer ht_p)
{
    GHashTable* ht = static_cast<decltype (ht)> (ht_p);
    GncCustomer* cust = GNC_CUSTOMER (cust_p);
    GncBillTerm* term;
    gint32 count;

    term = gncCustomerGetTerms (cust);
    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 custstr[GUID_ENCODING_LENGTH + 1];
            gchar termstr[GUID_ENCODING_LENGTH + 1];
            guid_to_string_buff (qof_instance_get_guid (QOF_INSTANCE (cust)), custstr);
            guid_to_string_buff (qof_instance_get_guid (QOF_INSTANCE (term)), termstr);
            PWARN ("customer %s has grandchild billterm %s\n", custstr, termstr);
        }
    }
}