mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Ensure that all KVP changes are properly marked dirty and committed.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23466 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
cb598dfd77
commit
7fa5a33932
@ -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));
|
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);
|
xaccSplitScrub(copying_split);
|
||||||
@ -1217,7 +1217,11 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
|
|||||||
{
|
{
|
||||||
kvp_frame *txn_frame;
|
kvp_frame *txn_frame;
|
||||||
txn_frame = xaccTransGetSlots(new_txn);
|
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);
|
xaccTransCommitEdit(new_txn);
|
||||||
|
@ -1943,10 +1943,10 @@ xaccSplitVoid(Split *split)
|
|||||||
kvp_frame_set_gnc_numeric(frame, void_former_val_str,
|
kvp_frame_set_gnc_numeric(frame, void_former_val_str,
|
||||||
xaccSplitGetValue(split));
|
xaccSplitGetValue(split));
|
||||||
|
|
||||||
|
/* Marking dirty handled by SetAmount etc. */
|
||||||
xaccSplitSetAmount (split, zero);
|
xaccSplitSetAmount (split, zero);
|
||||||
xaccSplitSetValue (split, zero);
|
xaccSplitSetValue (split, zero);
|
||||||
xaccSplitSetReconcile(split, VREC);
|
xaccSplitSetReconcile(split, VREC);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1959,6 +1959,7 @@ xaccSplitUnvoid(Split *split)
|
|||||||
xaccSplitSetReconcile(split, NREC);
|
xaccSplitSetReconcile(split, NREC);
|
||||||
kvp_frame_set_slot(frame, void_former_amt_str, NULL);
|
kvp_frame_set_slot(frame, void_former_amt_str, NULL);
|
||||||
kvp_frame_set_slot(frame, void_former_val_str, NULL);
|
kvp_frame_set_slot(frame, void_former_val_str, NULL);
|
||||||
|
qof_instance_set_dirty (QOF_INSTANCE (split));
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
|
@ -1857,6 +1857,7 @@ xaccTransSetDatePostedGDate (Transaction *trans, GDate date)
|
|||||||
kvp_value_delete(kvp_value);
|
kvp_value_delete(kvp_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* mark dirty and commit handled by SetDateInternal */
|
||||||
xaccTransSetDateInternal(trans, &trans->date_posted,
|
xaccTransSetDateInternal(trans, &trans->date_posted,
|
||||||
gdate_to_timespec(date));
|
gdate_to_timespec(date));
|
||||||
set_gains_date_dirty (trans);
|
set_gains_date_dirty (trans);
|
||||||
@ -2480,13 +2481,13 @@ xaccTransReverse (Transaction *orig)
|
|||||||
xaccSplitSetAmount(s, gnc_numeric_neg(xaccSplitGetAmount(s)));
|
xaccSplitSetAmount(s, gnc_numeric_neg(xaccSplitGetAmount(s)));
|
||||||
xaccSplitSetValue(s, gnc_numeric_neg(xaccSplitGetValue(s)));
|
xaccSplitSetValue(s, gnc_numeric_neg(xaccSplitGetValue(s)));
|
||||||
xaccSplitSetReconcile(s, NREC);
|
xaccSplitSetReconcile(s, NREC);
|
||||||
qof_instance_set_dirty(QOF_INSTANCE(trans));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Now update the original with a pointer to the new one */
|
/* Now update the original with a pointer to the new one */
|
||||||
kvp_val = kvp_value_new_guid(xaccTransGetGUID(trans));
|
kvp_val = kvp_value_new_guid(xaccTransGetGUID(trans));
|
||||||
kvp_frame_set_slot_nc(orig->inst.kvp_data, TRANS_REVERSED_BY, kvp_val);
|
kvp_frame_set_slot_nc(orig->inst.kvp_data, TRANS_REVERSED_BY, kvp_val);
|
||||||
|
|
||||||
|
qof_instance_set_dirty(QOF_INSTANCE(trans));
|
||||||
xaccTransCommitEdit(trans);
|
xaccTransCommitEdit(trans);
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
|
@ -107,14 +107,14 @@ void gnc_imap_destroy (GncImportMatchMap *imap)
|
|||||||
void gnc_imap_clear (GncImportMatchMap *imap)
|
void gnc_imap_clear (GncImportMatchMap *imap)
|
||||||
{
|
{
|
||||||
if (!imap) return;
|
if (!imap) return;
|
||||||
|
xaccAccountBeginEdit (imap->acc);
|
||||||
/* Clear the IMAP_FRAME kvp */
|
/* Clear the IMAP_FRAME kvp */
|
||||||
kvp_frame_set_slot_path (imap->frame, NULL, IMAP_FRAME);
|
kvp_frame_set_slot_path (imap->frame, NULL, IMAP_FRAME);
|
||||||
|
|
||||||
/* Clear the bayes kvp, IMAP_FRAME_BAYES */
|
/* Clear the bayes kvp, IMAP_FRAME_BAYES */
|
||||||
kvp_frame_set_slot_path (imap->frame, NULL, IMAP_FRAME_BAYES);
|
kvp_frame_set_slot_path (imap->frame, NULL, IMAP_FRAME_BAYES);
|
||||||
|
qof_instance_set_dirty (QOF_INSTANCE (imap->acc));
|
||||||
/* XXX: mark the account (or book) as dirty! */
|
xaccAccountCommitEdit (imap->acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Look up an Account in the map */
|
/** Look up an Account in the map */
|
||||||
|
@ -72,8 +72,11 @@ void gnc_import_set_trans_online_id(Transaction * transaction,
|
|||||||
const gchar * string_value)
|
const gchar * string_value)
|
||||||
{
|
{
|
||||||
kvp_frame * frame;
|
kvp_frame * frame;
|
||||||
|
xaccTransBeginEdit (transaction);
|
||||||
frame = xaccTransGetSlots(transaction);
|
frame = xaccTransGetSlots(transaction);
|
||||||
kvp_frame_set_str (frame, "online_id", string_value);
|
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)
|
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)
|
const gchar * string_value)
|
||||||
{
|
{
|
||||||
kvp_frame * frame;
|
kvp_frame * frame;
|
||||||
|
xaccTransBeginEdit (xaccSplitGetParent (split));
|
||||||
frame = xaccSplitGetSlots(split);
|
frame = xaccSplitGetSlots(split);
|
||||||
kvp_frame_set_str (frame, "online_id", string_value);
|
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)
|
gboolean gnc_import_split_has_online_id(Split * split)
|
||||||
|
@ -683,6 +683,7 @@ gnc_template_register_save_xfrm_cell (BasicCell * cell,
|
|||||||
|
|
||||||
/* set the actual account to the fake account for these templates */
|
/* set the actual account to the fake account for these templates */
|
||||||
xaccAccountInsertSplit (template_acc, sd->split);
|
xaccAccountInsertSplit (template_acc, sd->split);
|
||||||
|
qof_instance_set_dirty (QOF_INSTANCE (sd->split));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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));
|
DEBUG ("kvp_frame after: %s\n", kvp_frame_to_string (kvpf));
|
||||||
|
|
||||||
/* set the amount to an innocuous value */
|
/* set the amount to an innocuous value */
|
||||||
|
/* Note that this marks the split dirty */
|
||||||
xaccSplitSetValue (sd->split, gnc_numeric_create (0, 1));
|
xaccSplitSetValue (sd->split, gnc_numeric_create (0, 1));
|
||||||
|
|
||||||
sd->handled_dc = TRUE;
|
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));
|
DEBUG ("kvp_frame after: %s\n", kvp_frame_to_string (kvpf));
|
||||||
|
|
||||||
/* set the shares to an innocuous value */
|
/* set the shares to an innocuous value */
|
||||||
|
/* Note that this marks the split dirty */
|
||||||
xaccSplitSetSharePriceAndAmount (sd->split,
|
xaccSplitSetSharePriceAndAmount (sd->split,
|
||||||
gnc_numeric_create (0, 1),
|
gnc_numeric_create (0, 1),
|
||||||
gnc_numeric_create (0, 1));
|
gnc_numeric_create (0, 1));
|
||||||
|
@ -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
|
// 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.
|
// chosen output directory from the print settings and store it again in the owner kvp.
|
||||||
GtkPrintSettings *print_settings = gnc_print_get_settings();
|
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,
|
const char* dirname = gtk_print_settings_get(print_settings,
|
||||||
GNC_GTK_PRINT_SETTINGS_EXPORT_DIR);
|
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))
|
if (g_file_test(dirname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
|
||||||
{
|
{
|
||||||
QofInstance *qofinstance = qofOwnerGetOwner(owner);
|
QofInstance *qofinstance = qofOwnerGetOwner(owner);
|
||||||
//gncOwnerBeginEdit(owner);
|
|
||||||
kvp_frame_set_string(kvp, KVP_OWNER_EXPORT_PDF_DIRNAME, dirname);
|
|
||||||
if (qofinstance)
|
if (qofinstance)
|
||||||
|
{
|
||||||
|
gncOwnerBeginEdit(owner);
|
||||||
|
kvp_frame_set_string(kvp, KVP_OWNER_EXPORT_PDF_DIRNAME,
|
||||||
|
dirname);
|
||||||
qof_instance_set_dirty(qofinstance);
|
qof_instance_set_dirty(qofinstance);
|
||||||
// shoot... there is no such thing as: gncOwnerCommitEdit(owner);
|
qof_commit_edit (qofinstance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user