1 (edited by chandra 05/10/2024 10:15:46 am)

Topic: Audit trail missing "changed from <value>"

My accounting team members are long-time users of FA and are now exploring the audit trail feature for GL entries. I am the IT system admin posting on their behalf.

In the latest frontaccounting demo server at https://demo.frontaccounting.eu

the accountant posted a bank payment entry for 8,199 . This is transaction 161. Then he searched for it, clicked on the 'edit' (pencil icon), updated the amount to 8,201. This is transaction 162.

The audit trail report shows these relevant entries after the edit. Attaching a screenshot of the audit trail pdf report generated in FA.

161 | changed | 0.00
162 | changed | 8,201
161 | closed  | 0.00
162 | closed  | 8,201

This seems incomplete. The original 'changed from' value "8,199" from transaction 161 is missing, only the final 'changed to' value "8,201" is recorded. Is this the designed/expected behavior?

The original value is important for us. It does not seem to get persisted anywhere in the database once it is updated to the new value, so there is no way to recover/report it?

Appreciate suggestions, inputs.

Post's attachments

audit_trail_test1.png 72.9 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Audit trail missing "changed from <value>"

yes it is designed this way, though it should display the previous entry aswell, FA currently does not stores it in the audit trail table. You might need some modification to store the all historical values in audit trail table.

Re: Audit trail missing "changed from <value>"

Dear dz, thanks for your response. This is a setback for us. We are committed users of FA for many years, and now we have a critical requirement to maintain audit trail which includes the historical value changes.

The audit trail must be able to answer "who changed what to what and when".

This would have to be a core functional enhancement I suppose, since FA is currently not storing historical values in the audit trail table.

I will post on the wish list forum.

Meanwhile, if anyone has a workaround to this, kindly share!

Re: Audit trail missing "changed from <value>"

I can think of two work arounds for this a dirty way and a better way

dirty way
create a log entry in the function when voided

better way
enter the original amount in the memo to post to audit_trail 'description' and voided 'memo_' in the database

here is the name and location of the void function that you need to do the work. append the original amount to the memo_

./admin/db/voiding_db.inc:function void_transaction($type, $type_no, $date_, $memo_)

here are locations where it is doing the 'Document reentered.' memo specifically

./purchasing/includes/db/invoice_db.inc:        void_transaction($trans_type, $trans_no, $supp_trans->tran_date, _("Document reentered."));
./gl/includes/db/gl_db_banking.inc:    void_transaction(ST_BANKTRANSFER, $trans_no, $date_, _("Document reentered."));
./gl/includes/db/gl_db_banking.inc:        $msg = void_transaction($trans_type, $old_trans, $date_, _("Document reentered."));
./gl/includes/db/gl_journal.inc:        $msg = void_transaction($trans_type, $cart->order_id, Today(), _("Document reentered."));

Re: Audit trail missing "changed from <value>"

Here is how I would do it this is a working example on BANKPAYMENT ONLY you would have to do all the cases that you want recorded. ie. fetch that original trans type prior to void, then append data you need to memo.

in ./admin/db/voiding_db.inc:function void_transaction($type, $type_no, $date_, $memo_)
change case ST_BANKPAYMENT to appear like this.

        case ST_BANKPAYMENT : // it's a payment
            if (!exists_bank_trans($type, $type_no))
                return _('Selected transaction does not exists.');
                  $original_trans = db_fetch(get_bank_trans($type, $type_no));
                  $memo_ = $memo_."\nOriginal Amt: ".$original_trans['amount'];
            void_bank_trans($type, $type_no);
            break;

I've tested this and it works adding it to both the voided table and the audit_trail table
Unfortunatly the audit_trail report doesnt include the description in the report but that could be easily added.