diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index b84dff8a0..9f11db3b2 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -254,7 +254,7 @@ module.exports = Self => { ENGINE = MEMORY SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f - LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel + LEFT JOIN alertLevel al ON al.id = f.alertLevel WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) AND f.shipped >= CURDATE()`); stmts.push('CALL ticket_getProblems(FALSE)'); diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 31834112e..52a918314 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -273,7 +273,7 @@ module.exports = Self => { ENGINE = MEMORY SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f - LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel + LEFT JOIN alertLevel al ON al.id = f.alertLevel WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) AND f.shipped >= CURDATE()`); stmts.push('CALL ticket_getProblems(FALSE)'); diff --git a/modules/ticket/back/models/alert-level.json b/modules/ticket/back/models/alert-level.json index a94c01106..222e98108 100644 --- a/modules/ticket/back/models/alert-level.json +++ b/modules/ticket/back/models/alert-level.json @@ -9,13 +9,12 @@ }, "properties": { "code": { - "type": "String", + "type": "string" + }, + "id": { + "type": "number", "id": true, "description": "Identifier" - }, - "alertLevel": { - "type": "Number", - "id": true } }, "acls": [ diff --git a/modules/ticket/back/models/state.json b/modules/ticket/back/models/state.json index efa56abee..9d4dd4f5d 100644 --- a/modules/ticket/back/models/state.json +++ b/modules/ticket/back/models/state.json @@ -9,23 +9,23 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "name": { - "type": "String", + "type": "string", "required": false }, "order": { - "type": "Number", + "type": "number", "required": false }, "alertLevel": { - "type": "Number", + "type": "number", "required": false }, "code": { - "type": "String", + "type": "string", "required": false } } diff --git a/modules/ticket/back/models/ticket-state.json b/modules/ticket/back/models/ticket-state.json index a7f0f8242..a10938ef0 100644 --- a/modules/ticket/back/models/ticket-state.json +++ b/modules/ticket/back/models/ticket-state.json @@ -9,14 +9,14 @@ "properties": { "ticketFk": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "updated": { - "type": "Date" + "type": "date" }, "alertLevel": { - "type": "Number" + "type": "number" }, "code": { "type": "string" diff --git a/print/methods/closure.js b/print/methods/closure.js index 85b486158..0dae2f491 100644 --- a/print/methods/closure.js +++ b/print/methods/closure.js @@ -21,7 +21,7 @@ module.exports = app => { JOIN ticket t ON t.id = e.ticketFk JOIN warehouse wh ON wh.id = t.warehouseFk AND wh.hasComission JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel + JOIN alertLevel al ON al.id = ts.alertLevel WHERE al.code = 'PACKED' AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) @@ -33,7 +33,7 @@ module.exports = app => { await db.rawSql(` UPDATE ticket t JOIN ticketState ts ON t.id = ts.ticketFk - JOIN alertLevel al ON al.alertLevel = ts.alertLevel + JOIN alertLevel al ON al.id = ts.alertLevel JOIN agencyMode am ON am.id = t.agencyModeFk JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk JOIN zone z ON z.id = t.zoneFk @@ -64,7 +64,7 @@ module.exports = app => { FROM expedition e JOIN ticket t ON t.id = e.ticketFk JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel + JOIN alertLevel al ON al.id = ts.alertLevel WHERE al.code = 'PACKED' AND t.id = ? AND t.refFk IS NULL @@ -100,7 +100,7 @@ module.exports = app => { FROM expedition e JOIN ticket t ON t.id = e.ticketFk JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel + JOIN alertLevel al ON al.id = ts.alertLevel WHERE al.code = 'PACKED' AND t.agencyModeFk IN(?) AND t.warehouseFk = ? @@ -137,7 +137,7 @@ module.exports = app => { FROM expedition e JOIN ticket t ON t.id = e.ticketFk JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.alertLevel = ts.alertLevel + JOIN alertLevel al ON al.id = ts.alertLevel WHERE al.code = 'PACKED' AND t.routeFk = ? AND t.refFk IS NULL