Transaction Cut and Paste problems #2019
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A couple of bug fixes...
The first commit I think is correct but am unsure on second one, it works but may be I am missing something.
Below is an image illustrating problem...
The last transaction was copied and pasted to the blank transaction and as you can see the transfer account is that of the current register. The transaction is still correct but could be confusing and hence the bug report.
To fix this, when the register loads an existing check is made to ensure the transaction and splits being edited are in the split list we are loading and as part of that I am recording the anchor split of the pending transaction. If the pending transaction is the blank transaction I use that to set the leading virtual cell in the register.
There is one situation when this would fail, if the copied transaction has two splits for the same account as it would always pick the same anchor split. I do not think this is a common occurrence so for most users not a problem. I did think of another way to fix this which involved passing the copied current cursor split to
gnc_txn_to_float_txn
and making sure it was the first in the floating split list but decided to do it register load.