From 6927f4b28df4486277c11be1fc0e3760495b26a5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Nov 2024 11:51:00 +0100 Subject: [PATCH 1/6] feat: refs #6818 saysimple integration --- back/model-config.json | 3 +++ back/models/country.json | 7 ++++- back/models/say-simple-country.json | 26 +++++++++++++++++++ db/dump/fixtures.before.sql | 3 +++ .../11330-greenMoss/00-firstScript.sql | 6 +++++ modules/client/back/methods/client/summary.js | 5 +++- 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 back/models/say-simple-country.json create mode 100644 db/versions/11330-greenMoss/00-firstScript.sql diff --git a/back/model-config.json b/back/model-config.json index 5368769fd..efb148ee8 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -139,6 +139,9 @@ "StarredModule": { "dataSource": "vn" }, + "SaySimpleCountry": { + "dataSource": "vn" + }, "TempContainer": { "dataSource": "tempStorage" }, diff --git a/back/models/country.json b/back/models/country.json index 80d456702..ee72ae49d 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -44,6 +44,11 @@ "type": "belongsTo", "model": "Continent", "foreignKey": "continentFk" + }, + "saySimpleCountry": { + "type": "hasOne", + "model": "SaySimpleCountry", + "foreignKey": "countryFk" } }, "acls": [ @@ -54,4 +59,4 @@ "permission": "ALLOW" } ] -} +} \ No newline at end of file diff --git a/back/models/say-simple-country.json b/back/models/say-simple-country.json new file mode 100644 index 000000000..39acd5f0b --- /dev/null +++ b/back/models/say-simple-country.json @@ -0,0 +1,26 @@ +{ + "name": "SaySimpleCountry", + "base": "VnModel", + "options": { + "mysql": { + "table": "saySimpleCountry" + } + }, + "properties": { + "countryFk": { + "type": "number", + "id": true + }, + "channel": { + "type": "number" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index f25a4aab4..7bb0ace84 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4008,3 +4008,6 @@ UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; +INSERT INTO vn.saySimpleCountry (countryFk, channel) + VALUES (19, 1169), + (8, 1183); \ No newline at end of file diff --git a/db/versions/11330-greenMoss/00-firstScript.sql b/db/versions/11330-greenMoss/00-firstScript.sql new file mode 100644 index 000000000..e0ef77e2d --- /dev/null +++ b/db/versions/11330-greenMoss/00-firstScript.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS vn.saySimpleCountry( + countryFk MEDIUMINT(8) UNSIGNED, + channel INT(4) COMMENT 'channel de whatsapp de saySimple', + PRIMARY KEY (countryFk), + CONSTRAINT `saySimpleCountry_FK` FOREIGN KEY (`countryFk`) REFERENCES vn.country (`id`) ON UPDATE CASCADE +); \ No newline at end of file diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 8162096f0..9242fbd44 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -54,7 +54,10 @@ module.exports = Self => { { relation: 'country', scope: { - fields: ['name'] + fields: ['id', 'name'], + include: { + relation: 'saySimpleCountry', + } } }, { From 9b28cf9130dff4346f627d1888a1f7de7cb4ddcd Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Nov 2024 12:51:09 +0100 Subject: [PATCH 2/6] feat: refs #6818 add records --- db/dump/fixtures.before.sql | 2 +- db/versions/11330-greenMoss/00-firstScript.sql | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 7bb0ace84..ce4e9ddfc 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4008,6 +4008,6 @@ UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; -INSERT INTO vn.saySimpleCountry (countryFk, channel) +INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) VALUES (19, 1169), (8, 1183); \ No newline at end of file diff --git a/db/versions/11330-greenMoss/00-firstScript.sql b/db/versions/11330-greenMoss/00-firstScript.sql index e0ef77e2d..762e456b1 100644 --- a/db/versions/11330-greenMoss/00-firstScript.sql +++ b/db/versions/11330-greenMoss/00-firstScript.sql @@ -3,4 +3,8 @@ CREATE TABLE IF NOT EXISTS vn.saySimpleCountry( channel INT(4) COMMENT 'channel de whatsapp de saySimple', PRIMARY KEY (countryFk), CONSTRAINT `saySimpleCountry_FK` FOREIGN KEY (`countryFk`) REFERENCES vn.country (`id`) ON UPDATE CASCADE -); \ No newline at end of file +); + +INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) + VALUES (19, 1169), + (8, 1183); \ No newline at end of file From 6ef1f950d17897d377cc9fb342835f4a3e745543 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 8 Nov 2024 17:47:10 +0100 Subject: [PATCH 3/6] feat: refs #6818 add config table --- back/model-config.json | 3 +++ back/models/say-simple-config.json | 26 +++++++++++++++++++ back/models/say-simple-country.json | 2 +- db/dump/fixtures.before.sql | 6 ++++- .../11330-greenMoss/00-firstScript.sql | 8 +++++- 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 back/models/say-simple-config.json diff --git a/back/model-config.json b/back/model-config.json index efb148ee8..364ffabdf 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -142,6 +142,9 @@ "SaySimpleCountry": { "dataSource": "vn" }, + "SaySimpleConfig": { + "dataSource": "vn" + }, "TempContainer": { "dataSource": "tempStorage" }, diff --git a/back/models/say-simple-config.json b/back/models/say-simple-config.json new file mode 100644 index 000000000..edc4caa43 --- /dev/null +++ b/back/models/say-simple-config.json @@ -0,0 +1,26 @@ +{ + "name": "SaySimpleConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "saySimpleConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "url": { + "type": "string" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/back/models/say-simple-country.json b/back/models/say-simple-country.json index 39acd5f0b..adddddc02 100644 --- a/back/models/say-simple-country.json +++ b/back/models/say-simple-country.json @@ -19,7 +19,7 @@ { "accessType": "READ", "principalType": "ROLE", - "principalId": "$everyone", + "principalId": "$authenticated", "permission": "ALLOW" } ] diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index ce4e9ddfc..cd2fb8b6b 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4010,4 +4010,8 @@ UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) VALUES (19, 1169), - (8, 1183); \ No newline at end of file + (8, 1183), + (NULL, 1320); + +INSERT IGNORE INTO vn.saySimpleConfig (url) + VALUES ('saysimle-url-mock'); \ No newline at end of file diff --git a/db/versions/11330-greenMoss/00-firstScript.sql b/db/versions/11330-greenMoss/00-firstScript.sql index 762e456b1..127c8e40e 100644 --- a/db/versions/11330-greenMoss/00-firstScript.sql +++ b/db/versions/11330-greenMoss/00-firstScript.sql @@ -5,6 +5,12 @@ CREATE TABLE IF NOT EXISTS vn.saySimpleCountry( CONSTRAINT `saySimpleCountry_FK` FOREIGN KEY (`countryFk`) REFERENCES vn.country (`id`) ON UPDATE CASCADE ); +CREATE TABLE IF NOT EXISTS vn.saySimpleConfig( + id INT AUTO_INCREMENT PRIMARY KEY, + url VARCHAR(255) NOT NULL +); + INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) VALUES (19, 1169), - (8, 1183); \ No newline at end of file + (8, 1183), + (NULL, 1320); \ No newline at end of file From 4add10f3dde74909f531c0955d28a315a27580ab Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 12 Nov 2024 17:52:51 +0100 Subject: [PATCH 4/6] feat: refs #7994 remove comment script --- db/versions/11251-navyChrysanthemum/01-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/11251-navyChrysanthemum/01-firstScript.sql b/db/versions/11251-navyChrysanthemum/01-firstScript.sql index c942e0400..e3e08e0aa 100644 --- a/db/versions/11251-navyChrysanthemum/01-firstScript.sql +++ b/db/versions/11251-navyChrysanthemum/01-firstScript.sql @@ -1 +1 @@ --- ALTER TABLE vn.sale MODIFY COLUMN originalQuantity decimal(10,2) DEFAULT 0.00 NOT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity'; \ No newline at end of file +ALTER TABLE vn.sale MODIFY COLUMN originalQuantity decimal(10,2) DEFAULT 0.00 NOT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity'; \ No newline at end of file From ebc04205317fd6f5c3f6d9eea2146a3db324b05b Mon Sep 17 00:00:00 2001 From: Pako Date: Wed, 13 Nov 2024 06:50:21 +0100 Subject: [PATCH 5/6] fix: problem calculation updated --- db/routines/vn/procedures/sale_getProblems.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql index b50b4784d..cd65bb81c 100644 --- a/db/routines/vn/procedures/sale_getProblems.sql +++ b/db/routines/vn/procedures/sale_getProblems.sql @@ -127,7 +127,7 @@ BEGIN LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible, 0) < s.quantity - AND IFNULL(av.available, 0) < s.quantity + AND IFNULL(av.available, 0) < 0 AND IFNULL(issw.visible, 0) < s.quantity AND NOT s.isPicked AND NOT s.reserved @@ -190,7 +190,7 @@ BEGIN LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk WHERE IFNULL(v.visible, 0) < s.quantity - AND IFNULL(av.available, 0) >= s.quantity + AND IFNULL(av.available, 0) >= 0 AND IFNULL(issw.visible, 0) < s.quantity AND s.quantity > 0 AND NOT s.isPicked From 1086981b536b8825f0ee4eace4448f088015f9bb Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 13 Nov 2024 09:35:06 +0100 Subject: [PATCH 6/6] fix: refs #7779 ticket_splitItemPackingType --- .../vn/procedures/ticket_splitItemPackingType.sql | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/db/routines/vn/procedures/ticket_splitItemPackingType.sql b/db/routines/vn/procedures/ticket_splitItemPackingType.sql index 9a4bc01eb..92ff393cd 100644 --- a/db/routines/vn/procedures/ticket_splitItemPackingType.sql +++ b/db/routines/vn/procedures/ticket_splitItemPackingType.sql @@ -14,7 +14,7 @@ proc:BEGIN */ DECLARE vDone INT DEFAULT FALSE; DECLARE vHasItemPackingType BOOL; - DECLARE vItemPackingTypeFk INT; + DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H'; DECLARE vNewTicketFk INT; DECLARE vItemPackingTypes CURSOR FOR @@ -36,14 +36,10 @@ proc:BEGIN ) ENGINE=MEMORY SELECT vSelf ticketFk, vOriginalItemPackingTypeFk itemPackingTypeFk; - IF NOT vHasItemPackingType THEN - LEAVE proc; - END IF; - CREATE OR REPLACE TEMPORARY TABLE tSalesToMove ( ticketFk INT, saleFk INT, - itemPackingTypeFk INT + itemPackingTypeFk VARCHAR(1) ) ENGINE=MEMORY; INSERT INTO tSalesToMove (saleFk, itemPackingTypeFk) @@ -55,7 +51,6 @@ proc:BEGIN AND i.itemPackingTypeFk <> vOriginalItemPackingTypeFk; OPEN vItemPackingTypes; - l: LOOP SET vDone = FALSE; FETCH vItemPackingTypes INTO vItemPackingTypeFk; @@ -71,7 +66,6 @@ proc:BEGIN WHERE itemPackingTypeFk = vItemPackingTypeFk; END LOOP; - CLOSE vItemPackingTypes; UPDATE sale s