gnucash stable: Bug 798930 - invoices wont sequence to the next number

John Ralls jralls at code.gnucash.org
Fri May 26 20:43:37 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/7d566389 (commit)
	from  https://github.com/Gnucash/gnucash/commit/3d30e597 (commit)



commit 7d5663899ca62b4e52a854372a7c777a6ee6e730
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri May 26 20:41:13 2023 -0400

    Bug 798930 - invoices wont sequence to the next number
    
    Because KVP can't magically cast between int64_t and double.

diff --git a/libgnucash/engine/gnc-optiondb.cpp b/libgnucash/engine/gnc-optiondb.cpp
index a7498805c1..117848fdd2 100644
--- a/libgnucash/engine/gnc-optiondb.cpp
+++ b/libgnucash/engine/gnc-optiondb.cpp
@@ -457,9 +457,11 @@ GncOptionDB::save_to_kvp(QofBook* book, bool clear_options) const noexcept
                         else if (is_qofinstance_ui_type(type))
                             kvp = kvp_value_from_qof_instance_option(option);
                         else if (type == GncOptionUIType::NUMBER_RANGE)
-                            /* The Gtk control uses a double so that's what we
-                             * have to store. */
-                            kvp = new KvpValue(option.template get_value<double>());
+                        {
+                            auto d_value{option.template get_value<double>()};
+                            auto value{static_cast<int64_t>(d_value)};
+                            kvp = new KvpValue(value);
+                        }
                         else
                         {
                             auto str{option.template get_value<std::string>()};



Summary of changes:
 libgnucash/engine/gnc-optiondb.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list