Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(proposal) Journal transaction editing history #2046

Closed
sfount opened this issue Aug 23, 2017 · 4 comments
Closed

(proposal) Journal transaction editing history #2046

sfount opened this issue Aug 23, 2017 · 4 comments
Assignees

Comments

@sfount
Copy link
Contributor

sfount commented Aug 23, 2017

We currently have no way of differentiating transactions that have been edited and transactions that were directly written by the system.

If an accountant or developer is trying to audit the system to find out where something has gone wrong it would be very useful to know if something has been changed to know where to look for the issue.

I propose we introduce a new table transaction_history that we will write in every time an editing session is successfully run on a transaction.

The columns would be

  • uuid
  • transaction_uuid
  • timestamp
  • user_id
  • (optional) Operations ['EDITING', 'DELETING', 'ADDING']

Whilst this doesn't give us a history of the full transaction it will be a good first step towards answering questions:

Has a transaction been edited?

SELECT COUNT(uuid) as numberOfEdits FROM transaction_history WHERE transaction_uuid = ?

Who has edited a specific transaction?

SELECT user_id, timestamp FROM transaction_histroy JOIN user ON user_id = user.id WHERE transaction_uuid = ?
@jniles
Copy link
Collaborator

jniles commented Aug 29, 2017

To clarify, transaction_uuid should be record_uuid, correct?

This proposal LGTM. Just knowing if a transaction has been messed with can inform us what next questions to ask.

@jniles
Copy link
Collaborator

jniles commented Sep 16, 2017

Note - this is tangentially related to #1559

@jniles jniles self-assigned this Sep 26, 2017
@jniles
Copy link
Collaborator

jniles commented Sep 26, 2017

I'll tackle this one.

The optional fields don't make much sense to me - this kind of resolution needs to be available on a line-by-line basis, not a transaction basis.

The only update I'll make is renaming transaction_uuid -> record_uuid since that is the column name found in the posting_journal and general_ledger.

jniles added a commit to jniles/bhima that referenced this issue Sep 26, 2017
This commit contains the first implementation of the transaction_history
proposed in IMA-WorldHealth#2046.  It implements the table and triggers to update the
transaction_history after the transaction has been edited.

Closes IMA-WorldHealth#2046.
bors bot added a commit that referenced this issue Sep 27, 2017
2156: Feature: Transaction History r=DedrickEnc a=jniles

This PR implements transaction histories as described in #2046.  A new table has been added - `transaction_history`.  This table contains the `record_uuid` of a transaction, the user id, and a timestamp for when it was edited.  The table is updated during the transaction edit database transaction.

Using this simplistic implementation, I've also included a small text on the Edit Transaction modal to show when the last edit was and by whom.  See below:

![transactionhistorydisplay](https://user-images.githubusercontent.com/896472/30869253-937a4ec6-a2d8-11e7-8073-c54f8ed136dd.png)
_Fig 1: Transaction History Display in the Bottom Left of the Modal._
@jniles
Copy link
Collaborator

jniles commented Oct 7, 2017

Closed in #2156.

@jniles jniles closed this as completed Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants