WIP: feat: refs #6583 add new opt in where builder #3162
|
@ -52,7 +52,8 @@ BEGIN
|
||||||
IFNULL(dest.nickname, origin.nickname) nickname,
|
IFNULL(dest.nickname, origin.nickname) nickname,
|
||||||
dest.landed,
|
dest.landed,
|
||||||
dest.preparation,
|
dest.preparation,
|
||||||
origin.departmentFk
|
origin.departmentFk,
|
||||||
|
origin.saleClonedFk
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.ticketFk,
|
SELECT s.ticketFk,
|
||||||
c.salesPersonFk workerFk,
|
c.salesPersonFk workerFk,
|
||||||
|
@ -73,11 +74,13 @@ BEGIN
|
||||||
t.warehouseFk,
|
t.warehouseFk,
|
||||||
t.companyFk,
|
t.companyFk,
|
||||||
t.agencyModeFk,
|
t.agencyModeFk,
|
||||||
wd.departmentFk
|
wd.departmentFk,
|
||||||
|
sc.saleClonedFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN workerDepartment wd ON wd.workerFk = c.salesPersonFk
|
JOIN workerDepartment wd ON wd.workerFk = c.salesPersonFk
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
LEFT JOIN saleCloned sc ON sc.saleClonedFk = s.id
|
||||||
JOIN saleVolume sv ON sv.saleFk = s.id
|
JOIN saleVolume sv ON sv.saleFk = s.id
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
|
|
|
@ -55,6 +55,11 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'Department identifier'
|
description: 'Department identifier'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'onlyWithDestination',
|
||||||
|
type: 'Boolean',
|
||||||
|
description: 'True when only tickets with destination are returned'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
arg: 'filter',
|
arg: 'filter',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
@ -103,6 +108,9 @@ module.exports = Self => {
|
||||||
return {'f.isFullMovable': value};
|
return {'f.isFullMovable': value};
|
||||||
case 'departmentFk':
|
case 'departmentFk':
|
||||||
return {'f.departmentFk': value};
|
return {'f.departmentFk': value};
|
||||||
|
case 'onlyWithDestination':
|
||||||
|
if (!value) return;
|
||||||
|
return {'f.id': {neq: null}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue