correciones varias
This commit is contained in:
parent
070cd764b6
commit
9159af69f4
|
@ -134,10 +134,10 @@ module.exports = function(Client) {
|
||||||
JOIN RoleMapping rm ON (rm.principalId = ac.id)
|
JOIN RoleMapping rm ON (rm.principalId = ac.id)
|
||||||
JOIN Role r on (r.id = rm.roleId)
|
JOIN Role r on (r.id = rm.roleId)
|
||||||
WHERE rm.principalType = 'USER'
|
WHERE rm.principalType = 'USER'
|
||||||
AND cc.employeeFk = ${instances[0].employeeFk}
|
AND cc.employeeFk = ?
|
||||||
AND r.\`name\` = 'manager'`;
|
AND r.\`name\` = 'manager'`;
|
||||||
|
|
||||||
Client.dataSource.connector.execute(sql, [], (_, res) => clientCreditCb(_, res));
|
Client.dataSource.connector.execute(sql, [instances[0].employeeFk], (_, res) => clientCreditCb(_, res));
|
||||||
}
|
}
|
||||||
|
|
||||||
function clientCreditCb(_, instance) {
|
function clientCreditCb(_, instance) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ module.exports = (Client) => {
|
||||||
ORDER BY em.name ASC
|
ORDER BY em.name ASC
|
||||||
LIMIT ? OFFSET ?`;
|
LIMIT ? OFFSET ?`;
|
||||||
|
|
||||||
Client.rawSql(query, [where.value, limit, skip], callback)
|
Client.rawSql(query, [where.value, parseInt(limit, 10), parseInt(skip, 10)], callback)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
callback(null, formatSalesPerson(response));
|
callback(null, formatSalesPerson(response));
|
||||||
})
|
})
|
||||||
|
|
|
@ -36,7 +36,7 @@ module.exports = function(Self) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function getAddress(ctx, newData, next) {
|
function getAddress(ctx, newData, next) {
|
||||||
Self.findOne( {where: { id: newData.id}}, function (err, oldData){
|
Self.findOne({where: {id: newData.id}}, (_, oldData) => {
|
||||||
if (oldData)
|
if (oldData)
|
||||||
callbackGetAddress(ctx, newData, oldData, next);
|
callbackGetAddress(ctx, newData, oldData, next);
|
||||||
});
|
});
|
||||||
|
@ -45,10 +45,9 @@ module.exports = function(Self) {
|
||||||
function callbackGetAddress(ctx, newData, oldData, next) {
|
function callbackGetAddress(ctx, newData, oldData, next) {
|
||||||
if (newData.isDefaultAddress) {
|
if (newData.isDefaultAddress) {
|
||||||
removeAllDefault(oldData.client, next);
|
removeAllDefault(oldData.client, next);
|
||||||
}
|
} else if (oldData.isDefaultAddress && newData.hasOwnProperty('isDefaultAddress') && !newData.isDefaultAddress) {
|
||||||
else if (oldData.isDefaultAddress && newData.hasOwnProperty('isDefaultAddress') && !newData.isDefaultAddress)
|
|
||||||
next(generateErrorDefaultAddress());
|
next(generateErrorDefaultAddress());
|
||||||
else
|
} else
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue