gnucash maint: Improve transaction sorting on effective num field.

John Ralls jralls at code.gnucash.org
Tue Jun 15 17:03:05 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/601eb513 (commit)
	from  https://github.com/Gnucash/gnucash/commit/84fb25a0 (commit)



commit 601eb513619a9d8d9a609ac22d5e3b20527ed6ad
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jun 8 09:49:46 2021 -0700

    Improve transaction sorting on effective num field.
    
    Inspired by PR #983. Transaction sorting on num broke down if the
    user had a non-numeric string or a number larger than an int in
    the effective num field (might be split-action if the option is set).
    
    The comparison first tries to use strtoull on the two strings and
    compares the results. If they're both nonzero and different then the
    numeric order is returned. If they're both nonzero but the same the
    unconverted parts of each are passed to g_utf8_collate; if either is 0
    then the whole strings are passed to g_utf8_collate. strtoull will
    return 0 for a negative number.



Summary of changes:
 libgnucash/engine/Transaction.c              | 43 +++++++++++++++++++++++-----
 libgnucash/engine/test/utest-Transaction.cpp |  8 +++++-
 2 files changed, 43 insertions(+), 8 deletions(-)



More information about the gnucash-patches mailing list