diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 00b4eec96..628b85343 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -35,6 +35,10 @@ module.exports = Self => { arg: 'clientFk', type: 'Integer', description: `The client id` + }, { + arg: 'ticketFk', + type: 'Integer', + description: `The ticket id` }, { arg: 'agencyModeFk', type: 'Integer', @@ -78,6 +82,8 @@ module.exports = Self => { return {'o.agency_id': value}; case 'sourceApp': return {'o.source_app': value}; + case 'ticketFk': + return {'ort.ticketFk': value}; case 'isConfirmed': return {'o.confirmed': value ? 1 : 0}; case 'id': @@ -118,6 +124,12 @@ module.exports = Self => { LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN company co ON co.id = o.company_id`); + + if (ctx.args && ctx.args.ticketFk) { + stmt.merge({ + sql: `LEFT JOIN orderTicket ort ON ort.orderFk = o.id` + }); + } stmt.merge(conn.makeSuffix(filter)); stmts.push(stmt); diff --git a/modules/order/front/search-panel/index.html b/modules/order/front/search-panel/index.html index 8f692a0fa..0af885a53 100644 --- a/modules/order/front/search-panel/index.html +++ b/modules/order/front/search-panel/index.html @@ -50,6 +50,13 @@ model="filter.to"> + + + +