Make gnucash 2.7+ rerun bayesian data conversion whenever needed

Whenever recent 2.6.x versions of gnucash store bayesian data
in the old format (full account name based), gnucash 2.7+
should perform a conversion the the new format (guid based)
on subsequent opening of the file.
This commit is contained in:
Robert Fewell 2016-03-10 12:08:40 +01:00 committed by Geert Janssens
parent 1806515122
commit 7003a56171

View File

@ -558,8 +558,17 @@ void gnc_imap_add_account_bayes(GncImportMatchMap *imap, GList *tokens, Account
* /imap->frame/IMAP_FRAME/token_string/account_fullname or guid
*/
if (use_fullname == TRUE)
{
KvpFrame *book_frame = qof_book_get_slots (imap->book);
const gchar *book_path = "changed-bayesian-to-guid";
kvp_frame_set_slot_path(imap->frame, new_value, IMAP_FRAME_BAYES,
(char*)current_token->data, account_fullname, NULL);
/* Reset the run once kvp flag for versions 2.7.0 and later */
if (kvp_frame_get_string(book_frame, book_path) != NULL)
kvp_frame_set_string(book_frame, book_path, "false");
}
else
kvp_frame_set_slot_path(imap->frame, new_value, IMAP_FRAME_BAYES,
(char*)current_token->data, guid_string, NULL);