gnucash master: Counter formats stored in wrong place.

Robert Fewell bobit at code.gnucash.org
Thu Apr 7 05:39:31 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/83373563 (commit)
	from  https://github.com/Gnucash/gnucash/commit/29bdd9b5 (commit)



commit 83373563c3f02dc747e33427c390389e9f719b3b
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Apr 7 10:33:11 2022 +0100

    Counter formats stored in wrong place.
    
    The Book Options, counter formats were being stored under the 'options'
    tree but need to be stored in the 'counter_format' tree similar to the
    'counters' tree.

diff --git a/libgnucash/app-utils/gnc-optiondb.cpp b/libgnucash/app-utils/gnc-optiondb.cpp
index b36a1ba60..dcec0e109 100644
--- a/libgnucash/app-utils/gnc-optiondb.cpp
+++ b/libgnucash/app-utils/gnc-optiondb.cpp
@@ -414,7 +414,7 @@ static inline void
 counter_option_path(const GncOption& option, GSList* list, std::string& name)
 {
     constexpr const char* counters{"counters"};
-    constexpr const char* formats{"counter_formats/"};
+    constexpr const char* formats{"counter_formats"};
     auto key = option.get_key();
     name = key.substr(0, key.size() - 1);
     list->next->data = (void*)name.c_str();
diff --git a/libgnucash/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
index e03fda12e..e73b77202 100644
--- a/libgnucash/engine/qofbook.cpp
+++ b/libgnucash/engine/qofbook.cpp
@@ -1185,7 +1185,7 @@ qof_book_commit_edit(QofBook *book)
 }
 
 /* Deal with the fact that some options are not in the "options" tree but rather
- * in the "counters" tree */
+ * in the "counters" or "counter_formats" tree */
 static Path gslist_to_option_path (GSList *gspath)
 {
     Path tmp_path;
@@ -1194,7 +1194,7 @@ static Path gslist_to_option_path (GSList *gspath)
     Path path_v {str_KVP_OPTION_PATH};
     for (auto item = gspath; item != nullptr; item = g_slist_next(item))
         tmp_path.push_back(static_cast<const char*>(item->data));
-    if (tmp_path.front() == "counters")
+    if ((tmp_path.front() == "counters") || (tmp_path.front() == "counter_formats"))
         return tmp_path;
 
     path_v.insert(path_v.end(), tmp_path.begin(), tmp_path.end());



Summary of changes:
 libgnucash/app-utils/gnc-optiondb.cpp | 2 +-
 libgnucash/engine/qofbook.cpp         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list