When updating book counters for business objects (in book slots), ensure they're saved.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19038 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2010-04-19 16:56:40 +00:00
parent 42e6e70bfe
commit ac1cf031f5
2 changed files with 5 additions and 2 deletions

View File

@ -390,7 +390,7 @@ void qof_book_set_version (QofBook *book, gint32 version)
}
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 @@ qof_book_get_counter (const QofBook *book, const char *counter_name)
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;

View File

@ -281,7 +281,7 @@ gboolean qof_book_equal (const QofBook *book_1, const QofBook *book_2);
/** 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);