本文整理汇总了C++中qof_instance_get_guid函数的典型用法代码示例。如果您正苦于以下问题:C++ qof_instance_get_guid函数的具体用法?C++ qof_instance_get_guid怎么用?C++ qof_instance_get_guid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qof_instance_get_guid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: remove_guids
static void
remove_guids (Split *sa, Split *sb)
{
KvpFrame *ksub;
/* Find and remove the matching guid's */
ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sa->inst.kvp_data, "lot-split",
"peer_guid", qof_instance_get_guid(sb));
if (ksub)
{
gnc_kvp_bag_remove_frame (sa->inst.kvp_data, "lot-split", ksub);
kvp_frame_delete (ksub);
}
/* Now do it in the other direction */
ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sb->inst.kvp_data, "lot-split",
"peer_guid", qof_instance_get_guid(sa));
if (ksub)
{
gnc_kvp_bag_remove_frame (sb->inst.kvp_data, "lot-split", ksub);
kvp_frame_delete (ksub);
}
/* Finally, merge b's lot-splits, if any, into a's */
/* This is an important step, if it got busted into many pieces. */
gnc_kvp_bag_merge (sa->inst.kvp_data, "lot-split",
sb->inst.kvp_data, "lot-split");
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:28,代码来源:Scrub2.c
示例2: vendor_dom_tree_create
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;
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:53,代码来源:gnc-vendor-xml-v2.cpp
示例3: taxtable_scrub_entries
/* for each entry, check the tax tables. If the tax tables are
* grandchildren, then fix them to point to the most senior child
*/
static void
taxtable_scrub_entries (QofInstance * entry_p, gpointer ht_p)
{
GHashTable *ht = static_cast<decltype(ht)>(ht_p);
GncEntry *entry = GNC_ENTRY(entry_p);
GncTaxTable *table, *new_tt;
gint32 count;
table = gncEntryGetInvTaxTable(entry);
if (table)
{
if (taxtable_is_grandchild(table))
{
gchar guidstr[GUID_ENCODING_LENGTH+1];
guid_to_string_buff(qof_instance_get_guid(QOF_INSTANCE(entry)),guidstr);
PINFO("Fixing i-taxtable on entry %s\n",guidstr);
new_tt = taxtable_find_senior(table);
gncEntryBeginEdit(entry);
gncEntrySetInvTaxTable(entry, new_tt);
gncEntryCommitEdit(entry);
table = new_tt;
}
if (table)
{
count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
count++;
g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
}
}
table = gncEntryGetBillTaxTable(entry);
if (table)
{
if (taxtable_is_grandchild(table))
{
gchar guidstr[GUID_ENCODING_LENGTH+1];
guid_to_string_buff(qof_instance_get_guid(QOF_INSTANCE(entry)),guidstr);
PINFO("Fixing b-taxtable on entry %s\n",guidstr);
new_tt = taxtable_find_senior(table);
gncEntryBeginEdit(entry);
gncEntrySetBillTaxTable(entry, new_tt);
gncEntryCommitEdit(entry);
table = new_tt;
}
if (table)
{
count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
count++;
g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
}
}
}
开发者ID:Isendir,项目名称:gnucash,代码行数:55,代码来源:gnc-tax-table-xml-v2.cpp
示例4: employee_dom_tree_create
static xmlNodePtr
employee_dom_tree_create (GncEmployee *employee)
{
xmlNodePtr ret, kvpnode;
gnc_numeric num;
Account* ccard_acc;
ret = xmlNewNode(NULL, BAD_CAST gnc_employee_string);
xmlSetProp(ret, BAD_CAST "version", BAD_CAST employee_version_string);
xmlAddChild(ret, guid_to_dom_tree(employee_guid_string,
qof_instance_get_guid(QOF_INSTANCE (employee))));
xmlAddChild(ret, text_to_dom_tree(employee_username_string,
gncEmployeeGetUsername (employee)));
xmlAddChild(ret, text_to_dom_tree(employee_id_string,
gncEmployeeGetID (employee)));
xmlAddChild(ret, gnc_address_to_dom_tree(employee_addr_string,
gncEmployeeGetAddr (employee)));
maybe_add_string (ret, employee_language_string,
gncEmployeeGetLanguage (employee));
maybe_add_string (ret, employee_acl_string, gncEmployeeGetAcl (employee));
xmlAddChild(ret, int_to_dom_tree(employee_active_string,
gncEmployeeGetActive (employee)));
num = gncEmployeeGetWorkday (employee);
xmlAddChild(ret, gnc_numeric_to_dom_tree (employee_workday_string, &num));
num = gncEmployeeGetRate (employee);
xmlAddChild(ret, gnc_numeric_to_dom_tree (employee_rate_string, &num));
xmlAddChild
(ret,
commodity_ref_to_dom_tree(employee_currency_string,
gncEmployeeGetCurrency (employee)));
ccard_acc = gncEmployeeGetCCard (employee);
if (ccard_acc)
xmlAddChild(ret, guid_to_dom_tree(employee_ccard_string,
qof_instance_get_guid(QOF_INSTANCE(ccard_acc))));
kvpnode = kvp_frame_to_dom_tree (employee_slots_string,
qof_instance_get_slots (QOF_INSTANCE(employee)));
if (kvpnode) xmlAddChild (ret, kvpnode);
return ret;
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:51,代码来源:gnc-employee-xml-v2.c
示例5: maybe_add_guid
static void
maybe_add_guid (xmlNodePtr ptr, const char *tag, GncTaxTable *table)
{
if (table)
xmlAddChild (ptr, guid_to_dom_tree (tag,
qof_instance_get_guid(QOF_INSTANCE(table))));
}
开发者ID:JohannesKlug,项目名称:gnucash,代码行数:7,代码来源:gnc-tax-table-xml-v2.c
示例6: job_dom_tree_create
static xmlNodePtr
job_dom_tree_create (GncJob *job)
{
xmlNodePtr ret;
ret = xmlNewNode(NULL, BAD_CAST gnc_job_string);
xmlSetProp(ret, BAD_CAST "version", BAD_CAST job_version_string);
xmlAddChild(ret, guid_to_dom_tree(job_guid_string,
qof_instance_get_guid (QOF_INSTANCE (job))));
xmlAddChild(ret, text_to_dom_tree(job_id_string,
gncJobGetID (job)));
xmlAddChild(ret, text_to_dom_tree(job_name_string,
gncJobGetName (job)));
maybe_add_string (ret, job_reference_string, gncJobGetReference (job));
xmlAddChild(ret, gnc_owner_to_dom_tree (job_owner_string,
gncJobGetOwner (job)));
xmlAddChild(ret, int_to_dom_tree(job_active_string,
gncJobGetActive (job)));
return ret;
}
开发者ID:nizarklai,项目名称:gnucash-1,代码行数:27,代码来源:gnc-job-xml-v2.c
示例7: load_single_tx
static /*@ null @*/ Transaction*
load_single_tx( GncSqlBackend* be, GncSqlRow* row )
{
const GncGUID* guid;
GncGUID tx_guid;
Transaction* pTx;
g_return_val_if_fail( be != NULL, NULL );
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
if ( guid == NULL ) return NULL;
tx_guid = *guid;
// Don't overwrite the transaction if it's already been loaded (and possibly modified).
pTx = xaccTransLookup( &tx_guid, be->book );
if ( pTx != NULL )
{
return NULL;
}
pTx = xaccMallocTransaction( be->book );
xaccTransBeginEdit( pTx );
gnc_sql_load_object( be, row, GNC_ID_TRANS, pTx, tx_col_table );
if (pTx != xaccTransLookup( &tx_guid, be->book ))
{
PERR("A malformed transaction with id %s was found in the dataset.",
guid_to_string(qof_instance_get_guid(pTx)));
qof_backend_set_error( &be->be, ERR_BACKEND_DATA_CORRUPT);
pTx = NULL;
}
return pTx;
}
开发者ID:LievaartR,项目名称:gnucash,代码行数:35,代码来源:gnc-transaction-sql.c
示例8: load_taxtable_entries
static void
load_taxtable_entries( GncSqlBackend* be, GncTaxTable* tt )
{
GncSqlResult* result;
gchar guid_buf[GUID_ENCODING_LENGTH+1];
GValue value;
gchar* buf;
GncSqlStatement* stmt;
GError* error = NULL;
g_return_if_fail( be != NULL );
g_return_if_fail( tt != NULL );
guid_to_string_buff( qof_instance_get_guid( QOF_INSTANCE(tt) ), guid_buf );
memset( &value, 0, sizeof( GValue ) );
g_value_init( &value, G_TYPE_STRING );
g_value_set_string( &value, guid_buf );
buf = g_strdup_printf( "SELECT * FROM %s WHERE taxtable='%s'", TTENTRIES_TABLE_NAME, guid_buf );
stmt = gnc_sql_connection_create_statement_from_sql( be->conn, buf );
g_free( buf );
result = gnc_sql_execute_select_statement( be, stmt );
gnc_sql_statement_dispose( stmt );
if ( result != NULL )
{
GncSqlRow* row;
row = gnc_sql_result_get_first_row( result );
while ( row != NULL )
{
load_single_ttentry( be, row, tt );
row = gnc_sql_result_get_next_row( result );
}
gnc_sql_result_dispose( result );
}
}
开发者ID:cstim,项目名称:gnucash-svn,代码行数:35,代码来源:gnc-tax-table-sql.c
示例9: billterm_scrub_invoices
/* for each invoice, check the bill terms. If the bill terms are
* grandchildren, then fix them to point to the most senior child
*/
static void
billterm_scrub_invoices (QofInstance * invoice_p, gpointer ht_p)
{
GHashTable *ht = ht_p;
GncInvoice *invoice = GNC_INVOICE(invoice_p);
GncBillTerm *term, *new_bt;
gint32 count;
term = gncInvoiceGetTerms(invoice);
if (term)
{
if (billterm_is_grandchild(term))
{
gchar guidstr[GUID_ENCODING_LENGTH+1];
guid_to_string_buff(qof_instance_get_guid(QOF_INSTANCE(invoice)),guidstr);
PWARN("Fixing i-billterm on invoice %s\n", guidstr);
new_bt = billterm_find_senior(term);
gncInvoiceBeginEdit(invoice);
gncInvoiceSetTerms(invoice, new_bt);
gncInvoiceCommitEdit(invoice);
term = new_bt;
}
if (term)
{
count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
count++;
g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
}
}
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:33,代码来源:gnc-bill-term-xml-v2.c
示例10: qof_instance_coll_copy
static void
qof_instance_coll_copy(QofInstance *original, gpointer user_data)
{
QofInstanceCopyData *qecd;
QofBook *book;
QofInstance *inst;
const GncGUID *g;
g_return_if_fail(original != NULL);
g_return_if_fail(user_data != NULL);
qecd = (QofInstanceCopyData*)user_data;
book = qof_session_get_book(qecd->new_session);
if (!qof_object_compliance(original->e_type, TRUE))
{
return;
}
inst = (QofInstance*)qof_object_new_instance(original->e_type, book);
qecd->to = inst;
qecd->from = original;
g = qof_instance_get_guid(original);
qof_instance_set_guid(qecd->to, g);
qof_begin_edit(inst);
g_slist_foreach(qecd->param_list, qof_instance_foreach_copy, qecd);
qof_commit_edit(inst);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:25,代码来源:qofsession.c
示例11: col_ref_cb
static void
col_ref_cb (QofInstance* ref_ent, gpointer user_data)
{
QofInstanceReference *ref;
QofInstanceCopyData *qecd;
QofInstance *ent;
const GncGUID *cm_guid;
char cm_sa[GUID_ENCODING_LENGTH + 1];
gchar *cm_string;
g_return_if_fail(user_data);
qecd = (QofInstanceCopyData*)user_data;
ent = qecd->from;
g_return_if_fail(ent);
ref = g_new0(QofInstanceReference, 1);
ref->type = ent->e_type;
ref->ref_guid = g_new(GncGUID, 1);
ref->ent_guid = qof_instance_get_guid(ent);
ref->param = qof_class_get_parameter(ent->e_type,
qecd->param->param_name);
cm_guid = qof_entity_get_guid(ref_ent);
guid_to_string_buff(cm_guid, cm_sa);
cm_string = g_strdup(cm_sa);
if (TRUE == string_to_guid(cm_string, ref->ref_guid))
{
g_free(cm_string);
qof_session_update_reference_list(qecd->new_session, ref);
}
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:29,代码来源:qofsession.c
示例12: gncBillTermDestroy
void gncBillTermDestroy (GncBillTerm *term)
{
if (!term) return;
DEBUG("destroying bill term %s (%p)",
guid_to_string(qof_instance_get_guid(&term->inst)), term);
qof_instance_set_destroying(term, TRUE);
qof_instance_set_dirty (&term->inst);
gncBillTermCommitEdit (term);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:9,代码来源:gncBillTerm.c
示例13: create_session
static QofSession*
create_session(void)
{
QofSession* session = qof_session_new();
QofBook* book = qof_session_get_book( session );
Account* root = gnc_book_get_root_account( book );
Account* acct1;
Account* acct2;
KvpFrame* frame;
Transaction* tx;
Split* spl1;
Split* spl2;
Timespec ts;
struct timeval tv;
gnc_commodity_table* table;
gnc_commodity* currency;
table = gnc_commodity_table_get_table( book );
currency = gnc_commodity_table_lookup( table, GNC_COMMODITY_NS_CURRENCY, "CAD" );
acct1 = xaccMallocAccount( book );
xaccAccountSetType( acct1, ACCT_TYPE_BANK );
xaccAccountSetName( acct1, "Bank 1" );
xaccAccountSetCommodity( acct1, currency );
frame = qof_instance_get_slots( QOF_INSTANCE(acct1) );
kvp_frame_set_gint64( frame, "int64-val", 100 );
kvp_frame_set_double( frame, "double-val", 3.14159 );
kvp_frame_set_numeric( frame, "numeric-val", gnc_numeric_zero() );
time( &(tv.tv_sec) );
tv.tv_usec = 0;
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = 1000 * tv.tv_usec;
kvp_frame_set_timespec( frame, "timespec-val", ts );
kvp_frame_set_string( frame, "string-val", "abcdefghijklmnop" );
kvp_frame_set_guid( frame, "guid-val", qof_instance_get_guid( QOF_INSTANCE(acct1) ) );
gnc_account_append_child( root, acct1 );
acct2 = xaccMallocAccount( book );
xaccAccountSetType( acct2, ACCT_TYPE_BANK );
xaccAccountSetName( acct2, "Bank 1" );
tx = xaccMallocTransaction( book );
xaccTransBeginEdit( tx );
xaccTransSetCurrency( tx, currency );
spl1 = xaccMallocSplit( book );
xaccTransAppendSplit( tx, spl1 );
spl2 = xaccMallocSplit( book );
xaccTransAppendSplit( tx, spl2 );
xaccTransCommitEdit( tx );
return session;
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:57,代码来源:test-dbi-basic.c
示例14: g_return_val_if_fail
/* ================================================================= */
bool
GncSqlInvoiceBackend::commit (GncSqlBackend* be, QofInstance* inst)
{
const GncGUID* guid;
GncInvoice* invoice;
E_DB_OPERATION op;
gboolean is_infant;
gboolean is_ok = TRUE;
g_return_val_if_fail (inst != NULL, FALSE);
g_return_val_if_fail (GNC_IS_INVOICE (inst), FALSE);
g_return_val_if_fail (be != NULL, FALSE);
invoice = GNC_INVOICE (inst);
is_infant = qof_instance_get_infant (inst);
if (qof_instance_get_destroying (inst))
{
op = OP_DB_DELETE;
}
else if (be->pristine() || is_infant)
{
op = OP_DB_INSERT;
}
else
{
op = OP_DB_UPDATE;
}
if (op != OP_DB_DELETE)
{
// Ensure the commodity is in the db
is_ok = gnc_sql_save_commodity (be, gncInvoiceGetCurrency (invoice));
}
if (is_ok)
{
is_ok = gnc_sql_do_db_operation (be, op, TABLE_NAME, GNC_ID_INVOICE, inst,
col_table);
}
if (is_ok)
{
// Now, commit or delete any slots
guid = qof_instance_get_guid (inst);
if (!qof_instance_get_destroying (inst))
{
is_ok = gnc_sql_slots_save (be, guid, is_infant, inst);
}
else
{
is_ok = gnc_sql_slots_delete (be, guid);
}
}
return is_ok;
}
开发者ID:tmertens,项目名称:gnucash,代码行数:57,代码来源:gnc-invoice-sql.cpp
示例15: save_employee
/* ================================================================= */
static gboolean
save_employee (GncSqlBackend* be, QofInstance* inst)
{
GncEmployee* emp;
const GncGUID* guid;
E_DB_OPERATION op;
gboolean is_infant;
gboolean is_ok = TRUE;
g_return_val_if_fail (inst != NULL, FALSE);
g_return_val_if_fail (GNC_IS_EMPLOYEE (inst), FALSE);
g_return_val_if_fail (be != NULL, FALSE);
emp = GNC_EMPLOYEE (inst);
is_infant = qof_instance_get_infant (inst);
if (qof_instance_get_destroying (inst))
{
op = OP_DB_DELETE;
}
else if (be->is_pristine_db || is_infant)
{
op = OP_DB_INSERT;
}
else
{
op = OP_DB_UPDATE;
}
if (op != OP_DB_DELETE)
{
// Ensure the commodity is in the db
is_ok = gnc_sql_save_commodity (be, gncEmployeeGetCurrency (emp));
}
if (is_ok)
{
is_ok = gnc_sql_do_db_operation (be, op, TABLE_NAME, GNC_ID_EMPLOYEE, emp,
col_table);
}
if (is_ok)
{
// Now, commit or delete any slots
guid = qof_instance_get_guid (inst);
if (!qof_instance_get_destroying (inst))
{
is_ok = gnc_sql_slots_save (be, guid, is_infant, inst);
}
else
{
is_ok = gnc_sql_slots_delete (be, guid);
}
}
return is_ok;
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:57,代码来源:gnc-employee-sql.cpp
示例16: gncBillTermDestroy
void gncBillTermDestroy (GncBillTerm *term)
{
gchar guidstr[GUID_ENCODING_LENGTH+1];
if (!term) return;
guid_to_string_buff(qof_instance_get_guid(&term->inst),guidstr);
DEBUG("destroying bill term %s (%p)", guidstr, term);
qof_instance_set_destroying(term, TRUE);
qof_instance_set_dirty (&term->inst);
gncBillTermCommitEdit (term);
}
开发者ID:c-holtermann,项目名称:gnucash,代码行数:10,代码来源:gncBillTerm.c
示例17: g_return_val_if_fail
/* ================================================================= */
bool
GncSqlSchedXactionBackend::commit (GncSqlBackend* sql_be, QofInstance* inst)
{
SchedXaction* pSx;
const GncGUID* guid;
E_DB_OPERATION op;
gboolean is_infant;
gboolean is_ok;
g_return_val_if_fail (sql_be != NULL, FALSE);
g_return_val_if_fail (inst != NULL, FALSE);
g_return_val_if_fail (GNC_IS_SX (inst), FALSE);
pSx = GNC_SX (inst);
is_infant = qof_instance_get_infant (inst);
if (qof_instance_get_destroying (inst))
{
op = OP_DB_DELETE;
}
else if (sql_be->pristine() || is_infant)
{
op = OP_DB_INSERT;
}
else
{
op = OP_DB_UPDATE;
}
is_ok = sql_be->do_db_operation(op, SCHEDXACTION_TABLE, GNC_SX_ID, pSx,
col_table);
guid = qof_instance_get_guid (inst);
if (op == OP_DB_INSERT || op == OP_DB_UPDATE)
{
gnc_sql_recurrence_save_list (sql_be, guid, gnc_sx_get_schedule (pSx));
}
else
{
gnc_sql_recurrence_delete (sql_be, guid);
}
if (is_ok)
{
// Now, commit any slots
if (op == OP_DB_INSERT || op == OP_DB_UPDATE)
{
is_ok = gnc_sql_slots_save (sql_be, guid, is_infant, inst);
}
else
{
is_ok = gnc_sql_slots_delete (sql_be, guid);
}
}
return is_ok;
}
开发者ID:goodvibes2,项目名称:gnucash,代码行数:56,代码来源:gnc-schedxaction-sql.cpp
示例18: g_return_val_if_fail
/* ================================================================= */
bool
GncSqlVendorBackend::commit (GncSqlBackend* sql_be, QofInstance* inst)
{
GncVendor* v;
const GncGUID* guid;
E_DB_OPERATION op;
gboolean is_infant;
gboolean is_ok = TRUE;
g_return_val_if_fail (inst != NULL, FALSE);
g_return_val_if_fail (GNC_IS_VENDOR (inst), FALSE);
g_return_val_if_fail (sql_be != NULL, FALSE);
v = GNC_VENDOR (inst);
is_infant = qof_instance_get_infant (inst);
if (qof_instance_get_destroying (inst))
{
op = OP_DB_DELETE;
}
else if (sql_be->pristine() || is_infant)
{
op = OP_DB_INSERT;
}
else
{
op = OP_DB_UPDATE;
}
if (op != OP_DB_DELETE)
{
// Ensure the commodity is in the db
is_ok = sql_be->save_commodity (gncVendorGetCurrency(v));
}
if (is_ok)
{
is_ok = sql_be->do_db_operation(op, TABLE_NAME, GNC_ID_VENDOR, v,
col_table);
}
if (is_ok)
{
// Now, commit or delete any slots
guid = qof_instance_get_guid (inst);
if (!qof_instance_get_destroying (inst))
{
is_ok = gnc_sql_slots_save (sql_be, guid, is_infant, inst);
}
else
{
is_ok = gnc_sql_slots_delete (sql_be, guid);
}
}
return is_ok;
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:56,代码来源:gnc-vendor-sql.cpp
示例19: g_return_val_if_fail
bool
GncSqlTaxTableBackend::commit (GncSqlBackend* sql_be, QofInstance* inst)
{
GncTaxTable* tt;
const GncGUID* guid;
E_DB_OPERATION op;
gboolean is_infant;
gboolean is_ok;
g_return_val_if_fail (inst != NULL, FALSE);
g_return_val_if_fail (GNC_IS_TAXTABLE (inst), FALSE);
g_return_val_if_fail (sql_be != NULL, FALSE);
tt = GNC_TAXTABLE (inst);
is_infant = qof_instance_get_infant (inst);
if (qof_instance_get_destroying (inst))
{
op = OP_DB_DELETE;
}
else if (sql_be->pristine() || is_infant)
{
op = OP_DB_INSERT;
}
else
{
op = OP_DB_UPDATE;
}
is_ok = sql_be->do_db_operation(op, TT_TABLE_NAME, GNC_ID_TAXTABLE, tt,
tt_col_table);
if (is_ok)
{
// Now, commit or delete any slots and tax table entries
guid = qof_instance_get_guid (inst);
if (!qof_instance_get_destroying (inst))
{
is_ok = gnc_sql_slots_save (sql_be, guid, is_infant, inst);
if (is_ok)
{
is_ok = save_tt_entries (sql_be, guid, gncTaxTableGetEntries (tt));
}
}
else
{
is_ok = gnc_sql_slots_delete (sql_be, guid);
if (is_ok)
{
is_ok = delete_all_tt_entries (sql_be, guid);
}
}
}
return is_ok;
}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:55,代码来源:gnc-tax-table-sql.cpp
示例20: billterm_scrub_vendor
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))));
}
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:20,代码来源:gnc-bill-term-xml-v2.c
注:本文中的qof_instance_get_guid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论