From 13dee94714123d61c5215e6d71576237701df4b9 Mon Sep 17 00:00:00 2001 From: Jonathan Niles Date: Mon, 11 Dec 2017 17:24:05 +0100 Subject: [PATCH] fix(account statement): show description This commit hides the account label and shows the transaction label by default. --- .../account_statement.ctrl.js | 2 +- server/controllers/finance/accounts/index.js | 24 ++----------------- server/controllers/finance/fiscal.js | 22 +++++++++++++++++ .../account_statement.spec.js | 2 +- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/client/src/modules/account_statement/account_statement.ctrl.js b/client/src/modules/account_statement/account_statement.ctrl.js index 57d46b926b..77ede84293 100644 --- a/client/src/modules/account_statement/account_statement.ctrl.js +++ b/client/src/modules/account_statement/account_statement.ctrl.js @@ -82,6 +82,7 @@ function AccountStatementController( { field : 'account_label', displayName : 'FORM.LABELS.ACCOUNT_TITLE', + visible : false, headerCellFilter : 'translate' }, { @@ -114,7 +115,6 @@ function AccountStatementController( { field : 'description', displayName : 'TABLE.COLUMNS.DESCRIPTION', headerCellFilter : 'translate', - visible : false, footerCellTemplate : '' }, { field : 'project_name', diff --git a/server/controllers/finance/accounts/index.js b/server/controllers/finance/accounts/index.js index 2a82662b5d..908e4c0a4d 100644 --- a/server/controllers/finance/accounts/index.js +++ b/server/controllers/finance/accounts/index.js @@ -32,6 +32,7 @@ const types = require('./types'); const categories = require('./categories'); const Periods = require('../../../lib/period'); const AccountExtras = require('./extra.js'); +const Fiscal = require('../fiscal.js'); const debug = require('debug')('accounts'); /** @@ -234,27 +235,6 @@ function getBalance(req, res, next) { .done(); } -/** - * @function getFirstDateOfFirstFiscalYear - * - * @description - * returns the start date of the very first fiscal year for the provided - * enterprise. - * - * @TODO - move this to the fiscal controller with other AccountExtra functions. - */ -function getFirstDateOfFirstFiscalYear(enterpriseId) { - const sql = ` - SELECT start_date FROM fiscal_year - WHERE enterprise_id = ? - ORDER BY DATE(start_date) - LIMIT 1; - `; - - return db.one(sql, enterpriseId); -} - - /** * @function getOpeningBalanceForPeriod * @@ -281,7 +261,7 @@ function getOpeningBalanceForPeriod(req, res, next) { case period.periods.allTime: debug('#getOpeningBalanceForPeriod() all time period detected. Using first fiscal year start date.'); promise = promise - .then(() => getFirstDateOfFirstFiscalYear(req.session.enterprise.id)) + .then(() => Fiscal.getFirstDateOfFirstFiscalYear(req.session.enterprise.id)) .then(fiscal => fiscal.start_date); break; diff --git a/server/controllers/finance/fiscal.js b/server/controllers/finance/fiscal.js index dde8290df5..6b5939cd7a 100644 --- a/server/controllers/finance/fiscal.js +++ b/server/controllers/finance/fiscal.js @@ -31,6 +31,7 @@ exports.update = update; exports.remove = remove; exports.getPeriodByFiscal = getPeriodByFiscal; exports.lookupFiscalYearByDate = lookupFiscalYearByDate; +exports.getFirstDateOfFirstFiscalYear = getFirstDateOfFirstFiscalYear; /** * @method lookupFiscalYear @@ -667,3 +668,24 @@ function lookupFiscalYearByDate(transDate) { return db.one(sql, [transDate, transDate], transDate, 'fiscal year'); } + +/** + * @function getFirstDateOfFirstFiscalYear + * + * @description + * returns the start date of the very first fiscal year for the provided + * enterprise. + * + * @TODO - move this to the fiscal controller with other AccountExtra functions. + */ +function getFirstDateOfFirstFiscalYear(enterpriseId) { + const sql = ` + SELECT start_date FROM fiscal_year + WHERE enterprise_id = ? + ORDER BY DATE(start_date) + LIMIT 1; + `; + + return db.one(sql, enterpriseId); +} + diff --git a/test/end-to-end/account_statement/account_statement.spec.js b/test/end-to-end/account_statement/account_statement.spec.js index e3a46becd1..50ef2b9e93 100644 --- a/test/end-to-end/account_statement/account_statement.spec.js +++ b/test/end-to-end/account_statement/account_statement.spec.js @@ -14,7 +14,7 @@ describe('Account Statement Core', () => { before(() => helpers.navigate(path)); const sample = { - account : 41111000, + account : '41111000', comment : 'custom', };