diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index b894815b8..1e500ab11 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -339,28 +339,5 @@ module.exports = Self => { if (count <= 0) throw new UserError('The role cannot set this credit amount'); - - // Si se puso a 0 por gerencia, solo gerencia puede aumentarlo - - let query = 'SELECT * FROM clientCredit WHERE clientFk = ? ORDER BY created DESC LIMIT 1'; - let instances = await Self.rawSql(query, [finalState.id]); - - if (instances.length !== 1 || instances[0].amount > 0) - return; - - query = ` - SELECT COUNT(*) AS hasRoleManager - FROM worker em - JOIN account.user ac ON ac.id = em.userFk - JOIN salix.RoleMapping rm ON rm.principalId = ac.id - JOIN account.role r on r.id = rm.roleId - WHERE em.id = ? - AND rm.principalType = 'USER' - AND r.name = 'manager'`; - - let instance = await Self.rawSql(query, [instances[0].workerFk]); - - if (instance[0].hasRoleManager) - throw new UserError('Only manager can change the credit'); } };