Skip to content

Commit

Permalink
fix(vouchers): update to new identifiers
Browse files Browse the repository at this point in the history
This commit fixes the voucher identifiers that were broken in the update
from the previous updates.

Fixes #136.
  • Loading branch information
Jonathan Niles authored and sfount committed Jan 13, 2017
1 parent f0956d6 commit 828864a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/controllers/finance/vouchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,16 @@ function getVouchers(uuid, request) {

sql += !detailed ? ' GROUP BY v.uuid ' : '';

sql += ' ORDER BY v.date ';

return db.exec(sql, sqlParams);
}

function getSql(detailed) {
let sql = `
SELECT BUID(v.uuid) as uuid, v.date, v.project_id, v.currency_id, v.amount,
v.description, v.user_id, v.type_id, u.display_name,
CONCAT_WS('.', '${identifiers.VOUCHER}', p.abbr, v.reference) AS reference,
CONCAT_WS('.', '${identifiers.VOUCHER.key}', p.abbr, v.reference) AS reference,
BUID(vi.document_uuid) AS document_uuid
FROM voucher v
JOIN voucher_item vi ON vi.voucher_uuid = v.uuid
Expand All @@ -249,7 +251,7 @@ function getSql(detailed) {
v.description, v.user_id, v.type_id, BUID(vi.document_uuid) as document_uuid,
BUID(vi.uuid) AS voucher_item_uuid, vi.account_id, vi.debit,
vi.credit, a.number, a.label, u.display_name,
CONCAT_WS('.', '${identifiers.VOUCHER}', p.abbr, v.reference) AS reference
CONCAT_WS('.', '${identifiers.VOUCHER.key}', p.abbr, v.reference) AS reference
FROM voucher v
JOIN voucher_item vi ON vi.voucher_uuid = v.uuid
JOIN project p ON p.id = v.project_id
Expand Down

0 comments on commit 828864a

Please sign in to comment.