2017-11-27 14:08:18 +00:00
|
|
|
var path = require('path');
|
|
|
|
var database = require(path.join(__dirname, '../../database.js'));
|
|
|
|
var format = require(path.join(__dirname, '../../util/format.js'));
|
|
|
|
|
|
|
|
module.exports = class Header {
|
|
|
|
getData(params, cb) {
|
|
|
|
let query = `SELECT
|
2017-12-26 09:02:47 +00:00
|
|
|
c.name AS clientName,
|
|
|
|
LOWER(ct.code) countryCode
|
2017-11-27 14:08:18 +00:00
|
|
|
FROM client c
|
|
|
|
JOIN country ct ON ct.id = c.countryFk
|
|
|
|
WHERE c.id = ?`;
|
|
|
|
database.pool.query(query, [params.clientId], (error, result) => {
|
|
|
|
if (error || result.length == 0)
|
|
|
|
return cb(new Error('No template data found'));
|
|
|
|
|
|
|
|
Object.assign(this, result[0]);
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|