fixed agency check
This commit is contained in:
parent
e6bb179b61
commit
10344c7f3c
|
@ -43,8 +43,12 @@ module.exports = Self => {
|
|||
throw new UserError(`You can't create an order for a client that doesn't has tax data verified`);
|
||||
|
||||
let clientFk = address.clientFk;
|
||||
let agency;
|
||||
if (params.agency)
|
||||
agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk);
|
||||
else
|
||||
agency = {code: null};
|
||||
|
||||
let agency = await Self.app.models.Agency.findById(agencyModeFk);
|
||||
if (agency.code != 'refund') {
|
||||
let query = `SELECT vn.clientGetDebt(?, CURDATE()) AS debt`;
|
||||
let clientDebt = await Self.rawSql(query, [clientFk]);
|
||||
|
|
Loading…
Reference in New Issue