GNOME Bugzilla – Bug 608436
Add auto-clear feature
Last modified: 2018-06-29 22:34:15 UTC
= Usage scenario = John keeps his personal accounting in GnuCash and writes all credit card expenses therein. On weekends, we checks his Internet Banking and sees that some transactions have been recorded. He would like to clear those transactions in GnuCash, but it is tiresome to go through each Internet Banking transaction and do manual comparison with GnuCash records, especially since Internet Banking transactions might be in a different order than in GnuCash. John would prefer having an "auto-clear" feature. Given the "current amount" from the Internet Banking, he would like GnuCash to clear the transactions for him, if and only if, there is a unique combination of transactions that could achieve this. If there is no solution, or if the solution is not unique, GnuCash should warn him and John must manually clear the transactions.
Created attachment 152565 [details] [review] Patch against trunk, implemented the described feature. Please review and comment.
Created attachment 152636 [details] [review] Patch against trunk which implements this feature. Fixed issues pointed out by Yawar Amin.
Comment on attachment 152636 [details] [review] Patch against trunk which implements this feature. We should give this a try - thanks for the patch!
Comment on attachment 152636 [details] [review] Patch against trunk which implements this feature. r18610
This patch breaks the build for Debian Stable (Lenny), because it uses g_double_hash() in window-autoclear.c at line 107. g_double_hash was introduced only in glib-2.22. Debian Stable uses glib-2.16; glib 2-22 was released only last September.
Created attachment 153036 [details] [review] Use g_str_hash() instead of g_double_hash() for glib-2.16 compatibility Since the denominator is the same for all gnc_numeric-s manipulated in that hash table, we can safely use g_str_hash() instead of g_double_hash(). This patch must be applied above Attachement 152636.
Thanks, that does it. Committed in r18612.
bug#610321 reports some functions which are unavailable in older glib/gtk: GTK_BUTTONBOX_CENTER requires gtk-2.11, but we would like to get along with gtk-2.10; maybe you can enclose the macro with #if GTK_CHECK_VERSION(). GHashTableIter requires glib-2.16, but we would like to get along with glib-2.6. Can you please try to fix the compatibility with that versions? Thanks!
Okey, I'll see what I can do.
Comment on attachment 153036 [details] [review] Use g_str_hash() instead of g_double_hash() for glib-2.16 compatibility I got confused by the status of this patch. jralls committed something inspired from this in r18612, but it was broken and subsequently corrected in r18632.
The history here seems pretty clear to me. The only part that might be confusing is some extra work in r18612 to fix a couple of strict-aliasing errors. That was partly wrong and fixed in r18632, but it didn't have anything to do with this bug. Cristian Klein provided attachment 154146 [details] [review] to bug 610321 that he says corrects the GHashTableIter issue. I guess someone who still has glib-2.6 around needs to make sure that it compiles and works in that (ancient) environment and commit it if it does.
The glib-2.6 compatibility is silly. No actively maintained distribution still ships it. The most conservative one (RHEL5) ships 2.12 already. I requested to bump this requirement, but apart from John no other dev has voiced his opinion yet. But regarding this bug: if I understand John correctly it can be closed. The patches in this bug are applied, and the new bugs this enhancement introduced are being tracked in bug 610321.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=608436. Please update any external references or bookmarks.