[Transaction.cpp] small modification to xaccTransSetNotes

pull/2107/head
Christopher Lam 11 months ago
parent 7e740babdf
commit 985f591830

@ -2080,15 +2080,8 @@ qofTransSetNotes (Transaction *trans, const char *notes)
void
xaccTransSetNotes (Transaction *trans, const char *notes)
{
GValue v = G_VALUE_INIT;
if (!trans || !notes) return;
g_value_init (&v, G_TYPE_STRING);
g_value_set_static_string (&v, notes);
xaccTransBeginEdit(trans);
qof_instance_set_kvp (QOF_INSTANCE (trans), &v, 1, trans_notes_str);
qof_instance_set_dirty(QOF_INSTANCE(trans));
g_value_unset (&v);
xaccTransCommitEdit(trans);
set_kvp_string_path (trans, {trans_notes_str}, notes);
}
void

@ -1870,8 +1870,8 @@ test_xaccTransSetNotes (Fixture *fixture, gconstpointer pData)
g_assert_cmpstr (frame->get_slot({trans_notes_str})->get<const char*>(), ==, "set");
xaccTransSetNotes (trans, "");
g_assert_cmpstr (xaccTransGetNotes (trans), ==, "");
g_assert_cmpstr (frame->get_slot({trans_notes_str})->get<const char*>(), ==, "");
g_assert_cmpstr (xaccTransGetNotes (trans), ==, nullptr);
g_assert_null (frame->get_slot({trans_notes_str}));
xaccTransSetNotes (trans, "reset");
g_assert_cmpstr (xaccTransGetNotes (trans), ==, "reset");

Loading…
Cancel
Save