diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 42e44a31d..00f72ea14 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -203,7 +203,7 @@ module.exports = Self => { LEFT JOIN cache.visible v ON v.item_id = lb.item_id AND v.calc_id = @calc_id JOIN item i ON i.id = lb.item_id - JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = ${userConfig.warehouseFk} + JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = ? JOIN buy b ON b.id = lb.buy_id LEFT JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN itemType t ON t.id = i.typeFk @@ -211,7 +211,7 @@ module.exports = Self => { LEFT JOIN origin ori ON ori.id = i.originFk LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(? ,INTERVAL 1 YEAR) LEFT JOIN supplier s ON s.id = e.supplierFk` - , [date]); + , [userConfig.warehouseFk, date]); if (ctx.args.tags) { let i = 1; diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 724502601..8b2a014e6 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -182,11 +182,11 @@ module.exports = Self => { LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN origin ori ON ori.id = i.originFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = ${userConfig.warehouseFk} + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = ? LEFT JOIN buy b ON b.id = lb.buy_id LEFT JOIN entry e ON e.id = b.entryFk LEFT JOIN supplier s ON s.id = e.supplierFk` - ); + , [userConfig.warehouseFk]); if (ctx.args.tags) { let i = 1;