Skip to content

Commit d0ad95f

Browse files
author
Alex Aycinena
committed
Correct bug introduced in commit 63deaad. affecting Edit->Tax Report Options and the US Income Tax Report
1 parent b5c1937 commit d0ad95f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

libgnucash/engine/Account.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4006,13 +4006,17 @@ gint64
40064006
xaccAccountGetTaxUSCopyNumber (const Account *acc)
40074007
{
40084008
auto copy_number = get_kvp_int64_path (acc, {"tax-US", "copy-number"});
4009-
return copy_number ? *copy_number : 1;
4009+
return (copy_number && (*copy_number != 0)) ? *copy_number : 1;
40104010
}
40114011

40124012
void
40134013
xaccAccountSetTaxUSCopyNumber (Account *acc, gint64 copy_number)
40144014
{
4015-
set_kvp_int64_path (acc, {"tax-US", "copy-number"}, copy_number);
4015+
if (copy_number != 0)
4016+
set_kvp_int64_path (acc, {"tax-US", "copy-number"}, copy_number);
4017+
else
4018+
/* deletes KVP if it exists */
4019+
set_kvp_int64_path (acc, {"tax-US", "copy-number"}, std::nullopt);
40164020
}
40174021

40184022
/*********************************************************************\

libgnucash/engine/Account.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,9 +1406,9 @@ typedef enum
14061406
const char * xaccAccountGetTaxUSPayerNameSource (const Account *account);
14071407
/** DOCUMENT ME! */
14081408
void xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source);
1409-
/** DOCUMENT ME! */
1409+
/** Returns copy_number stored in KVP; if KVP doesn't exist or copy_number is zero, returns 1 */
14101410
gint64 xaccAccountGetTaxUSCopyNumber (const Account *account);
1411-
/** DOCUMENT ME! */
1411+
/** Saves copy_number in KVP if it is greater than 1; if copy_number is zero, deletes KVP */
14121412
void xaccAccountSetTaxUSCopyNumber (Account *account, gint64 copy_number);
14131413
/** @} */
14141414

0 commit comments

Comments
 (0)