From 9760e5021216e1712e27dd2970139c74158ce4ce Mon Sep 17 00:00:00 2001 From: alexandre Date: Fri, 12 May 2023 08:46:12 +0200 Subject: [PATCH] refs #5513 minor fixes --- db/changes/231601/00-buyConfig_travelConfig.sql | 2 +- db/dump/fixtures.sql | 4 ++-- modules/supplier/back/methods/supplier/getItemsPackaging.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/changes/231601/00-buyConfig_travelConfig.sql b/db/changes/231601/00-buyConfig_travelConfig.sql index 7643b9387..40fc057de 100644 --- a/db/changes/231601/00-buyConfig_travelConfig.sql +++ b/db/changes/231601/00-buyConfig_travelConfig.sql @@ -1,6 +1,6 @@ CREATE TABLE `vn`.`buyConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `showLastBuy` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la Ășltima compra', + `monthsAgo` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la Ășltima compra', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 48d72b7cf..661a90faa 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2863,10 +2863,10 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`) (2, 1, 50, 2), (3, 1, 0, 3); -INSERT INTO `vn`.`travelConfig` (id, warehouseInFk, warehouseOutFk, agencyFk, companyFk) +INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`) VALUES (1, 1, 1, 1, 442); -INSERT INTO `vn`.`buyConfig` (id, showLastBuy) +INSERT INTO `vn`.`buyConfig` (`id`, `monthsAgo`) VALUES (1, 6); diff --git a/modules/supplier/back/methods/supplier/getItemsPackaging.js b/modules/supplier/back/methods/supplier/getItemsPackaging.js index cae32a701..ced2f016f 100644 --- a/modules/supplier/back/methods/supplier/getItemsPackaging.js +++ b/modules/supplier/back/methods/supplier/getItemsPackaging.js @@ -38,12 +38,12 @@ module.exports = Self => { JOIN vn.item i ON i.id = b.itemFk JOIN vn.entry e ON e.id = b.entryFk JOIN vn.supplier s ON s.id = e.supplierFk - JOIN vn.buyConfig bc ON bc.showLastBuy + JOIN vn.buyConfig bc ON bc.monthsAgo JOIN vn.travel t ON t.id = e.travelFk LEFT JOIN entryTmp et ON et.id = i.id WHERE e.supplierFk = ? - AND (i.family ='EMB' OR i.family = 'CONT') - AND b.created > (util.VN_CURDATE() - INTERVAL bc.showLastBuy MONTH) + AND i.family IN ('EMB', 'CONT') + AND b.created > (util.VN_CURDATE() - INTERVAL bc.monthsAgo MONTH) GROUP BY b.itemFk ORDER BY et.quantity DESC, quantityTotal DESC`, [entry, id, id]); return result;