From 75be124e1f9e600d74b509cb3d22e7f417c79681 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 4 Sep 2024 14:14:12 +0200 Subject: [PATCH 01/13] feat: refs #7929 create table material --- .../11213-aquaCarnation/00-firstScript.sql | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 db/versions/11213-aquaCarnation/00-firstScript.sql diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql new file mode 100644 index 000000000..3067ce06e --- /dev/null +++ b/db/versions/11213-aquaCarnation/00-firstScript.sql @@ -0,0 +1,253 @@ + +use vn; + +CREATE TABLE IF NOT EXISTS `material` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acero'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acero Galvanizado'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acetato'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acrílico'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Alambre'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Algodón'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Aluminio'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Antracita'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Arcilla'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Bambú'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Banano'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Canneté'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cartón'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cartulina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Celofán'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cemento'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cera'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cerámica'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Chapa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Chenilla'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cloruro de polivinilo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cobre'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Corcho'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cordel'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton Chess'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cristal'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cubo Asa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cuerda'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cuero'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Raso'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Velvet'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Eco Glass'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Encaje'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Esparto'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Espuma'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Felpa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Coco'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Vidrio y Resina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fieltro'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Foam'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Gamuza'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Gasa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Glass'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Goma'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Grafito'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hierro'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja Carbono'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja de Mirto'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hormigón'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Jute'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Kraft'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lana'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Látex'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Latrix'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lienzo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lino'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lurex'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Madera'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Metacrilato'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Metal'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Mimbre'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Musgo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Nonwoven'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Nylon'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Organza'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Paja'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Pana'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Papel'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Paperweb'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Paulownia'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Peluche'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Piedra'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Pizarra'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Plástico'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Poliestireno'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Polipropileno'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Poliresina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Polyester'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Porcelana'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Puntilla'); +INSERT IGNORE INTO `material` (`name`) VALUES ('PVC'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rafia'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rama'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Raso'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rattan'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rayon'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Reciclable'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Red'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Resina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Roca'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rope'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Saco'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Salim'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Seagrass'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Silicona'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Sisal'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Tejido'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Tela'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Terciopelo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Terracota'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Textil'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Titanio'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Tul'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Velvet'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Vidrio'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Yute'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Zinc'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Base de goma'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Base de madera'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina'); + +CREATE TABLE IF NOT EXISTS `secondaryMaterial` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Abedul'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acacia'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero Galvanizado'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acetato'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acrílico'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Alambre'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Algodón'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Aluminio'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Antracita'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Arcilla'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Bambú'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Banano'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Canneté'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartón'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartulina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Celofán'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cemento'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cera'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cerámica'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chapa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chenilla'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cloruro de polivinilo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cobre'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Corcho'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cordel'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton Chess'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cristal'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cubo Asa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuerda'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuero'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Raso'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Velvet'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Eco Glass'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Encaje'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Esparto'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Espuma'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Felpa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Coco'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Vidrio y Resina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fieltro'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Foam'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gamuza'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gasa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Glass'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Goma'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Grafito'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hierro'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja Carbono'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja de Mirto'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hormigón'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Jute'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Kraft'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lana'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Látex'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Latrix'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lienzo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lino'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lurex'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Madera'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metacrilato'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metal'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Mimbre'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Musgo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nonwoven'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nylon'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Organza'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paja'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pana'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Papel'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paperweb'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paulownia'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Peluche'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Piedra'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pizarra'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plástico'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliestireno'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polipropileno'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliresina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polyester'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Porcelana'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Puntilla'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('PVC'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rafia'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rama'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Raso'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rattan'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rayon'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Reciclable'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Red'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Resina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Roca'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rope'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Saco'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Salim'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Seagrass'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Silicona'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Sisal'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tejido'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tela'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terciopelo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terracota'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Textil'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Titanio'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tul'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Velvet'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Vidrio'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Yute'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Zinc'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de goma'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de madera'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plumas'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Protección Uva'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Purpurina'); + +UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material'; +UPDATE vn.tag SET isFree=0,sourceTable='secondaryMaterial' WHERE name='Material secundario'; \ No newline at end of file From 684658bb966766ad0a3d7bd5175a3ab7709e38a2 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 5 Sep 2024 14:25:50 +0200 Subject: [PATCH 02/13] feat: refs #7929 quitar codigo --- .../11213-aquaCarnation/00-firstScript.sql | 126 +----------------- 1 file changed, 1 insertion(+), 125 deletions(-) diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql index 3067ce06e..b23a6c782 100644 --- a/db/versions/11213-aquaCarnation/00-firstScript.sql +++ b/db/versions/11213-aquaCarnation/00-firstScript.sql @@ -125,129 +125,5 @@ INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas'); INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva'); INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina'); -CREATE TABLE IF NOT EXISTS `secondaryMaterial` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(50) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Abedul'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acacia'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero Galvanizado'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acetato'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acrílico'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Alambre'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Algodón'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Aluminio'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Antracita'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Arcilla'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Bambú'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Banano'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Canneté'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartón'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartulina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Celofán'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cemento'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cera'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cerámica'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chapa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chenilla'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cloruro de polivinilo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cobre'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Corcho'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cordel'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton Chess'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cristal'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cubo Asa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuerda'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuero'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Raso'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Velvet'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Eco Glass'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Encaje'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Esparto'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Espuma'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Felpa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Coco'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Vidrio y Resina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fieltro'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Foam'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gamuza'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gasa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Glass'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Goma'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Grafito'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hierro'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja Carbono'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja de Mirto'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hormigón'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Jute'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Kraft'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lana'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Látex'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Latrix'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lienzo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lino'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lurex'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Madera'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metacrilato'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metal'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Mimbre'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Musgo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nonwoven'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nylon'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Organza'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paja'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pana'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Papel'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paperweb'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paulownia'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Peluche'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Piedra'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pizarra'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plástico'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliestireno'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polipropileno'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliresina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polyester'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Porcelana'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Puntilla'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('PVC'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rafia'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rama'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Raso'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rattan'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rayon'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Reciclable'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Red'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Resina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Roca'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rope'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Saco'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Salim'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Seagrass'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Silicona'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Sisal'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tejido'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tela'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terciopelo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terracota'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Textil'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Titanio'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tul'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Velvet'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Vidrio'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Yute'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Zinc'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de goma'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de madera'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plumas'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Protección Uva'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Purpurina'); - UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material'; -UPDATE vn.tag SET isFree=0,sourceTable='secondaryMaterial' WHERE name='Material secundario'; \ No newline at end of file +UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name='Material secundario'; \ No newline at end of file From 3e4caa8edf5f4633aedaa7bb591bb15549113d26 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 5 Sep 2024 14:38:55 +0200 Subject: [PATCH 03/13] feat: refs #7929 autoincrement 1 --- db/versions/11213-aquaCarnation/00-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql index b23a6c782..9e744b66c 100644 --- a/db/versions/11213-aquaCarnation/00-firstScript.sql +++ b/db/versions/11213-aquaCarnation/00-firstScript.sql @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `material` ( `name` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul'); INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia'); From a7bc58a5bc6374e9c9227ff9ab376a7ea0e332dd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 5 Sep 2024 14:45:17 +0200 Subject: [PATCH 04/13] fix: refs #7931 Immediately discount order lines from available --- .../cache/procedures/available_refresh.sql | 7 +++++- .../cache/procedures/available_updateItem.sql | 23 +++++++++++++++++++ .../hedera/procedures/order_addItem.sql | 10 ++++---- 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 db/routines/cache/procedures/available_updateItem.sql diff --git a/db/routines/cache/procedures/available_refresh.sql b/db/routines/cache/procedures/available_refresh.sql index abf023a41..87c003648 100644 --- a/db/routines/cache/procedures/available_refresh.sql +++ b/db/routines/cache/procedures/available_refresh.sql @@ -1,5 +1,10 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`( + OUT `vCalc` INT, + `vRefresh` INT, + `vWarehouse` INT, + `vDated` DATE +) proc: BEGIN DECLARE vStartDate DATE; DECLARE vReserveDate DATETIME; diff --git a/db/routines/cache/procedures/available_updateItem.sql b/db/routines/cache/procedures/available_updateItem.sql new file mode 100644 index 000000000..347eaa137 --- /dev/null +++ b/db/routines/cache/procedures/available_updateItem.sql @@ -0,0 +1,23 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`( + `vItem` INT, + `vWarehouse` INT, + `vDated` DATE, + `vQuantity` INT +) +BEGIN + DECLARE vCalc INT; + + SELECT id INTO vCalc FROM cache_calc + WHERE cacheName = 'available' + AND params = CONCAT_WS('/', vWarehouse, vDated) + AND last_refresh <= NOW(); + + IF vCalc IS NOT NULL THEN + UPDATE available + SET available = available - vQuantity + WHERE calc_id = vCalc + AND item_id = vItem; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/hedera/procedures/order_addItem.sql b/db/routines/hedera/procedures/order_addItem.sql index f690f9aa6..204dcb6bf 100644 --- a/db/routines/hedera/procedures/order_addItem.sql +++ b/db/routines/hedera/procedures/order_addItem.sql @@ -1,8 +1,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`( vSelf INT, - vWarehouse INT, - vItem INT, + vWarehouse INT, + vItem INT, vAmount INT) BEGIN /** @@ -37,7 +37,7 @@ BEGIN ROLLBACK; RESIGNAL; END; - + CALL order_calcCatalogFromItem(vSelf, vItem); START TRANSACTION; @@ -102,6 +102,8 @@ BEGIN amount = vAdd, price = vPrice; + CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd); + SET vRow = LAST_INSERT_ID(); INSERT INTO orderRowComponent (rowFk, componentFk, price) @@ -121,6 +123,6 @@ BEGIN END IF; COMMIT; - CALL vn.ticketCalculatePurge; + CALL vn.ticketCalculatePurge; END$$ DELIMITER ; From c1e086072b7c95addf1d40f08321444f386f1868 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 5 Sep 2024 14:50:36 +0200 Subject: [PATCH 05/13] fix: refs #7524 load after get client --- modules/client/front/balance/create/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 9113d7605..f4ff0e3aa 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -23,6 +23,7 @@ class Controller extends Dialog { } set clientFk(value) { + if (!value) return; this.receipt.clientFk = value; const filter = { @@ -32,6 +33,7 @@ class Controller extends Dialog { } }; + this.getAmountPaid(); this.$http.get(`Clients/findOne`, {filter}) .then(res => { this.receipt.email = res.data.email; @@ -50,7 +52,6 @@ class Controller extends Dialog { set companyFk(value) { this.receipt.companyFk = value; - this.getAmountPaid(); } set description(value) { @@ -152,7 +153,7 @@ class Controller extends Dialog { getAmountPaid() { const filter = { where: { - clientFk: this.$params.id, + clientFk: this.$params.id ?? this.clientFk, companyFk: this.receipt.companyFk } }; @@ -210,8 +211,8 @@ ngModule.vnComponent('vnClientBalanceCreate', { payed: ' Date: Thu, 5 Sep 2024 15:47:45 +0200 Subject: [PATCH 06/13] fix: refs #7524 add fixture orm config --- db/dump/fixtures.before.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 769c081c5..9f590233f 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3953,3 +3953,7 @@ VALUES (4, 'Referencia Transferencias', 'trnRef'), (5, 'Referencia Nominas', 'payRef'), (6, 'ABA', 'aba'); + +INSERT INTO vn.ormConfig SET + id = 1, + selectLimit = 1000; \ No newline at end of file From 640b45ed995a3e75fadcf3f3931438553f55d7bc Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 09:06:00 +0200 Subject: [PATCH 07/13] fix: refs #7931 Apply PR change requests --- .../cache/procedures/available_updateItem.sql | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/db/routines/cache/procedures/available_updateItem.sql b/db/routines/cache/procedures/available_updateItem.sql index 347eaa137..8e94a9d75 100644 --- a/db/routines/cache/procedures/available_updateItem.sql +++ b/db/routines/cache/procedures/available_updateItem.sql @@ -6,12 +6,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_update `vQuantity` INT ) BEGIN +/** + * Immediately deduct/add an amount from the available cache (if exists). + * + * @param vItem The item id + * @param vWarehouse The warehouse id + * @param vDated Available cache date + * @param vQuantity The amount to be deducted from the cache + */ DECLARE vCalc INT; - SELECT id INTO vCalc FROM cache_calc + SELECT id INTO vCalc + FROM cache_calc WHERE cacheName = 'available' - AND params = CONCAT_WS('/', vWarehouse, vDated) - AND last_refresh <= NOW(); + AND params = CONCAT_WS('/', vWarehouse, vDated); IF vCalc IS NOT NULL THEN UPDATE available From 48f94140e265cadc274833ef0004dfae66b73273 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 09:16:22 +0200 Subject: [PATCH 08/13] fix: refs #7931 Back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index 61bf6b3e7..f068a3a32 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(185); + expect(result.available).toEqual(175); expect(result.visible).toEqual(92); await tx.rollback(); From d44dec3703dca6f6182ce9cdbf20dfdc07a5a52c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 11:25:49 +0200 Subject: [PATCH 09/13] fix: refs #7931 Back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index f068a3a32..61bf6b3e7 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(175); + expect(result.available).toEqual(185); expect(result.visible).toEqual(92); await tx.rollback(); From 382e54b57220c36c2e29065986cb3fbf0f78999f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 11:30:43 +0200 Subject: [PATCH 10/13] fix: refs #7931 Back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index 61bf6b3e7..f068a3a32 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(185); + expect(result.available).toEqual(175); expect(result.visible).toEqual(92); await tx.rollback(); From d10db686e536df72cb982b8d811702f5425c4b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 6 Sep 2024 12:52:24 +0200 Subject: [PATCH 11/13] fix: refs #7346 ticket_close serial --- db/routines/vn/procedures/ticket_close.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/ticket_close.sql b/db/routines/vn/procedures/ticket_close.sql index 97da5057c..f8bbe239b 100644 --- a/db/routines/vn/procedures/ticket_close.sql +++ b/db/routines/vn/procedures/ticket_close.sql @@ -17,6 +17,7 @@ BEGIN DECLARE vHasDailyInvoice BOOL; DECLARE vWithPackage BOOL; DECLARE vHasToInvoice BOOL; + DECLARE vSerial VARCHAR(2); DECLARE cur CURSOR FOR SELECT ticketFk FROM tmp.ticket_close; @@ -83,14 +84,17 @@ BEGIN GROUP BY e.freightItemFk); IF(vHasDailyInvoice) AND vHasToInvoice THEN + SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial; + IF NOT vSerial THEN + CALL util.throw('Cannot booking without a serial'); + END IF; - -- Facturacion rapida CALL ticket_setState(vCurTicketFk, 'DELIVERED'); - -- Facturar si está contabilizado + IF vIsTaxDataChecked THEN CALL invoiceOut_newFromClient( vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'multiple')), + vSerial, vShipped, vCompanyFk, NULL, From e2c6a4575610e89c29cc32e9e6718af45189befb Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 12:57:57 +0200 Subject: [PATCH 12/13] fix: refs #7931 Available back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index f068a3a32..adf9b7f76 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('item getVisibleAvailable()', () => { - it('should check available visible for today', async() => { + it('should check available visible for tomorrow', async() => { const tx = await models.Item.beginTransaction({}); const options = {transaction: tx}; @@ -9,10 +9,11 @@ describe('item getVisibleAvailable()', () => { const itemFk = 1; const warehouseFk = 1; const dated = Date.vnNew(); + dated.setDate(dated.getDate() + 1); const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(175); + expect(result.available).toEqual(185); expect(result.visible).toEqual(92); await tx.rollback(); From 0ad4d3a9592dcb8283b3f25ffd39f8c2bcfbdc3b Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 6 Sep 2024 13:50:49 +0200 Subject: [PATCH 13/13] feat: refs #7905 getBuysCsv --- loopback/util/flatten.js | 42 ++++++++++++++++++ .../entry/back/methods/entry/getBuysCsv.js | 44 +++++++++++++++++++ modules/entry/back/models/entry.js | 1 + 3 files changed, 87 insertions(+) create mode 100644 loopback/util/flatten.js create mode 100644 modules/entry/back/methods/entry/getBuysCsv.js diff --git a/loopback/util/flatten.js b/loopback/util/flatten.js new file mode 100644 index 000000000..18d682d1f --- /dev/null +++ b/loopback/util/flatten.js @@ -0,0 +1,42 @@ +/** + * Flattens an array of objects by converting each object into a flat structure. + * + * @param {Array} dataArray Array of objects to be flattened + * @return {Array} Array of flattened objects + */ +function flatten(dataArray) { + return dataArray.map(item => flattenObj(item.__data)); +} + +/** + * Recursively flattens an object, converting nested properties into a single level object + * with keys representing the original nested structure. + * + * @param {Object} data The object to be flattened + * @param {String} [prefix=''] Optional prefix for nested keys + * @return {Object} Flattened object + */ +function flattenObj(data, prefix = '') { + let result = {}; + try { + for (let key in data) { + if (!data[key]) continue; + + const newKey = prefix ? `${prefix}_${key}` : key; + const value = data[key]; + + if (typeof value === 'object' && value !== null && !Array.isArray(value)) + Object.assign(result, flattenObj(value.__data, newKey)); + else + result[newKey] = value; + } + } catch (error) { + console.error(error); + } + + return result; +} +module.exports = { + flatten, + flattenObj, +}; diff --git a/modules/entry/back/methods/entry/getBuysCsv.js b/modules/entry/back/methods/entry/getBuysCsv.js new file mode 100644 index 000000000..4bd246fa0 --- /dev/null +++ b/modules/entry/back/methods/entry/getBuysCsv.js @@ -0,0 +1,44 @@ +const {toCSV} = require('vn-loopback/util/csv'); +const {flatten} = require('vn-loopback/util/flatten'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('getBuysCsv', { + description: 'Returns buys for one entry in CSV file format', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The entry id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/getBuysCsv`, + verb: 'GET' + } + }); + + Self.getBuysCsv = async(ctx, id, options) => { + const data = await Self.getBuys(ctx, id, null, options); + if (!data.length) throw new UserError('The entry has no lines or does not exist'); + const dataFlatted = flatten(data); + return [toCSV(dataFlatted), 'text/csv', `inline; filename="buys-${id}.csv"`]; + }; +}; diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index b11d64415..8ca79f531 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -3,6 +3,7 @@ module.exports = Self => { require('../methods/entry/filter')(Self); require('../methods/entry/getEntry')(Self); require('../methods/entry/getBuys')(Self); + require('../methods/entry/getBuysCsv')(Self); require('../methods/entry/importBuys')(Self); require('../methods/entry/importBuysPreview')(Self); require('../methods/entry/lastItemBuys')(Self);