From 40b2c32a00a30e2eb5e4e38921c336b52cf6e8b0 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 3 May 2024 17:37:36 +0200 Subject: [PATCH 01/22] feat: refs #6243 show all cmr --- db/dump/.dump/data.sql | 2 +- .../route/{getExternalCmrs.js => cmrs.js} | 30 ++++--------------- modules/route/back/models/route.js | 2 +- print/templates/reports/cmr/sql/data.sql | 3 +- 4 files changed, 9 insertions(+), 28 deletions(-) rename modules/route/back/methods/route/{getExternalCmrs.js => cmrs.js} (87%) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 8c6794a5b..a5a95d565 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -1783,7 +1783,7 @@ INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','emplo INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (764,'Route','getDeliveryPoint','READ','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (765,'Route','getExternalCmrs','READ','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (765,'Route','cmrs','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (766,'Route','getSuggestedTickets','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (767,'Route','getTickets','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','employee'); diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/cmrs.js similarity index 87% rename from modules/route/back/methods/route/getExternalCmrs.js rename to modules/route/back/methods/route/cmrs.js index b8cd1041a..814ff77c6 100644 --- a/modules/route/back/methods/route/getExternalCmrs.js +++ b/modules/route/back/methods/route/cmrs.js @@ -3,8 +3,8 @@ const buildFilter = require('vn-loopback/util/filter').buildFilter; const mergeFilters = require('vn-loopback/util/filter').mergeFilters; module.exports = Self => { - Self.remoteMethod('getExternalCmrs', { - description: 'Returns an array of external cmrs', + Self.remoteMethod('cmrs', { + description: 'Returns an array of cmrs', accessType: 'READ', accepts: [ { @@ -53,31 +53,14 @@ module.exports = Self => { root: true }, http: { - path: `/getExternalCmrs`, + path: `/cmrs`, verb: 'GET' } }); - Self.getExternalCmrs = async( - filter, - cmrFk, - ticketFk, - routeFk, - country, - clientFk, - hasCmrDms, - shipped, - options + Self.cmrs = async(filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, options ) => { - const params = { - cmrFk, - ticketFk, - routeFk, - country, - clientFk, - hasCmrDms, - shipped, - }; + const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped}; const conn = Self.dataSource.connector; let where = buildFilter(params, (param, value) => { @@ -124,8 +107,7 @@ module.exports = Self => { JOIN dmsType dt ON dt.id = d.dmsTypeFk WHERE dt.name = 'cmr' ) sub ON sub.ticketFk = t.id - WHERE co.code <> 'ES' - AND am.name <> 'ABONO' + WHERE am.name <> 'ABONO' AND w.code = 'ALG' AND t.cmrFk ) sub diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index bf1f26e74..ecc434108 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -15,7 +15,7 @@ module.exports = Self => { require('../methods/route/sendSms')(Self); require('../methods/route/downloadZip')(Self); require('../methods/route/cmr')(Self); - require('../methods/route/getExternalCmrs')(Self); + require('../methods/route/cmrs')(Self); require('../methods/route/downloadCmrsZip')(Self); require('../methods/route/cmrEmail')(Self); require('../methods/route/getExpeditionSummary')(Self); diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql index e9500cc4b..09a42a718 100644 --- a/print/templates/reports/cmr/sql/data.sql +++ b/print/templates/reports/cmr/sql/data.sql @@ -39,8 +39,7 @@ SELECT c.id cmrFk, LEFT JOIN supplier s ON s.id = c.supplierFk LEFT JOIN country cou ON cou.id = s.countryFk LEFT JOIN company co ON co.id = c.companyFk - LEFT JOIN supplierAccount sa ON sa.id = co.supplierAccountFk - LEFT JOIN supplier s2 ON s2.id = sa.supplierFk + LEFT JOIN supplier s2 ON s2.id = c.companyFk LEFT JOIN country cou2 ON cou2.id = s2.countryFk LEFT JOIN `address` a ON a.id = c.addressToFk LEFT JOIN province p ON p.id = a.provinceFk From a13581ed9771469be59bbc0cec3ee8ecfe11b1f2 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 3 Jun 2024 16:31:38 +0200 Subject: [PATCH 02/22] feat: refs #6243 Add warehouseFk parameter --- modules/route/back/methods/route/cmrs.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/route/back/methods/route/cmrs.js b/modules/route/back/methods/route/cmrs.js index 48d074624..0c25cbca5 100644 --- a/modules/route/back/methods/route/cmrs.js +++ b/modules/route/back/methods/route/cmrs.js @@ -47,6 +47,10 @@ module.exports = Self => { type: 'date', description: 'The to date filter', }, + { + arg: 'warehouseFk', + type: 'integer', + } ], returns: { type: ['object'], @@ -58,9 +62,10 @@ module.exports = Self => { } }); - Self.cmrs = async(filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, options + Self.cmrs = async( + filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, warehouseFk, options ) => { - const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped}; + const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, warehouseFk, shipped}; const conn = Self.dataSource.connector; let where = buildFilter(params, (param, value) => { @@ -89,7 +94,8 @@ module.exports = Self => { co.name country, t.clientFk, IF(sub.id, TRUE, FALSE) hasCmrDms, - DATE(t.shipped) shipped + DATE(t.shipped) shipped, + t.warehouseFk FROM ticket t JOIN ticketState ts ON ts.ticketFk = t.id JOIN state s ON s.id = ts.stateFk From 96a3a2e69b2349ba13cd96d57af6df75c92b45a0 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 7 Jun 2024 11:50:16 +0200 Subject: [PATCH 03/22] fix: refs #6243 rollback --- db/dump/.dump/data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 778f6f23b..3be9dd4f5 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -1842,7 +1842,7 @@ INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','emplo INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (764,'Route','getDeliveryPoint','READ','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (765,'Route','cmrs','READ','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (765,'Route','getExternalCmrs','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (766,'Route','getSuggestedTickets','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (767,'Route','getTickets','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','employee'); From 521f3f14469ce825c2026c213675d2ff66b65ea6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 7 Jun 2024 11:52:24 +0200 Subject: [PATCH 04/22] feat: refs #6243 update ACL --- db/versions/11093-purpleGerbera/00-firstScript.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 db/versions/11093-purpleGerbera/00-firstScript.sql diff --git a/db/versions/11093-purpleGerbera/00-firstScript.sql b/db/versions/11093-purpleGerbera/00-firstScript.sql new file mode 100644 index 000000000..024b0bb59 --- /dev/null +++ b/db/versions/11093-purpleGerbera/00-firstScript.sql @@ -0,0 +1,4 @@ +UPDATE salix.ACL + SET property = 'cmrs' + WHERE property = 'getExternalCmrs' + AND model = 'Route'; \ No newline at end of file From e081c4504dadd3787ab4b7ed239992a48cc2d7c5 Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 10 Jun 2024 14:51:48 +0200 Subject: [PATCH 05/22] feat: refs #7548 link a grafana --- modules/ticket/back/methods/ticket/summary.js | 1 + modules/ticket/back/models/ticket.json | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index 1ce91e1b2..6bfa478ec 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -56,6 +56,7 @@ module.exports = Self => { const filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, + {relation: 'ticketCollections', scope: {fields: ['collectionFk']}}, {relation: 'agencyMode', scope: {fields: ['name']}}, {relation: 'zone', scope: {fields: ['name']}}, {relation: 'client', diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 248c0312f..2d14de808 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -147,6 +147,11 @@ "type": "belongsTo", "model": "Cmr", "foreignKey": "cmrFk" + }, + "ticketCollections": { + "type": "hasMany", + "model": "TicketCollection", + "foreignKey": "ticketFk" } } } From 2061d08bacf0c53b158a7cd3fd594633bf8f780f Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 10 Jun 2024 15:54:53 +0200 Subject: [PATCH 06/22] feat: add changelog --- CHANGELOG.md | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2bb2e7e4..b322f9f25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,82 @@ +# Version 24.24 - 2024-06-11 + +### Added 🆕 + +- 6281 feat:buyFk in itemShekving by:sergiodt +- 6281 feat:buyFk in itemShelving by:sergiodt +- feat: #6408 tests by:jgallego +- feat: packaging refs #4021 (origin/4021_packaging) by:sergiodt +- feat: refs #6021 add new field by:pablone +- feat: refs #6281 change fixtures by:robert +- feat: refs # 6408 test ok (origin/6408-rocketChat) by:jgallego +- feat: refs #6477 productionConfig add column by:robert +- feat: refs #6600 add column (origin/6600-createItemPhotoComment) by:jorgep +- feat: refs #6600 Add photoMotivation column to item table and create itemPhotoComment table by:jorgep +- feat: refs #6889 add back tests by:jorgep +- feat: refs #6889 fixtures & models by:jorgep +- feat : refs #6889 wip: check if is productionReviewer or owner by:jorgep +- feat: refs #6942 set false isBooed & ledger by:jorgep +- feat: refs #6942 toUnbook by:jorgep +- feat: refs #6942 xdiario fixtures by:jorgep +- feat: refs #7398 Change by:guillermo +- feat: refs #7438 Added volume to item_valuateInventory by:guillermo +- feat: refs #7438 Requested changes and little changes by:guillermo +- refs #6281 feat:buyFk in itemShelving by:sergiodt + +### Changed 📦 + +- refactor: refs #6600 add space by:jorgep +- refactor: refs #6889 improve file loading logic by:jorgep +- refactor: refs #6889 sale tests e2e by:jorgep +- refactor: refs #6889 script sql (origin/6889-dropAddSaleByCode) by:jorgep +- refactor: refs #6889 use addSale by:jorgep +- refactor: refs #6942 toUnbook & drop buyer acls by:jorgep +- refactor: refs #7398 Refactor and change ekt_scan (origin/7398-ektScan) by:guillermo +- refactor: refs #7486 Optimized procs by:guillermo + +### Fixed 🛠️ + +- feat: refs #6281 change fixtures by:robert +- feat: refs #6889 fixtures & models by:jorgep +- feat: refs #6942 xdiario fixtures by:jorgep +- fix: checking process.env.NODE_ENV by:alexm +- fix: en translations by:alexm +- fix: move to boot (origin/7421-fix_checking_NODE_ENV, 7421-fix_checking_NODE_ENV) by:alexm +- fix: refs #6095 filter by refFk null by:pablone +- fix: refs #6600 rollback by:jorgep +- fix: refs #6889 allocate 'productionReviewer' role to revision dep. workers & check if is owner or reviewer by:jorgep +- fix: refs #6889 check if has collection or sectorCollection by:jorgep +- fix: refs #6889 e2e tests by:jorgep +- fix: refs #6889 fix back tests by:jorgep +- fix: refs #6889 modify fixtures by:jorgep +- fix: refs #6889 rollback by:jorgep +- fix: refs #6942 acls & back by:jorgep +- fix: refs #6942 add deleteById acl by:jorgep +- fix: refs #6942 add test & change column name by:jorgep +- fix: refs #6942 create invoiceIn acl by:jorgep +- fix: refs #6942 delete by:jorgep +- fix: refs #6942 drop quotes by:jorgep +- fix : refs #6942 remove grafana update priv by:jorgep +- fix: refs #6942 revoke update isBooked by:jorgep +- fix: refs #6942 toBook/toUnbook by:jorgep +- fix: refs #7442 Fix kubernetes deploy by:Juan Ferrer Toribio +- fix(salix): refs #7272 #7272 Add aclService in routes.js by:Javier Segarra +- fix(salix): refs #7272 #7272 Back validateToken endpoint by:Javier Segarra +- fix(salix): refs #7272 #7272 Bug when acl not loaded by:Javier Segarra +- fix(salix): refs #7272 #7272 Call validateToken by:Javier Segarra +- fix(salix): refs #7272 #7272 Errors when Token not exists by:Javier Segarra +- fix(salix): refs #7272 #7272 Front retry calls by:Javier Segarra +- fix(salix): refs #7272 #7272 i18n Error by:Javier Segarra +- fix(salix): refs #7272 #7272 Remove aclService from auth.js by:Javier Segarra +- fix: simplify by:alexm +- fix traduction & e2e by:carlossa +- refs #6820 fix back by:carlossa +- refs #6820 fix pr by:carlossa +- refs #6832 fix: ToItem (origin/6832_refactorBackToItem) by:Sergio De la torre +- refs #7292 fix tback by:carlossa +- refs #7296 fix pr errors, trad by:carlossa +- test(salix): refs #7272 #7272 fix renew-token.spec by:Javier Segarra + # Changelog From bd13ecd464277c41ac7a9e56d68aad4fc3e31cbd Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 11 Jun 2024 07:59:53 +0200 Subject: [PATCH 07/22] refactor: refs #7486 engine memory and primary key sales_merge --- db/routines/vn/procedures/sales_merge.sql | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/sales_merge.sql b/db/routines/vn/procedures/sales_merge.sql index a91268c2f..3dd01f9bc 100644 --- a/db/routines/vn/procedures/sales_merge.sql +++ b/db/routines/vn/procedures/sales_merge.sql @@ -1,5 +1,5 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sales_merge`(vTicketFk INT) +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sales_merge`(vTicketFk INT) BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -8,19 +8,21 @@ BEGIN END; CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve + (PRIMARY KEY (id)) + ENGINE = MEMORY SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity FROM sale s JOIN item i ON i.id = s.itemFk JOIN itemType it ON it.id = i.typeFk WHERE s.ticketFk = vTicketFk AND it.isMergeable - GROUP BY s.itemFk, s.price, s.discount; + GROUP BY s.itemFk, s.price, s.discount; START TRANSACTION; UPDATE sale s JOIN tSalesToPreserve stp ON stp.id = s.id - SET quantity = newQuantity + SET s.quantity = newQuantity WHERE s.ticketFk = vTicketFk; DELETE s.* @@ -35,5 +37,5 @@ BEGIN COMMIT; DROP TEMPORARY TABLE tSalesToPreserve; -END$$ -DELIMITER ; +END$$ +DELIMITER ; From 2dec51804cb92d41872eced40fb9a1780b2dd524 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 11 Jun 2024 08:38:26 +0200 Subject: [PATCH 08/22] build: dump --- db/dump/.dump/data.sql | 59 +- db/dump/.dump/privileges.sql | 200 ++++-- db/dump/.dump/structure.sql | 1304 +++++++++++++++------------------- db/dump/.dump/triggers.sql | 37 +- 4 files changed, 798 insertions(+), 802 deletions(-) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 3be9dd4f5..c0d0c34e6 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,7 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('vn-database','11071','60ac8cf6fc77b99b199b27866011b1efe8c961e8','2024-05-28 07:32:50','11074'); +INSERT INTO `version` VALUES ('vn-database','11090','7adf4a373d19ce126adbc7b1077f69a74559c09a','2024-06-11 08:32:36','11094'); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); @@ -775,6 +775,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10975','00-action.sql','jenkins@ INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:04:52',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10978','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:33',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10984','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10988','00-pbx_prefix.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-04-11 17:00:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10990','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL); @@ -800,6 +801,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','11010','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','11012','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11013','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11014','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11015','00-photoMotivation.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11016','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-27 13:16:09',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11018','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11019','00-locker.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL); @@ -819,6 +821,8 @@ INSERT INTO `versionLog` VALUES ('vn-database','11040','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','11044','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:31',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11045','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-10 14:53:29',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11046','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11050','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11050','01-elementFilter.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11051','00-sipConfig_callLimit.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-14 14:31:10',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11054','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11055','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL); @@ -827,8 +831,22 @@ INSERT INTO `versionLog` VALUES ('vn-database','11057','01-part.sql','jenkins@db INSERT INTO `versionLog` VALUES ('vn-database','11057','02-part.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:47',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11057','03-part.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11058','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11059','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11060','00-createRoleReviewer.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11061','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11065','00-modifyInvoiceInPrivileges.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11065','01-modifyInvoiceInAcls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11068','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11069','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11071','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11074','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11075','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-28 12:54:13',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11078','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11079','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 08:22:10',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11080','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 12:01:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11083','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-03 10:46:36',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11090','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','11092','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-07 08:21:23',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -924,6 +942,7 @@ INSERT INTO `role` VALUES (125,'claimViewer','Trabajadores que consulta las recl INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11-16 14:32:13','2023-11-16 14:32:13',NULL); INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL); INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783); +INSERT INTO `role` VALUES (130,'reviewer','Revisor de producción',1,'2024-06-11 00:00:00','2024-06-11 00:00:00',10578); INSERT INTO `roleInherit` VALUES (1,1,2,NULL); INSERT INTO `roleInherit` VALUES (2,1,3,NULL); @@ -950,7 +969,6 @@ INSERT INTO `roleInherit` VALUES (27,21,53,NULL); INSERT INTO `roleInherit` VALUES (28,22,13,NULL); INSERT INTO `roleInherit` VALUES (29,22,21,NULL); INSERT INTO `roleInherit` VALUES (30,30,5,NULL); -INSERT INTO `roleInherit` VALUES (31,30,20,NULL); INSERT INTO `roleInherit` VALUES (32,30,22,NULL); INSERT INTO `roleInherit` VALUES (33,30,53,NULL); INSERT INTO `roleInherit` VALUES (34,30,64,NULL); @@ -1182,7 +1200,6 @@ INSERT INTO `roleInherit` VALUES (353,110,49,NULL); INSERT INTO `roleInherit` VALUES (354,103,119,NULL); INSERT INTO `roleInherit` VALUES (355,127,11,NULL); INSERT INTO `roleInherit` VALUES (356,123,125,NULL); -INSERT INTO `roleInherit` VALUES (357,36,35,NULL); INSERT INTO `roleInherit` VALUES (358,36,49,NULL); INSERT INTO `roleInherit` VALUES (359,129,35,NULL); INSERT INTO `roleInherit` VALUES (360,101,129,NULL); @@ -1190,6 +1207,11 @@ INSERT INTO `roleInherit` VALUES (361,50,112,NULL); INSERT INTO `roleInherit` VALUES (362,122,15,NULL); INSERT INTO `roleInherit` VALUES (364,35,18,NULL); INSERT INTO `roleInherit` VALUES (365,123,119,NULL); +INSERT INTO `roleInherit` VALUES (366,30,37,NULL); +INSERT INTO `roleInherit` VALUES (367,30,73,NULL); +INSERT INTO `roleInherit` VALUES (368,130,49,10578); +INSERT INTO `roleInherit` VALUES (369,50,130,10578); +INSERT INTO `roleInherit` VALUES (370,72,130,10578); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); @@ -1373,7 +1395,7 @@ INSERT INTO `ACL` VALUES (213,'TravelThermograph','*','WRITE','ALLOW','ROLE','bu INSERT INTO `ACL` VALUES (214,'Entry','*','*','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (218,'Intrastat','*','*','ALLOW','ROLE','buyer'); -INSERT INTO `ACL` VALUES (221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'); +INSERT INTO `ACL` VALUES (221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','guest'); INSERT INTO `ACL` VALUES (226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'); INSERT INTO `ACL` VALUES (227,'Address','*','READ','ALLOW','ROLE','trainee'); INSERT INTO `ACL` VALUES (228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'); @@ -1402,7 +1424,7 @@ INSERT INTO `ACL` VALUES (259,'Client','createReceipt','*','ALLOW','ROLE','sales INSERT INTO `ACL` VALUES (260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (262,'Entry','*','*','ALLOW','ROLE','administrative'); -INSERT INTO `ACL` VALUES (263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (263,'InvoiceIn','*','READ','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (264,'StarredModule','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'); INSERT INTO `ACL` VALUES (266,'ZoneLog','*','READ','ALLOW','ROLE','employee'); @@ -1469,7 +1491,6 @@ INSERT INTO `ACL` VALUES (338,'Shelving','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (339,'OsTicket','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (340,'OsTicketConfig','*','*','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (345,'Ticket','deliveryNoteCsvEmail','READ','ALLOW','ROLE','employee'); @@ -1644,7 +1665,7 @@ INSERT INTO `ACL` VALUES (522,'Client','replaceOrCreate','*','ALLOW','ROLE','emp INSERT INTO `ACL` VALUES (523,'Client','updateAll','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (527,'VnUser','acl','READ','ALLOW','ROLE','account'); +INSERT INTO `ACL` VALUES (527,'VnUser','acl','READ','ALLOW','ROLE','guest'); INSERT INTO `ACL` VALUES (528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'); INSERT INTO `ACL` VALUES (530,'Account','exists','READ','ALLOW','ROLE','account'); INSERT INTO `ACL` VALUES (531,'Account','exists','READ','ALLOW','ROLE','account'); @@ -1809,7 +1830,7 @@ INSERT INTO `ACL` VALUES (727,'Account','find','READ','ALLOW','ROLE','employee') INSERT INTO `ACL` VALUES (728,'Account','exists','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (729,'Sale','clone','WRITE','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (730,'Ticket','setDeleted','WRITE','ALLOW','ROLE','deliveryAssistant'); -INSERT INTO `ACL` VALUES (732,'Sale','isInPreparing','*','ALLOW','ROLE','production'); +INSERT INTO `ACL` VALUES (732,'Sale','isInPreparing','*','ALLOW','ROLE','reviewer'); INSERT INTO `ACL` VALUES (733,'Train','*','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (734,'WorkerDepartment','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (735,'VnUser','higherPrivileges','*','ALLOW','ROLE','itManagement'); @@ -1866,7 +1887,7 @@ INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery'); INSERT INTO `ACL` VALUES (787,'Ticket','makePdfList','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (788,'Ticket','invoiceTicketsAndPdf','*','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (789,'InvoiceIn','*','*','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (789,'InvoiceIn','*','READ','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (790,'InvoiceIn','getSerial','READ','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (791,'InvoiceIn','corrective','WRITE','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (792,'InvoiceInCorrection','*','*','ALLOW','ROLE','administrative'); @@ -1920,6 +1941,25 @@ INSERT INTO `ACL` VALUES (842,'Worker','__get__locker','READ','ALLOW','ROLE','hr INSERT INTO `ACL` VALUES (843,'Worker','__get__locker','READ','ALLOW','ROLE','productionBoss'); INSERT INTO `ACL` VALUES (844,'RoadmapStop','*','*','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (845,'RoadmapStop','*','*','ALLOW','ROLE','productionBoss'); +INSERT INTO `ACL` VALUES (846,'Ticket','refund','WRITE','ALLOW','ROLE','logistic'); +INSERT INTO `ACL` VALUES (847,'RouteConfig','*','READ','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (848,'InvoiceIn','updateInvoiceIn','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (849,'InvoiceIn','clone','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (850,'InvoiceIn','corrective','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (851,'InvoiceIn','exchangeRateUpdate','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (852,'InvoiceIn','invoiceInEmail','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (853,'InvoiceIn','toBook','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (854,'InvoiceIn','toUnbook','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (855,'InvoiceIn','deleteById','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (856,'InvoiceIn','updateInvoiceIn','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (857,'InvoiceIn','clone','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (858,'InvoiceIn','corrective','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (859,'InvoiceIn','exchangeRateUpdate','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (860,'InvoiceIn','invoiceInEmail','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (861,'InvoiceIn','toBook','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (862,'InvoiceIn','deleteById','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (863,'InvoiceIn','create','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (864,'InvoiceIn','create','WRITE','ALLOW','ROLE','buyer'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); @@ -2008,6 +2048,7 @@ INSERT INTO `defaultViewConfig` VALUES ('itemsIndex','{\"intrastat\":false,\"ste INSERT INTO `defaultViewConfig` VALUES ('latestBuys','{\"intrastat\":false,\"description\":false,\"density\":false,\"isActive\":false,\n \"freightValue\":false,\"packageValue\":false,\"isIgnored\":false,\"price2\":false,\"ektFk\":false,\"weight\":false,\n \"size\":false,\"comissionValue\":false,\"landing\":false}'); INSERT INTO `defaultViewConfig` VALUES ('ticketsMonitor','{\"id\":false}'); INSERT INTO `defaultViewConfig` VALUES ('clientsDetail','{\"id\":true,\"phone\":true,\"city\":true,\"socialName\":true,\"salesPersonFk\":true,\"email\":true,\"name\":false,\"fi\":false,\"credit\":false,\"creditInsurance\":false,\"mobile\":false,\"street\":false,\"countryFk\":false,\"provinceFk\":false,\"postcode\":false,\"created\":false,\"businessTypeFk\":false,\"payMethodFk\":false,\"sageTaxTypeFk\":false,\"sageTransactionTypeFk\":false,\"isActive\":false,\"isVies\":false,\"isTaxDataChecked\":false,\"isEqualizated\":false,\"isFreezed\":false,\"hasToInvoice\":false,\"hasToInvoiceByAddress\":false,\"isToBeMailed\":false,\"hasLcr\":false,\"hasCoreVnl\":false,\"hasSepaVnl\":false}'); +INSERT INTO `defaultViewConfig` VALUES ('routesList','{\"ID\":true,\"worker\":true,\"agency\":true,\"vehicle\":true,\"date\":true,\"volume\":true,\"description\":true,\"started\":true,\"finished\":true,\"actions\":true}'); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 39b7d4a8c..00ef1018b 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -303,7 +303,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','jerarquia' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerBusinessAgreement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifa_componentes','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifa_componentes_series','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Entradas','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','cl_main','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','cl_main','alexm@%','0000-00-00 00:00:00','Select',''); @@ -349,7 +348,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','empresa','alex INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','sectorType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Tintas','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Movimientos','juan@%','0000-00-00 00:00:00','Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -365,9 +364,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','tickets_ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas','root@localhost','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select',''); @@ -600,7 +597,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','ektEntryAssign','a INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','itemShelving','root@localhost','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','propertyDms','juan@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerTimeControlConfig','juan@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','entry','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','Update'); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','entry','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','businessType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','entryLog','juan@10.5.1.2','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','projectState','alexm@%','0000-00-00 00:00:00','Select',''); @@ -627,7 +624,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','wks','alexm@%' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','entryObservation','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','itemShelvingList','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','expeditionTruck','alexm@%','0000-00-00 00:00:00','Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','expeditionTruck','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','alertLevel','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','expeditionSticker','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','entryObservation','alexm@%','0000-00-00 00:00:00','Select',''); @@ -650,9 +647,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','pgcMaster',' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','Update'); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','Update'); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','inventoryFailure','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','intrastat','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','inventoryFailure','alexm@%','0000-00-00 00:00:00','Select',''); @@ -660,7 +657,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','inventoryFailureCause INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceCorrection','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceCorrectionDataSource','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceCorrectionType','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','invoiceIn','alexm@%','0000-00-00 00:00:00','Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInDueDay','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','invoiceInDueDay','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','invoiceInIntrastat__','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); @@ -751,7 +748,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','alexm@%','0000- INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','buy','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','saleGoal','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleComponent','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','arcRead','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','clientProtected','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); @@ -773,7 +769,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','PreciosEspecia INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','movingState','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferState','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','buffer','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','buffer','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferGroup','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','lastRFID','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','person__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); @@ -788,7 +784,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleState INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleEvent','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','cooler','Tintas','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','itemBotanical','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','cooler','Entradas','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','signInLog','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketTracking','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionState','alexm@%','0000-00-00 00:00:00','Select',''); @@ -1190,7 +1185,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','businessCalendar',' INSERT IGNORE INTO `tables_priv` VALUES ('','edi','employee','item','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleNotes','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleDms','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','palletizerBoss','expeditionTruck','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','invoiceInConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','palletizerBoss','zoneEvent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','palletizerBoss','routesMonitor','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','propertyNotes','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); @@ -1224,7 +1219,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','module','juan@ INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','printConfig','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','url','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','userConfigView','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimRedelivery','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimRedelivery','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientRisk','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','sale','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -1252,7 +1247,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','expeditio INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','expeditionScan','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','expeditionPallet','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','province','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','expeditionTruck','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visitAccess','root@localhost','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','v_botanic_export','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','itemCost','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','deliveryAssistant','m3','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -1309,6 +1304,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','gu INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visitAgent','root@localhost','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','remittance','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicleConsumption','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleConsumption','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); @@ -1398,14 +1394,27 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','farmingDeliv INSERT IGNORE INTO `tables_priv` VALUES ('','sage','grafana','TiposIva','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','waste','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visit','root@localhost','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','chat','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','antenna','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','bufferPool','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','enteringLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','expeditionLoading','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','failureLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','movingLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','sorterLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert','Update'); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientInforma','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','solunionCAP','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientUnpaid','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pay_dem','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; @@ -1465,35 +1474,28 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','user_id','0 INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','extension','0000-00-00 00:00:00','Select'); INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','name','0000-00-00 00:00:00','Select'); INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','active','0000-00-00 00:00:00','Select'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','id','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','supplierFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','dated','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','invoiceNumber','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','isExcludedFromAvailable','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','notes','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','isConfirmed','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','isOrdered','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','isRaid','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','commission','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','created','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','evaNotes','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','travelFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','currencyFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','companyFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','gestDocFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','invoiceInFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','isBlocked','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','loadPriority','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','kop','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','sub','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','pro','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','auction','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','invoiceAmount','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','buyerFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','typeFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','reference','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','observationEditorFk','0000-00-00 00:00:00','Update'); -INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','entry','clonedFrom','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','editorFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','expenseFkDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','withholdingSageFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','isVatDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','bookEntried','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','siiTrascendencyInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusTaxBreakFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusSubjectOpFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusRectificationTypeFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','siiTypeInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','operated','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','booked','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','docFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','companyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','created','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','currencyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','supplierRef','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','issued','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','supplierFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','serial','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','serialNumber','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','id','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','routeFk','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','name','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','beachFk','0000-00-00 00:00:00','Update'); @@ -1601,7 +1603,10 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','editorFk', INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','recycledPlastic','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','nonRecycledPlastic','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','minQuantity','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Id_Entrada','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','originFk','0000-00-00 00:00:00','Select,Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Id_Proveedor','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Fecha','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','id','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','warehouseFk','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','shipped','0000-00-00 00:00:00','Update'); @@ -1668,6 +1673,93 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','cloned INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','editorFk','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','lockerUserFk','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','entryEditor','entry','locked','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Referencia','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Inventario','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Confirmada','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Pedida','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Redada','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','comision','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','odbc_date','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Notas_Eva','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','travel_id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','Id_Moneda','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','empresa_id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','gestdoc_id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','recibida_id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','loadPriority','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','kop','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','sub','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','pro','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','invoiceAmount','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','buyerFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','typeFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn2008','entryEditor','Entradas','reference','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','serialNumber','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','serial','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','supplierFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','issued','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','supplierRef','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','currencyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','created','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','companyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','docFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','booked','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','operated','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','siiTypeInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','cplusRectificationTypeFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','cplusSubjectOpFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','cplusTaxBreakFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','siiTrascendencyInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','bookEntried','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','isVatDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','withholdingSageFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','expenseFkDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','hrBoss','invoiceIn','editorFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','serialNumber','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','serial','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','supplierFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','issued','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','supplierRef','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','currencyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','created','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','companyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','docFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','booked','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','operated','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','siiTypeInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','cplusRectificationTypeFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','cplusSubjectOpFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','cplusTaxBreakFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','siiTrascendencyInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','bookEntried','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','isVatDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','withholdingSageFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','expenseFkDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','invoiceIn','editorFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','id','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','serialNumber','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','serial','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','supplierFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','issued','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','supplierRef','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','currencyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','created','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','companyFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','docFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','booked','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','operated','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','siiTypeInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','cplusRectificationTypeFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','cplusSubjectOpFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','cplusTaxBreakFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','siiTrascendencyInvoiceInFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','bookEntried','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','isVatDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','withholdingSageFk','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','expenseFkDeductible','0000-00-00 00:00:00','Update'); +INSERT IGNORE INTO `columns_priv` VALUES ('','vn','logistic','invoiceIn','editorFk','0000-00-00 00:00:00','Update'); /*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `procs_priv` DISABLE KEYS */; @@ -1732,8 +1824,10 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','barcodeToItem','FUN INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticket_splititempackingtype','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_getCommission','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','expeditionstate_addbypallet','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ledger_nextTx','PROCEDURE','guillermo@10.5.1.3','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','mail_insert','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_fixMisfit','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','entry_updateComission','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); @@ -1761,7 +1855,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','manager','collection_make','PR INSERT IGNORE INTO `procs_priv` VALUES ('','util','android','debugadd','PROCEDURE','jenkins@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','copyComponentsFromSaleList','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaEntryValueUpdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaInvoiceInBooking','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaInvoiceInBooking','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvinglog_get','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expedition_getstate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1861,7 +1955,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','workercalendar_calculateb INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticketparking_findskipped','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticketcollection_getnopacked','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','supplier_checkbalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','item_valuateinventory','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ledger_docompensation','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ledger_next','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicein_booking','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -2055,10 +2148,9 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','entry_getTransf INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','intrastat_estimateNet','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','alexm@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','developer','connection_kill','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','client_getRisk','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','item_ValuateInventory','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -2066,6 +2158,8 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByE INSERT IGNORE INTO `procs_priv` VALUES ('','vn','entryEditor','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_nextTx','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_docompensation','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); /*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2090,7 +2184,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_ INSERT IGNORE INTO `global_priv` VALUES ('','buyerAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerAssist','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_questions\": 0, \"max_updates\": 30000, \"max_connections\": 300000, \"max_user_connections\": 400, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); @@ -2128,7 +2222,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"ve INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','packager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','palletizerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','palletizerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','preservedBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','production','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','productionAssi','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index b61cbcc5c..dd068cdc7 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -3223,7 +3223,7 @@ BEGIN -- Marcamos para no repetir UPDATE vn.claimEnd ce JOIN vn.claim c ON c.id = ce.claimFk - SET c.isChargedToMana = TRUE + SET ce.isGreuge = TRUE WHERE ce.claimDestinationFk NOT IN (1,5) AND NOT ce.isGreuge AND c.claimStateFk = 3; @@ -10095,42 +10095,39 @@ BEGIN DECLARE vXtraLongAgj INT; DECLARE vDefaultKlo INT; - SELECT - ec.usefulAuctionLeftSegmentLength, - ec.standardBarcodeLength, - ec.floridayBarcodeLength, - ec.floramondoBarcodeLength, - ec.defaultKlo - INTO - vUsefulAuctionLeftSegmentLength, + SELECT usefulAuctionLeftSegmentLength, + standardBarcodeLength, + floridayBarcodeLength, + floramondoBarcodeLength, + defaultKlo + INTO vUsefulAuctionLeftSegmentLength, vStandardBarcodeLength, vFloridayBarcodeLength, vFloramondoBarcodeLength, vDefaultKlo - FROM edi.ektConfig ec; + FROM ektConfig; - DROP TEMPORARY TABLE IF EXISTS tmp.ekt; - CREATE TEMPORARY TABLE tmp.ekt + CREATE OR REPLACE TEMPORARY TABLE tmp.ekt ENGINE = MEMORY SELECT id ektFk FROM ekt LIMIT 0; - CASE + CASE WHEN LENGTH(vBarcode) <= vFloridayBarcodeLength THEN INSERT INTO tmp.ekt SELECT id - FROM edi.ektRecent e + FROM ektRecent e WHERE e.cps = vBarcode OR e.batchNumber = vBarcode; WHEN LENGTH(vBarcode) = vFloramondoBarcodeLength THEN INSERT INTO tmp.ekt SELECT e.id - FROM edi.ektRecent e + FROM ektRecent e WHERE e.pro = MID(vBarcode,2,6) - AND CAST(e.ptd AS SIGNED) = MID(vBarcode,8,5); + AND CAST(e.ptd AS SIGNED) = MID(vBarcode, 8, 5); ELSE - SET vBarcode = LPAD(vBarcode,vStandardBarcodeLength,'0'); + SET vBarcode = LPAD(vBarcode, vStandardBarcodeLength, '0'); SET vAuction = MID(vBarcode, 1, 3); SET vKlo = MID(vBarcode, 4, 2); SET vFec = MAKEDATE(YEAR(util.VN_CURDATE()), MID(vBarcode, 6, 3)); @@ -10141,21 +10138,23 @@ BEGIN -- Clásico de subasta -- Trade standard -- Trade que construye como la subasta - -- Trade como el anterior pero sin trade code + -- Trade como el anterior pero sin trade code INSERT INTO tmp.ekt SELECT id FROM ekt WHERE fec >= vFec - INTERVAL 1 DAY - AND (( - vKlo = vDefaultKlo + AND ( + (vKlo = vDefaultKlo AND (klo = vKlo OR klo IS NULL OR klo = 0) - AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj)) - OR (klo = vKlo + AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj) + ) OR ( + klo = vKlo AND auction = vAuction - AND agj = vShortAgj) + AND agj = vShortAgj + ) ) - ORDER BY agj DESC, fec DESC - LIMIT 1; + ORDER BY agj DESC, fec DESC + LIMIT 1; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; @@ -10163,9 +10162,11 @@ BEGIN IF NOT vIsFound THEN INSERT INTO tmp.ekt SELECT id - FROM edi.ektRecent e - WHERE e.batchNumber - = LEFT(vBarcode,vUsefulAuctionLeftSegmentLength) + FROM ektRecent e + WHERE e.batchNumber = LEFT( + vBarcode, + vUsefulAuctionLeftSegmentLength + ) AND e.batchNumber > 0; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; @@ -10175,7 +10176,7 @@ BEGIN IF NOT vIsFound THEN INSERT INTO tmp.ekt SELECT id - FROM edi.ektRecent e + FROM ektRecent e WHERE e.putOrderFk = vBarcode; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; @@ -10185,18 +10186,28 @@ BEGIN IF NOT vIsFound THEN INSERT INTO tmp.ekt SELECT id - FROM edi.ektRecent e - WHERE e.deliveryNumber - = MID(vBarcode, 4, 13) + FROM ektRecent e + WHERE e.deliveryNumber = MID(vBarcode, 4, 13) AND e.deliveryNumber > 0; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; END IF; + + -- Solo campo agj + IF NOT vIsFound THEN + INSERT INTO tmp.ekt + SELECT id + FROM ektRecent + WHERE agj = vShortAgj; + + SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; + END IF; + END CASE; IF vIsFound THEN UPDATE ekt e - JOIN tmp.ekt t ON t.ektFk = e.id + JOIN tmp.ekt t ON t.ektFk = e.id SET e.scanned = TRUE; END IF; END ;; @@ -11067,26 +11078,6 @@ CREATE TABLE `addressPostCode` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Client''s address registered for floranet network'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `builder` --- - -DROP TABLE IF EXISTS `builder`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `builder` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) NOT NULL, - `elementFk` int(11) NOT NULL, - `quantity` int(10) unsigned NOT NULL DEFAULT 1, - PRIMARY KEY (`id`), - KEY `builder_FK` (`itemFk`), - KEY `builder_FK_1` (`elementFk`), - CONSTRAINT `builder_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `builder_FK_1` FOREIGN KEY (`elementFk`) REFERENCES `element` (`itemFk`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `catalogue` -- @@ -11106,37 +11097,25 @@ CREATE TABLE `catalogue` ( `description` text DEFAULT NULL, `created` timestamp NULL DEFAULT current_timestamp(), `payed` datetime DEFAULT NULL, + `addressFk` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `itemFk` (`itemFk`), + KEY `catalogue_address_FK` (`addressFk`), + CONSTRAINT `catalogue_address_FK` FOREIGN KEY (`addressFk`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `catalogue_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `element` +-- Table structure for table `config` -- -DROP TABLE IF EXISTS `element`; +DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `element` ( - `itemFk` int(11) NOT NULL, - `typeFk` smallint(5) unsigned DEFAULT NULL, - `size` int(11) DEFAULT NULL, - `inkFk` char(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, - `originFk` tinyint(2) unsigned DEFAULT NULL, - `name` varchar(30) DEFAULT NULL, - `quantity` int(11) NOT NULL DEFAULT 1, - PRIMARY KEY (`itemFk`), - KEY `element_FK` (`itemFk`), - KEY `element_FK_1` (`typeFk`), - KEY `element_FK_2` (`inkFk`), - KEY `element_FK_3` (`originFk`), - CONSTRAINT `element_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `element_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `element_FK_2` FOREIGN KEY (`inkFk`) REFERENCES `vn`.`ink` (`id`) ON UPDATE CASCADE, - CONSTRAINT `element_FK_3` FOREIGN KEY (`originFk`) REFERENCES `vn`.`origin` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Filtro para localizar posibles items que coincidan con la descripción'; +CREATE TABLE `config` ( + `email` varchar(255) NOT NULL DEFAULT 'floranet@verdnatura.es' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11166,6 +11145,27 @@ CREATE TABLE `order` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `recipe` +-- + +DROP TABLE IF EXISTS `recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) NOT NULL COMMENT 'Bouquet or plant name', + `elementFk` int(11) NOT NULL COMMENT 'Item detail for bouquet''s composition', + `quantity` int(10) unsigned NOT NULL DEFAULT 1, + `cost` decimal(10,2) NOT NULL DEFAULT 1.00, + PRIMARY KEY (`id`), + KEY `recipe_FK` (`itemFk`), + KEY `recipe_FK_1` (`elementFk`), + CONSTRAINT `recipe_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE, + CONSTRAINT `recipe_item_FK` FOREIGN KEY (`elementFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Dumping events for database 'floranet' -- @@ -11278,19 +11278,28 @@ proc:BEGIN postalCode, `type`, image, - description + description, + addressFk ) - SELECT i.name, - i.`size`, - i.id, + SELECT CONCAT(i.name, ' by ',a.nickname), + r.price + apc.deliveryCost, + r.itemFk, vLanded, vPostalCode, it.name, CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image), - i.description + i.description, + apc.addressFk FROM vn.item i + JOIN (SELECT itemFk, SUM(quantity * cost) price + FROM recipe + GROUP BY itemFk) r ON r.itemFk = i.id JOIN vn.itemType it ON it.id = i.typeFk - WHERE it.code IN ('FNR','FNP'); + JOIN addressPostCode apc + ON apc.dayOfWeek = dayOfWeek(vLanded) + AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR + AND apc.postCode = vPostalCode + JOIN vn.address a ON a.id = apc.addressFk; SELECT * FROM catalogue @@ -11324,9 +11333,18 @@ BEGIN /** * Set actions for contact request * - * @param vPostalCode Delivery address postal code + * @param vName Name + * @param vPhone Phone number + * @param vEmail e-mail + * @param vMessage text of the message */ - + + CALL vn.mail_insert( + 'floranet@verdnatura.es', + vEmail, + 'Contact request', + CONCAT('Phone: ',vPhone, ' Message: ', vMessage) + ); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -11362,7 +11380,7 @@ BEGIN apc.dayOfWeek - vCurrentDayOfWeek, 7 - apc.dayOfWeek ) DAY nextDay, - NOW() + INTERVAL apc.hoursInAdvance - 12 HOUR minDeliveryTime + NOW() + INTERVAL apc.hoursInAdvance HOUR minDeliveryTime FROM addressPostCode apc WHERE apc.postCode = vPostalCode HAVING nextDay > minDeliveryTime) sub; @@ -11384,21 +11402,165 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_confirm`(vCatalogueFk INT) READS SQL DATA -BEGIN -/** Update order.isPaid field. +proc:BEGIN +/** Update order.isPaid field, and makes the ticket * * @param vCatalogueFk floranet.catalogue.id * * @returns floranet.order.isPaid */ + DECLARE vNewTicketFk INT; + DECLARE vCustomerEmail VARCHAR(255); + DECLARE vFloranetEmail VARCHAR(255); + DECLARE vSubjectEmail VARCHAR(100); + DECLARE vBodyEmail TEXT; + DECLARE vZoneFk INT; + + DECLARE exit handler FOR SQLEXCEPTION + BEGIN + ROLLBACK; + + GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + + SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')) AS `SQLEXCEPTION`; + + CALL vn.mail_insert( + 'floranet@verdnatura.es,pako@verdnatura.es', + 'noreply@verdnatura.es', + 'Floranet.order_confirm failure', + CONCAT('CatalogueFk: ', vCatalogueFk, '\n','ERROR ', IFNULL(@errno, 0), ': ', ifnull(@text, 'texto')) + ); + END; + + IF (SELECT isPaid FROM `order` WHERE catalogueFk = vCatalogueFk) THEN + SELECT CONCAT('CatalogueFk: ', vCatalogueFk, ' Esta orden ya está confirmada') AS `ERROR`; + LEAVE proc; + END IF; + + START TRANSACTION; + UPDATE `order` SET isPaid = TRUE, payed = NOW() WHERE catalogueFk = vCatalogueFk; - SELECT isPaid + SELECT zoneFk + INTO vZoneFk + FROM ( + SELECT zoneFk, COUNT(*) totalCount + FROM vn.ticket t + JOIN catalogue c ON c.id = vCatalogueFk + WHERE t.shipped > util.VN_CURDATE() - INTERVAL 1 YEAR + AND t.addressFk = c.addressFk + GROUP BY zoneFk + ORDER BY totalCount DESC + LIMIT 10000000000000000000 + ) sub + LIMIT 1; + + INSERT INTO vn.ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + routeFk, + companyFk, + landed, + zoneFk + ) + SELECT a.clientFk, + c.dated - INTERVAL 1 DAY, + c.addressFk, + a.agencyModeFk, + a.nickname, + ag.warehouseFk, + NULL, + co.id, + c.dated, + vZoneFk + FROM vn.address a + JOIN vn.agencyMode am ON am.id = a.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + JOIN catalogue c ON c.addressFk = a.id + JOIN vn.company co ON co.code = 'VNL' + WHERE c.id = vCatalogueFk; + + SET vNewTicketFk = LAST_INSERT_ID(); + + INSERT INTO vn.sale( + ticketFk, + itemFk, + concept, + price, + quantity) + SELECT + vNewTicketFk, + c.itemFk, + CONCAT('Entrega: ',c.name), + - c.price, + 1 + FROM catalogue c + JOIN addressPostCode apc + ON apc.addressFk = c.addressFk + AND apc.dayOfWeek = dayOfWeek(c.dated) + WHERE c.id = vCatalogueFk; + + INSERT INTO vn.sale( + ticketFk, + itemFk, + concept, + price, + quantity) + SELECT + vNewTicketFk, + r.elementFk, + i.longName, + r.cost, + r.quantity + FROM catalogue c + JOIN recipe r ON r.itemFk = c.itemFk + JOIN vn.item i ON i.id = r.elementFk + WHERE c.id = vCatalogueFk; + + SELECT cl.email, + cf.email, + CONCAT('Nuevo pedido FLORANET para entrega el ',c.dated), + CONCAT_WS('\n', + CONCAT('Producto: ', c.name), + CONCAT('Fecha de entrega: ',c.dated), + CONCAT('Destinatario: ', o.deliveryName), + CONCAT('Dirección: ', o.address), + CONCAT('CP: ', c.postalCode), + CONCAT('Foto: ', c.image), + CONCAT('Mensaje: ', IFNULL(o.message,"Ninguno.")), + CONCAT('Teléfono: ',IFNULL(o.deliveryPhone,"--")), + CONCAT('Observaciones: ', IFNULL(o.observations,"No hay.")) + ) + INTO vCustomerEmail, + vFloranetEmail, + vSubjectEmail, + vBodyEmail + FROM vn.client cl + JOIN vn.address a ON a.clientFk = cl.id + JOIN catalogue c ON c.addressFk = a.id + JOIN `order` o ON o.catalogueFk = c.id + JOIN config cf + WHERE c.id = vCatalogueFk; + + CALL vn.mail_insert( + vCustomerEmail, + vFloranetEmail, + vSubjectEmail, + vBodyEmail); + + SELECT isPaid, vNewTicketFk FROM `order` WHERE catalogueFk = vCatalogueFk; + + COMMIT; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -11423,7 +11585,7 @@ BEGIN * * @param vJsonData The order data in json format */ - INSERT INTO `order` + REPLACE `order` SET catalogueFk = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.products[0].id')), customerName = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.customerName')), email = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.email')), @@ -11431,7 +11593,8 @@ BEGIN message= JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.message')), deliveryName = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryName')), address = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.address')), - deliveryPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryPhone')); + deliveryPhone = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.deliveryPhone')), + observations = JSON_UNQUOTE(JSON_EXTRACT(vJsonData, '$.customer.customerData.observations')); SELECT LAST_INSERT_ID() orderFk; END ;; @@ -11457,13 +11620,12 @@ BEGIN * Returns list of url for sliders. */ SELECT - CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url, - i.longName - FROM vn.item i - JOIN vn.itemType it ON it.id = i.typeFk - WHERE it.code IN ('FNR','FNP') - LIMIT 3; - + CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url, + i.longName + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + WHERE it.code IN ('FNR','FNP') + LIMIT 3; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24856,6 +25018,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `midnight`() RETURNS datetime READS SQL DATA + DETERMINISTIC BEGIN RETURN TIMESTAMP(util.VN_CURDATE(), '23:59:59'); @@ -25935,14 +26098,14 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_commit`(isTx BOOL) +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_commit`(vIsTx BOOL) BEGIN /** * Confirma los cambios asociados a una transacción. * - * @param isTx es true si existe transacción asociada + * @param vIsTx es true si existe transacción asociada */ - IF isTx THEN + IF vIsTx THEN COMMIT; END IF; END ;; @@ -25961,14 +26124,14 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_rollback`(isTx BOOL) +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_rollback`(vIsTx BOOL) BEGIN /** * Deshace los cambios asociados a una transacción. * - * @param isTx es true si existe transacción asociada + * @param vIsTx es true si existe transacción asociada */ - IF isTx THEN + IF vIsTx THEN ROLLBACK; END IF; END ;; @@ -25987,14 +26150,14 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_start`(isTx BOOL) +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_start`(vIsTx BOOL) BEGIN /** * Inicia una transacción. * - * @param isTx es true si existe transacción asociada + * @param vIsTx es true si existe transacción asociada */ - IF isTx THEN + IF vIsTx THEN START TRANSACTION; END IF; END ;; @@ -32529,6 +32692,7 @@ CREATE TABLE `item` ( `nonRecycledPlastic` decimal(10,2) DEFAULT NULL, `minQuantity` int(10) unsigned DEFAULT NULL COMMENT 'Cantidad mínima para una línea de venta', `isBoxPickingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'FALSE: using item.packingOut TRUE: boxPicking using itemShelving.packing', + `photoMotivation` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`), KEY `Color` (`inkFk`), @@ -34183,6 +34347,14 @@ CREATE TABLE `mrwConfig` ( `password` varchar(100) DEFAULT NULL, `franchiseCode` varchar(100) DEFAULT NULL, `subscriberCode` varchar(100) DEFAULT NULL, + `defaultHeight` int(10) unsigned DEFAULT NULL COMMENT 'default height in centimeters', + `defaultLength` int(10) unsigned DEFAULT NULL COMMENT 'default length in centimeters', + `defaultWidth` int(10) unsigned DEFAULT NULL COMMENT 'default width in centimeters', + `defaultWeight` int(10) unsigned DEFAULT NULL COMMENT 'default weight in centimeters', + `expeditionDeadLine` time DEFAULT NULL COMMENT 'This field stores the latest time by which expeditions can be generated to be sent today', + `counterWidth` int(10) unsigned DEFAULT NULL COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.', + `serviceTypeWidth` int(10) unsigned DEFAULT NULL COMMENT 'If it does not reach the required value, it will be padded with zeros on the left to meet the specified length.', + `portugalPostCodeTrim` int(10) unsigned DEFAULT NULL COMMENT 'It will trim the last characters of the postal code', PRIMARY KEY (`id`), CONSTRAINT `mrwConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -35631,6 +35803,7 @@ CREATE TABLE `productionConfig` ( `collection_assign_lockname` varchar(100) DEFAULT 'collection_assign' COMMENT 'Lockname value for proc vn.collection_new', `defaultSectorFk` int(10) unsigned NOT NULL DEFAULT 37 COMMENT 'Default sector', `scannableCodeType` enum('qr','barcode') NOT NULL DEFAULT 'barcode', + `scannablePreviusCodeType` enum('qr','barcode') NOT NULL DEFAULT 'barcode', PRIMARY KEY (`id`), KEY `productionConfig_FK` (`shortageAddressFk`), KEY `productionConfig_FK_1` (`clientSelfConsumptionFk`), @@ -38881,6 +39054,7 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), KEY `ticketLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `ticketLog_originFk` (`originFk`,`creationDate`), + KEY `ticketLog_creationDate_IDX` (`creationDate`,`changedModel`,`action`) USING BTREE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -42520,10 +42694,7 @@ BEGIN */ DECLARE vClient INT DEFAULT NULL; - -- SET vPhone = vPhone COLLATE 'utf8_unicode_ci'; - - DROP TEMPORARY TABLE IF EXISTS tClient; - CREATE TEMPORARY TABLE tClient + CREATE OR REPLACE TEMPORARY TABLE tClient ENGINE = MEMORY SELECT id clientFk FROM `client` @@ -42536,13 +42707,14 @@ BEGIN OR mobile = vPhone UNION SELECT clientFk - FROM vn.clientContact + FROM clientContact WHERE phone = vPhone; SELECT t.clientFk INTO vClient FROM tClient t JOIN `client` c ON c.id = t.clientFk WHERE c.isActive + AND c.salesPersonFk LIMIT 1; DROP TEMPORARY TABLE tClient; @@ -45818,7 +45990,7 @@ BEGIN DECLARE vIsTooLittle TINYINT(1); SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume - OR IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle + AND IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle FROM ticket t LEFT JOIN saleVolume sv ON sv.ticketFk = t.id JOIN volumeConfig vc @@ -51162,28 +51334,12 @@ BEGIN * @param vCollectionFk Id de colección */ DECLARE vHasTooMuchCollections BOOL; - DECLARE vItemPackingTypeFk VARCHAR(1); - DECLARE vWarehouseFk INT; - DECLARE vLockName VARCHAR(215); - DECLARE vLockTime INT DEFAULT 30; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - IF vLockName IS NOT NULL THEN - DO RELEASE_LOCK(vLockName); - CALL util.debugAdd('releaseLock', vLockName); -- Tmp - END IF; - - RESIGNAL; - END; -- Si hay colecciones sin terminar, sale del proceso CALL collection_get(vUserFk); - SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, - collection_assign_lockname - INTO vHasTooMuchCollections, - vLockName + SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 + INTO vHasTooMuchCollections FROM productionConfig pc LEFT JOIN tCollection ON TRUE; @@ -51193,21 +51349,6 @@ BEGIN CALL util.throw('Hay colecciones pendientes'); END IF; - SELECT warehouseFk, itemPackingTypeFk - INTO vWarehouseFk, vItemPackingTypeFk - FROM operator - WHERE workerFk = vUserFk; - - SET vLockName = CONCAT_WS('/', - vLockName, - vWarehouseFk, - vItemPackingTypeFk - ); - - IF NOT GET_LOCK(vLockName, vLockTime) THEN - CALL util.throw(CONCAT('Cannot get lock: ', vLockName)); - END IF; - -- Se eliminan las colecciones sin asignar que estan obsoletas INSERT INTO ticketTracking(stateFk, ticketFk) SELECT s.id, tc.ticketFk @@ -51215,7 +51356,7 @@ BEGIN JOIN ticketCollection tc ON tc.collectionFk = c.id JOIN `state` s ON s.code = 'PRINTED_AUTO' JOIN productionConfig pc - WHERE c.workerFk IS NULL + WHERE c.workerFk IS NULL AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; DELETE c.* @@ -51229,8 +51370,7 @@ BEGIN VALUES(vUserFk); -- Comprueba si hay colecciones disponibles que se ajustan a su configuracion - SELECT MIN(c.id) - INTO vCollectionFk + SELECT MIN(c.id) INTO vCollectionFk FROM `collection` c JOIN operator o ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL) @@ -51256,116 +51396,6 @@ BEGIN UPDATE `collection` SET workerFk = vUserFk WHERE id = vCollectionFk; - - DO RELEASE_LOCK(vLockName); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `collection_assign2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_assign2`( - vUserFk INT, - OUT vCollectionFk INT -) -proc:BEGIN -/** - * Comprueba si existen colecciones libres que se ajustan - * al perfil del usuario y le asigna la más antigua. - * Añade un registro al semillero de colecciones. - * - * @param vUserFk Id de usuario - * @param vCollectionFk Id de colección - */ - DECLARE vHasTooMuchCollections BOOL; - DECLARE vLockTime INT DEFAULT 15; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('collection_assign2'); - - RESIGNAL; - END; - - -- Si hay colecciones sin terminar, sale del proceso - CALL collection_get(vUserFk); - - SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 - INTO vHasTooMuchCollections - FROM tCollection - JOIN productionConfig pc ; - - DROP TEMPORARY TABLE tCollection; - - IF vHasTooMuchCollections THEN - CALL util.throw('Hay colecciones pendientes'); - LEAVE proc; - END IF; - - IF NOT GET_LOCK('collection_assign2',vLockTime) THEN - LEAVE proc; - END IF; - - -- Se eliminan las colecciones sin asignar que estan obsoletas - INSERT INTO ticketTracking(stateFk, ticketFk) - SELECT s.id, tc.ticketFk - FROM `collection` c - JOIN ticketCollection tc ON tc.collectionFk = c.id - JOIN `state` s ON s.code = 'PRINTED_AUTO' - JOIN productionConfig pc - WHERE c.workerFk IS NULL - AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; - - DELETE c.* - FROM `collection` c - JOIN productionConfig pc - WHERE c.workerFk IS NULL - AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime; - - -- Se añade registro al semillero - INSERT INTO collectionHotbed(userFk) - VALUES(vUserFk); - - -- Comprueba si hay colecciones disponibles que se ajustan a su configuracion - SELECT MIN(c.id) - INTO vCollectionFk - FROM `collection` c - JOIN operator o - ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL) - AND o.numberOfWagons = c.wagons - AND o.trainFk = c.trainFk - AND o.warehouseFk = c.warehouseFk - AND c.workerFk IS NULL - AND (c.saleTotalCount <= o.linesLimit OR o.linesLimit IS NULL) - JOIN ( - SELECT tc.collectionFk, SUM(sv.volume) volume - FROM ticketCollection tc - JOIN saleVolume sv ON sv.ticketFk = tc.ticketFk - WHERE sv.shipped >= util.VN_CURDATE() - GROUP BY tc.collectionFk - ) sub ON sub.collectionFk = c.id - AND (volume <= o.volumeLimit OR o.volumeLimit IS NULL) - WHERE o.workerFk = vUserFk; - - IF vCollectionFk IS NULL THEN - CALL collection_new(vUserFk, vCollectionFk); - END IF; - - UPDATE `collection` - SET workerFk = vUserFk - WHERE id = vCollectionFk; - - DO RELEASE_LOCK('collection_assign2'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51663,7 +51693,10 @@ BEGIN BEGIN IF vLockName IS NOT NULL THEN DO RELEASE_LOCK(vLockName); - CALL util.debugAdd('releaseLock', vLockName); -- Tmp + CALL util.debugAdd(JSON_OBJECT( + 'type', 'releaseLock', + 'userFk', vUserFk + ), vLockName); -- Tmp END IF; RESIGNAL; @@ -53435,12 +53468,12 @@ BEGIN * * @param vDuaFk Id del dua a recalcular */ - DECLARE done BOOL DEFAULT FALSE; + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; - DECLARE vASIEN BIGINT DEFAULT 0; - DECLARE vCounter INT DEFAULT 0; + DECLARE vBookEntry INT; + DECLARE vFiscalYear INT; - DECLARE rs CURSOR FOR + DECLARE vInvoicesIn CURSOR FOR SELECT DISTINCT e.invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id @@ -53449,9 +53482,7 @@ BEGIN AND de.customsValue AND ii.isBooked = FALSE; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id @@ -53465,38 +53496,36 @@ BEGIN e.isConfirmed = TRUE WHERE d.id = vDuaFk; - SELECT IFNULL(ASIEN,0) INTO vASIEN - FROM dua - WHERE id = vDuaFk; + SELECT ASIEN INTO vBookEntry FROM dua WHERE id = vDuaFk; - FETCH rs INTO vInvoiceFk; + IF vBookEntry IS NULL THEN + SELECT YEAR(IFNULL(ii.bookEntried, d.bookEntried)) INTO vFiscalYear + FROM invoiceIn ii + JOIN entry e ON e.invoiceInFk = ii.id + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk + WHERE d.id = vDuaFk + LIMIT 1; + CALL ledger_nextTx(vFiscalYear, vBookEntry); + END IF; - WHILE NOT done DO + OPEN vInvoicesIn; - CALL invoiceIn_booking(vInvoiceFk); - - IF vCounter > 0 OR vASIEN > 0 THEN - - UPDATE XDiario x - JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN - SET x.ASIEN = vASIEN; - - ELSE - - SELECT lastBookEntry INTO vASIEN FROM ledgerConfig; +l: LOOP + SET vDone = FALSE; + FETCH vInvoicesIn INTO vInvoiceFk; + IF vDone THEN + LEAVE l; END IF; - SET vCounter = vCounter + 1; + CALL invoiceIn_booking(vInvoiceFk, vBookEntry); + END LOOP; - FETCH rs INTO vInvoiceFk; - - END WHILE; - - CLOSE rs; + CLOSE vInvoicesIn; UPDATE dua - SET ASIEN = vASIEN + SET ASIEN = vBookEntry WHERE id = vDuaFk; UPDATE invoiceIn ii @@ -53566,7 +53595,7 @@ BEGIN WHERE id = vDuaFk; IF vBookNumber IS NULL OR NOT vBookNumber THEN - CALL ledger_next(YEAR(vBookDated), vBookNumber); + CALL ledger_nextTx(YEAR(vBookDated), vBookNumber); END IF; -- Apunte de la aduana @@ -54048,41 +54077,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `entry_checkBooked` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_checkBooked`( - vSelf INT -) -BEGIN -/** - * Comprueba si una entrada está contabilizada, - * y si lo está retorna un throw. - * - * @param vSelf Id de entrada - */ - DECLARE vIsBooked BOOL; - - SELECT isBooked INTO vIsBooked - FROM `entry` - WHERE id = vSelf; - - IF vIsBooked AND NOT IFNULL(@isModeInventory, FALSE) THEN - CALL util.throw('Entry is already booked'); - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_checkPackaging` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -54599,6 +54593,43 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entry_isEditable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_isEditable`( + vSelf INT +) +BEGIN +/** + * Comprueba si una entrada se puede actualizar + * si no se puede retorna un throw. + * + * @param vSelf Id de entrada + */ + DECLARE vIsEditable BOOL; + + SELECT e.isBooked INTO vIsEditable + FROM `entry` e + JOIN entryType et ON et.code = e.typeFk + WHERE NOT et.isInformal + AND e.id = vSelf; + + IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN + CALL util.throw('Entry is not editable'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_lock` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55150,7 +55181,8 @@ BEGIN JOIN vn.travel t ON t.id = e.travelFk JOIN vn.warehouse w ON w.id = t.warehouseInFk WHERE t.shipped >= util.VN_CURDATE() - AND e.currencyFk = vCurrency; + AND e.currencyFk = vCurrency + AND NOT e.isBooked; SET vComission = currency_getCommission(vCurrency); @@ -57311,9 +57343,19 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_booking`(vSelf INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_booking`( + vSelf INT, + vBookNumber INT +) BEGIN - DECLARE vBookNumber INT; +/** + * Genera la contabilidad para una factura y la marca como contabilizada + * Cuadra el asiento generado en si encuentra problemas derivados + * de los calculos con decimales + * + * @param vSelf Id invoiceIn + * @param vBookEntry Id de asiento, si es NULL se genera uno nuevo + */ DECLARE vFiscalYear INT; CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn @@ -57370,7 +57412,10 @@ BEGIN WHERE ii.id = vSelf; SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1; - CALL ledger_next(vFiscalYear, vBookNumber); + + IF vBookNumber IS NULL THEN + CALL ledger_nextTx(vFiscalYear, vBookNumber); + END IF; -- Apunte del proveedor INSERT INTO XDiario( @@ -57499,7 +57544,7 @@ BEGIN LEFT JOIN ( SELECT e.id FROM tInvoiceIn tii - JOIN expense e ON e.id = tii.expenseFk + JOIN expense e ON e.id = tii.expenseFk WHERE e.isWithheld LIMIT 1 ) eWithheld ON TRUE @@ -57776,7 +57821,7 @@ BEGIN WHERE io.id = vInvoice; SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1; - CALL ledger_next(vFiscalYear, vBookNumber); + CALL ledger_nextTx(vFiscalYear, vBookNumber); -- Linea del cliente INSERT INTO XDiario( ASIEN, @@ -60051,13 +60096,15 @@ BEGIN SELECT itemFk, packing, - created + created, + buyFk FROM itemShelving WHERE id = vItemShelvingFk ) ish2 ON ish2.itemFk = ish.itemFk AND ish2.packing = ish.packing AND date(ish2.created) = date(ish.created) + AND ish2.buyFk = ish.buyFk WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci; IF vNewItemShelvingFk THEN @@ -60094,7 +60141,6 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) BEGIN - /** * Añade registro o lo actualiza si ya existe. * @@ -60107,11 +60153,23 @@ BEGIN * @param vWarehouseFk indica el sector * **/ - DECLARE vItemFk INT; + DECLARE vBuyFk INT; + + SELECT id INTO vBuyFk + FROM buy WHERE id = vBarcode; SELECT barcodeToItem(vBarcode) INTO vItemFk; + IF vBuyFk IS NULL THEN + CALL cache.last_buy_refresh(FALSE); + + SELECT buy_id INTO vBuyFk + FROM cache.last_buy + WHERE item_id = vItemFk + AND warehouse_id = vWarehouseFk; + END IF; + IF vPacking IS NULL THEN SET vPacking = itemPacking(vBarcode, vWarehouseFk); @@ -60121,31 +60179,32 @@ BEGIN IF (SELECT COUNT(*) FROM itemShelving WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk - AND packing = vPacking) = 1 THEN + AND packing = vPacking + AND buyFk = vBuyFk) THEN UPDATE itemShelving - SET visible = visible+vQuantity + SET visible = visible + vQuantity WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; ELSE - CALL cache.last_buy_refresh(FALSE); - INSERT INTO itemShelving( itemFk, - shelvingFk, - visible, - grouping, - packing, - packagingFk) - SELECT vItemFk, - vShelvingFk, - vQuantity, - IFNULL(vGrouping, b.grouping), - IFNULL(vPacking, b.packing), - IFNULL(vPackagingFk, b.packagingFk) - FROM item i - LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id - WHERE i.id = vItemFk; + INSERT INTO itemShelving( + itemFk, + shelvingFk, + visible, + grouping, + packing, + packagingFk, + buyFk) + SELECT vItemFk, + vShelvingFk, + vQuantity, + IFNULL(vGrouping, b.grouping), + IFNULL(vPacking, b.packing), + IFNULL(vPackagingFk, b.packagingFk), + id + FROM buy b + WHERE id = vBuyFk; END IF; END ;; DELIMITER ; @@ -61478,7 +61537,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `item_comparative`( vAvailableSince DATE, vBuyerFk INT, vIsFloramondo BOOL, - vCountryFk INT + vCountryFk INT ) proc: BEGIN /** @@ -61495,7 +61554,6 @@ proc: BEGIN * @param tmp.comparativeFilterType(filterFk INT ,itemTypeFk INT) * @return tmp.comparative */ - DECLARE vDayRangeStart DATE; DECLARE vDayRangeEnd DATE; DECLARE w1, w2, w3, w4, w5, w6, w7 INT; @@ -61531,14 +61589,14 @@ proc: BEGIN END IF; SELECT MIN(dated) INTO vDayRangeStart - FROM vn.time + FROM `time` WHERE dated <= vDate GROUP BY period ORDER BY dated desc LIMIT 1 OFFSET vWeekRange; SELECT MAX(dated) INTO vDayRangeEnd - FROM vn.time + FROM `time` WHERE dated >= vDate GROUP BY period ORDER BY dated ASC @@ -61555,12 +61613,11 @@ proc: BEGIN JOIN itemType t ON t.id = i.typeFk JOIN itemCategory c ON c.id = t.categoryFk LEFT JOIN worker w ON w.id = t.workerFk - WHERE (NOT vHasTypeFilter - OR t.id IN (SELECT itemTypeFk FROM tmp.comparativeFilterType)) - AND (vBuyerFk IS NULL - OR t.workerFk = vBuyerFk) - AND (vIsFloramondo IS NULL - OR i.isFloramondo = vIsFloramondo); + WHERE (NOT vHasTypeFilter OR t.id IN ( + SELECT itemTypeFk FROM tmp.comparativeFilterType + )) + AND (vBuyerFk IS NULL OR t.workerFk = vBuyerFk) + AND (vIsFloramondo IS NULL OR i.isFloramondo = vIsFloramondo); IF vDate < util.VN_CURDATE() THEN ALTER TABLE tmp.itemInventory @@ -61587,10 +61644,11 @@ proc: BEGIN SET i = i + 1; SELECT t.period INTO vPeriod - FROM vn.`time` t + FROM `time` t WHERE t.dated = vDayRangeStart + INTERVAL (vWeekCount * (i - 1)) DAY; - INSERT IGNORE INTO tTable(cy, ly, zy) VALUES(vPeriod, vPeriod - 100, vPeriod - 200); + INSERT IGNORE INTO tTable(cy, ly, zy) + VALUES(vPeriod, vPeriod - 100, vPeriod - 200); UNTIL i = vWeekCount END REPEAT; SELECT cy, ly, zy INTO w1, y1, z1 FROM tTable LIMIT 1; @@ -61602,7 +61660,6 @@ proc: BEGIN SELECT cy, ly, zy INTO w7, y7, z7 FROM tTable WHERE cy > w6 LIMIT 1; -- Genera una tabla con los datos del año pasado. - CREATE OR REPLACE TEMPORARY TABLE tLastYear (KEY (lItemFk)) ENGINE = MEMORY @@ -61623,15 +61680,14 @@ proc: BEGIN SUM(IF(c.timePeriod = y7, c.price, 0)) lprice7 FROM tmp.itemInventory ai JOIN comparative c ON c.itemFk = ai.id - JOIN warehouse w on w.id = c.warehouseFk + JOIN warehouse w ON w.id = c.warehouseFk JOIN tTable wt ON c.timePeriod = wt.ly - WHERE IFNULL(vWarehouseFk, c.warehouseFk) = c.warehouseFk + WHERE (vWarehouseFk IS NULL OR vWarehouseFk = c.warehouseFk) AND w.isComparative AND (vCountryFk IS NULL OR c.countryFk = vCountryFk) GROUP BY ai.id; - -- Genera una tabla con los datos de hace DOS años. - + -- Genera una tabla con los datos de hace 2 años CREATE OR REPLACE TEMPORARY TABLE tTwoYearsAgo (KEY (tItemFk)) ENGINE = MEMORY @@ -61652,73 +61708,72 @@ proc: BEGIN SUM(IF(c.timePeriod = z7, c.price, 0)) vlprice7 FROM tmp.itemInventory ai JOIN comparative c ON c.itemFk = ai.id - JOIN warehouse w on w.id = c.warehouseFk + JOIN warehouse w ON w.id = c.warehouseFk JOIN tTable wt ON c.timePeriod = wt.zy - WHERE IFNULL(vWarehouseFk, c.warehouseFk) = c.warehouseFk + WHERE (vWarehouseFk IS NULL OR vWarehouseFk = c.warehouseFk) AND w.isComparative AND (vCountryFk IS NULL OR c.countryFk = vCountryFk) GROUP BY ai.id; - -- Genera una tabla con los datos de este año.ss - + -- Genera una tabla con los datos de este año CREATE OR REPLACE TEMPORARY TABLE tCurrentYear (KEY (cItemFk)) ENGINE = MEMORY SELECT t.itemFk cItemFk, - SUM(IF(week = w1, total, 0)) cweek1, - SUM(IF(week = w2, total, 0)) cweek2, - SUM(IF(week = w3, total, 0)) cweek3, - SUM(IF(week = w4, total, 0)) cweek4, - SUM(IF(week = w5, total, 0)) cweek5, - SUM(IF(week = w6, total, 0)) cweek6, - SUM(IF(week = w7, total, 0)) cweek7, - SUM(IF(week = w1, price, 0)) cprice1, - SUM(IF(week = w2, price, 0)) cprice2, - SUM(IF(week = w3, price, 0)) cprice3, - SUM(IF(week = w4, price, 0)) cprice4, - SUM(IF(week = w5, price, 0)) cprice5, - SUM(IF(week = w6, price, 0)) cprice6, - SUM(IF(week = w7, price, 0)) cprice7 + SUM(IF(`week` = w1, total, 0)) cweek1, + SUM(IF(`week` = w2, total, 0)) cweek2, + SUM(IF(`week` = w3, total, 0)) cweek3, + SUM(IF(`week` = w4, total, 0)) cweek4, + SUM(IF(`week` = w5, total, 0)) cweek5, + SUM(IF(`week` = w6, total, 0)) cweek6, + SUM(IF(`week` = w7, total, 0)) cweek7, + SUM(IF(`week` = w1, price, 0)) cprice1, + SUM(IF(`week` = w2, price, 0)) cprice2, + SUM(IF(`week` = w3, price, 0)) cprice3, + SUM(IF(`week` = w4, price, 0)) cprice4, + SUM(IF(`week` = w5, price, 0)) cprice5, + SUM(IF(`week` = w6, price, 0)) cprice6, + SUM(IF(`week` = w7, price, 0)) cprice7 FROM ( SELECT s.itemFk, ti.period `week`, SUM(s.quantity) total, - TRUNCATE(SUM(s.quantity * s.priceFixed),0) price - FROM ticket t + TRUNCATE(SUM(s.quantity * s.priceFixed), 0) price + FROM ticket t FORCE INDEX (Fecha) JOIN sale s ON t.id = s.ticketFk - JOIN tmp.itemInventory it ON it.id = s.itemFk - JOIN time ti ON ti.dated = DATE(t.shipped) + JOIN tmp.itemInventory it ON it.id = s.itemFk + JOIN `time` ti ON ti.dated = DATE(t.shipped) JOIN item i ON i.id = s.itemFk JOIN itemType tp ON tp.id = i.typeFk JOIN itemCategory ic ON ic.id = tp.categoryFk JOIN warehouse w ON w.id = t.warehouseFk - STRAIGHT_JOIN address ad ON ad.id = t.addressFk - JOIN province p ON p.id = ad.provinceFk + JOIN `address` ad ON ad.id = t.addressFk + JOIN province p ON p.id = ad.provinceFk JOIN `client` c ON c.id = ad.clientFk WHERE t.shipped BETWEEN vDayRangeStart AND util.dayEnd(vDayRangeEnd) - AND c.typeFk IN ('Normal','handMaking') - AND w.id = COALESCE(vWarehouseFk, w.id) + AND c.typeFk IN ('normal', 'handMaking') + AND (vWarehouseFk IS NULL OR vWarehouseFk = w.id) + AND (vCountryFk IS NULL OR p.countryFk = vCountryFk) AND w.isComparative - AND (vCountryFk IS NULL OR p.countryFk = vCountryFk) - GROUP BY i.id, week + GROUP BY i.id, `week` ) t GROUP BY t.itemFk; - -- Genera la tabla con la comparativa. + -- Genera la tabla con la comparativa CREATE OR REPLACE TEMPORARY TABLE tmp.comparative ENGINE = MEMORY - SELECT it.subName productor, - b.packing, + SELECT it.subName productor, + b.packing, b.buyingValue costefijo, b.groupingMode caja, it.image ArticleImage, - IFNULL(it.inkFk,"?") color, + IFNULL(it.inkFk, '?') color, tp.code tipo, it.typeFk tipo_id, o.code origen, it.category categoria, it.stems tallos, - it.size medida, + it.`size` medida, it.name article, w.code codigoTrabajador, tp.categoryFk reino_id, @@ -61729,24 +61784,27 @@ proc: BEGIN it.id Id_Article, i.buy_id, tp.life, - IFNULL(i.sd,0) sd, + IFNULL(i.sd, 0) sd, i.avalaible, i.visible, i.buy_date, e.id provider_id, it.comment comments, it.description itemDescription, - IF(cy.cItemFk IS NULL AND i.visible = 0 AND i.avalaible = 0 - AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) filtret, + IF(cy.cItemFk IS NULL AND i.visible = 0 + AND i.avalaible = 0 AND (i.sd IS NULL OR i.sd = 0), + FALSE, + TRUE + ) filtret, IF(it.hasMinPrice, FORMAT(it.minPrice, 2), "") pvp, s.company_name FROM tmp.itemInventory i JOIN item it ON it.id = i.id - LEFT JOIN itemType tp ON tp.id = it.typeFk - LEFT JOIN worker w ON w.id = tp.workerFk + JOIN itemType tp ON tp.id = it.typeFk + JOIN worker w ON w.id = tp.workerFk LEFT JOIN buy b ON b.id = i.buy_id - LEFT JOIN entry e ON e.id = b.entryFk - LEFT JOIN origin o ON o.id = it.originFk + LEFT JOIN `entry` e ON e.id = b.entryFk + JOIN origin o ON o.id = it.originFk LEFT JOIN tLastYear ly ON ly.lItemFk = it.id LEFT JOIN tCurrentYear cy ON cy.cItemFk = it.id LEFT JOIN tTwoYearsAgo zy ON zy.tItemFk = it.id @@ -61759,8 +61817,8 @@ proc: BEGIN OR ly.lweek1 OR ly.lweek2 OR ly.lweek3 OR ly.lweek4 OR ly.lweek5 OR ly.lweek6 OR ly.lweek7 OR zy.vlweek1 OR zy.vlweek2 OR zy.vlweek3 OR zy.vlweek4 OR zy.vlweek5 OR zy.vlweek6 OR zy.vlweek7; - -- Elimina las tablas temporales creadas... - DROP TEMPORARY TABLE IF EXISTS tmp.itemInventory, + DROP TEMPORARY TABLE IF EXISTS + tmp.itemInventory, tTwoYearsAgo, tLastYear, tCurrentYear, @@ -63551,256 +63609,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_ValuateInventory` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_ValuateInventory`(vDated DATE, vIsDetailed BOOLEAN) -BEGIN - DECLARE vInventoried DATE; - DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE; - DECLARE vInventoryClone DATE; - DECLARE vDateDayEnd DATETIME; - DECLARE vInventorySupplierFk INT; - - SELECT inventorySupplierFk INTO vInventorySupplierFk - FROM entryConfig; - - SET vDateDayEnd = util.dayEnd(vDated); - - SELECT tr.landed INTO vInventoried - FROM travel tr - JOIN `entry` e ON e.travelFk = tr.id - JOIN entryConfig ec - WHERE landed <= vDateDayEnd - AND e.supplierFk = vInventorySupplierFk - ORDER BY tr.landed DESC - LIMIT 1; - - SET vHasNotInventory = (vInventoried IS NULL); - - IF vHasNotInventory THEN - SELECT landed INTO vInventoryClone - FROM travel tr - JOIN `entry` e ON e.travelFk = tr.id - JOIN entryConfig ec - WHERE landed >= vDated - AND e.supplierFk = vInventorySupplierFk - ORDER BY landed ASC - LIMIT 1; - - SET vInventoried = vDated + INTERVAL 1 DAY; - SET vDateDayEnd = vInventoryClone; - END IF; - - CREATE OR REPLACE TEMPORARY TABLE tInventory( - warehouseFk SMALLINT, - itemFk BIGINT, - quantity INT, - cost DOUBLE DEFAULT 0, - total DOUBLE DEFAULT 0, - warehouseInventory VARCHAR(20), - PRIMARY KEY (warehouseInventory, itemFk) USING HASH - ) - ENGINE = MEMORY; - - -- Inventario inicial - IF vHasNotInventory THEN - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT tr.warehouseInFk, - b.itemFk, - SUM(b.quantity), - w.name - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN `entry` e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = warehouseInFk - JOIN entryConfig ec - WHERE landed = vDateDayEnd - AND e.supplierFk = vInventorySupplierFk - AND w.valuatedInventory - AND t.isInventory - GROUP BY tr.warehouseInFk, b.itemFk; - ELSE - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT tr.warehouseInFk, - b.itemFk, - SUM(b.quantity), - w.name - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN `entry` e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = warehouseInFk - JOIN entryConfig ec - WHERE landed = vInventoried - AND e.supplierFk = vInventorySupplierFk - AND w.valuatedInventory - AND t.isInventory - GROUP BY tr.warehouseInFk, b.itemFk; - END IF; - - -- Añadimos las entradas - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT tr.warehouseInFk, - b.itemFk, - b.quantity * IF(vHasNotInventory, -1, 1), - w.name - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN `entry` e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = tr.warehouseInFk - JOIN entryConfig ec - WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd - AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE) - AND NOT e.isRaid - AND w.valuatedInventory - AND t.isInventory - AND e.supplierFk <> vInventorySupplierFk - ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity * IF(vHasNotInventory, -1, 1)); - - -- Descontamos las salidas - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT tr.warehouseOutFk, - b.itemFk, - b.quantity * IF(vHasNotInventory, 1, -1), - w.name - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN `entry` e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd - AND NOT e.isRaid - AND w.valuatedInventory - AND t.isInventory - ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity * IF(vHasNotInventory,1,-1)); - - -- Descontamos las lineas de venta - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT w.id, - s.itemFk, - s.quantity * IF(vHasNotInventory, 1, -1), - w.name - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN `client` c ON c.id = t.clientFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd - AND w.valuatedInventory - AND it.isInventory - ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 1, -1); - - -- Volver a poner lo que esta aun en las estanterias - IF vDated = util.VN_CURDATE() THEN - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT w.id, - s.itemFk, - s.quantity * IF(vHasNotInventory, 0, 1), - w.name - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN `client` c ON c.id = t.clientFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vDated AND vDateDayEnd - AND NOT (s.isPicked OR t.isLabeled) - AND w.valuatedInventory - AND it.isInventory - ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + s.quantity * IF(vHasNotInventory, 0, 1); - END IF; - - -- Mercancia en transito - INSERT INTO tInventory(warehouseFk, itemFk, quantity, warehouseInventory) - SELECT tr.warehouseInFk, - b.itemFk, - b.quantity, - CONCAT(wOut.`name`, ' - ', wIn.`name`) - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN `entry` e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk - WHERE vDated >= tr.shipped AND vDated < tr.landed - AND NOT isRaid - AND wIn.valuatedInventory - AND t.isInventory - AND e.isConfirmed - ON DUPLICATE KEY UPDATE tInventory.quantity = tInventory.quantity + (b.quantity); - - CALL vn.buyUltimate(NULL, vDateDayEnd); - - UPDATE tInventory i - JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.itemFk = bu.itemFk - JOIN buy b ON b.id = bu.buyFk - SET total = i.quantity * (IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0)), - cost = IFNULL(b.buyingValue, 0) + IFNULL(b.packageValue, 0) + IFNULL(b.freightValue, 0) + IFNULL(b.comissionValue, 0) - WHERE i.quantity; - - DELETE FROM tInventory - WHERE quantity IS NULL OR NOT quantity; - - IF vIsDetailed THEN - SELECT ti.warehouseFk, - i.id itemFk, - i.longName, - i.size, - ti.quantity, - tp.name Tipo, - ic.name Reino, - ti.cost, - CAST(ti.total AS DECIMAL(10, 2)) total, - ti.warehouseInventory almacen - FROM tInventory ti - JOIN warehouse w ON w.id = warehouseFk - JOIN item i ON i.id = ti.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - WHERE w.valuatedInventory - AND ti.total > 0 - ORDER BY ti.total DESC; - ELSE - SELECT i.warehouseInventory Almacen, - ic.name Reino, - CAST(i.total AS DECIMAL(10, 2)) Euros, - w.code Comprador, - it.id - FROM tInventory i - JOIN warehouse wh ON wh.id = warehouseFk - JOIN item it ON it.id = i.itemFk - JOIN itemType itp ON itp.id = it.typeFk - LEFT JOIN worker w ON w.id = itp.workerFk - JOIN itemCategory ic ON ic.id = itp.categoryFk - WHERE wh.valuatedInventory - AND i.total > 0; - END IF; - - DROP TEMPORARY TABLE - tmp.buyUltimate, - tInventory; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_zoneClosure` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63876,7 +63684,7 @@ BEGIN DECLARE vIsOriginalAClient BOOL; DECLARE vPayMethodCompensation INT; - CALL ledger_next(YEAR(vDated), vNewBookEntry); + CALL ledger_nextTx(YEAR(vDated), vNewBookEntry); SELECT COUNT(id) INTO vIsOriginalAClient FROM client @@ -63974,32 +63782,10 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_next`( OUT vLastBookEntry INT ) BEGIN - DECLARE vHasStartTransaction BOOLEAN; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - - IF vHasStartTransaction THEN - ROLLBACK TO sp; - RESIGNAL; - ELSE - ROLLBACK; - CALL util.throw ('It has not been possible to generate a new ledger'); - END IF; - END; - IF vFiscalYear IS NULL THEN CALL util.throw('Fiscal year is required'); END IF; - SELECT @@in_transaction INTO vHasStartTransaction; - - IF NOT vHasStartTransaction THEN - START TRANSACTION; - ELSE - SAVEPOINT sp; - END IF; - SELECT bookEntry + 1 INTO vLastBookEntry FROM ledgerCompany WHERE fiscalYear = vFiscalYear @@ -64015,12 +63801,41 @@ BEGIN UPDATE ledgerCompany SET bookEntry = vLastBookEntry WHERE fiscalYear = vFiscalYear; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ledger_nextTx` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_nextTx`( + IN vFiscalYear INT, + OUT vLastBookEntry INT +) +BEGIN + DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + CALL util.tx_rollback(vIsRequiredTx); + RESIGNAL; + END; - IF vHasStartTransaction THEN - RELEASE SAVEPOINT sp; - ELSE - COMMIT; - END IF; + IF vFiscalYear IS NULL THEN + CALL util.throw('Fiscal year is required'); + END IF; + + CALL util.tx_start(vIsRequiredTx); + CALL ledger_next(vFiscalYear, vLastBookEntry); + CALL util.tx_commit(vIsRequiredTx); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -65713,13 +65528,19 @@ proc: BEGIN -- Líneas y volumen por ticket UPDATE tmp.productionBuffer pb JOIN ( - SELECT tt.ticketFk, - COUNT(*) `lines`, - SUM(sv.volume) m3, - IFNULL(SUM(IF(sv.isPicked, sv.volume, 0)) / SUM(sv.volume), 0) rate - FROM tmp.productionTicket tt - JOIN saleVolume sv ON sv.ticketFk = tt.ticketFk - GROUP BY tt.ticketFk + SELECT tt.ticketFk, + COUNT(*) `lines`, + SUM(s.quantity * ic.cm3delivery / 1000000) m3, + IFNULL(SUM(IF(s.isPicked, + (s.quantity * ic.cm3delivery / 1000000), + 0)) / SUM(s.quantity * ic.cm3delivery / 1000000), + 0) rate + FROM tmp.productionTicket tt + JOIN sale s ON s.ticketFk = tt.ticketFk + AND s.quantity > 0 + JOIN itemCost ic ON ic.itemFk = s.itemFk + AND ic.warehouseFk = vWarehouseFk + GROUP BY tt.ticketFk ) m ON m.ticketFk = pb.ticketFk SET pb.`lines` = m.`lines`, pb.m3 = m.m3, @@ -65786,6 +65607,8 @@ proc: BEGIN AND ish.visible GROUP BY ish.itemFk, p.sectorFk; + CREATE INDEX idxItem ON tItemShelvingStock (itemFk); + INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount) SELECT pb.ticketFk, COUNT(DISTINCT s.id) FROM tmp.productionBuffer pb @@ -67475,19 +67298,21 @@ BEGIN END; CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve + (PRIMARY KEY (id)) + ENGINE = MEMORY SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity FROM sale s JOIN item i ON i.id = s.itemFk JOIN itemType it ON it.id = i.typeFk WHERE s.ticketFk = vTicketFk AND it.isMergeable - GROUP BY s.itemFk, s.price, s.discount; + GROUP BY s.itemFk, s.price, s.discount; START TRANSACTION; UPDATE sale s JOIN tSalesToPreserve stp ON stp.id = s.id - SET quantity = newQuantity + SET s.quantity = newQuantity WHERE s.ticketFk = vTicketFk; DELETE s.* @@ -68401,10 +68226,15 @@ BEGIN FROM tmp.sale_getProblems tp JOIN ticket t ON t.id = tp.ticketFk JOIN ( - SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat + SELECT t.addressFk, + SUM(ROUND(`ic`.`cm3delivery` * `s`.`quantity` / 1000, 0)) litros, + t.totalWithoutVat FROM tmp.ticket_list tl - JOIN saleVolume sv ON sv.ticketFk = tl.ticketFk JOIN ticket t ON t.id = tl.ticketFk + JOIN sale s ON s.ticketFk = t.id + AND s.quantity > 0 + JOIN itemCost ic ON ic.itemFk = s.itemFk + AND ic.warehouseFk = t.warehouseFk JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = util.VN_CURDATE() JOIN agencyMode am ON am.id = t.agencyModeFk @@ -68432,12 +68262,12 @@ BEGIN FROM ( SELECT COUNT(s.id) nComp, tl.ticketFk, s.id saleFk FROM tmp.ticket_list tl - JOIN vn.sale s ON s.ticketFk = tl.ticketFk - LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id - LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN sale s ON s.ticketFk = tl.ticketFk + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + LEFT JOIN component c ON c.id = sc.componentFk AND c.isRequired + JOIN ticket t ON t.id = tl.ticketFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP') AND s.quantity > 0 GROUP BY s.id @@ -69088,7 +68918,7 @@ BEGIN FROM ticket t JOIN sale s ON s.ticketFk = t.id LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE t.shipped >= util.midnight() + WHERE t.shipped >= util.VN_CURDATE() AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk) GROUP BY s.id) sub; @@ -71590,14 +71420,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketPackaging_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackaging_add`( vClientFk INT, @@ -71627,7 +71457,10 @@ BEGIN SELECT DISTINCT clientFk FROM ( SELECT clientFk, SUM(quantity) totalQuantity - FROM tmp.packagingToInvoice + FROM tmp.packagingToInvoice tpi + JOIN client c ON c.id = tpi.clientFk + LEFT JOIN supplier s ON s.nif = c.fi + WHERE s.id IS NULL GROUP BY itemFk, clientFk HAVING totalQuantity > 0)sub; @@ -74661,7 +74494,7 @@ BEGIN ENGINE = MEMORY SELECT t.id ticketFk, FALSE hasProblem FROM ticket t - WHERE t.shipped >= util.midnight() + WHERE t.shipped >= util.VN_CURDATE() AND (vClientFk IS NULL OR t.clientFk = vClientFk); UPDATE tmp.ticket t @@ -74703,7 +74536,7 @@ BEGIN ENGINE = MEMORY SELECT t.id ticketFk, FALSE hasProblem FROM ticket t - WHERE t.shipped >= util.midnight() + WHERE t.shipped >= util.VN_CURDATE() AND (vSelf IS NULL OR t.id = vSelf); UPDATE tmp.ticket t @@ -74837,7 +74670,7 @@ BEGIN SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem FROM ticket t JOIN client c ON c.id = t.clientFk - WHERE t.shipped >= util.midnight() + WHERE t.shipped >= util.VN_CURDATE() AND (c.id = vClientFk OR vClientFk IS NULL); CALL ticket_setProblem('isTaxDataChecked'); @@ -74909,7 +74742,7 @@ BEGIN SELECT t.id ticketFk FROM vn.ticket t LEFT JOIN vn.sale s ON s.ticketFk = t.id - WHERE t.shipped >= util.midnight() + WHERE t.shipped >= util.VN_CURDATE() AND (s.itemFk = vItemFk OR vItemFk IS NULL) GROUP BY t.id )SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem @@ -76481,8 +76314,8 @@ BEGIN DECLARE vEvaNotes VARCHAR(255); DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; - DECLARE vTx BOOLEAN DEFAULT @@in_transaction; - DECLARE vRsEntry CURSOR FOR + DECLARE vIsRequiredTx BOOLEAN DEFAULT NOT @@in_transaction; + DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e JOIN travel t ON t.id = e.travelFk @@ -76492,11 +76325,11 @@ BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - CALL util.tx_rollback(vTx); + CALL util.tx_rollback(vIsRequiredTx); RESIGNAL; END; - CALL util.tx_start(vTx); + CALL util.tx_start(vIsRequiredTx); INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom) SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk @@ -76533,7 +76366,7 @@ BEGIN SET @isModeInventory = FALSE; CLOSE vRsEntry; - CALL util.tx_commit(vTx); + CALL util.tx_commit(vIsRequiredTx); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76810,6 +76643,33 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `travel_throwAwb` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_throwAwb`(vSelf INT) +BEGIN +/** + * Throws an error if travel does not have a logical AWB + * or there are several AWBs associated with the same DUA + * + * @param vSelf The travel id + */ + IF NOT travel_hasUniqueAwb(vSelf) THEN + CALL util.throw('A different AWB is found in the entries'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_upcomingArrivals` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -79979,7 +79839,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `xdiario_new`( ) BEGIN IF vBookNumber IS NULL THEN - CALL ledger_next(YEAR(vDated), vBookNumber); + CALL ledger_nextTx(YEAR(vDated), vBookNumber); END IF; INSERT INTO XDiario @@ -87135,7 +86995,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum(`s`.`isPicked` <> 0) AS `alreadyMadeSaleLines`,sum(`s`.`isPicked` <> 0) / count(`s`.`id`) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`saleGroup` `sg` join `saleGroupDetail` `sgd` on(`sgd`.`saleGroupFk` = `sg`.`id`)) join `sale` `s` on(`s`.`id` = `sgd`.`saleFk`)) join `ticketState` `tls` on(`tls`.`ticketFk` = `s`.`ticketFk`)) join `alertLevel` `al` on(`al`.`id` = `tls`.`alertLevel`)) join `worker` `w` on(`w`.`id` = `sg`.`userFk`)) left join `parking` `p` on(`p`.`id` = `sg`.`parkingFk`)) join `itemShelvingStock` `iss` on(`iss`.`itemFk` = `s`.`itemFk`)) where `sg`.`created` >= `util`.`VN_CURDATE`() + interval 0.1 day group by `sg`.`id` */; +/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum(`s`.`isPicked` <> 0) AS `alreadyMadeSaleLines`,sum(`s`.`isPicked` <> 0) / count(`s`.`id`) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`saleGroup` `sg` join `saleGroupDetail` `sgd` on(`sgd`.`saleGroupFk` = `sg`.`id`)) join `sale` `s` FORCE INDEX (PRIMARY) on(`s`.`id` = `sgd`.`saleFk`)) join `ticketState` `tls` on(`tls`.`ticketFk` = `s`.`ticketFk`)) join `alertLevel` `al` on(`al`.`id` = `tls`.`alertLevel`)) join `worker` `w` on(`w`.`id` = `sg`.`userFk`)) left join `parking` `p` on(`p`.`id` = `sg`.`parkingFk`)) join `itemShelvingStock` `iss` on(`iss`.`itemFk` = `s`.`itemFk`)) where `sg`.`created` >= `util`.`VN_CURDATE`() + interval 0.1 day group by `sg`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -89855,4 +89715,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-05-28 6:58:24 +-- Dump completed on 2024-06-11 6:35:36 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index fd1042138..b2f550bbe 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -2239,7 +2239,7 @@ trig: BEGIN LEAVE trig; END IF; - CALL entry_checkBooked(NEW.entryFk); + CALL entry_isEditable(NEW.entryFk); IF NEW.printedStickers <> 0 THEN CALL util.throw('it is not possible to create buy lines with printedstickers other than 0'); END IF; @@ -2366,7 +2366,7 @@ trig:BEGIN LEAVE trig; END IF; - CALL entry_checkBooked(OLD.entryFk); + CALL entry_isEditable(OLD.entryFk); SET NEW.editorFk = account.myUser_getId(); SELECT defaultEntry INTO vDefaultEntry @@ -2515,7 +2515,7 @@ DELIMITER ;; BEFORE DELETE ON `buy` FOR EACH ROW BEGIN - CALL entry_checkBooked(OLD.entryFk); + CALL entry_isEditable(OLD.entryFk); IF OLD.printedStickers <> 0 THEN CALL util.throw("it is not possible to delete buys with printed labels "); END IF; @@ -4591,8 +4591,8 @@ BEGIN CALL supplier_checkIsActive(NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); - IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN - CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries'); + IF NEW.travelFk IS NOT NULL THEN + CALL travel_throwAwb(NEW.travelFk); END IF; END */;; DELIMITER ; @@ -4619,7 +4619,7 @@ BEGIN DECLARE vTotalBuy INT; IF NEW.isBooked = OLD.isBooked THEN - CALL entry_checkBooked(OLD.id); + CALL entry_isEditable(OLD.id); ELSE IF NEW.isBooked THEN SELECT COUNT(*) INTO vTotalBuy @@ -4635,8 +4635,8 @@ BEGIN IF NOT (NEW.travelFk <=> OLD.travelFk) THEN - IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN - CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries'); + IF NEW.travelFk IS NOT NULL THEN + CALL travel_throwAwb(NEW.travelFk); END IF; SELECT COUNT(*) > 0 INTO vIsVirtual @@ -4721,7 +4721,7 @@ DELIMITER ;; BEFORE DELETE ON `entry` FOR EACH ROW BEGIN - CALL entry_checkBooked(OLD.id); + CALL entry_isEditable(OLD.id); DELETE FROM buy WHERE entryFk = OLD.id; END */;; DELIMITER ; @@ -6783,13 +6783,12 @@ BEGIN DECLARE vIsCash BOOLEAN; DECLARE vIsSupplierActive BOOLEAN; - -- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH SELECT (at2.code = 'cash') INTO vIsCash FROM accounting a JOIN accountingType at2 ON at2.id = a.accountingTypeFk WHERE a.id = NEW.bankFk; - IF vIsCash THEN + IF vIsCash THEN SELECT account INTO vBankAccount FROM accounting WHERE id = NEW.bankFk; @@ -6798,7 +6797,7 @@ BEGIN FROM supplier WHERE id = NEW.supplierFk; - CALL ledger_next(YEAR(NEW.received), NEW.companyFk, vNewBookEntry); + CALL ledger_next(YEAR(NEW.received), vNewBookEntry); INSERT INTO XDiario ( ASIEN, @@ -8986,7 +8985,9 @@ BEGIN SET hasNewRoute = TRUE WHERE ticketFk = NEW.id; - CALL ticket_doCmr(NEW.id); + IF NEW.cmrFk THEN + CALL ticket_doCmr(NEW.id); + END IF; END IF; END */;; DELIMITER ; @@ -9897,8 +9898,8 @@ BEGIN CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); - IF NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN - CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries'); + IF NEW.awbFk IS NOT NULL THEN + CALL travel_throwAwb(NEW.id); END IF; END */;; DELIMITER ; @@ -9949,8 +9950,8 @@ BEGIN END IF; END IF; - IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN - CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries'); + IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN + CALL travel_throwAwb(NEW.id); END IF; END */;; DELIMITER ; @@ -10824,4 +10825,4 @@ USE `vn2008`; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-05-28 6:58:42 +-- Dump completed on 2024-06-11 6:35:55 From 873f36fef6f96de60f78cb719a8dc74fe3d39352 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 11 Jun 2024 08:50:32 +0200 Subject: [PATCH 09/22] refactor: refs #7503 Added relations and ACLs --- modules/invoiceOut/back/models/invoice-out.json | 5 +++++ modules/ticket/back/models/ticket.json | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modules/invoiceOut/back/models/invoice-out.json b/modules/invoiceOut/back/models/invoice-out.json index 2bf5182e8..1ee36accb 100644 --- a/modules/invoiceOut/back/models/invoice-out.json +++ b/modules/invoiceOut/back/models/invoice-out.json @@ -44,6 +44,11 @@ "model": "Client", "foreignKey": "clientFk" }, + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "clientFk" + }, "company": { "type": "belongsTo", "model": "Company", diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 248c0312f..d1b202f83 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -77,6 +77,11 @@ "model": "Client", "foreignKey": "clientFk" }, + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "clientFk" + }, "warehouse": { "type": "belongsTo", "model": "Warehouse", From 76f76b8304ccc75458216b7cceda417723024341 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 11 Jun 2024 10:48:24 +0200 Subject: [PATCH 10/22] feat: refs #7568 Added freelancer exception --- db/routines/vn/procedures/ticket_doCmr.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/ticket_doCmr.sql b/db/routines/vn/procedures/ticket_doCmr.sql index 2da8464b4..e9cd1d659 100644 --- a/db/routines/vn/procedures/ticket_doCmr.sql +++ b/db/routines/vn/procedures/ticket_doCmr.sql @@ -18,7 +18,7 @@ BEGIN com.id companyFk, a.id addressFk, c2.defaultAddressFk, - su.id supplierFk, + IFNULL(sat.supplierFk, su.id) supplierFk, t.landed FROM ticket t JOIN ticketState ts ON ts.ticketFk = t.id @@ -28,15 +28,18 @@ BEGIN JOIN `address` a ON a.id = t.addressFk JOIN province p ON p.id = a.provinceFk JOIN country co ON co.id = p.countryFk - JOIN agencyMode am ON am.id = t.agencyModeFk JOIN warehouse w ON w.id = t.warehouseFk JOIN company com ON com.id = t.companyFk JOIN client c2 ON c2.id = com.clientFk - JOIN supplierAccount sa ON sa.id = com.supplierAccountFk + JOIN supplierAccount sa ON sa.id = com.supplierAccountFk JOIN supplier su ON su.id = sa.supplierFk LEFT JOIN route r ON r.id = t.routeFk LEFT JOIN worker wo ON wo.id = r.workerFk LEFT JOIN vehicle v ON v.id = r.vehicleFk + LEFT JOIN agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN agency ag ON ag.id = am.agencyFk + LEFT JOIN supplierAgencyTerm sat ON sat.agencyFk = ag.id + AND wo.isFreelance WHERE al.code IN ('PACKED', 'DELIVERED') AND co.code <> 'ES' AND am.name <> 'ABONO' From 1cefe817f55096390ce68b63f377a80c494764c6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 11 Jun 2024 12:06:44 +0200 Subject: [PATCH 11/22] feat: add editZone ACL for buyer --- db/versions/11096-blackChico/00-addBuyerAcl.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/versions/11096-blackChico/00-addBuyerAcl.sql diff --git a/db/versions/11096-blackChico/00-addBuyerAcl.sql b/db/versions/11096-blackChico/00-addBuyerAcl.sql new file mode 100644 index 000000000..1b4adee5c --- /dev/null +++ b/db/versions/11096-blackChico/00-addBuyerAcl.sql @@ -0,0 +1,8 @@ +INSERT INTO salix.ACL + SET + model = 'Ticket', + property = 'editZone', + accessType = 'WRITE', + permission = 'ALLOW', + principalType = 'ROLE', + principalId = 'buyer'; \ No newline at end of file From 8039530ab42db21e6e76bb72ca4ae90e1fda0e87 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 11 Jun 2024 14:15:10 +0200 Subject: [PATCH 12/22] fix: refs #7039 fix item-tax --- modules/item/front/tax/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/front/tax/index.js b/modules/item/front/tax/index.js index b72fbefa3..2d70414ab 100644 --- a/modules/item/front/tax/index.js +++ b/modules/item/front/tax/index.js @@ -11,7 +11,7 @@ export default class Controller extends Section { fields: ['id', 'countryFk', 'taxClassFk'], include: [{ relation: 'country', - scope: {fields: ['country']} + scope: {fields: ['name']} }] }; From 13d1d0a61cd8d2f406799ff5ebe60704b3858925 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 11 Jun 2024 14:29:16 +0200 Subject: [PATCH 13/22] feat: refs #7499 add printedStickers --- modules/entry/back/methods/entry/getBuys.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/entry/back/methods/entry/getBuys.js b/modules/entry/back/methods/entry/getBuys.js index 90c1bb9d0..0ed77e8d1 100644 --- a/modules/entry/back/methods/entry/getBuys.js +++ b/modules/entry/back/methods/entry/getBuys.js @@ -48,7 +48,8 @@ module.exports = Self => { 'weight', 'buyingValue', 'price2', - 'price3' + 'price3', + 'printedStickers' ], include: { relation: 'item', From 79c922300bd53b0be596d9bf28e65757c4a8401b Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 11 Jun 2024 14:50:47 +0200 Subject: [PATCH 14/22] hotfix #6408 --- modules/ticket/back/methods/ticket/state.js | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/ticket/back/methods/ticket/state.js b/modules/ticket/back/methods/ticket/state.js index 9b0b862f2..eede02d74 100644 --- a/modules/ticket/back/methods/ticket/state.js +++ b/modules/ticket/back/methods/ticket/state.js @@ -26,6 +26,7 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {}; let tx; + let newStateOrder; if (typeof options == 'object') Object.assign(myOptions, options); @@ -40,11 +41,16 @@ module.exports = Self => { throw new UserError('State cannot be blank'); if (params.stateFk) { - const {code} = await models.State.findById(params.stateFk, {fields: ['code']}, myOptions); + const {code, order} = await models.State.findById( + params.stateFk, + {fields: ['code', 'order']}, + myOptions); params.code = code; + newStateOrder = order; } else { - const {id} = await models.State.findOne({where: {code: params.code}}, myOptions); + const {id, order} = await models.State.findOne({where: {code: params.code}}, myOptions); params.stateFk = id; + newStateOrder = order; } if (!params.userFk) { @@ -75,7 +81,9 @@ module.exports = Self => { }, myOptions); const salesPersonFk = ticket.client().salesPersonFk; - if (salesPersonFk) { + const stateChecked = await models.State.findOne({fields: ['order'], where: {code: 'CHECKED'}}); + + if (salesPersonFk && newStateOrder >= stateChecked.order) { const sales = await Self.rawSql(` SELECT DISTINCT s.id, s.itemFk, @@ -83,17 +91,9 @@ module.exports = Self => { s.originalQuantity AS oldQuantity, s.quantity AS newQuantity FROM vn.sale s - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state s2 ON s2.id = ts.stateFk WHERE s.ticketFk = ? - AND st.isChecked AND s.originalQuantity IS NOT NULL AND s.originalQuantity <> s.quantity - AND s2.\`order\` < (SELECT \`order\` FROM vn.state WHERE code = 'CHECKED') - ORDER BY st.created DESC `, [params.ticketFk], myOptions); let changes = ''; From 17fa1e10f64993e99141c353da9eb74fb51347ba Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 12 Jun 2024 07:33:10 +0200 Subject: [PATCH 15/22] feat: refs #6701 Added claimRatio_afterInsert --- db/routines/vn/triggers/claimRatio_afterUpdate.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/routines/vn/triggers/claimRatio_afterUpdate.sql diff --git a/db/routines/vn/triggers/claimRatio_afterUpdate.sql b/db/routines/vn/triggers/claimRatio_afterUpdate.sql new file mode 100644 index 000000000..daae7ecf0 --- /dev/null +++ b/db/routines/vn/triggers/claimRatio_afterUpdate.sql @@ -0,0 +1,11 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterUpdate` + AFTER UPDATE ON `claimRatio` + FOR EACH ROW +BEGIN + INSERT INTO clientRate(clientFk, `value`) + VALUES(NEW.clientFk, NEW.priceIncreasing) + ON DUPLICATE KEY UPDATE + `value` = VALUES(`value`); +END$$ +DELIMITER ; From c4c6df5a78f445a235eb210987445100609d29fe Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 12 Jun 2024 07:41:00 +0200 Subject: [PATCH 16/22] feat(jenkinsfile): use build_id --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8edac0a4..19f47c5b0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -121,7 +121,7 @@ pipeline { steps { script { def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}" + env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" } sh 'docker-compose build back' } @@ -159,7 +159,7 @@ pipeline { steps { script { def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}" + env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" } sh 'gulp build' sh 'docker-compose build front' @@ -179,7 +179,7 @@ pipeline { steps { script { def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}" + env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" } sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY' sh 'docker-compose push' @@ -210,7 +210,7 @@ pipeline { steps { script { def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-vn${env.BUILD_ID}" + env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" } withKubeConfig([ serverUrl: "$KUBERNETES_API", From 789e0e65e3172737bc8b8a1dfc8a75d47e23fea6 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 12 Jun 2024 09:12:48 +0200 Subject: [PATCH 17/22] fix(sale): rocket is only sent if it has sales --- modules/ticket/back/methods/ticket/state.js | 60 +++++++++++---------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/modules/ticket/back/methods/ticket/state.js b/modules/ticket/back/methods/ticket/state.js index eede02d74..1e6069b79 100644 --- a/modules/ticket/back/methods/ticket/state.js +++ b/modules/ticket/back/methods/ticket/state.js @@ -86,39 +86,41 @@ module.exports = Self => { if (salesPersonFk && newStateOrder >= stateChecked.order) { const sales = await Self.rawSql(` SELECT DISTINCT s.id, - s.itemFk, - s.concept, - s.originalQuantity AS oldQuantity, - s.quantity AS newQuantity + s.itemFk, + s.concept, + s.originalQuantity AS oldQuantity, + s.quantity AS newQuantity FROM vn.sale s - WHERE s.ticketFk = ? - AND s.originalQuantity IS NOT NULL - AND s.originalQuantity <> s.quantity + WHERE s.ticketFk = ? + AND s.originalQuantity IS NOT NULL + AND s.originalQuantity <> s.quantity `, [params.ticketFk], myOptions); - let changes = ''; - const url = await models.Url.getUrl(); - const $t = ctx.req.__; - for (let sale of sales) { - changes += `\r\n-` + $t('Changes in sales', { - itemId: sale.itemFk, - concept: sale.concept, - oldQuantity: sale.oldQuantity, - newQuantity: sale.newQuantity, - itemUrl: `${url}item/${sale.itemFk}/summary` - }); - const currentSale = await models.Sale.findById(sale.id, null, myOptions); - await currentSale.updateAttributes({ - originalQuantity: currentSale.quantity - }, myOptions); - } + if (sales.length) { + let changes = ''; + const url = await models.Url.getUrl(); + const $t = ctx.req.__; + for (let sale of sales) { + changes += `\r\n-` + $t('Changes in sales', { + itemId: sale.itemFk, + concept: sale.concept, + oldQuantity: sale.oldQuantity, + newQuantity: sale.newQuantity, + itemUrl: `${url}item/${sale.itemFk}/summary` + }); + const currentSale = await models.Sale.findById(sale.id, null, myOptions); + await currentSale.updateAttributes({ + originalQuantity: currentSale.quantity + }, myOptions); + } - const message = $t('Changed sale quantity', { - ticketId: ticket.id, - changes: changes, - ticketUrl: `${url}ticket/${ticket.id}/sale` - }); - await models.Chat.sendCheckingPresence(ctx, salesPersonFk, message, myOptions); + const message = $t('Changed sale quantity', { + ticketId: ticket.id, + changes: changes, + ticketUrl: `${url}ticket/${ticket.id}/sale` + }); + await models.Chat.sendCheckingPresence(ctx, salesPersonFk, message, myOptions); + } } await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticket.id, params.code], myOptions); From d9b0a1a75c585f357413c358d95ef31e44c81015 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 12 Jun 2024 09:59:58 +0200 Subject: [PATCH 18/22] fix(updateQuantity): fix rocket translation --- modules/ticket/back/methods/sale/updateQuantity.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/updateQuantity.js b/modules/ticket/back/methods/sale/updateQuantity.js index 610826283..36d75ffed 100644 --- a/modules/ticket/back/methods/sale/updateQuantity.js +++ b/modules/ticket/back/methods/sale/updateQuantity.js @@ -72,16 +72,20 @@ module.exports = Self => { const salesPerson = sale.ticket().client().salesPersonUser(); if (salesPerson) { const url = await Self.app.models.Url.getUrl(); - const message = $t('Changed sale quantity', { - ticketId: sale.ticket().id, + const change = $t('Changes in sales', { itemId: sale.itemFk, concept: sale.concept, oldQuantity: oldQuantity, newQuantity: newQuantity, - ticketUrl: `${url}ticket/${sale.ticket().id}/sale`, itemUrl: `${url}item/${sale.itemFk}/summary` }); + const message = $t('Changed sale quantity', { + ticketId: sale.ticket().id, + changes: change, + ticketUrl: `${url}ticket/${sale.ticket().id}/sale`, + }); + await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions); } From 446e180cf06e24e7e2a496c345cc9efa647f89e3 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 12 Jun 2024 11:58:07 +0200 Subject: [PATCH 19/22] hotfix claim --- db/dump/.dump/data.sql | 2 +- modules/claim/back/methods/claim/updateClaim.js | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index c0d0c34e6..632f3b4b0 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -1711,7 +1711,7 @@ INSERT INTO `ACL` VALUES (570,'InvoiceOut','canCreatePdf','WRITE','ALLOW','ROLE' INSERT INTO `ACL` VALUES (571,'Supplier','editPayMethodCheck','WRITE','ALLOW','ROLE','financial'); INSERT INTO `ACL` VALUES (572,'Worker','isTeamBoss','WRITE','ALLOW','ROLE','teamBoss'); INSERT INTO `ACL` VALUES (573,'Worker','forceIsSubordinate','READ','ALLOW','ROLE','hr'); -INSERT INTO `ACL` VALUES (574,'Claim','editState','WRITE','ALLOW','ROLE','claimManager'); +INSERT INTO `ACL` VALUES (574,'Claim','editPickup','WRITE','ALLOW','ROLE','claimManager'); INSERT INTO `ACL` VALUES (577,'Claim','findOne','READ','ALLOW','ROLE','salesPerson'); INSERT INTO `ACL` VALUES (579,'Claim','updateClaim','WRITE','ALLOW','ROLE','salesPerson'); INSERT INTO `ACL` VALUES (580,'Claim','regularizeClaim','WRITE','ALLOW','ROLE','claimManager'); diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js index c99e0e2f1..326192385 100644 --- a/modules/claim/back/methods/claim/updateClaim.js +++ b/modules/claim/back/methods/claim/updateClaim.js @@ -69,30 +69,26 @@ module.exports = Self => { } } }, myOptions); - // Get sales person from claim client - const salesPerson = claim.client().salesPersonUser(); - const changedPickup = args.pickup != claim.pickup; + const changedPickup = args.pickup && args.pickup != claim.pickup; - // Validate when claimState has been changed if (args.claimStateFk) { const canEditOldState = await models.ClaimState.isEditable(ctx, claim.claimStateFk, myOptions); const canEditNewState = await models.ClaimState.isEditable(ctx, args.claimStateFk, myOptions); - const canEditState = await models.ACL.checkAccessAcl(ctx, 'Claim', 'editState', 'WRITE'); + const canEditPickup = await models.ACL.checkAccessAcl(ctx, 'Claim', 'editPickup', 'WRITE'); - if (!canEditOldState || !canEditNewState || changedPickup && !canEditState) + if (!canEditOldState || !canEditNewState || (changedPickup && !canEditPickup)) throw new UserError(`You don't have enough privileges to change that field`); } delete args.ctx; const updatedClaim = await claim.updateAttributes(args, myOptions); - // When pickup has been changed + const salesPerson = claim.client().salesPersonUser(); if (salesPerson) { if (changedPickup && updatedClaim.pickup) await notifyPickUp(ctx, salesPerson.id, claim); - // When claimState has been changed if (args.claimStateFk) { const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions); await notifyStateChange(ctx, salesPerson.id, claim, newState.description); @@ -113,7 +109,7 @@ module.exports = Self => { async function notifyStateChange(ctx, workerId, claim, newState) { const models = Self.app.models; const url = await models.Url.getUrl(); - const $t = ctx.req.__; // $translate + const $t = ctx.req.__; const message = $t(`Claim state has changed to`, { claimId: claim.id, From d7317e4067cf187d4026744db3386b3cf329d90d Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 13 Jun 2024 07:09:48 +0200 Subject: [PATCH 20/22] hotfix: refs #7024 Modify booked entries --- db/dump/fixtures.before.sql | 12 ++++++++++++ db/routines/vn/triggers/buy_beforeUpdate.sql | 10 +++++++++- db/routines/vn/triggers/entry_beforeUpdate.sql | 15 +++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 6818e7200..592297894 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3119,6 +3119,18 @@ INSERT INTO `vn`.`entryDms`(`entryFk`, `dmsFk`, `editorFk`) VALUES (1, 9, 9); +INSERT INTO vn.entryType (code,description,isInformal) + VALUES ('devaluation','Devaluation',0), + ('internal','Internal',1), + ('inventory','Inventory',1), + ('life','Life',1), + ('packaging','Packaging',0), + ('payment','Refund',0), + ('product','Product',0), + ('regularization','Regularization',1), + ('return','Return',0), + ('transport','Delivery',0); + INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state) VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), (2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), diff --git a/db/routines/vn/triggers/buy_beforeUpdate.sql b/db/routines/vn/triggers/buy_beforeUpdate.sql index dc999095b..1e2faecdc 100644 --- a/db/routines/vn/triggers/buy_beforeUpdate.sql +++ b/db/routines/vn/triggers/buy_beforeUpdate.sql @@ -13,7 +13,15 @@ trig:BEGIN LEAVE trig; END IF; - CALL entry_isEditable(OLD.entryFk); + IF NOT (NEW.entryFk <=> OLD.entryFk) OR + NOT (NEW.quantity <=> OLD.quantity) OR + NOT (NEW.buyingValue <=> OLD.buyingValue) OR + NOT (NEW.packing <=> OLD.packing) + THEN + + CALL entry_isEditable(OLD.entryFk); + END IF; + SET NEW.editorFk = account.myUser_getId(); SELECT defaultEntry INTO vDefaultEntry diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index 4ce2eecc2..31c6f9bd6 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -7,10 +7,21 @@ BEGIN DECLARE vPrintedCount INT; DECLARE vHasDistinctWarehouses BOOL; DECLARE vTotalBuy INT; - - IF NEW.isBooked = OLD.isBooked THEN + + IF NEW.isBooked = OLD.isBooked AND ( + NOT (NEW.supplierFk <=> OLD.supplierFk) OR + NOT (NEW.dated <=> OLD.dated) OR + NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR + NOT (NEW.travelFk <=> OLD.travelFk) OR + NOT (NEW.companyFk <=> OLD.companyFk) OR + NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR + NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR + NOT (NEW.typeFk <=> OLD.typeFk) + ) THEN + CALL entry_isEditable(OLD.id); ELSE + IF NEW.isBooked THEN SELECT COUNT(*) INTO vTotalBuy FROM buy From b5e139b7348a059436ea72998005ccd8247fe361 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 13 Jun 2024 08:43:11 +0200 Subject: [PATCH 21/22] fix: refs #7039 supplier search-panel country --- modules/supplier/front/search-panel/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/supplier/front/search-panel/index.html b/modules/supplier/front/search-panel/index.html index 161c8a98c..e67fa9083 100644 --- a/modules/supplier/front/search-panel/index.html +++ b/modules/supplier/front/search-panel/index.html @@ -35,7 +35,7 @@ label="Country" ng-model="filter.countryFk" url="countries" - show-field="country" + show-field="name" value-field="id"> From 615fd3e97bfbc9f38a8fc82e1f1d2473ec6284d3 Mon Sep 17 00:00:00 2001 From: ivanm Date: Thu, 13 Jun 2024 15:10:04 +0200 Subject: [PATCH 22/22] refs #7530 delete trigger deviceProductionConfig_afterUpdate --- .../triggers/deviceProductionConfig_afterUpdate.sql | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 db/routines/vn/triggers/deviceProductionConfig_afterUpdate.sql diff --git a/db/routines/vn/triggers/deviceProductionConfig_afterUpdate.sql b/db/routines/vn/triggers/deviceProductionConfig_afterUpdate.sql deleted file mode 100644 index 98e4f844f..000000000 --- a/db/routines/vn/triggers/deviceProductionConfig_afterUpdate.sql +++ /dev/null @@ -1,13 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionConfig_afterUpdate` - AFTER UPDATE ON `deviceProductionConfig` - FOR EACH ROW -BEGIN - IF NEW.isAllUsersAllowed = 1 OR NEW.isAllUsersAllowed = -1 THEN - SET @username := (SELECT account.myUser_getName()); - INSERT INTO vn.mail (receiver, subject, body) - VALUES ('cau@verdnatura.es', 'Se ha activado la autenticación sin restricciones en la app', - CONCAT('El usuario ', @username,' ha habilitado la opción para que todos los usuarios puedan acceder a la app sin restricciones')); - END IF; -END$$ -DELIMITER ;