hledger icon indicating copy to clipboard operation
hledger copied to clipboard

change transaction statuses in hledger-ui / random access editing

Open the-solipsist opened this issue 8 years ago • 4 comments
trafficstars

While generally it is a great principle that the tools like hledger should not change the ledger file they are dealing with, given the existence of hledger-add and hledger-web, both of which allow for adding of transactions, I feel there could be a tiny bit of text editing that should be allowable in hledger-ui as well.

One frequent task for any accounting practice is to reconcile one's local statement of accounts with the bank's statements.

hledger's journal format allows for three statuses — unmarked, pending, or cleared — that can be used to indicate reconciliation status, for instance. It would be very useful to change the status of individual transactions from within the hledger-ui without having to exit the programme (i.e., via E) for each transaction, or having to do this in a text editor.

i would imagine !, *, or [backspace]/[del]/0could be used for pending, cleared, or unmarked. Possibly, but not necessarily, doing this would only be possible after one enters a "change status" mode, just to ensure that this is done by people after a clear indication that they know they have entered an "editing" mode.

the-solipsist avatar Oct 24 '17 19:10 the-solipsist

I agree, and also want this feature. It requires some new infrastructure: support for rewriting an arbitrary transaction in the middle of a file. An API for this needs to be drafted, clarifying how we specify the transaction (eg by file and line number and/or transaction index).

simonmichael avatar Oct 24 '17 19:10 simonmichael

Idea : Reconciliation mode could just append the entries at the end of journal or even to separate file. They would be auto transactions that declare change of status and refer to original transactions by their hash. This allows changing /re reading journal on the fly.

Then "hledger rewrite" could be used to generate updated journal in one pass or change mode can do this when you somehow indicate that you are done. This could be implemented as a change to journal reader which will hash each transaction after parsing, and if hash is mentioned in the last of rewrites, it will remember current file and position and return positions as result of parsing. Separate pass then changes all the files, resulting in least invasive changes.

adept avatar Nov 17 '17 18:11 adept