validation client credit - refact
This commit is contained in:
parent
2aed5d088c
commit
8e5eca5629
|
@ -121,7 +121,12 @@ module.exports = function(Client) {
|
|||
|
||||
function maxCb(_, instances) {
|
||||
//console.log('maxCb', instances);
|
||||
if (instances && (instances.length !== 1 || instances[0].employeeFk == userId || instances[0].amount > 0)) {
|
||||
if(!instances){
|
||||
err();
|
||||
return;
|
||||
}
|
||||
|
||||
if (instances.length !== 1 || instances[0].employeeFk == userId || instances[0].amount > 0) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
@ -141,7 +146,7 @@ module.exports = function(Client) {
|
|||
}
|
||||
|
||||
function clientCreditCb(_, instance) {
|
||||
if (instance.length && instance[0].hasManagerRole > 0 )
|
||||
if (!instance || (instance.length && instance[0].hasManagerRole > 0 ))
|
||||
err();
|
||||
done();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue