From 4c0e05fdab6b428413bef10604f03e42cfd3d360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 19 Sep 2024 18:03:59 +0200 Subject: [PATCH 1/5] fix: refs #8011 Previas compo F --- .../vn/procedures/previousSticker_get.sql | 54 ++++++++++--------- .../reports/previa-label/previa-label.html | 2 +- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/db/routines/vn/procedures/previousSticker_get.sql b/db/routines/vn/procedures/previousSticker_get.sql index 90f2bec37..f43a23773 100644 --- a/db/routines/vn/procedures/previousSticker_get.sql +++ b/db/routines/vn/procedures/previousSticker_get.sql @@ -1,58 +1,60 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`previousSticker_get`(vSaleGroupFk INT) +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`previousSticker_get`( + vSaleGroupFk INT +) BEGIN /** * Devuelve los campos a imprimir en una etiqueta de preparaciĆ³n previa. - * Actualiza el valor de vn.saleGroup.parkingFk en el caso de que exista un + * Actualiza el valor de saleGroup.parkingFk en el caso de que exista un * saleGroup del mismo ticket con parking, del mismo sector, para que todos se * pongan juntos. * - * @param vSaleGroupFk Identificador de vn.saleGroup + * @param vSaleGroupFk Identificador de saleGroup */ DECLARE vTicketFk INT; DECLARE vParkingFk INT; DECLARE vSectorFk INT; + DECLARE vPreviousLines INT; - SELECT s.ticketFk - INTO vTicketFk - FROM vn.saleGroupDetail sgd - JOIN vn.sale s ON s.id = sgd.saleFk - WHERE sgd.saleGroupFk = vSaleGroupFk - LIMIT 1; + SELECT s.ticketFk, COUNT(*) + INTO vTicketFk, vPreviousLines + FROM saleGroupDetail sgd + JOIN sale s ON s.id = sgd.saleFk + WHERE sgd.saleGroupFk = vSaleGroupFk; SELECT sg.parkingFk, sc.sectorFk INTO vParkingFk, vSectorFk - FROM vn.saleGroup sg - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id - JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk - JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id - JOIN vn.sale s ON s.id = sgd.saleFk + FROM saleGroup sg + JOIN sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id + JOIN sectorCollection sc ON sc.id = scsg.sectorCollectionFk + JOIN saleGroupDetail sgd ON sgd.saleGroupFk = sg.id + JOIN sale s ON s.id = sgd.saleFk WHERE s.ticketFk = vTicketFk AND sg.parkingFk IS NOT NULL LIMIT 1; - UPDATE vn.saleGroup sg + UPDATE saleGroup sg SET sg.parkingFk = vParkingFk WHERE sg.id = vSaleGroupFk AND sg.sectorFk = vSectorFk; SELECT sgd.saleGroupFk, t.id ticketFk, - p.code as location, - t.observations, + vPreviousLines previousLines, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk , - count(*) items, + COUNT(*) ticketLines, + p.code `location`, sc.description sector - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk - JOIN vn.sector sc ON sc.id = sg.sectorFk - JOIN vn.ticket t ON t.id = s.ticketFk - LEFT JOIN vn.parking p ON p.id = sg.parkingFk - LEFT JOIN vn.`zone` z ON z.id = t.zoneFk + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN saleGroup sg ON sg.id = sgd.saleGroupFk + JOIN sector sc ON sc.id = sg.sectorFk + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN parking p ON p.id = sg.parkingFk + LEFT JOIN `zone` z ON z.id = t.zoneFk WHERE sgd.saleGroupFk = vSaleGroupFk; END$$ DELIMITER ; diff --git a/print/templates/reports/previa-label/previa-label.html b/print/templates/reports/previa-label/previa-label.html index 1dc9b14d0..68042e978 100644 --- a/print/templates/reports/previa-label/previa-label.html +++ b/print/templates/reports/previa-label/previa-label.html @@ -19,7 +19,7 @@
{{previa.itemPackingTypeFk}}
{{previa.shippingHour}}:{{previa.shippingMinute}}
-
{{previa.items}}
+
{{previa.previousLines}}
From 564d23653cc5fff96dbe40743d7bb05738cb075c Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 20 Sep 2024 13:24:00 +0200 Subject: [PATCH 2/5] fix: acls --- db/versions/11253-limeChico/00-firstScript.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 db/versions/11253-limeChico/00-firstScript.sql diff --git a/db/versions/11253-limeChico/00-firstScript.sql b/db/versions/11253-limeChico/00-firstScript.sql new file mode 100644 index 000000000..b67d8c12d --- /dev/null +++ b/db/versions/11253-limeChico/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Auto-generated SQL script #202409201320 +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Postcode','*','WRITE','ALLOW','ROLE','administrative'); + From 346893455ff3f3c17998ef5e08a48be658337dfc Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 20 Sep 2024 13:38:53 +0200 Subject: [PATCH 3/5] fix: remove comment --- db/versions/11253-limeChico/00-firstScript.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/versions/11253-limeChico/00-firstScript.sql b/db/versions/11253-limeChico/00-firstScript.sql index b67d8c12d..acf1de15c 100644 --- a/db/versions/11253-limeChico/00-firstScript.sql +++ b/db/versions/11253-limeChico/00-firstScript.sql @@ -1,4 +1,3 @@ --- Auto-generated SQL script #202409201320 INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('Postcode','*','WRITE','ALLOW','ROLE','administrative'); From 190c964ec2a2d3e90f168af873bfcf8a4df7852d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 20 Sep 2024 13:50:08 +0200 Subject: [PATCH 4/5] fix: refs#8011 previousSticker_get --- .../vn/procedures/previousSticker_get.sql | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/db/routines/vn/procedures/previousSticker_get.sql b/db/routines/vn/procedures/previousSticker_get.sql index f43a23773..b4b4d1c35 100644 --- a/db/routines/vn/procedures/previousSticker_get.sql +++ b/db/routines/vn/procedures/previousSticker_get.sql @@ -14,13 +14,17 @@ BEGIN DECLARE vTicketFk INT; DECLARE vParkingFk INT; DECLARE vSectorFk INT; - DECLARE vPreviousLines INT; + DECLARE vTicketLines INT; - SELECT s.ticketFk, COUNT(*) - INTO vTicketFk, vPreviousLines - FROM saleGroupDetail sgd - JOIN sale s ON s.id = sgd.saleFk - WHERE sgd.saleGroupFk = vSaleGroupFk; + WITH ticketData AS( + SELECT s.ticketFk + FROM vn.saleGroupDetail sgd + JOIN vn.sale s ON s.id = sgd.saleFk + WHERE sgd.saleGroupFk = vSaleGroupFk + ) + SELECT COUNT(*), s.ticketFk INTO vTicketLines, vTicketFk + FROM vn.sale s + JOIN ticketData td ON td.ticketFk = s.ticketFk; SELECT sg.parkingFk, sc.sectorFk INTO vParkingFk, vSectorFk @@ -40,11 +44,11 @@ BEGIN SELECT sgd.saleGroupFk, t.id ticketFk, - vPreviousLines previousLines, + COUNT(*) previousLines, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk , - COUNT(*) ticketLines, + vTicketLines ticketLines, p.code `location`, sc.description sector FROM sale s From e25415f8207fe218d917781b8fcc44decfe6c3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 20 Sep 2024 13:54:22 +0200 Subject: [PATCH 5/5] fix: refs#8011 previousSticker_get --- db/routines/vn/procedures/previousSticker_get.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/previousSticker_get.sql b/db/routines/vn/procedures/previousSticker_get.sql index b4b4d1c35..ad3dbd1c4 100644 --- a/db/routines/vn/procedures/previousSticker_get.sql +++ b/db/routines/vn/procedures/previousSticker_get.sql @@ -17,7 +17,7 @@ BEGIN DECLARE vTicketLines INT; WITH ticketData AS( - SELECT s.ticketFk + SELECT DISTINCT s.ticketFk FROM vn.saleGroupDetail sgd JOIN vn.sale s ON s.id = sgd.saleFk WHERE sgd.saleGroupFk = vSaleGroupFk