r19038 - gnucash/trunk/src/libqof/qof - When updating book counters for business objects (in book slots), ensure they're saved.
Phil Longstaff
plongstaff at code.gnucash.org
Mon Apr 19 12:56:40 EDT 2010
Author: plongstaff
Date: 2010-04-19 12:56:40 -0400 (Mon, 19 Apr 2010)
New Revision: 19038
Trac: http://svn.gnucash.org/trac/changeset/19038
Modified:
gnucash/trunk/src/libqof/qof/qofbook.c
gnucash/trunk/src/libqof/qof/qofbook.h
Log:
When updating book counters for business objects (in book slots), ensure they're saved.
Modified: gnucash/trunk/src/libqof/qof/qofbook.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofbook.c 2010-04-18 20:54:59 UTC (rev 19037)
+++ gnucash/trunk/src/libqof/qof/qofbook.c 2010-04-19 16:56:40 UTC (rev 19038)
@@ -390,7 +390,7 @@
}
gint64
-qof_book_get_counter (const QofBook *book, const char *counter_name)
+qof_book_get_counter (QofBook *book, const char *counter_name)
{
QofBackend *be;
KvpFrame *kvp;
@@ -439,9 +439,12 @@
counter++;
/* Save off the new counter */
+ qof_book_begin_edit(book);
value = kvp_value_new_gint64 (counter);
kvp_frame_set_slot_path (kvp, value, "counters", counter_name, NULL);
kvp_value_delete (value);
+ qof_book_mark_dirty(book);
+ qof_book_commit_edit(book);
/* and return the value */
return counter;
Modified: gnucash/trunk/src/libqof/qof/qofbook.h
===================================================================
--- gnucash/trunk/src/libqof/qof/qofbook.h 2010-04-18 20:54:59 UTC (rev 19037)
+++ gnucash/trunk/src/libqof/qof/qofbook.h 2010-04-19 16:56:40 UTC (rev 19038)
@@ -281,7 +281,7 @@
/** This will 'get and increment' the named counter for this book.
* The return value is -1 on error or the incremented counter.
*/
-gint64 qof_book_get_counter (const QofBook *book, const char *counter_name);
+gint64 qof_book_get_counter (QofBook *book, const char *counter_name);
const char* qof_book_get_string_option(const QofBook* book, const char* opt_name);
void qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_val);
More information about the gnucash-changes
mailing list