From c2b3ff8d81617d6f79195636c013742609707068 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 16 Apr 2019 08:42:44 +0200 Subject: [PATCH] #1335 worker/filter renamed columns acordantly --- db/dump/fixtures.sql | 2 +- modules/client/back/methods/client/listWorkers.js | 4 ++-- modules/order/back/methods/order/catalogFilter.js | 2 +- modules/ticket/back/methods/ticket/filter.js | 2 +- modules/worker/back/methods/worker/filter.js | 11 ++++++----- print/report/client-welcome/index.js | 2 +- print/report/printer-setup/index.js | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index ccc722c44..dda99aea5 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1260,7 +1260,7 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`, `secret`, `caller_id`) (9, 1201, '123456', 'developer'); INSERT INTO `postgresql`.`person`(`person_id`, `name`, `nickname`, `nif`, `firstname`, `id_trabajador`) - SELECT w.id, w.name, u.nickname,CONCAT(RPAD(CONCAT(w.id,9),8,w.id),'A'),w.firstName,w.id + SELECT w.id, w.lastName, u.nickname,CONCAT(RPAD(CONCAT(w.id,9),8,w.id),'A'),w.firstName,w.id FROM `vn`.`worker` `w` JOIN `account`.`user` `u` ON `u`.`id` = `w`.`userFk`; diff --git a/modules/client/back/methods/client/listWorkers.js b/modules/client/back/methods/client/listWorkers.js index 92339e32f..8fa4c085e 100644 --- a/modules/client/back/methods/client/listWorkers.js +++ b/modules/client/back/methods/client/listWorkers.js @@ -16,14 +16,14 @@ module.exports = function(Self) { Self.listWorkers = function() { let query = `SELECT w.id, - CONCAT(w.firstName, IFNULL(CONCAT(" ", w.name), "")) \`name\` + CONCAT(w.firstName, IFNULL(CONCAT(" ", w.lastName), "")) \`name\` FROM worker w JOIN account.user u ON w.userFk = u.id JOIN account.roleRole rr ON rr.role = u.role JOIN account.role r ON r.id = rr.inheritsFrom WHERE u.active AND r.\`name\` = 'employee' - ORDER BY w.name ASC`; + ORDER BY w.lastName ASC`; return Self.rawSql(query); }; diff --git a/modules/order/back/methods/order/catalogFilter.js b/modules/order/back/methods/order/catalogFilter.js index 9fa74647c..6e805d957 100644 --- a/modules/order/back/methods/order/catalogFilter.js +++ b/modules/order/back/methods/order/catalogFilter.js @@ -106,7 +106,7 @@ module.exports = Self => { i.value8, tci.price, tci.available, - w.name AS lastName, + w.lastName AS lastName, w.firstName FROM tmp.ticketCalculateItem tci JOIN vn.item i ON i.id = tci.itemFk diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 9c6c5cbe6..b9c11d4fa 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -187,7 +187,7 @@ module.exports = Self => { w.name AS warehouse, am.name AS agencyMode, st.name AS state, - wk.name AS salesPerson, + wk.lastName AS salesPerson, ts.stateFk as stateFk, ts.alertLevel as alertLevel, ts.code as alertLevelCode, diff --git a/modules/worker/back/methods/worker/filter.js b/modules/worker/back/methods/worker/filter.js index 0673c0e59..21462eb42 100644 --- a/modules/worker/back/methods/worker/filter.js +++ b/modules/worker/back/methods/worker/filter.js @@ -61,7 +61,7 @@ module.exports = Self => { }, { arg: 'nickname', type: 'String', - description: 'The worker name', + description: 'The worker nickname', http: {source: 'query'} } ], @@ -85,15 +85,16 @@ module.exports = Self => { ? {'w.id': value} : {or: [ {'w.firstName': {like: `%${value}%`}}, - {'w.name': {like: `%${value}%`}}, - {'u.name': {like: `%${value}%`}} + {'w.lastName': {like: `%${value}%`}}, + {'u.name': {like: `%${value}%`}}, + {'u.nickname': {like: `%${value}%`}} ]}; case 'id': return {'w.id': value}; case 'userFk': return {'w.userFk': value}; case 'name': - return {'w.name': {like: `%${value}%`}}; + return {'w.lastName': {like: `%${value}%`}}; case 'firstName': return {'w.firstName': {like: `%${value}%`}}; case 'extension': @@ -114,7 +115,7 @@ module.exports = Self => { stmt = new ParameterizedSQL( `SELECT w.id, u.email, p.extension, u.name as userName, - d.name AS department, w.name, u.nickname, mu.email + d.name AS department, w.lastName, u.nickname, mu.email FROM worker w LEFT JOIN workerDepartment wd ON wd.workerFk = w.id LEFT JOIN department d ON d.id = wd.departmentFk diff --git a/print/report/client-welcome/index.js b/print/report/client-welcome/index.js index 1e6b7934c..b2278b4ee 100755 --- a/print/report/client-welcome/index.js +++ b/print/report/client-welcome/index.js @@ -30,7 +30,7 @@ module.exports = { u.lang locale, u.name AS userName, c.email recipient, - CONCAT(w.name, ' ', w.firstName) salesPersonName, + CONCAT(w.lastName, ' ', w.firstName) salesPersonName, w.phone AS salesPersonPhone, CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail FROM client c diff --git a/print/report/printer-setup/index.js b/print/report/printer-setup/index.js index 5a2c5758b..1353d996c 100755 --- a/print/report/printer-setup/index.js +++ b/print/report/printer-setup/index.js @@ -38,7 +38,7 @@ module.exports = { u.lang locale, u.name AS userName, c.email recipient, - CONCAT(w.name, ' ', w.firstName) salesPersonName, + CONCAT(w.lastName, ' ', w.firstName) salesPersonName, w.phone AS salesPersonPhone, CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail FROM client c