From 2cbd610bc2355ff553d6cf31c6f9d445731a773f Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 12 Jun 2024 22:19:59 +0200 Subject: [PATCH] perf(salix): refs #6321 #7563 add ink.showOrder to procedure --- db/routines/vn/procedures/item_getSimilar.sql | 11 +++-------- modules/item/back/methods/item/getSimilar.js | 6 +++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index 63d2c05d95..318945c086 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -66,14 +66,7 @@ BEGIN ELSE 1 END AS minQuantity, iss.visible located, - b.price, - b.price1, - b.price2, - b.price3, - a.price, - a.price1, - a.price2, - a.price3, + b.price2 FROM vn.item i JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalcFk @@ -87,6 +80,7 @@ BEGIN LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id AND iss.warehouseFk = vWarehouseFk + LEFT JOIN vn.ink ink ON ink.id = i.tag5 JOIN itemTags its WHERE a.available > 0 AND (i.typeFk = its.typeFk OR NOT vShowType) @@ -95,6 +89,7 @@ BEGIN (t.name = its.name) DESC, (it.value = its.value) DESC, (i.tag5 = its.tag5) DESC, + (ink.`showOrder`) DESC, match5 DESC, (i.tag6 = its.tag6) DESC, match6 DESC, diff --git a/modules/item/back/methods/item/getSimilar.js b/modules/item/back/methods/item/getSimilar.js index f8115fb5e0..1fc39cb1c6 100644 --- a/modules/item/back/methods/item/getSimilar.js +++ b/modules/item/back/methods/item/getSimilar.js @@ -26,7 +26,11 @@ module.exports = Self => { Object.assign(myOptions, options); const where = filter.where; - const query = [where.itemFk, where.warehouseFk, where.date ?? Date.now(), where.showType ?? true]; + const today = + new Date().toLocaleDateString('es-ES', {year: 'numeric', + month: '2-digit', + day: '2-digit'}); + const query = [where.itemFk, where.warehouseFk, where.date ?? today, where.showType ?? true]; const [results] = await Self.rawSql('CALL vn.item_getSimilar(?, ?, ?, ?)', query, myOptions); return [