Skip to content

Commit

Permalink
feat: added created_at to all registries
Browse files Browse the repository at this point in the history
This commit adds the created_at field to all registries to ensure that
auditors can see the server date.

Closes Third-Culture-Software#6061.
  • Loading branch information
jniles committed Jan 5, 2022
1 parent d9dc8e5 commit 91918d8
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/src/modules/cash/payments/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function CashPaymentRegistryController(
type : 'date',
displayName : 'FORM.LABELS.SERVER_DATE',
headerCellFilter : 'translate',
cellTemplate : 'modules/stock/movements/templates/created_at.cell.html',
cellTemplate : 'modules/journal/templates/created_at.cell.html',
visible : false,
}, {
name : 'patientName',
Expand Down
3 changes: 2 additions & 1 deletion client/src/modules/invoices/registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ function InvoiceRegistryController(
type : 'date',
displayName : 'FORM.LABELS.SERVER_DATE',
headerCellFilter : 'translate',
cellTemplate : 'modules/stock/movements/templates/created_at.cell.html',
cellTemplate : 'modules/journal/templates/created_at.cell.html',
visible : false,
}, {
name : 'patientName',
displayName : 'TABLE.COLUMNS.PATIENT',
headerCellFilter : 'translate',
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/journal/journal.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function JournalController(
type : 'date',
displayName : 'FORM.LABELS.SERVER_DATE',
headerCellFilter : 'translate',
cellTemplate : 'modules/stock/movements/templates/created_at.cell.html',
cellTemplate : 'modules/journal/templates/created_at.cell.html',
visible : false,
}];

Expand Down
6 changes: 6 additions & 0 deletions client/src/modules/journal/templates/created_at.cell.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div
class="ui-grid-cell-contents text-right"
uib-tooltip="{{ row.entity.created_at | date : 'MMM dd, yyyy - HH:mm:ss' }}"
tooltip-placement="right">
<span>{{ row.entity.created_at | date:'dd/MM/yyyy HH:mm:ss'}}</span>
</div>
2 changes: 1 addition & 1 deletion client/src/modules/patients/registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function PatientRegistryController(
type : 'date',
displayName : 'FORM.LABELS.SERVER_DATE',
headerCellFilter : 'translate',
cellTemplate : 'modules/stock/movements/templates/created_at.cell.html',
cellTemplate : 'modules/journal/templates/created_at.cell.html',
visible : false,
}, {
field : 'last_visit',
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/purchases/registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function PurchaseRegistryController(
type : 'date',
displayName : 'FORM.LABELS.SERVER_DATE',
headerCellFilter : 'translate',
cellTemplate : 'modules/stock/movements/templates/created_at.cell.html',
cellTemplate : 'modules/journal/templates/created_at.cell.html',
visible : false,
name : 'patientName',
displayName : 'TABLE.COLUMNS.PATIENT',
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/vouchers/voucher-registry.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function VoucherController(
type : 'date',
displayName : 'FORM.LABELS.SERVER_DATE',
headerCellFilter : 'translate',
cellTemplate : 'modules/stock/movements/templates/created_at.cell.html',
cellTemplate : 'modules/journal/templates/created_at.cell.html',
visible : false,
}, {
name : 'patientName',
Expand Down
4 changes: 4 additions & 0 deletions server/controllers/finance/reports/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ const filters = [{
displayName : 'PERIODS.END',
isDate : true,
comparitor : '<',
}, {
field : 'created_at',
displayName : 'FORM.LABELS.SERVER_DATE',
isDate : true,
}];

// translation key mappings for dynamic filters
Expand Down
2 changes: 1 addition & 1 deletion server/lib/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class FilterParser {
}
}

equals(filterKey, columnAlias = filterKey, tableAlias = this._tableAlias, isArray) {
equals(filterKey, columnAlias = filterKey, tableAlias = this._tableAlias, isArray = false) {
const tableString = this._formatTableAlias(tableAlias);

if (this._filters[filterKey]) {
Expand Down
1 change: 0 additions & 1 deletion server/lib/renderers/xlsxReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const { find, headers, setValue } = require('./xlsx');

const i18n = require('../helpers/translate');


exports.render = render;
exports.find = find;
exports.extension = '.xlsx';
Expand Down
5 changes: 1 addition & 4 deletions server/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function execp(cmd) {
return deferred.promise;
}


/**
* @function roundDecimal
*
Expand All @@ -145,7 +144,7 @@ function execp(cmd) {
* @param {Number} precision
*/
function roundDecimal(number, precision = 4) {
const base = Math.pow(10, precision);
const base = 10 ** precision;
return Math.round(number * base) / base;
}

Expand Down Expand Up @@ -240,14 +239,12 @@ function calculateAge(dob) {
return moment().diff(dob, 'years');
}


function createDirectory(dirPath) {
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
}
}


function getRandomColor() {
const r = Math.floor(Math.random() * 255);
const g = Math.floor(Math.random() * 255);
Expand Down

0 comments on commit 91918d8

Please sign in to comment.