Ticket problems filter fix
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
88c5b6f8a6
commit
f13c47ce6d
|
@ -134,5 +134,5 @@
|
|||
"This ticket is deleted": "Este ticket está eliminado",
|
||||
"A travel with this data already exists": "Ya existe un travel con estos datos",
|
||||
"This thermograph id already exists": "La id del termógrafo ya existe",
|
||||
"ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED"
|
||||
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante"
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('filter', {
|
||||
|
@ -233,7 +234,7 @@ module.exports = Self => {
|
|||
});
|
||||
}
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
stmts.push(stmt);
|
||||
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems');
|
||||
|
@ -244,7 +245,7 @@ module.exports = Self => {
|
|||
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel
|
||||
WHERE (f.code = 'FREE' OR f.alertLevel IS NULL)
|
||||
WHERE (f.alertLevelCode = 'FREE' OR f.alertLevel IS NULL)
|
||||
AND f.shipped >= CURDATE()`);
|
||||
stmts.push('CALL ticketGetProblems()');
|
||||
|
||||
|
@ -264,6 +265,9 @@ module.exports = Self => {
|
|||
LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id
|
||||
LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`);
|
||||
|
||||
if (args.problems != undefined && (!args.from || !args.to))
|
||||
throw new UserError('Choose a date range or days forward');
|
||||
|
||||
let condition;
|
||||
let hasProblem;
|
||||
let range;
|
||||
|
@ -295,6 +299,7 @@ module.exports = Self => {
|
|||
stmt.merge(conn.makeWhere(problems));
|
||||
|
||||
stmt.merge(conn.makeOrderBy(filter.order));
|
||||
stmt.merge(conn.makeLimit(filter));
|
||||
let ticketsIndex = stmts.push(stmt);
|
||||
|
||||
stmts.push(
|
||||
|
|
Loading…
Reference in New Issue