gnucash stable: Correct bug introduced in commit 63deaad. affecting Edit->Tax Report Options and the US Income Tax Report
J.Alex Aycinena
alex.aycinena at code.gnucash.org
Thu Feb 6 18:07:34 EST 2025
Updated via https://github.com/Gnucash/gnucash/commit/d0ad95fe (commit)
from https://github.com/Gnucash/gnucash/commit/b5c19377 (commit)
commit d0ad95fe927ae93abf85f617e7d8db2e1c4a2dec
Author: Alex Aycinena <alex.aycinena at gmail.com>
Date: Thu Feb 6 15:06:09 2025 -0800
Correct bug introduced in commit 63deaad. affecting Edit->Tax Report Options and the US Income Tax Report
diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index c3bc18f7fc..438a0d8d04 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -4006,13 +4006,17 @@ gint64
xaccAccountGetTaxUSCopyNumber (const Account *acc)
{
auto copy_number = get_kvp_int64_path (acc, {"tax-US", "copy-number"});
- return copy_number ? *copy_number : 1;
+ return (copy_number && (*copy_number != 0)) ? *copy_number : 1;
}
void
xaccAccountSetTaxUSCopyNumber (Account *acc, gint64 copy_number)
{
- set_kvp_int64_path (acc, {"tax-US", "copy-number"}, copy_number);
+ if (copy_number != 0)
+ set_kvp_int64_path (acc, {"tax-US", "copy-number"}, copy_number);
+ else
+ /* deletes KVP if it exists */
+ set_kvp_int64_path (acc, {"tax-US", "copy-number"}, std::nullopt);
}
/*********************************************************************\
diff --git a/libgnucash/engine/Account.h b/libgnucash/engine/Account.h
index 842db88486..eea91ac018 100644
--- a/libgnucash/engine/Account.h
+++ b/libgnucash/engine/Account.h
@@ -1406,9 +1406,9 @@ typedef enum
const char * xaccAccountGetTaxUSPayerNameSource (const Account *account);
/** DOCUMENT ME! */
void xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source);
- /** DOCUMENT ME! */
+ /** Returns copy_number stored in KVP; if KVP doesn't exist or copy_number is zero, returns 1 */
gint64 xaccAccountGetTaxUSCopyNumber (const Account *account);
- /** DOCUMENT ME! */
+ /** Saves copy_number in KVP if it is greater than 1; if copy_number is zero, deletes KVP */
void xaccAccountSetTaxUSCopyNumber (Account *account, gint64 copy_number);
/** @} */
Summary of changes:
libgnucash/engine/Account.cpp | 8 ++++++--
libgnucash/engine/Account.h | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
More information about the gnucash-changes
mailing list