From 7d2e98267f4d66afc3e3a9d823c9da60558f935d Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Jul 2023 15:09:31 +0200 Subject: [PATCH] =?UTF-8?q?refs=20#5561=20eliminados=20valores=20a=20pi?= =?UTF-8?q?=C3=B1on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/232401/00-saleTracking_new.sql | 38 ------------------- .../{232401 => 233001}/00-aclSaleTracking.sql | 3 +- .../back/methods/sale-tracking/filter.js | 10 +++-- 3 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 db/changes/232401/00-saleTracking_new.sql rename db/changes/{232401 => 233001}/00-aclSaleTracking.sql (63%) diff --git a/db/changes/232401/00-saleTracking_new.sql b/db/changes/232401/00-saleTracking_new.sql deleted file mode 100644 index d5fa569fd..000000000 --- a/db/changes/232401/00-saleTracking_new.sql +++ /dev/null @@ -1,38 +0,0 @@ -DELIMITER $$ -$$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleTracking_new`( - vSaleFK INT, - vIsChecked BOOLEAN, - vOriginalQuantity INT, - vWorkerFk INT, - vState VARCHAR(50), - vIsScanned BOOLEAN) -BEGIN -/** - * Modifica registro de saleTracking - * - * @param vSaleFK Identificador del registro a modificar - * @param vIsChecked Indica si la línea ha sido pulsada - * @param vOriginalQuantity Cantidad original - * @param vWorkerFk Identificador del trabajador - * @param vAction Identificador de la acción realizada - * @param vState Identificador del estado a modificar - * @param vIsScanned Identificador si se ha escaneado automáticamente o manual - */ - - REPLACE vn.saleTracking(saleFk, - isChecked, - originalQuantity, - workerFk, - stateFk, - isScanned) - SELECT vSaleFK, - vIsChecked, - vOriginalQuantity, - IFNULL(vWorkerFk, vn.getUser()), - s.id, - vIsScanned - FROM vn.state s - WHERE s.code = vState COLLATE utf8_unicode_ci; -END$$ -DELIMITER ; diff --git a/db/changes/232401/00-aclSaleTracking.sql b/db/changes/233001/00-aclSaleTracking.sql similarity index 63% rename from db/changes/232401/00-aclSaleTracking.sql rename to db/changes/233001/00-aclSaleTracking.sql index 441945fe2..6a699091a 100644 --- a/db/changes/232401/00-aclSaleTracking.sql +++ b/db/changes/233001/00-aclSaleTracking.sql @@ -1,3 +1,4 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES - ('SaleTracking', 'deleteSaleGroupDetail', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + ('SaleTracking', 'deleteSaleGroupDetail', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('SaleTracking', 'replaceOrCreate', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/ticket/back/methods/sale-tracking/filter.js b/modules/ticket/back/methods/sale-tracking/filter.js index ee074a852..09101a47a 100644 --- a/modules/ticket/back/methods/sale-tracking/filter.js +++ b/modules/ticket/back/methods/sale-tracking/filter.js @@ -67,9 +67,13 @@ module.exports = Self => { JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.item i ON i.id = s.itemFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk - LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 - LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 - LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 + LEFT JOIN vn.state st ON TRUE + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id + AND stPrevious.stateFk = (SELECT id FROM vn.state WHERE code = 'PREVIOUS_PREPARATION') + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id + AND stPrepared.stateFk = (SELECT id FROM vn.state WHERE code = 'PREPARED') + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id + AND stControled.stateFk = (SELECT id FROM vn.state s2 WHERE code = 'CHECKED') LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk LEFT JOIN vn.parking p ON p.id = sg.parkingFk