Skip to content

Commit

Permalink
fix(account statement): show description
Browse files Browse the repository at this point in the history
This commit hides the account label and shows the transaction label by
default.
  • Loading branch information
jniles committed Dec 17, 2017
1 parent 01c9311 commit 13dee94
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function AccountStatementController(

{ field : 'account_label',
displayName : 'FORM.LABELS.ACCOUNT_TITLE',
visible : false,
headerCellFilter : 'translate' },

{
Expand Down Expand Up @@ -114,7 +115,6 @@ function AccountStatementController(
{ field : 'description',
displayName : 'TABLE.COLUMNS.DESCRIPTION',
headerCellFilter : 'translate',
visible : false,
footerCellTemplate : '<i></i>' },

{ field : 'project_name',
Expand Down
24 changes: 2 additions & 22 deletions server/controllers/finance/accounts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down Expand Up @@ -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
*
Expand All @@ -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;

Expand Down
22 changes: 22 additions & 0 deletions server/controllers/finance/fiscal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports.update = update;
exports.remove = remove;
exports.getPeriodByFiscal = getPeriodByFiscal;
exports.lookupFiscalYearByDate = lookupFiscalYearByDate;
exports.getFirstDateOfFirstFiscalYear = getFirstDateOfFirstFiscalYear;

/**
* @method lookupFiscalYear
Expand Down Expand Up @@ -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);
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Account Statement Core', () => {
before(() => helpers.navigate(path));

const sample = {
account : 41111000,
account : '41111000',
comment : 'custom',
};

Expand Down

0 comments on commit 13dee94

Please sign in to comment.