From 75c3d9cce047efcfb6d912c850d9f071840e26d1 Mon Sep 17 00:00:00 2001 From: mbayopanda Date: Thu, 22 Jul 2021 13:14:06 +0100 Subject: [PATCH] add hrRecord for deleted transactions --- client/src/modules/journal/templates/log.record.html | 5 ++++- client/src/modules/journal/templates/log.transaction.html | 8 +++++++- server/controllers/finance/journal/index.js | 4 +++- server/controllers/finance/transactions.js | 8 +++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/client/src/modules/journal/templates/log.record.html b/client/src/modules/journal/templates/log.record.html index 86b56f78b8..307d086300 100644 --- a/client/src/modules/journal/templates/log.record.html +++ b/client/src/modules/journal/templates/log.record.html @@ -1,6 +1,9 @@ -
+
+
+ {{ row.entity.hrRecord }} +
POSTING_JOURNAL.DELETED_TRANSACTION
\ No newline at end of file diff --git a/client/src/modules/journal/templates/log.transaction.html b/client/src/modules/journal/templates/log.transaction.html index 7ba96de7ce..3726604d53 100644 --- a/client/src/modules/journal/templates/log.transaction.html +++ b/client/src/modules/journal/templates/log.transaction.html @@ -4,8 +4,14 @@ ui-sref="journal({filters : [{ key : 'trans_id', displayValue : row.entity.transId, value: row.entity.transId, cacheable: 0 }, { key : 'includeNonPosted', value : 1 }, { key : 'period', value : 'allTime' }]})" ui-sref-opts="{ reload : false }" - ng-if="row.entity.transId" + ng-if="row.entity.transId && row.entity.action != 'deleted'" class="text-uppercase"> {{ row.entity.transId }} + + + {{ row.entity.transId }} +
\ No newline at end of file diff --git a/server/controllers/finance/journal/index.js b/server/controllers/finance/journal/index.js index 925932dd90..7f3fc99002 100644 --- a/server/controllers/finance/journal/index.js +++ b/server/controllers/finance/journal/index.js @@ -63,9 +63,11 @@ async function log(req, res, next) { th.timestamp AS timestamp, th.value AS value, th.action, - u.display_name + u.display_name, + dm.text as hrRecord FROM transaction_history th JOIN user u ON u.id = th.user_id + LEFT JOIN document_map dm ON dm.uuid = th.record_uuid `; filters.fullText('description', 'value'); diff --git a/server/controllers/finance/transactions.js b/server/controllers/finance/transactions.js index 4a1d3684f9..ded40d0122 100644 --- a/server/controllers/finance/transactions.js +++ b/server/controllers/finance/transactions.js @@ -106,7 +106,13 @@ async function deleteTransaction(uuid, actions, userId) { throw new Unauthorized(`User is not authorized to remove ${documentMap.text}.`); } - const transactionRecord = await db.exec('SELECT * FROM posting_journal WHERE record_uuid = ?', [db.bid(uuid)]); + const transactionRecord = await db.exec(` + SELECT pj.*, dm.text as hrRecord + FROM posting_journal pj + JOIN document_map dm ON dm.uuid = pj.record_uuid + WHERE pj.record_uuid = ? + `, [db.bid(uuid)]); + const INSERT_TRANSACTION_HISTORY = 'INSERT INTO transaction_history SET ?;'; const transactionHistory = { uuid : db.uuid(),