File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -4006,13 +4006,17 @@ gint64
40064006xaccAccountGetTaxUSCopyNumber (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
40124012void
40134013xaccAccountSetTaxUSCopyNumber (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/* ********************************************************************\
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments