From fd4fe288a5a2cbe57d432aca30bb92f44c679a4d Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Mar 2019 12:03:06 +0100 Subject: [PATCH] has visible disabled temporally --- modules/item/back/methods/item/filter.js | 28 +++++++++++++++------- modules/item/front/search-panel/index.html | 5 ---- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 0bea205e3..b71b3de1a 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -89,12 +89,12 @@ module.exports = Self => { } }); - filter = mergeFilters(ctx.args.filter, {where}); + /* case 'hasVisible': + return value ? {'v.visible': {gt: 0}} : {'v.visible': {or: [{lte: 0}, {neq: null}]}}; */ + filter = mergeFilters(ctx.args.filter, {where}); let stmts = []; let stmt; - if (ctx.args.hasVisible === true) - stmts.push('CALL cache.visible_refresh(@visibleCalc, true, 1)'); stmt = new ParameterizedSQL( `SELECT i.id, i.image, i.name, i.description, @@ -106,7 +106,7 @@ module.exports = Self => { intr.description AS intrastat, i.stems, ori.code AS origin, t.name AS type, ic.name AS category, i.density, - b.grouping, b.packing, itn.code AS niche + b.grouping, b.packing, itn.code AS niche, @visibleCalc FROM item i LEFT JOIN itemType t ON t.id = i.typeFk LEFT JOIN itemCategory ic ON ic.id = t.categoryFk @@ -120,13 +120,18 @@ module.exports = Self => { LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk` ); - if (ctx.args.hasVisible === true) { + /* if (ctx.args.hasVisible !== undefined) { + stmts.push('CALL cache.visible_refresh(@visibleCalc, false, 1)'); + stmts.push('CALL cache.visible_refresh(@visibleCalc, false, 44)'); let joinAvailable = new ParameterizedSQL( - `JOIN cache.visible v - ON v.item_id = i.id AND v.calc_id = @visibleCalc` + `LEFT JOIN cache.visible v + ON v.item_id = i.id` ); stmt.merge(joinAvailable); - } + } */ + /* where v.visible > 0 +where v.visible <= 0 OR v.visible IS NULL +*/ if (ctx.args.tags) { let i = 1; @@ -150,7 +155,12 @@ module.exports = Self => { } } - stmt.merge(conn.makeSuffix(filter)); + stmt.merge(conn.makeWhere(filter.where)); + + /* if (ctx.args.hasVisible !== undefined) + stmt.merge(`GROUP BY i.id`); + */ + stmt.merge(conn.makePagination(filter)); let itemsIndex = stmts.push(stmt) - 1; let sql = ParameterizedSQL.join(stmts, ';'); diff --git a/modules/item/front/search-panel/index.html b/modules/item/front/search-panel/index.html index ba512c1d0..a31f79497 100644 --- a/modules/item/front/search-panel/index.html +++ b/modules/item/front/search-panel/index.html @@ -42,11 +42,6 @@ - -