feat(salix): #7884 add new param
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-08-21 13:23:03 +00:00
parent 16039b0ccc
commit 151b26ae8b
1 changed files with 21 additions and 6 deletions

View File

@ -106,9 +106,14 @@ module.exports = Self => {
description: `The to shipped date filter`
},
{
arg: 'days',
arg: 'daysAfter',
type: 'number',
description: `N days interval`
description: `N days after interval`
},
{
arg: 'daysBefore',
type: 'number',
description: `N days before interval`
}
],
returns: {
@ -210,15 +215,25 @@ module.exports = Self => {
JOIN vn.currency cu ON cu.id = e.currencyFk`
);
if (ctx.args.days) {
if (ctx.args.daysAfter) {
stmt.merge({
sql: `
AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
AND t.shipped >= util.VN_CURDATE()
AND ((t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
AND t.shipped>= util.VN_CURDATE())
`,
params: [ctx.args.days]
params: [ctx.args.daysAfter]
});
}
if (ctx.args.daysBefore) {
stmt.merge({
sql: `
${ctx.args.daysAfter ? 'OR' : 'AND'} (t.shipped <= util.VN_CURDATE()
AND t.shipped >= util.VN_CURDATE() - INTERVAL ? DAY)
`,
params: [ctx.args.daysBefore]
});
}
stmt.merge({sql: ')'});
stmt.merge(conn.makeSuffix(filter));
const itemsIndex = stmts.push(stmt) - 1;