diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index e31c873c49..9a83f41636 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -813,7 +813,7 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT'), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT'), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), - (16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), + (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT'); -- Update the taxClass after insert of the items diff --git a/modules/item/back/methods/item/activeWithBuyer.js b/modules/item/back/methods/item/activeWithBuyer.js index ca2c9329d5..121079aaa3 100644 --- a/modules/item/back/methods/item/activeWithBuyer.js +++ b/modules/item/back/methods/item/activeWithBuyer.js @@ -1,4 +1,3 @@ - module.exports = Self => { Self.remoteMethod('activeWithBuyer', { description: 'Returns active workers in itemType', @@ -19,13 +18,18 @@ module.exports = Self => { } }); - Self.activeWithBuyer = async filter => { - const query = - `SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname - FROM worker w - JOIN itemType i ON i.workerFk = w.id - JOIN account.user u ON u.id = w.id`; + Self.activeWithBuyer = async(filter, options) => { + const myOptions = {}; - return Self.activeWorkers(query, filter); + if (typeof options == 'object') + Object.assign(myOptions, options); + + const query = + `SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname + FROM worker w + JOIN itemType i ON i.workerFk = w.id + JOIN account.user u ON u.id = w.id`; + + return Self.activeWorkers(query, filter, myOptions); }; };