Merge branch 'master' into 6434-signInLog_issue_MASTER
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
ac3d23579a
|
@ -32,31 +32,30 @@ module.exports = Self => {
|
||||||
throw new UserError('You cannot close tickets for today');
|
throw new UserError('You cannot close tickets for today');
|
||||||
|
|
||||||
const tickets = await Self.rawSql(`
|
const tickets = await Self.rawSql(`
|
||||||
SELECT
|
SELECT t.id,
|
||||||
t.id,
|
t.clientFk,
|
||||||
t.clientFk,
|
t.companyFk,
|
||||||
t.companyFk,
|
c.name clientName,
|
||||||
c.name clientName,
|
c.email recipient,
|
||||||
c.email recipient,
|
c.salesPersonFk,
|
||||||
c.salesPersonFk,
|
c.isToBeMailed,
|
||||||
c.isToBeMailed,
|
c.hasToInvoice,
|
||||||
c.hasToInvoice,
|
co.hasDailyInvoice,
|
||||||
co.hasDailyInvoice,
|
eu.email salesPersonEmail,
|
||||||
eu.email salesPersonEmail
|
t.addressFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
JOIN warehouse wh ON wh.id = t.warehouseFk AND wh.hasComission
|
JOIN warehouse wh ON wh.id = t.warehouseFk AND wh.hasComission
|
||||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN alertLevel al ON al.id = ts.alertLevel
|
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN province p ON p.id = c.provinceFk
|
JOIN province p ON p.id = c.provinceFk
|
||||||
JOIN country co ON co.id = p.countryFk
|
JOIN country co ON co.id = p.countryFk
|
||||||
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
||||||
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered'))
|
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered'))
|
||||||
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?)
|
||||||
AND util.dayEnd(?)
|
AND t.refFk IS NULL
|
||||||
AND t.refFk IS NULL
|
GROUP BY t.id
|
||||||
GROUP BY t.id
|
|
||||||
`, [toDate, toDate]);
|
`, [toDate, toDate]);
|
||||||
|
|
||||||
await closure(ctx, Self, tickets);
|
await closure(ctx, Self, tickets);
|
||||||
|
|
Loading…
Reference in New Issue