diff --git a/back/methods/dms/downloadFile.js b/back/methods/dms/downloadFile.js
index d64b15b70..6f2451505 100644
--- a/back/methods/dms/downloadFile.js
+++ b/back/methods/dms/downloadFile.js
@@ -30,7 +30,7 @@ module.exports = Self => {
path: `/:id/downloadFile`,
verb: 'GET'
},
- accessScopes: ['read:multimedia']
+ // accessScopes: ['read:multimedia']
});
Self.downloadFile = async function(ctx, id) {
diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js
index a1776cde5..4aa40197f 100644
--- a/back/methods/docuware/download.js
+++ b/back/methods/docuware/download.js
@@ -43,7 +43,7 @@ module.exports = Self => {
path: `/:id/download`,
verb: 'GET'
},
- accessScopes: ['read:multimedia']
+ // accessScopes: ['read:multimedia']
});
Self.download = async function(id, fileCabinet, filter) {
diff --git a/back/methods/image/download.js b/back/methods/image/download.js
index 201e16164..9ac06f30b 100644
--- a/back/methods/image/download.js
+++ b/back/methods/image/download.js
@@ -48,7 +48,7 @@ module.exports = Self => {
path: `/:collection/:size/:id/download`,
verb: 'GET'
},
- accessScopes: ['read:multimedia']
+ // accessScopes: ['read:multimedia']
});
Self.download = async function(ctx, collection, size, id) {
diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js
index 135774919..e17093839 100644
--- a/back/methods/osticket/sendToSupport.js
+++ b/back/methods/osticket/sendToSupport.js
@@ -46,7 +46,7 @@ module.exports = Self => {
html += `${data}:
${tryParse(additionalData[data])}
`;
const subjectReason = httpRequest?.data?.error;
- smtp.send({
+ await smtp.send({
to: `${config.app.reportEmail}, ${emailUser.email}`,
subject:
'[Support-Salix] ' +
diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql
index 8a419f697..3779a5812 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','10962','5411433e529d50d68b3a0675b1a0a6215ea931ca','2024-03-25 17:47:37','10969');
+INSERT INTO `version` VALUES ('vn-database','10970','7ea917dc4db761955007c73bbd4667a0e44b8e9c','2024-04-05 07:49:24','10981');
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);
@@ -673,14 +673,21 @@ INSERT INTO `versionLog` VALUES ('vn-database','10874','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10876','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10878','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10879','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10880','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10881','00-alterTableNotification.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10881','01-notification.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10882','00-vehicle.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10883','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10884','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10885','00-revokeUpdateClient.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:57',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10887','00-schemaAndUser.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10887','01-tables.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10888','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-16 07:39:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10889','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 09:55:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10891','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10892','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10893','00-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10896','01-financialProductType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10896','02-flight.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10896','03-gastos_resumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:00',NULL,NULL);
@@ -706,6 +713,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10913','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10914','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-28 11:52:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10915','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10918','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:27',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10919','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10922','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-29 13:44:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10923','00-createParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10923','01-aclParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
@@ -714,13 +722,32 @@ INSERT INTO `versionLog` VALUES ('vn-database','10925','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10926','00-refactorClaimState.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10928','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:52',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10929','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:16:19',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10932','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10940','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-06 16:48:18',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10941','00-restoreVn2008Jerarquia.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 09:36:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10942','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 10:24:45',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10943','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 10:29:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10946','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-08 07:56:17',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','00-account.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','01-bs.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','02-edi.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','03-hedera.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','04-pbx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','05-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','06-salix.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','06-srt.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','07-util.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:56',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn2.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10956','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10957','00-aclTicketClone.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10959','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-18 13:32:25',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10962','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-25 08:27:35',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10968','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10969','00-aclSupplierDms.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10970','00-specialPrice.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10975','00-action.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:03:46',NULL,NULL);
+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);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -736,7 +763,7 @@ INSERT INTO `role` VALUES (2,'customer','Privilegios básicos de un cliente',1,'
INSERT INTO `role` VALUES (3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
INSERT INTO `role` VALUES (5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
INSERT INTO `role` VALUES (6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
-INSERT INTO `role` VALUES (9,'developer','Desarrolladores del sistema',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
+INSERT INTO `role` VALUES (9,'developer','Desarrollador raso',1,'2017-05-19 09:04:58','2024-03-27 14:14:58',1437);
INSERT INTO `role` VALUES (11,'account','Privilegios relacionados con el login',0,'2017-05-19 09:04:58','2017-09-20 19:06:35',NULL);
INSERT INTO `role` VALUES (13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 09:04:58','2021-06-30 15:29:30',NULL);
INSERT INTO `role` VALUES (15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 09:04:58','2018-02-12 11:50:10',NULL);
@@ -1309,7 +1336,7 @@ INSERT INTO `ACL` VALUES (274,'InvoiceInLog','*','READ','ALLOW','ROLE','administ
INSERT INTO `ACL` VALUES (275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing');
INSERT INTO `ACL` VALUES (276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing');
INSERT INTO `ACL` VALUES (278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant');
-INSERT INTO `ACL` VALUES (279,'MailAlias','*','*','ALLOW','ROLE','marketing');
+INSERT INTO `ACL` VALUES (279,'MailAlias','*','READ','ALLOW','ROLE','marketing');
INSERT INTO `ACL` VALUES (283,'EntryObservation','*','*','ALLOW','ROLE','buyer');
INSERT INTO `ACL` VALUES (284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin');
INSERT INTO `ACL` VALUES (285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin');
@@ -1777,7 +1804,7 @@ INSERT INTO `ACL` VALUES (804,'DeviceProduction','*','READ','ALLOW','ROLE','empl
INSERT INTO `ACL` VALUES (805,'Collection','assign','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (806,'ExpeditionPallet','getPallet','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (807,'MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production');
-INSERT INTO `ACL` VALUES (808,'MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (808,'MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (809,'SaleTracking','delete','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (810,'SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (811,'SaleTracking','setPicked','WRITE','ALLOW','ROLE','production');
@@ -1789,6 +1816,10 @@ INSERT INTO `ACL` VALUES (816,'WorkerActivity','*','*','ALLOW','ROLE','productio
INSERT INTO `ACL` VALUES (817,'ParkingLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (818,'ExpeditionPallet','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (819,'Ticket','addSaleByCode','WRITE','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (820,'TicketCollection','*','READ','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (821,'Ticket','clone','WRITE','ALLOW','ROLE','administrative');
+INSERT INTO `ACL` VALUES (822,'SupplierDms','*','*','ALLOW','ROLE','employee');
+INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','developer');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@@ -2492,7 +2523,7 @@ USE `cache`;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `cache` VALUES (1,'equalizator','00:19:00');
-INSERT INTO `cache` VALUES (2,'available','00:06:00');
+INSERT INTO `cache` VALUES (2,'available','00:01:00');
INSERT INTO `cache` VALUES (3,'stock','00:30:00');
INSERT INTO `cache` VALUES (4,'last_buy','23:59:00');
INSERT INTO `cache` VALUES (5,'weekly_sales','12:00:00');
diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql
index 3aea52588..8293cc74c 100644
--- a/db/dump/.dump/privileges.sql
+++ b/db/dump/.dump/privileges.sql
@@ -45,6 +45,7 @@ INSERT IGNORE INTO `db` VALUES ('','account','salix','Y','Y','Y','Y','N','N','N
INSERT IGNORE INTO `db` VALUES ('','mysql','salix','Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','psico','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','geo','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
+INSERT IGNORE INTO `db` VALUES ('','floranet','developer','Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','tmp','guest','Y','Y','Y','Y','N','Y','N','N','N','N','Y','N','N','N','N','N','N','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','util','salix','Y','Y','Y','Y','N','N','N','N','N','N','Y','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','dipole','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
@@ -77,6 +78,7 @@ INSERT IGNORE INTO `db` VALUES ('','bi','developer','Y','Y','Y','Y','N','N','N'
INSERT IGNORE INTO `db` VALUES ('','util','grafana','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','mysql','developerBoss','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','rfid','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
+INSERT IGNORE INTO `db` VALUES ('','floranet','floranet','N','N','N','N','N','N','N','N','N','N','Y','Y','N','N','N','N','Y','N','N','N');
/*!40000 ALTER TABLE `db` ENABLE KEYS */;
/*!40000 ALTER TABLE `tables_priv` DISABLE KEYS */;
@@ -777,7 +779,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 ('','vn','financial','vehicle','alexm@%','0000-00-00 00:00:00','Update','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicle','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update,Delete','');
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','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','');
@@ -1373,6 +1375,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accounting',
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accounting','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleState','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','expeditionState','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','specialPrice','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@@ -1657,9 +1662,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','guest','myUser_checkLogin
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','lang','FUNCTION','juan@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofmonth','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','account_conciliacion_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','add_awb_component','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','productionAssi','agencyModeImbalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
@@ -1686,7 +1689,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTIO
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');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','client_checkBalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','addressTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','absoluteInventoryHistory','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','client_getSalesPersonByTicket','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','pbx','developer','clientFromPhone','FUNCTION','juan@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','production','log_addWithUser','PROCEDURE','juan@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@@ -1694,6 +1697,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_ad
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_delete','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_move','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getSuppliersDebt','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','multipleInventoryHistory','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','bi','salesAssistant','defaultersFromDate','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updatepacking','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updategrouping','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@@ -1712,8 +1716,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaInvoiceInB
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');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@@ -1792,7 +1794,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','zone_getstate','PRO
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_gethierarchy','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workertimecontrol_weekcheckbreak','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','ticket_split','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','add_awb_component','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','saletracking_new','PROCEDURE','alexm@pc325.algemesi.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticketnotinvoicedbyclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','workerjourney_replace','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@@ -2047,6 +2048,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"vers
INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}');
diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql
index db8d543b4..5cc320fd4 100644
--- a/db/dump/.dump/structure.sql
+++ b/db/dump/.dump/structure.sql
@@ -48,7 +48,7 @@ DROP TABLE IF EXISTS `accountConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accountConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`homedir` varchar(50) NOT NULL COMMENT 'The base folder for users home directory',
`shell` varchar(50) NOT NULL COMMENT 'The default shell',
`idBase` int(11) NOT NULL COMMENT 'Base id for Posix users and groups',
@@ -56,7 +56,8 @@ CREATE TABLE `accountConfig` (
`max` smallint(6) NOT NULL COMMENT 'Maximum password age (seconds)',
`warn` smallint(6) NOT NULL COMMENT 'Warn to change password when elapsed (seconds)',
`inact` smallint(6) NOT NULL COMMENT 'Maximum inactivity time (seconds)',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `accountConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -113,13 +114,14 @@ DROP TABLE IF EXISTS `ldapConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ldapConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`server` varchar(255) NOT NULL COMMENT 'The LDAP server access url',
`rdn` varchar(255) NOT NULL COMMENT 'The LDAP user',
`password` varchar(255) NOT NULL COMMENT 'The LDAP password',
`userDn` varchar(255) DEFAULT NULL COMMENT 'The base DN for users',
`groupDn` varchar(255) DEFAULT NULL COMMENT 'The base DN for groups',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `ldapConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='LDAP server configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -204,9 +206,10 @@ DROP TABLE IF EXISTS `mailConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mailConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`domain` varchar(255) NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `mailConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -306,13 +309,14 @@ DROP TABLE IF EXISTS `roleConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `roleConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier',
+ `id` int(10) unsigned NOT NULL,
`mysqlPassword` varchar(255) NOT NULL COMMENT 'The password used for MySQL user roles, base64 encoded',
`rolePrefix` char(2) NOT NULL,
`userPrefix` char(2) DEFAULT NULL,
`userHost` varchar(255) NOT NULL,
`tplUser` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `roleConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Role configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -389,14 +393,15 @@ DROP TABLE IF EXISTS `sambaConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sambaConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`adDomain` varchar(255) NOT NULL COMMENT 'Active directory domain',
`adController` varchar(255) NOT NULL COMMENT 'The hosname of domain controller',
`adUser` varchar(255) DEFAULT NULL COMMENT 'Active directory user',
`adPassword` varchar(255) DEFAULT NULL COMMENT 'Active directory password',
`verifyCert` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Whether to verify server certificate',
`userDn` varchar(255) NOT NULL COMMENT 'Base DN for users without domain DN part',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `sambaConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -473,9 +478,10 @@ DROP TABLE IF EXISTS `userConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `userConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`loginKey` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `userConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -4562,9 +4568,10 @@ DROP TABLE IF EXISTS `nightTaskConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nightTaskConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`logMail` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `nightTaskConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -4962,10 +4969,11 @@ DROP TABLE IF EXISTS `workerProductivityConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `workerProductivityConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`minSeconsPackager` int(11) DEFAULT NULL,
`minSeconsItemPicker` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `workerProductivityConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -9428,14 +9436,15 @@ DROP TABLE IF EXISTS `exchangeConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `exchangeConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`logMail` varchar(150) DEFAULT NULL COMMENT 'Mail where the log information is sent',
`restrictToSenders` tinyint(4) NOT NULL COMMENT 'Whether to process mails only from known senders',
`presaleFk` mediumint(8) unsigned DEFAULT NULL,
`defaultKop` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `presale_id` (`presaleFk`),
- CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `exchangeConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -9509,11 +9518,12 @@ DROP TABLE IF EXISTS `ftpConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ftpConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`host` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`user` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`password` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `ftpConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -9813,9 +9823,10 @@ DROP TABLE IF EXISTS `offerRefreshConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `offerRefreshConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`dayRange` int(10) unsigned DEFAULT NULL COMMENT 'range of days to update the photos of an article in seconds',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `offerRefreshConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -11774,7 +11785,7 @@ DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`defaultLang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The default language if none is specified',
`https` tinyint(3) unsigned NOT NULL COMMENT 'Wether to force de use of HTTPS',
`cookieLife` smallint(5) unsigned NOT NULL COMMENT 'The cookies life, in days',
@@ -11788,7 +11799,8 @@ CREATE TABLE `config` (
`pdfsDir` varchar(255) NOT NULL COMMENT 'Directory where PDFs are allocated',
`dmsDir` varchar(255) DEFAULT NULL COMMENT 'Directory where documents are allocated',
PRIMARY KEY (`id`),
- KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.'
+ KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.',
+ CONSTRAINT `config_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -11881,11 +11893,12 @@ DROP TABLE IF EXISTS `imageConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `imageConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier',
+ `id` tinyint(3) unsigned NOT NULL,
`maxSize` int(10) unsigned NOT NULL COMMENT 'Maximun size for uploaded images in MB',
`useXsendfile` tinyint(4) NOT NULL COMMENT 'Whether to use the apache module XSendfile',
`url` varchar(255) NOT NULL COMMENT 'Public URL where image are hosted',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `imageConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Global image parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -11952,7 +11965,7 @@ DROP TABLE IF EXISTS `mailConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mailConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier',
+ `id` tinyint(3) unsigned NOT NULL,
`host` varchar(255) NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host',
`port` smallint(6) NOT NULL DEFAULT 465 COMMENT 'SMTP port',
`secure` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Wether to use a secure connection',
@@ -11960,7 +11973,8 @@ CREATE TABLE `mailConfig` (
`senderName` varchar(75) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The sender name',
`user` varchar(50) DEFAULT NULL COMMENT 'SMTP user',
`password` varchar(100) DEFAULT NULL COMMENT 'SMTP password, base64 encoded',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `mailConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -12407,7 +12421,7 @@ DROP TABLE IF EXISTS `orderConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `orderConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`employeeFk` int(10) unsigned NOT NULL,
`defaultAgencyFk` int(11) DEFAULT NULL,
`guestMethod` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
@@ -12423,7 +12437,8 @@ CREATE TABLE `orderConfig` (
CONSTRAINT `orderConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE,
CONSTRAINT `orderConfig_ibfk_1` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE,
CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`)
+ CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`),
+ CONSTRAINT `orderConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -12674,7 +12689,7 @@ DROP TABLE IF EXISTS `tpvConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tpvConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`currency` smallint(5) unsigned NOT NULL,
`terminal` tinyint(3) unsigned NOT NULL,
`transactionType` tinyint(3) unsigned NOT NULL,
@@ -12687,7 +12702,8 @@ CREATE TABLE `tpvConfig` (
`merchantUrl` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `employee_id` (`employeeFk`),
- CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `tpvConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Virtual TPV parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -12713,14 +12729,15 @@ DROP TABLE IF EXISTS `tpvImapConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tpvImapConfig` (
- `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `id` tinyint(3) unsigned NOT NULL,
`host` varchar(150) NOT NULL,
`user` varchar(50) NOT NULL,
`pass` varchar(50) NOT NULL,
`cleanPeriod` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`successFolder` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`errorFolder` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `tpvImapConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -13090,7 +13107,7 @@ BEGIN
WHERE c.available > 0
GROUP BY c.item_id;
- CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode);
+ CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode, FALSE);
DROP TEMPORARY TABLE tmp.item;
END ;;
@@ -13194,7 +13211,7 @@ BEGIN
ENGINE = MEMORY
SELECT vSelf itemFk;
- CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
+ CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
SELECT l.warehouseFk, w.name warehouse,
p.`grouping`, p.price, p.rate, l.available
@@ -14370,7 +14387,7 @@ BEGIN
WHERE orderFk = vSelf
GROUP BY itemFk;
- CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
+ CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
DROP TEMPORARY TABLE tmp.item;
END ;;
@@ -14452,7 +14469,7 @@ BEGIN
FROM `order`
WHERE id = vSelf;
- CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
+ CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
IF account.myUser_getName() = 'visitor' THEN
UPDATE tmp.ticketCalculateItem
@@ -16137,10 +16154,11 @@ DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`sundayFestive` tinyint(4) NOT NULL,
`countryPrefix` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `config_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -16183,13 +16201,14 @@ DROP TABLE IF EXISTS `followmeConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `followmeConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`music` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`context` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`takeCall` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`declineCall` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`timeout` int(11) NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `followmeConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -16400,7 +16419,7 @@ DROP TABLE IF EXISTS `sipConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sipConfig` (
- `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `id` mediumint(8) unsigned NOT NULL,
`host` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`deny` varchar(95) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`permit` varchar(95) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
@@ -16421,7 +16440,8 @@ CREATE TABLE `sipConfig` (
`disallow` varchar(100) DEFAULT 'all',
`allow` varchar(100) DEFAULT 'g729;ilbc;gsm;ulaw;alaw',
`qualify` enum('yes','no') DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `sipConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Default values for SIP accounts';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -17431,13 +17451,14 @@ DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`pendingTaxAccount` varchar(100) DEFAULT NULL COMMENT 'Cuenta contable IVA pendiente',
`nontaxableTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Operaciones exentas',
`pendingServiceTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Import. bienes y serv. corrientes pdte. liquidar',
`definitiveExportTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Exportaciones definitivas',
`shipmentTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Envíos definitivos a Canarias, Ceuta y Melilla',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `config_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -19487,11 +19508,12 @@ DROP TABLE IF EXISTS `accessTokenConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accessTokenConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`renewPeriod` int(10) unsigned DEFAULT NULL,
`courtesyTime` int(10) unsigned DEFAULT NULL,
`renewInterval` int(10) unsigned DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `accessTokenConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -19563,10 +19585,11 @@ DROP TABLE IF EXISTS `printConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `printConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`itRecipient` varchar(50) DEFAULT NULL COMMENT 'IT recipients for report mailing',
`incidencesEmail` varchar(50) DEFAULT NULL COMMENT 'CAU destinatary email',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `printConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Print service config';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -19858,7 +19881,7 @@ CREATE TABLE `config` (
`bufferWidthMargin` int(11) NOT NULL DEFAULT 100 COMMENT 'margen mínimo para que una caja pueda entrar en un buffer',
`bufferDefault` int(11) NOT NULL DEFAULT 26 COMMENT 'buffer por defecto si no se encuentra otro',
`bufferLength` int(11) NOT NULL DEFAULT 13000 COMMENT 'Longitud de los buffers, en mm',
- `id` int(11) NOT NULL DEFAULT 1,
+ `id` int(10) unsigned NOT NULL,
`maxBoxesInBuffer` int(11) NOT NULL DEFAULT 8 COMMENT 'max numero de cajas por buffer para declararlo full',
`isEnteringBlocked` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'bloquea la entrada de nuevas cajas al sorter',
`isAuto` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'deja el sorter en auto por un buffer',
@@ -19876,7 +19899,8 @@ CREATE TABLE `config` (
`isBalanced` tinyint(1) NOT NULL DEFAULT 1,
`testMode` tinyint(1) NOT NULL DEFAULT 0,
`isAllowedUnloading` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Permite que se pueda cambiar el mode de los buffers a UNLOADING',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `config_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -19959,6 +19983,8 @@ CREATE TABLE `expeditionLog` (
PRIMARY KEY (`id`),
KEY `expeditionLog_FK_1` (`bufferFk`),
KEY `expeditionLog_FK_2` (`antennaFk`),
+ KEY `expeditionLog_action_IDX` (`action`) USING BTREE,
+ KEY `expeditionLog_expeditionFk_IDX` (`expeditionFk`) USING BTREE,
CONSTRAINT `expeditionLog_FK_1` FOREIGN KEY (`bufferFk`) REFERENCES `buffer` (`id`) ON UPDATE CASCADE,
CONSTRAINT `expeditionLog_FK_2` FOREIGN KEY (`antennaFk`) REFERENCES `antenna` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
@@ -24422,7 +24448,7 @@ DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`dbVersion` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The current database version',
`hasTriggersDisabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Defines if triggers are disabled',
`environment` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The current Database environment',
@@ -24430,7 +24456,8 @@ CREATE TABLE `config` (
`mockUtcTime` datetime DEFAULT NULL,
`mockTime` datetime DEFAULT NULL,
`mockEnabled` tinyint(3) unsigned NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `config_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration table';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -24494,7 +24521,7 @@ DROP TABLE IF EXISTS `notification`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `notification` (
- `id` int(11) NOT NULL,
+ `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
@@ -24527,9 +24554,10 @@ DROP TABLE IF EXISTS `notificationConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `notificationConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`cleanDays` mediumint(9) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `notificationConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -24601,9 +24629,10 @@ DROP TABLE IF EXISTS `versionConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `versionConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`realm` varchar(16) DEFAULT NULL COMMENT 'Data set on which the project runs',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `versionConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -26608,10 +26637,11 @@ DROP TABLE IF EXISTS `accountingConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accountingConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`minDate` date NOT NULL,
`maxDate` date NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `accountingConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27041,12 +27071,13 @@ DROP TABLE IF EXISTS `auctionConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auctionConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`conversionCoefficient` double NOT NULL DEFAULT 1 COMMENT 'value used to calculate the used space of an item in a container',
`warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 7 COMMENT 'Default warehouse used for the calculation',
PRIMARY KEY (`id`),
KEY `auctionConfig_FK` (`warehouseFk`),
- CONSTRAINT `auctionConfig_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`)
+ CONSTRAINT `auctionConfig_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`),
+ CONSTRAINT `auctionConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27058,13 +27089,14 @@ DROP TABLE IF EXISTS `autoRadioConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `autoRadioConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`password` varchar(45) DEFAULT NULL,
`user` varchar(45) DEFAULT NULL,
`url` varchar(75) DEFAULT NULL,
`client` int(32) DEFAULT NULL,
`center` varchar(2) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `autoRadioConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27371,10 +27403,11 @@ DROP TABLE IF EXISTS `bankEntityConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bankEntityConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`bicLength` tinyint(4) DEFAULT 11 COMMENT 'Tamaño del campo bic',
`defaultBankId` int(11) NOT NULL DEFAULT 3117 COMMENT 'Id del banco por defecto',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `bankEntityConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27459,12 +27492,13 @@ DROP TABLE IF EXISTS `bionicConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bionicConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`generalInflationCoeficient` double(10,2) NOT NULL,
`minimumDensityVolumetricWeight` double(10,2) NOT NULL,
`verdnaturaVolumeBox` int(11) NOT NULL,
`itemCarryBox` int(11) NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `bionicConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27765,9 +27799,9 @@ CREATE TABLE `buy` (
`freightValue` decimal(10,3) NOT NULL DEFAULT 0.000,
`isIgnored` tinyint(1) NOT NULL DEFAULT 0,
`stickers` int(11) NOT NULL DEFAULT 0,
- `packing` int(11) DEFAULT 0,
+ `packing` int(11) NOT NULL DEFAULT 1 CHECK (`packing` > 0),
`grouping` smallint(5) unsigned NOT NULL DEFAULT 1,
- `groupingMode` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=sin obligar 1=groping 2=packing',
+ `groupingMode` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=sin obligar 1=grouping 2=packing',
`containerFk` smallint(5) unsigned DEFAULT NULL,
`comissionValue` decimal(10,3) NOT NULL DEFAULT 0.000,
`packageValue` decimal(10,3) NOT NULL DEFAULT 0.000,
@@ -27789,6 +27823,7 @@ CREATE TABLE `buy` (
`itemOriginalFk` int(11) DEFAULT NULL COMMENT 'Item original de la entrada',
`editorFk` int(10) unsigned DEFAULT NULL,
`packageFk` varchar(10) GENERATED ALWAYS AS (`packagingFk`) VIRTUAL,
+ `buyerFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `CompresId_Trabajador` (`workerFk`),
KEY `Id_Cubo` (`packagingFk`),
@@ -27820,9 +27855,10 @@ DROP TABLE IF EXISTS `buyConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `buyConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`monthsAgo` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la última compra',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `buyConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -27992,6 +28028,7 @@ CREATE TABLE `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` varchar(45) NOT NULL,
`nick` varchar(3) NOT NULL,
+ `name` varchar(45) GENERATED ALWAYS AS (`description`) VIRTUAL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -28046,12 +28083,13 @@ DROP TABLE IF EXISTS `chatConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chatConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`host` varchar(255) NOT NULL,
`api` varchar(255) NOT NULL,
`user` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `chatConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -28122,9 +28160,10 @@ DROP TABLE IF EXISTS `claimConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `claimConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`maxResponsibility` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `claimConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -28529,7 +28568,7 @@ DROP TABLE IF EXISTS `clientConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clientConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`riskTolerance` int(11) DEFAULT NULL COMMENT 'Maximo riesgo de un cliente para preparar su pedido',
`maxCreditRows` int(11) DEFAULT NULL COMMENT 'Máximo número de registros a mantener en la tabla clientCredit',
`maxPriceIncreasingRatio` decimal(2,2) NOT NULL DEFAULT 0.25 COMMENT 'máximo recobro permitido',
@@ -28544,7 +28583,8 @@ CREATE TABLE `clientConfig` (
KEY `clientNewConfigPayMethod_FK` (`defaultPayMethodFk`),
KEY `clientNewConfigMandateType_FK` (`defaultMandateTypeFk`),
CONSTRAINT `clientNewConfigMandateType_FK` FOREIGN KEY (`defaultMandateTypeFk`) REFERENCES `mandateType` (`id`),
- CONSTRAINT `clientNewConfigPayMethod_FK` FOREIGN KEY (`defaultPayMethodFk`) REFERENCES `payMethod` (`id`)
+ CONSTRAINT `clientNewConfigPayMethod_FK` FOREIGN KEY (`defaultPayMethodFk`) REFERENCES `payMethod` (`id`),
+ CONSTRAINT `clientConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -29174,7 +29214,7 @@ CREATE TABLE `company` (
`stamp` longblob DEFAULT NULL,
`created` timestamp NOT NULL ON UPDATE current_timestamp(),
`clientFk` int(11) DEFAULT NULL,
- `sage200Company` int(2) DEFAULT NULL,
+ `sage200Company__` int(2) DEFAULT NULL COMMENT '@deprecated 06/03/2024',
`supplierAccountFk` mediumint(8) unsigned DEFAULT NULL COMMENT 'Cuenta por defecto para ingresos desde este pais',
`isDefaulter` tinyint(4) NOT NULL DEFAULT 0,
`companyGroupFk` int(11) NOT NULL DEFAULT 1 COMMENT 'usado para calcular los greuges ',
@@ -29276,10 +29316,11 @@ DROP TABLE IF EXISTS `comparativeAddConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `comparativeAddConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`period` int(10) unsigned DEFAULT NULL COMMENT 'The number of periods to be regressed for insertion in vn.comparative',
`week` int(10) unsigned DEFAULT NULL COMMENT 'The number of weeks to exceed for recalculating the last period',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `comparativeAddConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -29291,12 +29332,13 @@ DROP TABLE IF EXISTS `comparativeConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `comparativeConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`defaultDayRange` int(10) unsigned DEFAULT NULL COMMENT 'Rango de días predeterminado si no se especifica',
`weekRange` int(10) unsigned DEFAULT NULL COMMENT 'La cantidad de semanas que se restarán y sumarán',
`maxDayRange` int(10) unsigned DEFAULT NULL COMMENT 'El rango máximo de días antes de utilizar el rango de días predeterminado',
`minDayRange` int(10) unsigned DEFAULT NULL COMMENT 'El rango mínimo de días antes de utilizar el rango de días predeterminado',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `comparativeConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -29407,7 +29449,7 @@ DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`ochoa` int(10) unsigned NOT NULL,
`invoiceOutFk` int(11) DEFAULT 0,
`inventoried` datetime DEFAULT NULL,
@@ -29446,7 +29488,8 @@ CREATE TABLE `config` (
`comparativeLastBuyScope` int(11) DEFAULT NULL COMMENT 'Rango en el que se busca la última entrada de un artículo',
`mainWarehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60,
PRIMARY KEY (`id`),
- KEY `fechainv_idx` (`inventoried`)
+ KEY `fechainv_idx` (`inventoried`),
+ CONSTRAINT `config_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -30166,10 +30209,11 @@ DROP TABLE IF EXISTS `deviceProductionConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `deviceProductionConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`isAllUsersallowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Permite que cualquier usuario pueda loguearse',
`isTractorHuntingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Habilita el modo cazador para usuarios que no se han logeado un tractor para sacar',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `deviceProductionConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -30388,10 +30432,11 @@ DROP TABLE IF EXISTS `docuwareConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `docuwareConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`url` varchar(75) DEFAULT NULL,
`cookie` varchar(1000) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `docuwareConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -31719,7 +31764,7 @@ DROP TABLE IF EXISTS `floramondoConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `floramondoConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`nextLanded` datetime DEFAULT NULL,
`warehouseInFk` smallint(6) unsigned DEFAULT NULL,
`MaxLatestDeliveryHour` int(11) DEFAULT NULL,
@@ -31729,7 +31774,8 @@ CREATE TABLE `floramondoConfig` (
`daysToKeepItem` int(4) DEFAULT NULL COMMENT 'Número de dias para mantener artículos',
PRIMARY KEY (`id`),
KEY `floramondoConfigWarehouseIn_idx` (`warehouseInFk`),
- CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `floramondoConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -31764,9 +31810,10 @@ DROP TABLE IF EXISTS `franceExpressConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `franceExpressConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`path` varchar(100) DEFAULT '\\\\server\\agencies\\franceexpress\\expeditions',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `franceExpressConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -31860,7 +31907,7 @@ DROP TABLE IF EXISTS `glsConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `glsConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`service` int(1) DEFAULT NULL,
`schedule` int(1) DEFAULT NULL,
`token` varchar(45) DEFAULT NULL,
@@ -31870,7 +31917,8 @@ CREATE TABLE `glsConfig` (
`refund` int(1) DEFAULT NULL,
`weight` int(1) DEFAULT NULL,
`density` int(11) NOT NULL DEFAULT 42,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `glsConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -31933,12 +31981,13 @@ DROP TABLE IF EXISTS `greugeConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `greugeConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`freightPickUpPrice` decimal(10,2) NOT NULL,
`yearsToDelete` int(11) DEFAULT NULL,
`maxPercentToWrong` decimal(10,2) DEFAULT NULL COMMENT 'Porcentaje del precio del ticket que es considerado error',
`lastNotifyCheck` timestamp NULL DEFAULT NULL COMMENT 'Última ejecución del procedimiento que revisa los greuges anormales',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `greugeConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -32149,7 +32198,7 @@ DROP TABLE IF EXISTS `inventoryConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `inventoryConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`maxRecentInventories` int(11) DEFAULT NULL COMMENT 'The maximum number of recent inventories to retain without deletion',
`daysInPastForInventory` int(11) DEFAULT NULL COMMENT 'The number of days in the past to consider for inventory calculations',
`warehouseOutFk` smallint(6) unsigned DEFAULT NULL COMMENT 'The identifier for the inventory output warehouse',
@@ -32161,7 +32210,8 @@ CREATE TABLE `inventoryConfig` (
KEY `inventoryConfig_agencyMode_FK` (`agencyModeFk`),
CONSTRAINT `inventoryConfig_agencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`),
CONSTRAINT `inventoryConfig_supplier_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`),
- CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`)
+ CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`),
+ CONSTRAINT `inventoryConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -32340,7 +32390,7 @@ DROP TABLE IF EXISTS `invoiceInConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `invoiceInConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`retentionRate` int(3) NOT NULL,
`retentionName` varchar(25) NOT NULL,
`sageWithholdingFk` smallint(6) NOT NULL,
@@ -32348,7 +32398,8 @@ CREATE TABLE `invoiceInConfig` (
`taxRowLimit` int(11) DEFAULT 4 COMMENT 'Número máximo de líneas de IVA que puede tener una factura',
PRIMARY KEY (`id`),
KEY `invoiceInConfig_sageWithholdingFk` (`sageWithholdingFk`),
- CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `invoiceInConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -32621,10 +32672,11 @@ DROP TABLE IF EXISTS `invoiceOutConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `invoiceOutConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`parallelism` int(10) unsigned NOT NULL DEFAULT 1,
`refLen` tinyint(3) unsigned NOT NULL DEFAULT 5 COMMENT 'Invoice reference identifier length',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `invoiceOutConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -32972,7 +33024,7 @@ DROP TABLE IF EXISTS `itemConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `itemConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`isItemTagTriggerDisabled` tinyint(1) NOT NULL DEFAULT 1,
`monthToDeactivate` int(3) NOT NULL DEFAULT 24,
`wasteRecipients` varchar(50) NOT NULL COMMENT 'Weekly waste report schedule recipients',
@@ -32983,7 +33035,8 @@ CREATE TABLE `itemConfig` (
`downloadMaxAttempts` tinyint(3) DEFAULT NULL COMMENT 'Intentos máximos para que se borre',
PRIMARY KEY (`id`),
KEY `itemConfig_FK` (`defaultTag`),
- CONSTRAINT `itemConfig_FK` FOREIGN KEY (`defaultTag`) REFERENCES `tag` (`id`)
+ CONSTRAINT `itemConfig_FK` FOREIGN KEY (`defaultTag`) REFERENCES `tag` (`id`),
+ CONSTRAINT `itemConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -33287,7 +33340,7 @@ CREATE TABLE `itemShelving` (
`visible` int(11) NOT NULL DEFAULT 0,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`grouping` smallint(5) unsigned DEFAULT NULL,
- `packing` int(11) unsigned DEFAULT NULL,
+ `packing` int(11) NOT NULL DEFAULT 1 CHECK (`packing` > 0),
`packagingFk` varchar(10) DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`isChecked` tinyint(1) DEFAULT NULL COMMENT 'Este valor cambia al escanear un carro. True: Existe. False: Nuevo. Null: No escaneado',
@@ -34024,9 +34077,10 @@ DROP TABLE IF EXISTS `machineWorkerConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `machineWorkerConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`maxHours` smallint(5) unsigned NOT NULL COMMENT 'Indicates how many hours a user record is reviewed to update or insert',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `machineWorkerConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -34174,11 +34228,12 @@ DROP TABLE IF EXISTS `mdbConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mdbConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`issueTrackerUrl` varchar(255) NOT NULL,
`issueNumberRegex` varchar(255) NOT NULL,
`chatDestination` varchar(255) NOT NULL COMMENT 'User (@) or channel (#) to send the message',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `mdbConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for Access';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -34401,13 +34456,14 @@ DROP TABLE IF EXISTS `mrwConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mrwConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`url` varchar(100) DEFAULT NULL,
`user` varchar(100) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`franchiseCode` varchar(100) DEFAULT NULL,
`subscriberCode` varchar(100) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `mrwConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -34668,7 +34724,7 @@ DROP TABLE IF EXISTS `osTicketConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `osTicketConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`host` varchar(100) DEFAULT NULL,
`user` varchar(100) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
@@ -34683,7 +34739,8 @@ CREATE TABLE `osTicketConfig` (
`responseType` varchar(100) DEFAULT NULL,
`fromEmailId` int(11) DEFAULT NULL,
`replyTo` varchar(100) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `osTicketConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -34800,7 +34857,7 @@ DROP TABLE IF EXISTS `packagingConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `packagingConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`upperGap` int(11) NOT NULL,
`previousPreparationMinimumSize` int(11) NOT NULL,
`defaultConveyorBuildingClass` int(11) NOT NULL,
@@ -34813,7 +34870,8 @@ CREATE TABLE `packagingConfig` (
KEY `packagingConfig_FK` (`defaultSmallPackageFk`),
KEY `packagingConfig_FK_1` (`defaultBigPackageFk`),
CONSTRAINT `packagingConfig_FK` FOREIGN KEY (`defaultSmallPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `packagingConfig_FK_1` FOREIGN KEY (`defaultBigPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `packagingConfig_FK_1` FOREIGN KEY (`defaultBigPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `packagingConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -34939,12 +34997,13 @@ DROP TABLE IF EXISTS `packingSiteConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `packingSiteConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`shinobiUrl` varchar(255) NOT NULL,
`shinobiToken` varchar(255) NOT NULL,
`shinobiGroupKey` varchar(255) NOT NULL,
`avgBoxingTime` int(3) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `packingSiteConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -35769,7 +35828,7 @@ CREATE TABLE `productionConfig` (
`ticketTrolleyMax` int(10) unsigned NOT NULL DEFAULT 4 COMMENT 'numero máximo de tickets por carro para asignar baldas en una colección',
`rookieDays` int(11) NOT NULL DEFAULT 3 COMMENT 'dias en que se cuida con especial cuidado los pedidos de un cliente por ser nuevo o recuperado',
`notBuyingMonths` int(11) NOT NULL DEFAULT 3 COMMENT 'numero de meses que han de pasar desde su ultima compra para considerar nueva la siguiente compra',
- `id` int(11) NOT NULL DEFAULT 1,
+ `id` int(10) unsigned NOT NULL,
`isZoneClosedByExpeditionActivated` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'activa el procedimiento vn.zone_getClosed',
`maxNotReadyCollections` int(11) NOT NULL DEFAULT 5,
`minTicketsToCloseZone` int(11) DEFAULT 15 COMMENT 'mínimo numero de tickets que deben de tener expediciones para cerrar una zona',
@@ -35794,7 +35853,8 @@ CREATE TABLE `productionConfig` (
KEY `productionConfig_FK_2` (`addressSelfConsumptionFk`),
CONSTRAINT `productionConfig_FK` FOREIGN KEY (`shortageAddressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE,
CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `productionConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -35861,12 +35921,10 @@ DROP TABLE IF EXISTS `professionalCategory`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `professionalCategory` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(50) NOT NULL,
- `level` int(11) unsigned DEFAULT NULL,
- `dayBreak` int(11) unsigned DEFAULT NULL,
+ `description` varchar(50) NOT NULL,
`code` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`),
- UNIQUE KEY `prefessionalCategory_UN` (`name`),
+ UNIQUE KEY `prefessionalCategory_UN` (`description`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -36111,6 +36169,23 @@ CREATE TABLE `punchState` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Table for storing punches that have cars with errors';
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `quality`
+--
+
+DROP TABLE IF EXISTS `quality`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `quality` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(50) DEFAULT NULL,
+ `isVisible` tinyint(1) NOT NULL DEFAULT 1,
+ `created` timestamp NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name_UNIQUE` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Valores usados en el tag calidad';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `queuePriority`
--
@@ -36171,12 +36246,13 @@ DROP TABLE IF EXISTS `rateConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `rateConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`rate0` int(11) DEFAULT NULL,
`rate1` int(11) DEFAULT NULL,
`rate2` int(11) DEFAULT NULL,
`rate3` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `rateConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -36636,7 +36712,8 @@ CREATE TABLE `routeConfig` (
`truckerBusinessProfessionalCategoryFk` int(11) NOT NULL DEFAULT 42,
PRIMARY KEY (`id`),
KEY `routeConfigCompany_Fk` (`defaultCompanyFk`),
- CONSTRAINT `routeConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`)
+ CONSTRAINT `routeConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`),
+ CONSTRAINT `routeConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -37301,13 +37378,14 @@ DROP TABLE IF EXISTS `salespersonConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `salespersonConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`manaMaxRate` decimal(3,2) DEFAULT 0.05 COMMENT 'Valor máximo a recficar en una línea por el maná de un comercial',
`manaMinRate` decimal(3,2) DEFAULT -0.05 COMMENT 'Valor mínimo a recficar en una línea por el maná de un comercial',
`manaDateFrom` date NOT NULL DEFAULT '2023-01-01' COMMENT 'first date to count mana',
`manaFromDays` int(11) NOT NULL DEFAULT 90 COMMENT 'Range of days from mana calculation',
`manaToDays` int(11) NOT NULL DEFAULT 30 COMMENT 'Range of days to mana calculation',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `salespersonConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -37513,10 +37591,11 @@ DROP TABLE IF EXISTS `sendingConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sendingConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`defaultWeight` int(11) NOT NULL DEFAULT 13,
`defaultPackages` int(11) NOT NULL DEFAULT 1,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `sendingConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -37851,11 +37930,12 @@ DROP TABLE IF EXISTS `smsConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `smsConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`uri` varchar(255) NOT NULL,
`title` varchar(50) NOT NULL,
`apiKey` varchar(50) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `smsConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='SMS configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -37930,15 +38010,18 @@ DROP TABLE IF EXISTS `specialPrice`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `specialPrice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `clientFk` int(11) NOT NULL DEFAULT 0,
- `itemFk` int(11) NOT NULL DEFAULT 0,
- `value` double NOT NULL DEFAULT 0,
+ `clientFk` int(11) DEFAULT NULL,
+ `itemFk` int(11) NOT NULL,
+ `value` decimal(10,2) NOT NULL,
+ `started` date NOT NULL DEFAULT '2024-01-01',
+ `ended` date DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `Id_Cliente_2` (`clientFk`,`itemFk`),
KEY `Id_Article` (`itemFk`),
KEY `Id_Cliente` (`clientFk`),
CONSTRAINT `sp_article_id` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `check_date_range` CHECK (`ended` is null or `ended` >= `started`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -38795,13 +38878,14 @@ DROP TABLE IF EXISTS `ticketConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ticketConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`scopeDays` tinyint(3) DEFAULT NULL,
`pickingDelay` int(11) NOT NULL DEFAULT 10 COMMENT 'minutos de cortesia desde que se crea un ticket hasta que se puede preparar',
`packagingInvoicingDated` date NOT NULL DEFAULT '2017-11-21' COMMENT 'Fecha desde la cual se gestiona el registro de embalajes de tickets (tabla vn.ticketPackaging)',
`packingDelay` int(11) DEFAULT 1 COMMENT 'Horas que marcará el retraso respecto hora de cierre web del ticket',
`daysForWarningClaim` int(11) NOT NULL DEFAULT 2 COMMENT 'dias restantes hasta que salte el aviso de reclamación fuera de plazo',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `ticketConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -39549,10 +39633,11 @@ DROP TABLE IF EXISTS `tillConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tillConfig` (
- `id` int(11) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`openingBalance` decimal(10,2) NOT NULL,
`updated` timestamp NOT NULL DEFAULT current_timestamp(),
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `tillConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -39841,7 +39926,7 @@ DROP TABLE IF EXISTS `travelConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `travelConfig` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen',
`warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino',
`agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto',
@@ -39854,7 +39939,8 @@ CREATE TABLE `travelConfig` (
CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `travelConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -40264,7 +40350,7 @@ DROP TABLE IF EXISTS `viaexpressConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `viaexpressConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`url` varchar(100) NOT NULL,
`client` varchar(100) NOT NULL,
`user` varchar(100) NOT NULL,
@@ -40274,7 +40360,8 @@ CREATE TABLE `viaexpressConfig` (
`agencyModeFk` int(11) DEFAULT NULL COMMENT 'Indica el agencyMode que es interdia',
PRIMARY KEY (`id`),
KEY `viaexpressConfig_agencyMode_Fk` (`agencyModeFk`),
- CONSTRAINT `viaexpressConfig_agencyMode_Fk` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`)
+ CONSTRAINT `viaexpressConfig_agencyMode_Fk` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`),
+ CONSTRAINT `viaexpressConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -40328,13 +40415,14 @@ DROP TABLE IF EXISTS `wagonConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wagonConfig` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`width` int(11) unsigned DEFAULT 1350,
`height` int(11) unsigned DEFAULT 1900,
`maxWagonHeight` int(11) unsigned DEFAULT 200,
`minHeightBetweenTrays` int(11) unsigned DEFAULT 50,
`maxTrays` int(11) unsigned DEFAULT 6,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `wagonConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -40739,7 +40827,7 @@ DROP TABLE IF EXISTS `workerConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `workerConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`businessUpdated` date DEFAULT NULL,
`roleFk` int(10) unsigned NOT NULL COMMENT 'Rol por defecto al dar de alta un trabajador nuevo',
`businessTypeFk` varchar(100) DEFAULT NULL COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo',
@@ -40748,7 +40836,8 @@ CREATE TABLE `workerConfig` (
KEY `workerConfig_FK` (`roleFk`),
KEY `workerConfig_FK_1` (`payMethodFk`),
CONSTRAINT `workerConfig_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `workerConfig_FK_1` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT `workerConfig_FK_1` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `workerConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -41237,7 +41326,7 @@ DROP TABLE IF EXISTS `workerTimeControlConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `workerTimeControlConfig` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`dayBreak` int(11) NOT NULL,
`dayBreakDriver` int(11) NOT NULL,
`shortWeekBreak` int(11) NOT NULL,
@@ -41264,7 +41353,8 @@ CREATE TABLE `workerTimeControlConfig` (
`maxTimeToBreak` int(11) DEFAULT 3600,
`maxWorkShortCycle` int(10) unsigned DEFAULT 561600 COMMENT 'Máximo tiempo que un trabajador puede estar trabajando con el que adquirirá el derecho a un descanso semanal corto',
`maxWorkLongCycle` int(10) unsigned DEFAULT 950400 COMMENT 'Máximo tiempo que un trabajador puede estar trabajando con el que adquirirá el derecho a un descanso semanal largo',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `workerTimeControlConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='All values in seconds';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -41455,9 +41545,10 @@ DROP TABLE IF EXISTS `zipConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zipConfig` (
- `id` double(10,2) NOT NULL,
+ `id` int(10) unsigned NOT NULL,
`maxSize` int(11) DEFAULT NULL COMMENT 'in MegaBytes',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `zipConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -41533,10 +41624,11 @@ DROP TABLE IF EXISTS `zoneConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zoneConfig` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `id` int(10) unsigned NOT NULL,
`scope` int(10) unsigned NOT NULL,
`forwardDays` int(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries',
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ CONSTRAINT `zoneConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -41788,9 +41880,9 @@ DELIMITER ;;
/*!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 */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -41798,9 +41890,8 @@ DELIMITER ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `clientsDisable` ON SCHEDULE EVERY 1 MONTH STARTS '2023-06-01 00:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN
UPDATE account.user u
JOIN client c ON c.id = u.id
- JOIN clientType ct ON ct.id = c.typeFk
SET u.active = FALSE
- WHERE ct.code = 'normal'
+ WHERE c.typeFk = 'normal'
AND u.id NOT IN (
SELECT DISTINCT c.id
FROM client c
@@ -42261,6 +42352,7 @@ BEGIN
CALL vn.addressTaxArea();
SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea;
+
DROP TEMPORARY TABLE
tmp.addressCompany,
tmp.addressTaxArea;
@@ -43905,13 +43997,16 @@ BEGIN
SELECT rate3 INTO price
FROM vn.priceFixed
- WHERE itemFk = vItemFk
+ WHERE itemFk = vItemFk
AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1;
- SELECT `value` INTO price
+ SELECT `value` INTO price
FROM vn.specialPrice
- WHERE itemFk = vItemFk
- AND clientFk = vClientFk ;
+ WHERE itemFk = vItemFk
+ AND (clientFk = vClientFk OR clientFk IS NULL)
+ AND started <= util.VN_CURDATE()
+ AND (ended >= util.VN_CURDATE() OR ended IS NULL)
+ ORDER BY id DESC LIMIT 1;
RETURN price;
END ;;
DELIMITER ;
@@ -46706,6 +46801,121 @@ 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 `absoluteInventoryHistory` */;
+/*!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 `absoluteInventoryHistory`(
+ vItemFk INT,
+ vWarehouseFk INT,
+ vDate DATETIME
+)
+BEGIN
+/**
+* Calcula y proporciona un historial de inventario absoluto
+* para un artículo específico en un almacén dado
+* hasta una fecha determinada.
+*
+* @param vItemFk Id de artículo
+* @param vWarehouseFk Id de almacén
+* @param vDate Fecha
+*/
+ DECLARE vCalculatedInventory INT;
+ DECLARE vToday DATETIME DEFAULT util.VN_CURDATE();
+ DECLARE vStartDate DATE DEFAULT '2001-01-01';
+
+ CREATE OR REPLACE TEMPORARY TABLE tHistoricalPast
+ ENGINE = MEMORY
+ SELECT *
+ FROM (
+ SELECT tr.landed `date`,
+ b.quantity input,
+ NULL `output`,
+ tr.isReceived ok,
+ s.name alias,
+ e.invoiceNumber reference,
+ e.id id,
+ tr.isDelivered f5
+ FROM buy b
+ JOIN `entry` e ON e.id = b.entryFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN supplier s ON s.id = e.supplierFk
+ WHERE tr.landed >= vStartDate
+ AND s.id <> (SELECT supplierFk FROM inventoryConfig)
+ AND vWarehouseFk IN (tr.warehouseInFk, 0)
+ AND b.itemFk = vItemFk
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ UNION ALL
+ SELECT tr.shipped,
+ NULL,
+ b.quantity,
+ tr.isDelivered,
+ s.name,
+ e.invoiceNumber,
+ e.id,
+ tr.isDelivered
+ FROM buy b
+ JOIN `entry` e ON e.id = b.entryFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN supplier s ON s.id = e.supplierFk
+ WHERE tr.shipped >= vStartDate
+ AND vWarehouseFk = tr.warehouseOutFk
+ AND s.id <> (SELECT supplierFk FROM inventoryConfig)
+ AND b.itemFk = vItemFk
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ UNION ALL
+ SELECT t.shipped,
+ NULL,
+ m.quantity,
+ (m.isPicked OR t.isLabeled OR t.refFk IS NOT NULL),
+ t.nickname,
+ t.refFk,
+ t.id,
+ t.isPrinted
+ FROM sale m
+ JOIN ticket t ON t.id = m.ticketFk
+ JOIN client c ON c.id = t.clientFk
+ WHERE t.shipped >= vStartDate
+ AND m.itemFk = vItemFk
+ AND vWarehouseFk IN (t.warehouseFk, 0)
+ ) t1
+ ORDER BY `date`, input DESC, ok DESC;
+
+ SELECT SUM(input) - SUM(`output`) INTO vCalculatedInventory
+ FROM tHistoricalPast
+ WHERE `date` < vDate;
+
+ SELECT p1.*, NULL v_virtual
+ FROM (
+ SELECT vDate `date`,
+ vCalculatedInventory input,
+ NULL `output`,
+ 1 ok,
+ 'Inventario calculado' alias,
+ '' reference,
+ 0 id,
+ 1 f5
+ UNION ALL
+ SELECT *
+ FROM tHistoricalPast
+ WHERE `date` >= vDate
+ ) p1;
+
+ DROP TEMPORARY TABLE tHistoricalPast;
+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 `addNoteFromDelivery` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -48312,7 +48522,7 @@ BEGIN
ENGINE = MEMORY
SELECT vItemFk itemFk;
- CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
+ CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, TRUE);
DROP TEMPORARY TABLE tmp.item;
END ;;
DELIMITER ;
@@ -48330,7 +48540,11 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(
+ vLanded DATE,
+ vAddressFk INT,
+ vAgencyModeFk INT,
+ vShowExpiredZones BOOLEAN)
BEGIN
/**
* Calcula los articulos disponibles y sus precios
@@ -48356,7 +48570,7 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
- CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE);
+ CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, vShowExpiredZones);
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
CREATE TEMPORARY TABLE tmp.ticketLot(
@@ -48540,7 +48754,7 @@ BEGIN
* Calcula los componentes de los articulos de tmp.ticketLot
*
* @param vZoneFk para calcular el transporte
- * @param vAddressFk Consignatario
+ * @param vAddressFk Consignatario
* @param vShipped dia de salida del pedido
* @param vWarehouseFk warehouse de salida del pedido
* @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk)
@@ -48554,7 +48768,20 @@ BEGIN
SELECT clientFk INTO vClientFK
FROM address
WHERE id = vAddressFk;
-
+
+ CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
+ (INDEX (itemFk))
+ ENGINE = MEMORY
+ SELECT * FROM (
+ SELECT *
+ FROM specialPrice
+ WHERE (clientFk = vClientFk OR clientFk IS NULL)
+ AND started <= vShipped
+ AND (ended >= vShipped OR ended IS NULL)
+ ORDER BY (clientFk = vClientFk) DESC, id DESC
+ LIMIT 10000000000000000000) t
+ GROUP BY itemFk;
+
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate
(PRIMARY KEY (itemFk, warehouseFk))
ENGINE = MEMORY
@@ -48566,7 +48793,7 @@ BEGIN
IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing,
IFNULL(pf.`grouping`, b.`grouping`) `grouping`,
ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
- tl.buyFk,
+ tl.buyFk,
i.typeFk,
IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping
FROM tmp.ticketLot tl
@@ -48574,8 +48801,7 @@ BEGIN
JOIN item i ON i.id = tl.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN specialPrice sp ON sp.itemFk = i.id
- AND sp.clientFk = vClientFk
+ LEFT JOIN tSpecialPrice sp ON sp.itemFk = i.id
LEFT JOIN (
SELECT * FROM (
SELECT pf.itemFk,
@@ -48593,7 +48819,7 @@ BEGIN
LIMIT 10000000000000000000
) tpf
GROUP BY tpf.itemFk, tpf.warehouseFk
- ) pf ON pf.itemFk = tl.itemFk
+ ) pf ON pf.itemFk = tl.itemFk
AND pf.warehouseFk = tl.warehouseFk
WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01
AND ic.merchandise
@@ -48625,10 +48851,10 @@ BEGIN
FROM tmp.ticketComponent tc
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
GROUP BY tc.itemFk, warehouseFk;
-
+
-- RECOBRO
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
- SELECT tcb.warehouseFk, tcb.itemFk, c2.id,
+ SELECT tcb.warehouseFk, tcb.itemFk, c2.id,
ROUND(tcb.base *
LEAST(
MAX(GREATEST(IFNULL(cr.priceIncreasing,0),
@@ -48659,29 +48885,29 @@ BEGIN
ROUND(base * wm.pricesModifierRate, 3) manaAuto
FROM tmp.ticketComponentBase tcb
JOIN `client` c on c.id = vClientFk
- JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
+ JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
JOIN vn.component c2 ON c2.code = 'autoMana'
WHERE wm.isPricesModifierActivated
HAVING manaAuto <> 0;
-
+
-- Precios especiales
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk,
tcb.itemFk,
c2.id,
GREATEST(
- IFNULL(ROUND(tcb.base * c2.tax, 4), 0),
+ IFNULL(ROUND(tcb.base * c2.tax, 4), 0),
IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3
) cost
FROM tmp.ticketComponentBase tcb
JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount'
- JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
- LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
+ JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
+ LEFT JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk
JOIN vn.item i ON i.id = tcb.itemFk
WHERE sp.value IS NULL
AND i.supplyResponseFk IS NULL;
- -- Individual
+ -- Individual
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk,
tcb.itemFk,
@@ -48692,14 +48918,14 @@ BEGIN
JOIN vn.client c ON c.id = vClientFk
JOIN vn.businessType bt ON bt.code = c.businessTypeFk
WHERE bt.code = 'individual';
-
+
-- Venta por paquetes
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
- SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3
+ SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3
FROM tmp.ticketComponentCalculate tcc
JOIN vn.component c2 ON c2.code = 'salePerPackage'
JOIN buy b ON b.id = tcc.buyFk
- LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
+ LEFT JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk
WHERE sp.value IS NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.`zone` (INDEX (id))
@@ -48707,7 +48933,7 @@ BEGIN
SELECT vZoneFk id;
CALL zone_getOptionsForShipment(vShipped, TRUE);
-
+
-- Reparto
INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFK,
@@ -48721,7 +48947,7 @@ BEGIN
JOIN agencyMode am ON am.id = z.agencyModeFk
JOIN vn.volumeConfig vc
JOIN vn.component c2 ON c2.code = 'delivery'
- LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
+ LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
AND ic.itemFk = tcc.itemFk
HAVING cost <> 0;
@@ -48738,7 +48964,7 @@ BEGIN
sp.value - SUM(tcc.cost) sumCost
FROM tmp.ticketComponentCopy tcc
JOIN component c ON c.id = tcc.componentFk
- JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
+ JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk
JOIN vn.component c2 ON c2.code = 'specialPrices'
WHERE c.classRate IS NULL
AND tcc.warehouseFk = vWarehouseFk
@@ -48774,9 +49000,9 @@ BEGIN
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price,
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg
FROM tmp.ticketComponentCalculate tcc
- JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
+ JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
AND tcs.warehouseFk = tcc.warehouseFk
- WHERE IFNULL(tcs.classRate, 1) = 1
+ WHERE IFNULL(tcs.classRate, 1) = 1
AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0)
GROUP BY tcs.warehouseFk, tcs.itemFk;
@@ -48813,13 +49039,14 @@ BEGIN
SELECT * FROM tmp.ticketComponentRate ORDER BY price LIMIT 10000000000000000000
) t
GROUP BY itemFk, warehouseFk, `grouping`;
-
+
DROP TEMPORARY TABLE
tmp.ticketComponentCalculate,
tmp.ticketComponentSum,
tmp.ticketComponentBase,
tmp.ticketComponentRate,
- tmp.ticketComponentCopy;
+ tmp.ticketComponentCopy,
+ tSpecialPrice;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -48911,7 +49138,7 @@ BEGIN
DECLARE v1Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR;
DECLARE v2Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR;
DECLARE v4Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR;
- DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR;
+ DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR;
DECLARE vTrashId VARCHAR(15);
DECLARE vCompanyBlk INT;
@@ -48929,8 +49156,9 @@ BEGIN
DELETE IGNORE FROM expedition WHERE created < v26Months;
DELETE FROM sms WHERE created < v18Months;
DELETE FROM saleTracking WHERE created < v1Years;
+ DELETE FROM productionError WHERE dated < v1Years;
DELETE FROM ticketTracking WHERE created < v18Months;
- DELETE tobs FROM ticketObservation tobs
+ DELETE tobs FROM ticketObservation tobs
JOIN ticket t ON tobs.ticketFk = t.id
WHERE t.shipped < v5Years;
DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < v1Years;
@@ -49012,12 +49240,12 @@ BEGIN
FROM travel t
LEFT JOIN entry e ON e.travelFk = t.id
WHERE t.shipped < v3Months AND e.travelFk IS NULL;
-
+
UPDATE dms d
- JOIN dmsType dt ON dt.id = d.dmsTypeFk
- SET d.dmsTypeFk = vTrashId
+ JOIN dmsType dt ON dt.id = d.dmsTypeFk
+ SET d.dmsTypeFk = vTrashId
WHERE created < util.VN_CURDATE() - INTERVAL dt.monthToDelete MONTH;
-
+
-- borrar entradas sin compras
CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
SELECT e.*
@@ -49035,7 +49263,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete
SELECT *
FROM route r
- WHERE created < v4Years;
+ WHERE created < v4Years;
UPDATE tRouteToDelete tmp
JOIN dms d ON d.id = tmp.gestdocFk
@@ -49079,7 +49307,7 @@ BEGIN
DELETE FROM mail WHERE creationDate < v2Months;
DELETE FROM split WHERE dated < v18Months;
DELETE FROM remittance WHERE dated < v18Months;
-
+
CREATE OR REPLACE TEMPORARY TABLE tTicketDelete
SELECT DISTINCT tl.originFk ticketFk
FROM ticketLog tl
@@ -49088,11 +49316,11 @@ BEGIN
FROM ticket t
JOIN ticketLog tl ON tl.originFk = t.id
LEFT JOIN ticketWeekly tw ON tw.ticketFk = t.id
- WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31'
+ WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31'
AND t.isDeleted
AND tw.ticketFk IS NULL
GROUP BY t.id
- ) sub ON sub.ids = tl.id
+ ) sub ON sub.ids = tl.id
WHERE tl.creationDate <= v2Months;
DELETE t
FROM ticket t
@@ -50566,6 +50794,13 @@ proc:BEGIN
DECLARE vHasTooMuchCollections BOOL;
DECLARE vLockTime INT DEFAULT 15;
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ DO RELEASE_LOCK('collection_assign');
+
+ RESIGNAL;
+ END;
+
-- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk);
@@ -50873,14 +51108,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 `collection_new` */;
/*!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_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT)
proc:BEGIN
@@ -50911,6 +51146,7 @@ proc:BEGIN
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 15;
DECLARE vFreeWagonFk INT;
+
DECLARE c1 CURSOR FOR
SELECT ticketFk, `lines`, m3
FROM tmp.productionBuffer
@@ -50927,13 +51163,21 @@ proc:BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ IF vLockName IS NOT NULL THEN
+ DO RELEASE_LOCK(vLockName);
+ END IF;
+
+ RESIGNAL;
+ END;
+
SELECT pc.ticketTrolleyMax * o.numberOfWagons,
pc.hasUniqueCollectionTime,
w.code,
o.warehouseFk,
o.itemPackingTypeFk,
st.code,
- CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk),
o.numberOfWagons,
o.trainFk,
o.linesLimit,
@@ -50944,7 +51188,6 @@ proc:BEGIN
vWarehouseFk,
vItemPackingTypeFk,
vStateFk,
- vLockName,
vWagons,
vTrainFk,
vLinesLimit,
@@ -50954,6 +51197,12 @@ proc:BEGIN
JOIN state st ON st.`code` = 'ON_PREPARATION'
JOIN operator o ON o.workerFk = vUserFk;
+ SET vLockName = CONCAT_WS('/',
+ 'collection_new',
+ vWarehouseFk,
+ vItemPackingTypeFk
+ );
+
IF NOT GET_LOCK(vLockName, vLockTime) THEN
LEAVE proc;
END IF;
@@ -51091,7 +51340,8 @@ proc:BEGIN
@lines:= COUNT(*) + @lines,
COUNT(*) `lines`,
MAX(i.`size`) height,
- @volume := SUM(sv.volume) + @volume volume
+ @volume := SUM(sv.volume) + @volume,
+ SUM(sv.volume) volume
FROM saleVolume sv
JOIN sale s ON s.id = sv.saleFk
JOIN item i ON i.id = s.itemFk
@@ -51134,13 +51384,13 @@ proc:BEGIN
UPDATE tTrain
SET ticketFk = vFirstTicketFk
WHERE wagon = vFreeWagonFk;
-
+
-- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo
DELETE tt.*
FROM tTrain tt
LEFT JOIN (
- SELECT DISTINCT wagon
- FROM tTrain
+ SELECT DISTINCT wagon
+ FROM tTrain
WHERE ticketFk IS NOT NULL
) nn ON nn.wagon = tt.wagon
WHERE nn.wagon IS NULL;
@@ -51155,7 +51405,7 @@ proc:BEGIN
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
IF vDone THEN
LEAVE read_loop;
- END IF;
+ END IF;
END IF;
END LOOP;
CLOSE c1;
@@ -51384,14 +51634,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 `company_getSuppliersDebt` */;
/*!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_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT)
BEGIN
@@ -51432,7 +51682,7 @@ BEGIN
IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount,
p.dueDated < vStartingDate isBeforeStarting,
p.currencyFk
- FROM payment p
+ FROM payment p
WHERE p.received > vStartDate
AND p.companyFk = vSelf
UNION ALL
@@ -51440,9 +51690,9 @@ BEGIN
r.companyFk,
- IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total,
rv.dueDated < vStartingDate isBeforeStarting,
- r.currencyFk
- FROM invoiceIn r
- INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
+ r.currencyFk
+ FROM invoiceIn r
+ INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
WHERE r.issued > vStartDate
AND r.isBooked
AND r.companyFk = vSelf
@@ -51494,11 +51744,11 @@ BEGIN
-IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue),
r.currencyFk,
FALSE isPayment,
- TRUE
- FROM invoiceIn r
+ TRUE
+ FROM invoiceIn r
LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk
AND r.supplierFk = si.supplierFk
- AND r.currencyFk = si.currencyFk
+ AND r.currencyFk = si.currencyFk
JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
WHERE rv.dueDated >= vStartingDate
AND (si.closingBalances IS NULL OR si.closingBalances <> 0)
@@ -51563,7 +51813,7 @@ BEGIN
AND vp.supplierFk = rd.supplierFk
AND vp.companyFk = rd.companyFk
AND vp.currencyFk = rd.currencyFk
- WHERE vp.isPayment = FALSE;
+ WHERE NOT vp.isPayment;
SELECT vp.expirationId,
vp.dated,
@@ -51578,14 +51828,14 @@ BEGIN
vp.isReconciled,
vp.endingBalance,
cr.amount clientRiskAmount,
- co.CEE
+ co.CEE
FROM tPendingDuedates vp
LEFT JOIN supplier s ON s.id = vp.supplierFk
LEFT JOIN client c ON c.fi = s.nif
LEFT JOIN clientRisk cr ON cr.clientFk = c.id
- LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
- LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk
- LEFT JOIN country co ON co.id = be.countryFk
+ LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
+ LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk
+ LEFT JOIN country co ON co.id = be.countryFk
AND cr.companyFk = vp.companyFk;
DROP TEMPORARY TABLE tOpeningBalances;
@@ -51921,6 +52171,61 @@ 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 `creditInsurance_getRisk` */;
+/*!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 `creditInsurance_getRisk`()
+BEGIN
+/**
+ * Devuelve el riesgo de los clientes que estan asegurados
+ */
+ CREATE OR REPLACE TEMPORARY TABLE tmp.client_list
+ (PRIMARY KEY (Id_Cliente))
+ ENGINE = MEMORY
+ SELECT * FROM (
+ SELECT cc.client Id_Cliente, ci.grade
+ FROM creditClassification cc
+ JOIN creditInsurance ci ON cc.id = ci.creditClassification
+ WHERE dateEnd IS NULL
+ ORDER BY ci.creationDate DESC
+ LIMIT 10000000000000000000) t1
+ GROUP BY Id_Cliente;
+
+ CALL vn2008.risk_vs_client_list(util.VN_CURDATE());
+
+ SELECT
+ c.id,
+ c.name,
+ c.credit clientCredit,
+ c.creditInsurance solunion,
+ CAST(r.risk AS DECIMAL(10,0)) risk,
+ CAST(c.creditInsurance - r.risk AS DECIMAL(10,0)) riskAlive,
+ cac.invoiced billedAnnually,
+ c.dueDay,
+ ci.grade,
+ c2.country
+ FROM tmp.client_list ci
+ LEFT JOIN tmp.risk r ON r.Id_Cliente = ci.Id_Cliente
+ JOIN client c ON c.id = ci.Id_Cliente
+ JOIN bs.clientAnnualConsumption cac ON c.id = cac.clientFk
+ JOIN country c2 ON c2.id = c.countryFk
+ GROUP BY c.id;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.risk;
+ DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
+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 `crypt` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -52590,6 +52895,7 @@ BEGIN
ii.operated = IFNULL(ii.operated,d.operated),
ii.issued = IFNULL(ii.issued,d.issued),
ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
+ e.isBooked = TRUE,
e.isConfirmed = TRUE
WHERE d.id = vDuaFk;
@@ -53179,6 +53485,41 @@ 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 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 */ ;
@@ -55715,7 +56056,7 @@ BEGIN
quantity int(11) DEFAULT '0',
buyingValue decimal(10,4) DEFAULT '0.0000',
freightValue decimal(10,3) DEFAULT '0.000',
- packing int(11) DEFAULT '0',
+ packing int(11) DEFAULT '1',
`grouping` smallint(5) unsigned NOT NULL DEFAULT '1',
groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
comissionValue decimal(10,3) DEFAULT '0.000',
@@ -55898,14 +56239,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 `inventory_repair` */;
/*!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 `inventory_repair`()
BEGIN
@@ -55945,7 +56286,7 @@ BEGIN
LEFT JOIN origin o ON o.id = i.originFk
) ON it.id = i.typeFk
LEFT JOIN edi.ekt ek ON b.ektFk = ek.id
- WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO';
+ WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO';
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk;
CREATE TEMPORARY TABLE tmp.lastEntryOk
@@ -56002,11 +56343,6 @@ BEGIN
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
SET b.price2 = eo.price2 WHERE b.price2 = 0 ;
- UPDATE buy b
- JOIN tmp.lastEntry lt ON lt.buyFk = b.id
- JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
- SET b.packing = eo.packing WHERE b.packing = 0;
-
UPDATE buy b
JOIN tmp.lastEntry lt ON lt.buyFk = b.id
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
@@ -56504,20 +56840,15 @@ BEGIN
* @param vInvoiceInFk Id de factura recibida
*/
DECLARE vRate DOUBLE DEFAULT 1;
- DECLARE vDated DATE;
DECLARE vExpenseFk VARCHAR(10);
- SELECT MAX(rr.dated) INTO vDated
+ SELECT `value` INTO vRate
FROM referenceRate rr
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
WHERE rr.dated <= ii.issued
- AND rr.currencyFk = ii.currencyFk;
-
- IF vDated THEN
- SELECT `value` INTO vRate
- FROM referenceRate
- WHERE dated = vDated;
- END IF;
+ AND rr.currencyFk = ii.currencyFk
+ ORDER BY dated DESC
+ LIMIT 1;
DELETE FROM invoiceInTax WHERE invoiceInFk = vInvoiceInFk;
@@ -63333,6 +63664,28 @@ 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 `multipleInventoryHistory` */;
+/*!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 `multipleInventoryHistory`(
+ vItemFk INT)
+BEGIN
+ DECLARE vDateInventory DATETIME;
+ SELECT inventoried INTO vDateInventory FROM config;
+
+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 `mysqlConnectionsSorter_kill` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -64686,16 +65039,22 @@ BEGIN
-- Rellena la tabla tmp.errorsByChecker con fallos de revisores
CREATE OR REPLACE TEMPORARY TABLE tmp.errorsByChecker
ENGINE = MEMORY
- SELECT st.workerFk,
- COUNT(t.id) errors
- FROM saleMistake sm
- JOIN saleTracking st ON sm.saleFk = st.saleFk
- JOIN `state` s2 ON s2.id = st.stateFk
- JOIN sale s ON s.id = sm.saleFk
- JOIN ticket t on t.id = s.ticketFk
- WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
- AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
- GROUP BY st.workerFk;
+ WITH rankedWorkers AS (
+ SELECT sm.id,
+ st.workerFk,
+ ROW_NUMBER() OVER(PARTITION BY sm.id ORDER BY s2.`order`) rnk
+ FROM vn.saleMistake sm
+ JOIN vn.saleTracking st ON sm.saleFk = st.saleFk
+ JOIN vn.`state` s2 ON s2.id = st.stateFk
+ JOIN vn.sale s ON s.id = sm.saleFk
+ JOIN vn.ticket t ON t.id = s.ticketFk
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ AND s2.code IN ('OK', 'PREVIOUS_PREPARATION', 'PREPARED', 'CHECKED')
+ )
+ SELECT workerFk, COUNT(*) errors
+ FROM rankedWorkers
+ WHERE rnk = 1
+ GROUP BY workerFk;
-- Rellena la tabla tmp.expeditionErrors con fallos de expediciones
CREATE OR REPLACE TEMPORARY TABLE tmp.expeditionErrors
@@ -66608,6 +66967,301 @@ BEGIN
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 `sale_boxPickingPrint` */;
+/*!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=`jenkins`@`10.0.%.%` PROCEDURE `sale_boxPickingPrint`(
+ IN vPrinterFk INT,
+ IN vSaleFk INT,
+ IN vPacking INT,
+ IN vSectorFk INT,
+ IN vUserFk INT,
+ IN vPackagingFk INT,
+ IN vPackingSiteFk INT)
+BEGIN
+/** Splits a line of sale to a different ticket and prints the transport sticker
+ */
+ DECLARE vAgencyModeFk INT;
+ DECLARE vConcept VARCHAR(30);
+ DECLARE vExpeditionFk INT;
+ DECLARE vItemFk INT;
+ DECLARE vItemShelvingFk INT;
+ DECLARE vItemShelvingSaleFk INT;
+ DECLARE vItemShelvingSaleFk_old INT;
+ DECLARE vLastExpeditionTimeStamp DATETIME;
+ DECLARE vMaxPhoneLength INT DEFAULT 11;
+ DECLARE vMaxStreetLength INT DEFAULT 36;
+ DECLARE vNewSaleFk INT;
+ DECLARE vNewTicketFk INT;
+ DECLARE vParkingCode VARCHAR(10);
+ DECLARE vQuantity INT;
+ DECLARE vRemainder INT DEFAULT 0;
+ DECLARE vRemainderSaleFk INT;
+ DECLARE vShelving VARCHAR(10);
+ DECLARE vTicketFk INT;
+
+ SELECT s.quantity,
+ s.quantity MOD vPacking,
+ s.ticketFk,
+ s.itemFk,
+ s.concept
+ INTO vQuantity,
+ vRemainder,
+ vTicketFk,
+ vItemFk,
+ vConcept
+ FROM sale s
+ WHERE s.id = vSaleFk;
+
+ IF vRemainder THEN
+ UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk;
+
+ INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept)
+ SELECT ticketFk, itemFk, vRemainder, price, discount, concept
+ FROM sale
+ WHERE id = vSaleFk;
+
+ SET vRemainderSaleFk = LAST_INSERT_ID();
+
+ INSERT INTO saleComponent(saleFk, componentFk, value)
+ SELECT vRemainderSaleFk, componentFk, value
+ FROM saleComponent
+ WHERE saleFk = vSaleFk;
+ END IF;
+
+w1: WHILE vQuantity >= vPacking DO
+
+ SET vItemShelvingFk = NULL;
+
+ SELECT sub.id
+ INTO vItemShelvingFk
+ FROM productionConfig pc
+ JOIN (
+ SELECT ish.id,
+ ish.visible - IFNULL(SUM(iss.quantity),0) available,
+ p.pickingOrder,
+ ish.created
+ FROM itemShelving ish
+ JOIN shelving sh ON sh.code = ish.shelvingFk
+ JOIN parking p ON p.id = sh.parkingFk
+ LEFT JOIN itemShelvingSale iss
+ ON iss.itemShelvingFk = ish.id
+ AND iss.created >= CURDATE()
+ AND iss.isPicked = FALSE
+ WHERE ish.itemFk = vItemFk
+ AND p.sectorFk = vSectorFk
+ GROUP BY ish.id
+ HAVING available >= vPacking) sub
+ ORDER BY IF(pc.orderMode = 'Location',sub.pickingOrder, sub.created)
+ LIMIT 1;
+
+ IF vItemShelvingFk THEN
+ INSERT INTO itemShelvingSale
+ SET itemShelvingFk = vItemShelvingFk,
+ saleFk = vSaleFk,
+ quantity = vPacking,
+ userFk = vUserFk,
+ isPicked = TRUE;
+
+ SET vItemShelvingSaleFk = LAST_INSERT_ID();
+
+ UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk;
+ ELSE
+ LEAVE w1;
+ END IF;
+
+ SET vNewTicketFk = NULL;
+
+ SELECT MAX(t.id) INTO vNewTicketFk
+ FROM ticket t
+ JOIN ticketLastState tls ON tls.ticketFk = t.id
+ JOIN (SELECT addressFk, clientFk, date(shipped) shipped, warehouseFk
+ FROM ticket
+ WHERE id = vTicketFk) tt
+ ON tt.addressFk = t.addressFk
+ AND tt.clientFk = t.clientFk
+ AND t.shipped BETWEEN tt.shipped AND util.dayend(tt.shipped)
+ AND t.warehouseFk = tt.warehouseFk
+ WHERE tls.name = 'Encajado' ;
+
+ IF ISNULL(vNewTicketFk) THEN
+ INSERT INTO ticket( clientFk,
+ shipped,
+ addressFk,
+ agencyModeFk,
+ nickname,
+ warehouseFk,
+ companyFk,
+ landed,
+ zoneFk,
+ zonePrice,
+ zoneBonus,
+ routeFk,
+ priority,
+ hasPriority,
+ clonedFrom)
+ SELECT clientFk,
+ shipped,
+ addressFk,
+ agencyModeFk,
+ nickname,
+ warehouseFk,
+ companyFk,
+ landed,
+ zoneFk,
+ zonePrice,
+ zoneBonus,
+ routeFk,
+ priority,
+ hasPriority,
+ id
+ FROM ticket
+ WHERE id = vTicketFk;
+
+ SET vNewTicketFk = LAST_INSERT_ID();
+
+ INSERT INTO ticketTracking(ticketFk, stateFk, userFk)
+ SELECT vNewTicketFk, id, vUserFk
+ FROM state
+ WHERE code = 'PACKED';
+ END IF;
+
+ UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk;
+
+ UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
+
+ SET vNewSaleFk = NULL;
+
+ SELECT MAX(id) INTO vNewSaleFk
+ FROM sale
+ WHERE ticketFk = vNewTicketFk
+ AND itemFk = vItemFk;
+
+ IF vNewSaleFk THEN
+ UPDATE sale
+ SET quantity = quantity + vPacking
+ WHERE id = vNewSaleFk;
+
+ SET vItemShelvingSaleFk_old = NULL;
+
+ SELECT MAX(id) INTO vItemShelvingSaleFk_old
+ FROM itemShelvingSale
+ WHERE itemShelvingFk = vItemShelvingFk
+ AND saleFk = vNewSaleFk;
+
+ IF vItemShelvingSaleFk_old THEN
+ UPDATE itemShelvingSale
+ SET quantity = quantity + vPacking
+ WHERE id = vItemShelvingSaleFk_old;
+
+ DELETE FROM itemShelvingSale
+ WHERE id = vItemShelvingSaleFk;
+
+ SET vItemShelvingSaleFk = vItemShelvingSaleFk_old;
+ ELSE
+ UPDATE itemShelvingSale
+ SET saleFk = vNewSaleFk
+ WHERE id = vItemShelvingSaleFk;
+ END IF;
+ ELSE
+ INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price)
+ SELECT vNewTicketFk, itemFk, concept, vPacking, discount, price
+ FROM sale
+ WHERE id = vSaleFk;
+
+ SET vNewSaleFk = LAST_INSERT_ID();
+
+ INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge)
+ SELECT vNewSaleFk, componentFk, value, isGreuge
+ FROM saleComponent
+ WHERE saleFk = vSaleFk;
+
+ UPDATE itemShelvingSale
+ SET saleFk = vNewSaleFk
+ WHERE id = vItemShelvingSaleFk;
+ END IF;
+
+ INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk)
+ SELECT vNewSaleFk, TRUE, vUserFk, id
+ FROM state
+ WHERE code = 'PREPARED';
+
+ SELECT agencyModeFk INTO vAgencyModeFk
+ FROM ticket
+ WHERE id = vNewTicketFk;
+
+ INSERT INTO expedition(
+ agencyModeFk,
+ ticketFk,
+ freightItemFk,
+ workerFk,
+ packagingFk,
+ itemPackingTypeFk,
+ hostFk,
+ packingSiteFk,
+ monitorId,
+ started,
+ ended
+ )
+ SELECT vAgencyModeFk,
+ vNewTicketFk,
+ i.id,
+ vUserFk,
+ vPackagingFk,
+ ps.code,
+ h.code,
+ vPackingSiteFk,
+ ps.monitorId,
+ IFNULL(vLastExpeditionTimeStamp, NOW()),
+ NOW()
+ FROM packingSite ps
+ JOIN host h ON h.id = ps.hostFk
+ JOIN item i ON i.name = 'Shipping cost'
+ WHERE ps.id = vPackingSiteFk
+ LIMIT 1;
+
+ SET vExpeditionFk = LAST_INSERT_ID();
+
+ SET vLastExpeditionTimeStamp = NOW();
+
+ CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE);
+
+ SELECT shelvingFk, p.code
+ INTO vShelving, vParkingCode
+ FROM itemShelving ish
+ JOIN shelving sh ON sh.code = ish.shelvingFk
+ JOIN parking p ON p.id = sh.parkingFk
+ WHERE ish.id = vItemShelvingFk;
+
+ UPDATE dipole.expedition_PrintOut
+ SET isPrinted = FALSE,
+ itemFk = vItemFk,
+ quantity = vPacking,
+ longName = vConcept,
+ shelvingFk = vShelving,
+ parkingCode = vParkingCode,
+ phone = RIGHT(phone,vMaxPhoneLength),
+ street = RIGHT(street, vMAxStreetLength)
+ WHERE expeditionFk = vExpeditionFk;
+
+ DELETE FROM sale
+ WHERE quantity = 0
+ AND id = vSaleFk;
+ END WHILE;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -66703,6 +67357,7 @@ BEGIN
JOIN parking p ON p.id = sh.parkingFk
JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
JOIN agencyMode am ON am.id = pb.agencyModeFk
+ JOIN agency a ON a .id = am.agencyFk
LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
@@ -66717,6 +67372,7 @@ BEGIN
AND ((rm.bufferFk AND rm.isPickingAllowed)
OR am.code = 'REC_ALG')
AND pb.shipped = vDated
+ AND a.isOwn
GROUP BY s.id
ORDER BY etd;
@@ -67377,14 +68033,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 `sale_replaceItem` */;
/*!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_general_ci */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
BEGIN
@@ -67464,7 +68120,9 @@ BEGIN
vNewItemFk);
SELECT price INTO vNewPrice
- FROM tmp.ticketCalculateItem;
+ FROM tmp.ticketComponentPrice
+ ORDER BY (vQuantity % `grouping`) ASC
+ LIMIT 1;
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
@@ -67491,7 +68149,7 @@ BEGIN
price)
SELECT vTicketFk,
vNewItemFk,
- CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName),
+ CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ', i.name),
vFinalPrice
FROM vn.item i
WHERE id = vNewItemFk;
@@ -68212,50 +68870,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 `solunionRiskRequest` */;
-/*!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 `solunionRiskRequest`()
-BEGIN
-
- DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
- CREATE TEMPORARY TABLE tmp.client_list
- (PRIMARY KEY (Id_Cliente))
- ENGINE = MEMORY
- SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc
- JOIN vn.creditInsurance ci ON cc.id = ci.creditClassification
- WHERE dateEnd IS NULL
- ORDER BY ci.creationDate DESC
- LIMIT 10000000000000000000) t1 GROUP BY Id_Cliente;
-
- CALL vn2008.risk_vs_client_list(util.VN_CURDATE());
-
- SELECT
- c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo,
- cast(c.creditInsurance - r.risk as decimal(10,0)) margen_vivo,
- f.Consumo consumo_anual, c.Vencimiento, ci.grade
- FROM
- vn2008.Clientes c
- JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente
- JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente
- JOIN bi.facturacion_media_anual f ON c.Id_Cliente = f.Id_Cliente
- GROUP BY Id_cliente;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.risk;
- DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
-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 `stockBuyedByWorker` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -69197,7 +69811,7 @@ BEGIN
SELECT id itemFk FROM vn.item
WHERE typeFk = vTypeFk;
- CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
+ CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
DROP TEMPORARY TABLE tmp.item;
DROP TEMPORARY TABLE tmp.ticketLot;
END ;;
@@ -69242,56 +69856,11 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE)
BEGIN
-
- DECLARE done INT DEFAULT FALSE;
- DECLARE vNewTicketFk INT;
- DECLARE vOldSaleFk INT;
- DECLARE vNewSaleFk INT;
-
- DECLARE cur1 CURSOR FOR
- SELECT id
- FROM vn.sale
- WHERE ticketFk = vTicketFk;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-
- SET vNewShipped = IFNULL(vNewShipped, util.VN_CURDATE());
-
- CALL vn.ticket_Clone(vTicketFk, vNewTicketFk);
-
- UPDATE vn.ticket
- SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed),
- shipped = vNewShipped
- WHERE id = vNewTicketFk;
-
- OPEN cur1;
-
- read_loop: LOOP
-
- FETCH cur1 INTO vOldSaleFk;
-
- IF done THEN
- LEAVE read_loop;
- END IF;
-
- INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed)
- SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed
- FROM vn.sale
- WHERE id = vOldSaleFk;
-
- SELECT max(id) INTO vNewSaleFk
- FROM vn.sale
- WHERE ticketFk = vNewTicketFk;
-
- INSERT INTO vn.saleComponent(saleFk, componentFk, value, isGreuge)
- SELECT vNewSaleFk, componentFk, value, isGreuge
- FROM vn.saleComponent
- WHERE saleFk = vOldSaleFk;
-
- END LOOP;
- CLOSE cur1;
-
+ DECLARE vNewTicketFk INT;
+
+ CALL ticket_cloneAll(vTicketFk, vNewShipped, TRUE, vNewTicketFk);
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -71099,6 +71668,74 @@ 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 `ticket_cloneAll` */;
+/*!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 `ticket_cloneAll`(vTicketFk INT, vNewShipped DATE, vWithWarehouse BOOLEAN, OUT vNewTicketFk INT)
+BEGIN
+
+ DECLARE vDone BOOLEAN DEFAULT FALSE;
+ DECLARE vOldSaleFk INT;
+ DECLARE vNewSaleFk INT;
+
+ DECLARE cur1 CURSOR FOR
+ SELECT id
+ FROM sale
+ WHERE ticketFk = vTicketFk;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ SET vNewShipped = IFNULL(vNewShipped, util.VN_CURDATE());
+
+ CALL ticket_Clone(vTicketFk, vNewTicketFk);
+
+ UPDATE ticket
+ SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed),
+ shipped = vNewShipped,
+ warehouseFk = IF(vWithWarehouse, warehouseFk, NULL)
+ WHERE id = vNewTicketFk;
+
+ OPEN cur1;
+
+ read_loop: LOOP
+
+ FETCH cur1 INTO vOldSaleFk;
+
+ IF vDone THEN
+ LEAVE read_loop;
+ END IF;
+
+ INSERT INTO sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed)
+ SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed
+ FROM sale
+ WHERE id = vOldSaleFk;
+
+ SELECT max(id) INTO vNewSaleFk
+ FROM sale
+ WHERE ticketFk = vNewTicketFk;
+
+ INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge)
+ SELECT vNewSaleFk, componentFk, value, isGreuge
+ FROM saleComponent
+ WHERE saleFk = vOldSaleFk;
+
+ END LOOP;
+
+ CLOSE cur1;
+
+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 `ticket_cloneWeekly` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -78445,7 +79082,7 @@ DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`()
BEGIN
/**
- * Calcula si para un mismo codigo postal y dia
+ * Calcula si para un mismo codigo postal y dia
* hay mas de una zona configurada y manda correo
*
*/
@@ -78453,17 +79090,18 @@ BEGIN
DECLARE vZoneFk INT;
DECLARE vIsDone INT DEFAULT FALSE;
DECLARE vTableCollisions TEXT;
+ DECLARE json_data JSON;
DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption;
-
+
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
DROP TEMPORARY TABLE IF EXISTS tmp.zone;
CREATE TEMPORARY TABLE tmp.zone
- SELECT z.id
+ SELECT z.id
FROM zone z
JOIN agencyMode am ON am.id = z.agencyModeFk
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
- WHERE dm.code IN ('AGENCY','DELIVERY');
+ WHERE dm.code IN ('AGENCY','DELIVERY');
CALL zone_getOptionsForShipment(util.VN_CURDATE(),FALSE);
@@ -78478,7 +79116,7 @@ BEGIN
PRIMARY KEY zoneFkk (zoneFk, geoFk),
INDEX(geoFk))
ENGINE = MyISAM;
-
+
OPEN cur1;
cur1Loop: LOOP
SET vIsDone = FALSE;
@@ -78486,82 +79124,63 @@ BEGIN
IF vIsDone THEN
LEAVE cur1Loop;
END IF;
-
+
CALL zone_getLeaves(vZoneFk, NULL, NULL, TRUE);
- myLoop: LOOP
+ myLoop: LOOP
SET vGeoFk = NULL;
- SELECT geoFk INTO vGeoFk
+ SELECT geoFk INTO vGeoFk
FROM tmp.zoneNodes zn
WHERE NOT isChecked
LIMIT 1;
-
+
IF vGeoFk IS NULL THEN
LEAVE myLoop;
END IF;
-
+
CALL zone_getLeaves(vZoneFk, vGeoFk, NULL, TRUE);
UPDATE tmp.zoneNodes
- SET isChecked = TRUE
+ SET isChecked = TRUE
WHERE geoFk = vGeoFk;
END LOOP;
END LOOP;
CLOSE cur1;
- DELETE FROM tmp.zoneNodes
+ DELETE FROM tmp.zoneNodes
WHERE sons > 0;
-
+
DROP TEMPORARY TABLE IF EXISTS geoCollision;
CREATE TEMPORARY TABLE geoCollision
SELECT z.agencyModeFk, zn.geoFk, zw.warehouseFk
FROM tmp.zoneNodes zn
JOIN zone z ON z.id = zn.zoneFk
- JOIN zoneWarehouse zw ON z.id = zw.zoneFk
+ JOIN zoneWarehouse zw ON z.id = zw.zoneFk
GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk
HAVING count(*) > 1;
-
- SELECT '
C.Postal | -Número de zona | -Precio | -Zona | -Almacén | -Salix | -
---|
{{$t('fields.previousSalesVolume')}}: | +{{$t('fields.previousSellsVolume')}}: |
-
-
-
+
|
|
---|---|---|---|
{{$t('fields.forecastedSalesVolume')}}: |
-
-
-
- |
- ||
{{$t('fields.forecastedPurchases')}}: | -
-
-
-
+
|
||
{{$t('fields.personFilling')}}: |
-
-
-
+
|
{{$t('fields.phone')}}: |
-
-
-
+
|