Skip to content

Commit

Permalink
fix(Trial Balance): disallow closed fiscal years
Browse files Browse the repository at this point in the history
This commit fixes a bug in the Trial Balance where closed fiscal years
could still be posted to the GL.

Closes #1647.
  • Loading branch information
jniles committed Oct 26, 2017
1 parent 72af815 commit f81f883
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/models/procedures/trial_balance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ BEGIN
WHERE DATE(pj.trans_date) NOT BETWEEN DATE(p.start_date) AND DATE(p.end_date)
GROUP BY pj.record_uuid;

-- check to make sure that the fiscal year is not closed
INSERT INTO stage_trial_balance_errors
SELECT pj.record_uuid, pj.trans_id, 'POSTING_JOURNAL.ERRORS.CLOSED_FISCAL_YEAR' AS code
FROM posting_journal AS pj JOIN stage_trial_balance_transaction AS temp
ON pj.record_uuid = temp.record_uuid
JOIN fiscal_year ON pj.fiscal_year_id = fiscal_year.id
WHERE fiscal_year.locked <> 0
GROUP BY pj.record_uuid;

-- check to make sure that all lines of a transaction have a description
INSERT INTO stage_trial_balance_errors
SELECT pj.record_uuid, pj.trans_id, 'POSTING_JOURNAL.ERRORS.MISSING_DESCRIPTION' AS code
Expand Down

0 comments on commit f81f883

Please sign in to comment.