diff --git a/src/app-utils/gnc-sx-instance-model.c b/src/app-utils/gnc-sx-instance-model.c index a3e2586cce..66229ec54c 100644 --- a/src/app-utils/gnc-sx-instance-model.c +++ b/src/app-utils/gnc-sx-instance-model.c @@ -1198,7 +1198,7 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data) g_debug("amount is %s for memo split '%s'", gnc_numeric_to_string (amt), xaccSplitGetMemo (copying_split)); - xaccSplitSetAmount(copying_split, amt); + xaccSplitSetAmount(copying_split, amt); /* marks split dirty */ } xaccSplitScrub(copying_split); @@ -1217,7 +1217,11 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data) { kvp_frame *txn_frame; txn_frame = xaccTransGetSlots(new_txn); - kvp_frame_set_guid(txn_frame, "from-sched-xaction", xaccSchedXactionGetGUID(creation_data->instance->parent->sx)); + kvp_frame_set_guid(txn_frame, "from-sched-xaction", + xaccSchedXactionGetGUID(creation_data->instance->parent->sx)); +/* The transaction was probably marked dirty by xaccTransSetCurrency, + * but just in case: */ + qof_instance_set_dirty (QOF_INSTANCE (new_txn)); } xaccTransCommitEdit(new_txn); diff --git a/src/engine/Split.c b/src/engine/Split.c index 892dc64f18..39c246f735 100644 --- a/src/engine/Split.c +++ b/src/engine/Split.c @@ -1943,10 +1943,10 @@ xaccSplitVoid(Split *split) kvp_frame_set_gnc_numeric(frame, void_former_val_str, xaccSplitGetValue(split)); + /* Marking dirty handled by SetAmount etc. */ xaccSplitSetAmount (split, zero); xaccSplitSetValue (split, zero); xaccSplitSetReconcile(split, VREC); - } void @@ -1959,6 +1959,7 @@ xaccSplitUnvoid(Split *split) xaccSplitSetReconcile(split, NREC); kvp_frame_set_slot(frame, void_former_amt_str, NULL); kvp_frame_set_slot(frame, void_former_val_str, NULL); + qof_instance_set_dirty (QOF_INSTANCE (split)); } /********************************************************************\ diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 9076ba3d5f..cd71c8d5f8 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1857,6 +1857,7 @@ xaccTransSetDatePostedGDate (Transaction *trans, GDate date) kvp_value_delete(kvp_value); } + /* mark dirty and commit handled by SetDateInternal */ xaccTransSetDateInternal(trans, &trans->date_posted, gdate_to_timespec(date)); set_gains_date_dirty (trans); @@ -2480,13 +2481,13 @@ xaccTransReverse (Transaction *orig) xaccSplitSetAmount(s, gnc_numeric_neg(xaccSplitGetAmount(s))); xaccSplitSetValue(s, gnc_numeric_neg(xaccSplitGetValue(s))); xaccSplitSetReconcile(s, NREC); - qof_instance_set_dirty(QOF_INSTANCE(trans)); }); /* Now update the original with a pointer to the new one */ kvp_val = kvp_value_new_guid(xaccTransGetGUID(trans)); kvp_frame_set_slot_nc(orig->inst.kvp_data, TRANS_REVERSED_BY, kvp_val); + qof_instance_set_dirty(QOF_INSTANCE(trans)); xaccTransCommitEdit(trans); return trans; } diff --git a/src/import-export/import-match-map.c b/src/import-export/import-match-map.c index 3e96b05e2d..558800d1ef 100644 --- a/src/import-export/import-match-map.c +++ b/src/import-export/import-match-map.c @@ -107,14 +107,14 @@ void gnc_imap_destroy (GncImportMatchMap *imap) void gnc_imap_clear (GncImportMatchMap *imap) { if (!imap) return; - + xaccAccountBeginEdit (imap->acc); /* Clear the IMAP_FRAME kvp */ kvp_frame_set_slot_path (imap->frame, NULL, IMAP_FRAME); /* Clear the bayes kvp, IMAP_FRAME_BAYES */ kvp_frame_set_slot_path (imap->frame, NULL, IMAP_FRAME_BAYES); - - /* XXX: mark the account (or book) as dirty! */ + qof_instance_set_dirty (QOF_INSTANCE (imap->acc)); + xaccAccountCommitEdit (imap->acc); } /** Look up an Account in the map */ diff --git a/src/import-export/import-utilities.c b/src/import-export/import-utilities.c index 4d7756a7bf..53cd6c1685 100644 --- a/src/import-export/import-utilities.c +++ b/src/import-export/import-utilities.c @@ -72,8 +72,11 @@ void gnc_import_set_trans_online_id(Transaction * transaction, const gchar * string_value) { kvp_frame * frame; + xaccTransBeginEdit (transaction); frame = xaccTransGetSlots(transaction); kvp_frame_set_str (frame, "online_id", string_value); + qof_instance_set_dirty (QOF_INSTANCE (transaction)); + xaccTransCommitEdit (transaction); } gboolean gnc_import_trans_has_online_id(Transaction * transaction) @@ -96,8 +99,10 @@ void gnc_import_set_split_online_id(Split * split, const gchar * string_value) { kvp_frame * frame; + xaccTransBeginEdit (xaccSplitGetParent (split)); frame = xaccSplitGetSlots(split); kvp_frame_set_str (frame, "online_id", string_value); + qof_instance_set_dirty (QOF_INSTANCE (split)); } gboolean gnc_import_split_has_online_id(Split * split) diff --git a/src/register/ledger-core/split-register-model-save.c b/src/register/ledger-core/split-register-model-save.c index b4cc14581e..f942ce1ce9 100644 --- a/src/register/ledger-core/split-register-model-save.c +++ b/src/register/ledger-core/split-register-model-save.c @@ -683,6 +683,7 @@ gnc_template_register_save_xfrm_cell (BasicCell * cell, /* set the actual account to the fake account for these templates */ xaccAccountInsertSplit (template_acc, sd->split); + qof_instance_set_dirty (QOF_INSTANCE (sd->split)); } static void @@ -760,6 +761,7 @@ gnc_template_register_save_debcred_cell (BasicCell * cell, DEBUG ("kvp_frame after: %s\n", kvp_frame_to_string (kvpf)); /* set the amount to an innocuous value */ + /* Note that this marks the split dirty */ xaccSplitSetValue (sd->split, gnc_numeric_create (0, 1)); sd->handled_dc = TRUE; @@ -791,6 +793,7 @@ gnc_template_register_save_shares_cell (BasicCell * cell, DEBUG ("kvp_frame after: %s\n", kvp_frame_to_string (kvpf)); /* set the shares to an innocuous value */ + /* Note that this marks the split dirty */ xaccSplitSetSharePriceAndAmount (sd->split, gnc_numeric_create (0, 1), gnc_numeric_create (0, 1)); diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index 5ebe906c75..e1d13f4621 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -1816,7 +1816,9 @@ gnc_plugin_page_report_exportpdf_cb( GtkAction *action, GncPluginPageReport *rep // As this is an invoice report with some owner, we will try to look up the // chosen output directory from the print settings and store it again in the owner kvp. GtkPrintSettings *print_settings = gnc_print_get_settings(); - if (print_settings && gtk_print_settings_has_key(print_settings, GNC_GTK_PRINT_SETTINGS_EXPORT_DIR)) + if (print_settings && + gtk_print_settings_has_key(print_settings, + GNC_GTK_PRINT_SETTINGS_EXPORT_DIR)) { const char* dirname = gtk_print_settings_get(print_settings, GNC_GTK_PRINT_SETTINGS_EXPORT_DIR); @@ -1824,11 +1826,14 @@ gnc_plugin_page_report_exportpdf_cb( GtkAction *action, GncPluginPageReport *rep if (g_file_test(dirname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { QofInstance *qofinstance = qofOwnerGetOwner(owner); - //gncOwnerBeginEdit(owner); - kvp_frame_set_string(kvp, KVP_OWNER_EXPORT_PDF_DIRNAME, dirname); if (qofinstance) + { + gncOwnerBeginEdit(owner); + kvp_frame_set_string(kvp, KVP_OWNER_EXPORT_PDF_DIRNAME, + dirname); qof_instance_set_dirty(qofinstance); - // shoot... there is no such thing as: gncOwnerCommitEdit(owner); + qof_commit_edit (qofinstance); + } } } }