diff --git a/client/client/src/web-payment/index.html b/client/client/src/web-payment/index.html
index e42377ff4..1511a02f5 100644
--- a/client/client/src/web-payment/index.html
+++ b/client/client/src/web-payment/index.html
@@ -15,9 +15,9 @@
- Id
+ Id
Amount
- Payed
+ Payed
diff --git a/client/ticket/src/sale-tracking/index.html b/client/ticket/src/sale-tracking/index.html
index 13ecc543c..6f3ce16e6 100644
--- a/client/ticket/src/sale-tracking/index.html
+++ b/client/ticket/src/sale-tracking/index.html
@@ -4,8 +4,7 @@
filter="{}"
link="{ticketFk: $ctrl.$stateParams.id}"
limit="20"
- data="sales"
- on-data-change="$ctrl.getTags()">
+ data="sales">
diff --git a/services/ticket/common/methods/sale-tracking/listSaleTracking.js b/services/ticket/common/methods/sale-tracking/listSaleTracking.js
index e45249ec6..ff198f3ad 100644
--- a/services/ticket/common/methods/sale-tracking/listSaleTracking.js
+++ b/services/ticket/common/methods/sale-tracking/listSaleTracking.js
@@ -1,3 +1,6 @@
+
+const ParameterizedSQL = require('vn-loopback/node_modules/loopback-connector').ParameterizedSQL;
+
module.exports = Self => {
Self.remoteMethod('listSaleTracking', {
description: 'Returns all ticket sale trackings',
@@ -20,40 +23,27 @@ module.exports = Self => {
});
Self.listSaleTracking = async filter => {
- let where = '';
- let limit = '';
- let order = '';
- let params;
+ let stmt = new ParameterizedSQL(`
+ SELECT
+ st.id,
+ s.ticketFk,
+ s.quantity,
+ s.concept,
+ s.itemFk,
+ st.originalQuantity,
+ st.created,
+ st.workerFk,
+ w.firstName,
+ w.name,
+ ste.name AS state
+ FROM saleTracking st
+ JOIN sale s ON s.id = st.saleFk
+ JOIN worker w ON w.id = st.workerFk
+ JOIN state ste ON ste.id = st.stateFk`);
- if (filter) {
- let connector = Self.dataSource.connector;
- if (filter.where) {
- where = 'WHERE s.ticketFk = ?';
- params = [filter.where.ticketFk];
- }
+ stmt.merge(Self.buildSuffix(filter));
- limit = connector._buildLimit(null, filter.limit, filter.skip);
- order = connector.buildOrderBy('Item', filter.order);
- }
-
- let query = `SELECT
- st.id,
- s.quantity,
- s.concept,
- s.itemFk,
- st.originalQuantity,
- st.created,
- st.workerFk,
- w.firstName,
- w.name,
- ste.name AS state
- FROM saleTracking st
- JOIN sale s ON s.id = st.saleFK
- JOIN worker w ON w.id = st.workerFk
- JOIN ticketState ts ON ts.ticketFk = s.ticketFk
- JOIN state ste ON ste.id = ts.stateFK ${where} ${order} ${limit}`;
-
- let trackings = await Self.rawSql(query, params);
+ let trackings = await Self.rawStmt(stmt);
let salesFilter = {
include: [