mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[Bug #642276] Bayesian association with Sqlite
Wraps the kvp_frame_set_slot_path with xaccAccountBeginEdit()/xaccAccountCommitEdit(). BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21742 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
343f17fc67
commit
0c5a2cbc90
@ -150,11 +150,14 @@ void gnc_imap_add_account (GncImportMatchMap *imap, const char *category,
|
|||||||
category = key;
|
category = key;
|
||||||
key = NULL;
|
key = NULL;
|
||||||
}
|
}
|
||||||
|
g_return_if_fail (acc != NULL);
|
||||||
|
|
||||||
value = kvp_value_new_guid (xaccAccountGetGUID (acc));
|
value = kvp_value_new_guid (xaccAccountGetGUID (acc));
|
||||||
g_return_if_fail (value != NULL);
|
g_return_if_fail (value != NULL);
|
||||||
|
xaccAccountBeginEdit (imap->acc);
|
||||||
kvp_frame_set_slot_path (imap->frame, value, IMAP_FRAME, category, key, NULL);
|
kvp_frame_set_slot_path (imap->frame, value, IMAP_FRAME, category, key, NULL);
|
||||||
|
qof_instance_set_dirty (QOF_INSTANCE (imap->acc));
|
||||||
|
xaccAccountCommit (imap->acc);
|
||||||
kvp_value_delete (value);
|
kvp_value_delete (value);
|
||||||
|
|
||||||
/* XXX Mark the account (or book) as dirty! */
|
/* XXX Mark the account (or book) as dirty! */
|
||||||
@ -475,7 +478,9 @@ void gnc_imap_add_account_bayes(GncImportMatchMap *imap, GList *tokens, Account
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_return_if_fail (acc != NULL);
|
||||||
account_fullname = gnc_account_get_full_name(acc);
|
account_fullname = gnc_account_get_full_name(acc);
|
||||||
|
xaccAccountBeginEdit (imap->acc);
|
||||||
|
|
||||||
PINFO("account name: '%s'\n", account_fullname);
|
PINFO("account name: '%s'\n", account_fullname);
|
||||||
|
|
||||||
@ -524,13 +529,14 @@ void gnc_imap_add_account_bayes(GncImportMatchMap *imap, GList *tokens, Account
|
|||||||
*/
|
*/
|
||||||
kvp_frame_set_slot_path(imap->frame, new_value, IMAP_FRAME_BAYES,
|
kvp_frame_set_slot_path(imap->frame, new_value, IMAP_FRAME_BAYES,
|
||||||
(char*)current_token->data, account_fullname, NULL);
|
(char*)current_token->data, account_fullname, NULL);
|
||||||
|
|
||||||
/* kvp_frame_set_slot_path() copied the value so we
|
/* kvp_frame_set_slot_path() copied the value so we
|
||||||
* need to delete this one ;-) */
|
* need to delete this one ;-) */
|
||||||
kvp_value_delete(new_value);
|
kvp_value_delete(new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free up the account fullname string */
|
/* free up the account fullname string */
|
||||||
|
qof_instance_set_dirty (QOF_INSTANCE (imap->acc));
|
||||||
|
xaccAccountCommitEdit (imap->acc);
|
||||||
g_free(account_fullname);
|
g_free(account_fullname);
|
||||||
|
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
|
@ -47,12 +47,18 @@ const gchar * gnc_import_get_acc_online_id(Account * account)
|
|||||||
return kvp_frame_get_string(frame, "online_id");
|
return kvp_frame_get_string(frame, "online_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used in the midst of editing a transaction; make it save the
|
||||||
|
* account data. */
|
||||||
void gnc_import_set_acc_online_id(Account * account,
|
void gnc_import_set_acc_online_id(Account * account,
|
||||||
const gchar * string_value)
|
const gchar * string_value)
|
||||||
{
|
{
|
||||||
kvp_frame * frame;
|
kvp_frame * frame;
|
||||||
|
g_return_if_fail (account != NULL);
|
||||||
frame = xaccAccountGetSlots(account);
|
frame = xaccAccountGetSlots(account);
|
||||||
|
xaccAccountBeginEdit (account);
|
||||||
kvp_frame_set_str(frame, "online_id", string_value);
|
kvp_frame_set_str(frame, "online_id", string_value);
|
||||||
|
qof_instance_set_dirty (QOF_INSTANCE (account));
|
||||||
|
xaccAccountCommitEdit (account);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar * gnc_import_get_trans_online_id(Transaction * transaction)
|
const gchar * gnc_import_get_trans_online_id(Transaction * transaction)
|
||||||
@ -61,7 +67,7 @@ const gchar * gnc_import_get_trans_online_id(Transaction * transaction)
|
|||||||
frame = xaccTransGetSlots(transaction);
|
frame = xaccTransGetSlots(transaction);
|
||||||
return kvp_frame_get_string(frame, "online_id");
|
return kvp_frame_get_string(frame, "online_id");
|
||||||
}
|
}
|
||||||
|
/* Not actually used */
|
||||||
void gnc_import_set_trans_online_id(Transaction * transaction,
|
void gnc_import_set_trans_online_id(Transaction * transaction,
|
||||||
const gchar * string_value)
|
const gchar * string_value)
|
||||||
{
|
{
|
||||||
@ -83,7 +89,9 @@ const gchar * gnc_import_get_split_online_id(Split * split)
|
|||||||
frame = xaccSplitGetSlots(split);
|
frame = xaccSplitGetSlots(split);
|
||||||
return kvp_frame_get_string(frame, "online_id");
|
return kvp_frame_get_string(frame, "online_id");
|
||||||
}
|
}
|
||||||
|
/* Used several places in a transaction edit where many other
|
||||||
|
* parameters are also being set, so individual commits wouldn't be
|
||||||
|
* appropriate. */
|
||||||
void gnc_import_set_split_online_id(Split * split,
|
void gnc_import_set_split_online_id(Split * split,
|
||||||
const gchar * string_value)
|
const gchar * string_value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user