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.
This commit is contained in:
Robert Fewell 2022-04-07 10:33:11 +01:00
parent 29bdd9b526
commit 83373563c3
2 changed files with 3 additions and 3 deletions

View File

@ -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();

View File

@ -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());