Copied over from bug 797573 Because of the base-36 sorting, trying to sort accounts becomes unpredictable. Perhaps it's time to remove it? -=-=-=-=-=- The problem is in how account codes are used in the comparison: their integer values are sometimes ignored and sometimes not. Consider accounts: Name = A, Code = '20' Name = B, Code = '20_' Name = C, Code = 'a' Name = D, Code = '11' A < B, because '20' < '20_' lexicographically. B < C, because '20_' < 'a' lexicographically. C < D, because a (10) < 11 numerically. D < A, because 11 < 20 numerically. A possible fix (works for me): diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index fcacf1862..194976dbd 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -2239,18 +2239,6 @@ xaccAccountOrder (const Account *aa, const Account *ab) da = priv_aa->accountCode; db = priv_ab->accountCode; - /* If accountCodes are both base 36 integers do an integer sort */ - la = strtoul (da, &endptr, 36); - if ((*da != '\0') && (*endptr == '\0')) - { - lb = strtoul (db, &endptr, 36); - if ((*db != '\0') && (*endptr == '\0')) - { - if (la < lb) return -1; - if (la > lb) return +1; - } - } - /* Otherwise do a string sort */ result = g_strcmp0 (da, db); if (result)
OK with me.
Same here.
Done. Many thanks to yegor.