GNOME Bugzilla – Bug 310567
RFE: multiple register sorting orders
Last modified: 2018-06-29 20:52:54 UTC
Incorrect translation Application: GnuCash Incorrect text: GnuCash (in standard sort order) displays most entries okay, but when I change the date on an entry it is moved to the top of the day it was changed to. i.e. I changed an entry from 7/16/05 to 7/15/05 and it move up above the entries that were already dated 7/15/05, including a deposit that had been already made, making it look like there wasn't money to cover the moved entry (a negative in the total balance column). Should be: I would like to sort by multiple columns, specifically I would like to sort by date, then by transfer (income/expense), and then by (check) number.
There is nothing in the report that suggests that this should be a bug in any translation, so it appears this report was mis-filed. Moving to the GnuCash product.
I think this would also be solved by implementing bug 89439
*** Bug 150952 has been marked as a duplicate of this bug. ***
update summary, severity.
I did also want to add myself to the list of people requesting this. The ability to have the transactions sorted by date, then by income/expense would be greatly helpful... in avoiding mini panic attacks ;).
I hate to comment on the same bug again... but, as the original submitter commented, currently it can effectively show that you wouldn't have sufficient funds within a given day due to sorting order issues (my bank, and probably all banks, list credits before debits on statements and process transactions in the same fashion). I know I winked a year ago in my comment, but it really can induce unnecessary stress when the projected minimum balance is inaccurate due to this sorting issue. I can't tell you how much I love GnuCash, and this is honestly the only issue I've ever had with it.
For me, it would be sufficient to have keyboard shortcuts to increment and decrement the entry time of the transaction by one second. This is essentially what I have to do when I edit the XAC file manually. If hidden functionality isn't acceptable, we could add "Bump forward" and "Bump backward" items under the "Transaction" menu.
Created attachment 146693 [details] [review] Menu items to bump transactions forward and backward in time by seconds
Here's a patch against SVN head that adds the bump menu items I suggested. It seems to work. The only thing I'm not confident about is the call I make to gnc_ppr_update_date_query(page) in order to refresh the register view. It doesn't seem to properly update the credit/debit/balance columns, though it does reorder the transactions properly, which at least gives you some immediate visual feedback. Is there a better way to go about that? Maybe I need to look at the code for the '+' and '-' shortcuts in the date-posted field. (Apologies for the double-post. I apparently still don't understand bugzilla's interface...)
Created attachment 146694 [details] [review] Adds a menu item to bump a transaction forward one second Upon thinking a little more about it, I realized that bumping a transaction forward is all I'd want to do. Bumping an unbumped transaction would send it back to the previous day, which would be undesirable.
Comment on attachment 146694 [details] [review] Adds a menu item to bump a transaction forward one second Patch looks good. One issue though: Can you please find a better wording instead of "Bump"? Rather a more accounting-like wording? As a non-native speaker, words that come to mind are "Move txn forward", "Reorder txn forward" or something like that. In the source the word "bump" is fine theoretically, but if the word in the GUI is different, the GUI-word should also be used in the source to avoid potential confusion.
You're right, it's not the most intuitive word. "Move" sounds too strong, as though it would change the date. Maybe "Shift txn forward"? I'll submit it with that change (to the GUI and the function names), if that's acceptable. The main problem with this patch is that unless you know what it's doing behind the scenes, it will probably be confusing: it won't always reorder the transactions, unless you know that you should keep hitting it until you achieve the desired effect. But querying the register for the date of the next transaction on the date of the current transaction sounded like more work than I was willing to do. Perhaps the patch's behavior is good enough if it's properly documented.
Created attachment 147149 [details] [review] Menu item to shift transaction forward Here's the patch redone with "shift" instead of "bump". Any idea how to get the ledger to redraw or recalculate the balance column? I've looked at other code and tried a few different functions (gnc_ledger_display_refresh, gnc_split_register_redraw, gnc_table_refresh_gui), but none of them do what is needed here. I noticed that making any change to a transaction and hitting "enter" to save it causes the balance column to update. I'm just having trouble tracking down what I can call to do that.
Comment on attachment 147149 [details] [review] Menu item to shift transaction forward Looks good. Regarding the balance column update: Unfortunately I also don't have any idea on how to fix that.
I think the running split balances are set by xaccAccountRecomputeBalance(), which goes though the splits in order and calculates the current, cleared and reconciled balances for that split. The order is set via xaccAccountSortSplits() which uses the function xaccSplitOrder() in engine/split.c. Do we really need to keep the running balances with the splits? Are they used for anything other than display in the register? If so, maybe their calculation should be moved out into the register code so that if a filter or sort order is set, the values can be recalculated correctly. Note that xaccAccountGetBalanceAsOfDate() assumes the splits are in date order.
Comment on attachment 147149 [details] [review] Menu item to shift transaction forward r18427, thanks a lot!
Re comment #13: Unfortunately the menu item in the current form IMHO isn't a fully finished feature. The behaviour of the menu item is rather unclear: After clicking on it, nothing changes in the transaction, only after I additionally pressed "enter". After this, as you already said, the running balance isn't updated, which is additionally confusing. These two points would need to be fixed before we can recommend this feature for the next stable version 2.4.0; otherwise I'd rather comment out the C lines which add it to the menu so that the menu item wouldn't be there for 2.4.0. Additionally, the menu item should be added to the right-click menu of the transactions, but this is probably rather easy.
Menu item temporarily removed (commented-out) in r18450. Can be enabled again once the next release is out.
This patch was not the correct approach. But instead the changes in SVN r20294 and r20306 implement the correct behaviour (for the invoice window) and "just" need to be copied over to the normal account register window.
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=310567. Please continue processing the bug there and please update any external references or bookmarks.