diff --git a/.gitignore b/.gitignore
index b741a2d44..895a6a8dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ print.*.json
db.json
junit.xml
.DS_Store
+storage
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f48811338..c031a3874 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,14 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [24.16.01] - 2024-04-18
+
+## [2414.01] - 2024-04-04
+
## [2408.01] - 2024-02-22
-### Added
-
-### Changed
-
-### Fixed
-
## [2406.01] - 2024-02-08
### Added
diff --git a/back/methods/collection/assign.js b/back/methods/collection/assign.js
index b0c1d9995..0484eb5a8 100644
--- a/back/methods/collection/assign.js
+++ b/back/methods/collection/assign.js
@@ -20,8 +20,9 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
- const [,, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
- [userId], myOptions);
+ const [, , [{collectionFk}]] =
+ await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
+ [userId], myOptions);
if (!collectionFk) throw new UserError('There are not picking tickets');
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
diff --git a/back/methods/dms/downloadFile.js b/back/methods/dms/downloadFile.js
index 1b9150053..6f2451505 100644
--- a/back/methods/dms/downloadFile.js
+++ b/back/methods/dms/downloadFile.js
@@ -29,7 +29,8 @@ module.exports = Self => {
http: {
path: `/:id/downloadFile`,
verb: 'GET'
- }
+ },
+ // accessScopes: ['read:multimedia']
});
Self.downloadFile = async function(ctx, id) {
diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js
index a0d72ce01..4aa40197f 100644
--- a/back/methods/docuware/download.js
+++ b/back/methods/docuware/download.js
@@ -42,7 +42,8 @@ module.exports = Self => {
http: {
path: `/:id/download`,
verb: 'GET'
- }
+ },
+ // 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 2b1a4b546..9ac06f30b 100644
--- a/back/methods/image/download.js
+++ b/back/methods/image/download.js
@@ -47,7 +47,8 @@ module.exports = Self => {
http: {
path: `/:collection/:size/:id/download`,
verb: 'GET'
- }
+ },
+ // accessScopes: ['read:multimedia']
});
Self.download = async function(ctx, collection, size, id) {
diff --git a/back/methods/image/specs/download.spec.js b/back/methods/image/specs/download.spec.js
index 1258a916a..bc23a0dcd 100644
--- a/back/methods/image/specs/download.spec.js
+++ b/back/methods/image/specs/download.spec.js
@@ -4,20 +4,21 @@ describe('image download()', () => {
const collection = 'user';
const size = '160x160';
const employeeId = 1;
+ const developerId = 9;
+ const jessicaJonesId = 1110;
const ctx = {req: {accessToken: {userId: employeeId}}};
it('should return the image content-type of the user', async() => {
- const userId = 9;
- const image = await models.Image.download(ctx, collection, size, userId);
+ const image = await models.Image.download(ctx, collection, size, developerId);
const contentType = image[1];
expect(contentType).toEqual('image/png');
});
- it(`should return false if the user doesn't have image`, async() => {
- const userId = 1110;
- const image = await models.Image.download(ctx, collection, size, userId);
+ it('should return the user profile picture', async() => {
+ const image = await models.Image.download(ctx, collection, size, jessicaJonesId);
+ const fileName = image[2];
- expect(image).toBeFalse();
+ expect(fileName).toMatch('1110.png');
});
});
diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js
index 8f663302d..44fad2c05 100644
--- a/back/methods/machine-worker/updateInTime.js
+++ b/back/methods/machine-worker/updateInTime.js
@@ -38,7 +38,7 @@ module.exports = Self => {
}, myOptions);
if (!machine)
- throw new Error($t('the plate does not exist', {plate}));
+ throw new UserError($t('the plate does not exist', {plate}));
const machineWorker = await Self.findOne({
where: {
@@ -48,7 +48,7 @@ module.exports = Self => {
}, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
- const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000);
+ const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) {
const isHimself = userId == machineWorker.workerFk;
diff --git a/back/methods/mobile-app-version-control/getVersion.js b/back/methods/mobile-app-version-control/getVersion.js
index 38f4acc54..9ace4e14a 100644
--- a/back/methods/mobile-app-version-control/getVersion.js
+++ b/back/methods/mobile-app-version-control/getVersion.js
@@ -40,6 +40,11 @@ module.exports = Self => {
fields,
};
- return Self.findOne(filter);
+ const result = await Self.findOne(filter);
+ return {
+ isVersionCritical: result?.isVersionBetaCritical ?? result?.isVersionCritical,
+ version: result?.versionBeta ?? result?.version,
+ url: result?.urlBeta ?? result?.urlProduction
+ };
};
};
diff --git a/back/methods/mobile-app-version-control/specs/getVersion.spec.js b/back/methods/mobile-app-version-control/specs/getVersion.spec.js
index 59d794ccf..da738c432 100644
--- a/back/methods/mobile-app-version-control/specs/getVersion.spec.js
+++ b/back/methods/mobile-app-version-control/specs/getVersion.spec.js
@@ -2,6 +2,8 @@ const {models} = require('vn-loopback/server/server');
describe('mobileAppVersionControl getVersion()', () => {
const appName = 'delivery';
+ const appNameVersion = '9.2';
+ const appNameVersionBeta = '9.7';
beforeAll(async() => {
ctx = {
req: {
@@ -13,17 +15,15 @@ describe('mobileAppVersionControl getVersion()', () => {
it('should get the version app', async() => {
ctx.req.accessToken.userId = 9;
- const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
+ const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
- expect(version).toEqual('9.2');
- expect(versionBeta).toBeUndefined();
+ expect(version).toEqual(appNameVersion);
});
it('should get the beta version app', async() => {
ctx.req.accessToken.userId = 66;
- const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
+ const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
- expect(versionBeta).toBeDefined();
- expect(version).toBeUndefined();
+ expect(version).toEqual(appNameVersionBeta);
});
});
diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js
index e7bba524a..0f48bc2d3 100644
--- a/back/methods/mrw-config/specs/createShipment.spec.js
+++ b/back/methods/mrw-config/specs/createShipment.spec.js
@@ -49,6 +49,7 @@ describe('MRWConfig createShipment()', () => {
await models.MrwConfig.create(
{
+ 'id': 1,
'url': 'https://url.com',
'user': 'user',
'password': 'password',
diff --git a/back/methods/notification/specs/getList.spec.js b/back/methods/notification/specs/getList.spec.js
index 52ac497a5..6c60d3505 100644
--- a/back/methods/notification/specs/getList.spec.js
+++ b/back/methods/notification/specs/getList.spec.js
@@ -7,7 +7,7 @@ describe('NotificationSubscription getList()', () => {
const notifications = await models.Notification.find({});
const totalAvailable = notifications.length - active.length;
- expect(active.length).toEqual(2);
+ expect(active.length).toEqual(3);
expect(available.length).toEqual(totalAvailable);
});
});
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/back/methods/vn-user/share-token.js b/back/methods/vn-user/share-token.js
new file mode 100644
index 000000000..8efa22db4
--- /dev/null
+++ b/back/methods/vn-user/share-token.js
@@ -0,0 +1,27 @@
+
+module.exports = Self => {
+ Self.remoteMethodCtx('shareToken', {
+ description: 'Returns token to view files or images and share it',
+ accessType: 'WRITE',
+ accepts: [],
+ returns: {
+ type: 'Object',
+ root: true
+ },
+ http: {
+ path: `/shareToken`,
+ verb: 'GET'
+ }
+ });
+
+ Self.shareToken = async function(ctx) {
+ const {accessToken: token} = ctx.req;
+
+ const user = await Self.findById(token.userId);
+ const multimediaToken = await user.accessTokens.create({
+ scopes: ['read:multimedia']
+ });
+
+ return {multimediaToken};
+ };
+};
diff --git a/back/methods/vn-user/specs/share-token.spec.js b/back/methods/vn-user/specs/share-token.spec.js
new file mode 100644
index 000000000..aaa83817c
--- /dev/null
+++ b/back/methods/vn-user/specs/share-token.spec.js
@@ -0,0 +1,27 @@
+const {models} = require('vn-loopback/server/server');
+describe('Share Token', () => {
+ let ctx = null;
+ beforeAll(async() => {
+ const unAuthCtx = {
+ req: {
+ headers: {},
+ connection: {
+ remoteAddress: '127.0.0.1'
+ },
+ getLocale: () => 'en'
+ },
+ args: {}
+ };
+ let login = await models.VnUser.signIn(unAuthCtx, 'salesAssistant', 'nightmare');
+ let accessToken = await models.AccessToken.findById(login.token);
+ ctx = {req: {accessToken: accessToken}};
+ });
+
+ it('should renew token', async() => {
+ const multimediaToken = await models.VnUser.shareToken(ctx);
+
+ expect(Object.keys(multimediaToken).length).toEqual(1);
+ expect(multimediaToken.multimediaToken.userId).toEqual(ctx.req.accessToken.userId);
+ expect(multimediaToken.multimediaToken.scopes[0]).toEqual('read:multimedia');
+ });
+});
diff --git a/back/models/mrw-config.json b/back/models/mrw-config.json
index f0cf799b1..50cf7e8fc 100644
--- a/back/models/mrw-config.json
+++ b/back/models/mrw-config.json
@@ -9,6 +9,7 @@
"properties": {
"id": {
"type": "number",
+ "id": true,
"required": true
},
"url": {
diff --git a/back/models/vn-user.js b/back/models/vn-user.js
index 3a416d7e3..b59f13ffa 100644
--- a/back/models/vn-user.js
+++ b/back/models/vn-user.js
@@ -13,6 +13,7 @@ module.exports = function(Self) {
require('../methods/vn-user/privileges')(Self);
require('../methods/vn-user/validate-auth')(Self);
require('../methods/vn-user/renew-token')(Self);
+ require('../methods/vn-user/share-token')(Self);
require('../methods/vn-user/update-user')(Self);
Self.definition.settings.acls = Self.definition.settings.acls.filter(acl => acl.property !== 'create');
diff --git a/back/models/vn-user.json b/back/models/vn-user.json
index 639603643..5f6ac3f47 100644
--- a/back/models/vn-user.json
+++ b/back/models/vn-user.json
@@ -1,129 +1,140 @@
{
- "name": "VnUser",
- "base": "User",
- "validateUpsert": true,
- "options": {
- "mysql": {
- "table": "account.user"
- }
- },
+ "name": "VnUser",
+ "base": "User",
+ "validateUpsert": true,
+ "options": {
+ "mysql": {
+ "table": "account.user"
+ }
+ },
"mixins": {
"Loggable": true
},
"resetPasswordTokenTTL": "604800",
- "properties": {
- "id": {
- "type": "number",
- "id": true
- },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true
+ },
"name": {
- "type": "string",
- "required": true
- },
- "username": {
- "type": "string"
- },
- "roleFk": {
- "type": "number",
- "mysql": {
- "columnName": "role"
- }
- },
- "nickname": {
- "type": "string"
- },
- "lang": {
- "type": "string"
- },
- "active": {
- "type": "boolean"
- },
- "email": {
- "type": "string"
- },
- "emailVerified": {
- "type": "boolean"
- },
- "created": {
- "type": "date"
- },
- "updated": {
- "type": "date"
- },
- "image": {
- "type": "string"
- },
- "hasGrant": {
- "type": "boolean"
- },
+ "type": "string",
+ "required": true
+ },
+ "username": {
+ "type": "string"
+ },
+ "roleFk": {
+ "type": "number",
+ "mysql": {
+ "columnName": "role"
+ }
+ },
+ "nickname": {
+ "type": "string"
+ },
+ "lang": {
+ "type": "string"
+ },
+ "active": {
+ "type": "boolean"
+ },
+ "email": {
+ "type": "string"
+ },
+ "emailVerified": {
+ "type": "boolean"
+ },
+ "created": {
+ "type": "date"
+ },
+ "updated": {
+ "type": "date"
+ },
+ "image": {
+ "type": "string"
+ },
+ "hasGrant": {
+ "type": "boolean"
+ },
"passExpired": {
"type": "date"
},
- "twoFactor": {
- "type": "string"
- }
- },
- "relations": {
- "role": {
- "type": "belongsTo",
- "model": "VnRole",
- "foreignKey": "roleFk"
- },
- "roles": {
- "type": "hasMany",
- "model": "RoleRole",
- "foreignKey": "role",
- "primaryKey": "roleFk"
- },
- "emailUser": {
- "type": "hasOne",
- "model": "EmailUser",
- "foreignKey": "userFk"
- },
- "worker": {
- "type": "hasOne",
- "model": "Worker",
- "foreignKey": "id"
- },
- "userConfig": {
- "type": "hasOne",
- "model": "UserConfig",
- "foreignKey": "userFk"
- }
- },
- "acls": [
- {
- "property": "signIn",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$everyone",
- "permission": "ALLOW"
- }, {
- "property": "recoverPassword",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$everyone",
- "permission": "ALLOW"
- }, {
- "property": "validateAuth",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$everyone",
- "permission": "ALLOW"
- }, {
- "property": "privileges",
- "accessType": "*",
- "principalType": "ROLE",
- "principalId": "$authenticated",
- "permission": "ALLOW"
- }, {
- "property": "renewToken",
- "accessType": "WRITE",
- "principalType": "ROLE",
- "principalId": "$authenticated",
- "permission": "ALLOW"
- }
- ],
+ "twoFactor": {
+ "type": "string"
+ }
+ },
+ "relations": {
+ "role": {
+ "type": "belongsTo",
+ "model": "VnRole",
+ "foreignKey": "roleFk"
+ },
+ "roles": {
+ "type": "hasMany",
+ "model": "RoleRole",
+ "foreignKey": "role",
+ "primaryKey": "roleFk"
+ },
+ "emailUser": {
+ "type": "hasOne",
+ "model": "EmailUser",
+ "foreignKey": "userFk"
+ },
+ "worker": {
+ "type": "hasOne",
+ "model": "Worker",
+ "foreignKey": "id"
+ },
+ "userConfig": {
+ "type": "hasOne",
+ "model": "UserConfig",
+ "foreignKey": "userFk"
+ }
+ },
+ "acls": [
+ {
+ "property": "signIn",
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ },
+ {
+ "property": "recoverPassword",
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ },
+ {
+ "property": "validateAuth",
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ },
+ {
+ "property": "privileges",
+ "accessType": "*",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
+ },
+ {
+ "property": "renewToken",
+ "accessType": "WRITE",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
+ },
+ {
+ "property": "shareToken",
+ "accessType": "WRITE",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
+ }
+ ],
"scopes": {
"preview": {
"fields": [
@@ -140,7 +151,7 @@
"hasGrant",
"realm",
"email",
- "emailVerified"
+ "emailVerified"
]
}
}
diff --git a/db/changes/240404/00-revokeMailAliasAccount.sql b/db/changes/240404/00-revokeMailAliasAccount.sql
deleted file mode 100644
index a86de1f3c..000000000
--- a/db/changes/240404/00-revokeMailAliasAccount.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-DELETE FROM salix.ACL
- WHERE model = 'MailAliasAccount'
- AND property = 'canEditAlias'
- AND principalType = 'ROLE'
- AND principalId = 'marketingBoss';
diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql
index 905847119..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','10943','fbdebad12c9b306004dee3fba252c1fc4613584e','2024-03-07 10:29:57','10943');
+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);
@@ -581,6 +581,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10825','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10827','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-23 12:32:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10828','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10828','01-RevokeClientes_regalos_lista.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10832','00-newWareHouse.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_commit.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_rollback.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_start.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
@@ -672,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);
@@ -696,16 +704,50 @@ INSERT INTO `versionLog` VALUES ('vn-database','10896','29-kk.sql','jenkins@db-p
INSERT INTO `versionLog` VALUES ('vn-database','10896','30-permissions.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:03',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10898','00-table.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:03',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10903','00-professionalCategoryAddCode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 08:38:28',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10905','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10906','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:04',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10908','00-createSupplierDms.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:24',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10909','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-26 11:07:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10912','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:25',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10913','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL);
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);
+INSERT INTO `versionLog` VALUES ('vn-database','10924','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','10925','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
+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 */;
@@ -721,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);
@@ -794,7 +836,7 @@ INSERT INTO `role` VALUES (115,'itManagement','TI management',1,'2023-03-29 09:2
INSERT INTO `role` VALUES (119,'palletizerBoss','Jefe de paletizadores',1,'2023-06-07 13:51:54','2023-06-07 13:51:54',NULL);
INSERT INTO `role` VALUES (120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 09:07:21','2023-06-19 09:07:21',21709);
INSERT INTO `role` VALUES (121,'buyerSalesAssistant','Rol para compradores que también son responsables de ventas',1,'2023-06-23 16:48:19','2023-06-23 16:48:19',NULL);
-INSERT INTO `role` VALUES (122,'logisticAssistant','Jefe auxiliar de logística',1,'2023-06-26 09:21:15','2023-06-26 09:21:15',NULL);
+INSERT INTO `role` VALUES (122,'logisticAssist','Jefe auxiliar de logística',1,'2023-06-26 09:21:15','2024-03-15 13:38:26',19295);
INSERT INTO `role` VALUES (123,'deliveryAssistant','Jefe auxiliar repartos',1,'2023-10-05 08:47:48','2023-10-05 08:47:48',10578);
INSERT INTO `role` VALUES (124,'hrBuyer','Recursos Humanos con Buyer',1,'2023-10-23 13:50:43','2023-10-23 13:50:43',NULL);
INSERT INTO `role` VALUES (125,'claimViewer','Trabajadores que consulta las reclamaciones ',1,'2023-11-16 09:14:46','2023-11-16 09:14:46',10578);
@@ -1036,7 +1078,6 @@ INSERT INTO `roleInherit` VALUES (312,115,120,NULL);
INSERT INTO `roleInherit` VALUES (314,43,18,NULL);
INSERT INTO `roleInherit` VALUES (315,121,35,NULL);
INSERT INTO `roleInherit` VALUES (316,121,21,NULL);
-INSERT INTO `roleInherit` VALUES (317,122,15,NULL);
INSERT INTO `roleInherit` VALUES (318,16,122,NULL);
INSERT INTO `roleInherit` VALUES (319,37,49,NULL);
INSERT INTO `roleInherit` VALUES (320,37,18,NULL);
@@ -1066,6 +1107,7 @@ INSERT INTO `roleInherit` VALUES (358,36,49,NULL);
INSERT INTO `roleInherit` VALUES (359,129,35,NULL);
INSERT INTO `roleInherit` VALUES (360,101,129,NULL);
INSERT INTO `roleInherit` VALUES (361,50,112,NULL);
+INSERT INTO `roleInherit` VALUES (362,122,15,NULL);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@@ -1159,7 +1201,7 @@ INSERT INTO `ACL` VALUES (105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketin
INSERT INTO `ACL` VALUES (106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `ACL` VALUES (108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `ACL` VALUES (109,'UserConfig','*','*','ALLOW','ROLE','employee');
-INSERT INTO `ACL` VALUES (110,'Bank','*','READ','ALLOW','ROLE','trainee');
+INSERT INTO `ACL` VALUES (110,'Accounting','*','READ','ALLOW','ROLE','trainee');
INSERT INTO `ACL` VALUES (111,'ClientLog','*','READ','ALLOW','ROLE','trainee');
INSERT INTO `ACL` VALUES (112,'Defaulter','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (113,'ClientRisk','*','READ','ALLOW','ROLE','trainee');
@@ -1294,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');
@@ -1393,6 +1435,8 @@ INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','em
INSERT INTO `ACL` VALUES (386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer');
INSERT INTO `ACL` VALUES (388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative');
+INSERT INTO `ACL` VALUES (389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager');
+INSERT INTO `ACL` VALUES (390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager');
INSERT INTO `ACL` VALUES (391,'Notification','*','WRITE','ALLOW','ROLE','system');
INSERT INTO `ACL` VALUES (392,'Boxing','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (393,'Url','*','READ','ALLOW','ROLE','employee');
@@ -1753,6 +1797,29 @@ INSERT INTO `ACL` VALUES (797,'MrwConfig','createShipment','WRITE','ALLOW','ROLE
INSERT INTO `ACL` VALUES (798,'MailAliasAccount','*','*','ALLOW','ROLE','itManagement');
INSERT INTO `ACL` VALUES (799,'Ticket','saveCmr','*','ALLOW','ROLE','developer');
INSERT INTO `ACL` VALUES (800,'EntryDms','*','*','ALLOW','ROLE','employee');
+INSERT INTO `ACL` VALUES (801,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee');
+INSERT INTO `ACL` VALUES (802,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee');
+INSERT INTO `ACL` VALUES (803,'ExpeditionPallet','*','READ','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (804,'DeviceProduction','*','READ','ALLOW','ROLE','employee');
+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','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');
+INSERT INTO `ACL` VALUES (812,'ExpeditionPallet','*','READ','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (813,'Sale','getFromSectorCollection','READ','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (814,'ItemBarcode','delete','WRITE','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (815,'WorkerActivityType','*','READ','ALLOW','ROLE','production');
+INSERT INTO `ACL` VALUES (816,'WorkerActivity','*','*','ALLOW','ROLE','production');
+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');
@@ -2071,61 +2138,61 @@ INSERT INTO `continent` VALUES (3,'África','AF');
INSERT INTO `continent` VALUES (4,'Europa','EU');
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
-INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,27,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (43,'VT','VENTAS',38,67,NULL,0,0,0,1,14,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (44,'management','GERENCIA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (46,'delivery','REPARTO',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',74,75,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL);
-INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL);
-INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',41,42,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL,'5300');
-INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',43,44,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',45,46,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',0,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL,'5100');
-INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',47,48,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',0,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL,'5000');
-INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',49,50,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',51,52,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',53,54,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',55,56,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL,'5200');
-INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',85,86,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',57,58,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',59,60,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL,'3300');
-INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',61,62,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500');
-INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',63,64,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,'5400');
-INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',65,66,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL);
-INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (43,'VT','VENTAS',38,69,NULL,0,0,0,1,15,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (44,'management','GERENCIA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (46,'delivery','REPARTO',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',76,77,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (80,'vallesTeam','EQUIPO J VALLES',43,44,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
+INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',45,46,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (94,'brocalTeam','EQUIPO J BROCAL',47,48,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',0,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
+INSERT INTO `department` VALUES (95,'zambranoTeam','EQUIPO C ZAMBRANO',49,50,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',0,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL);
+INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',51,52,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',53,54,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',55,56,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (125,'miriamMarTeam','EQUIPO MIRIAM MAR',57,58,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
+INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',85,86,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',59,60,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',61,62,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
+INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',63,64,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
+INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (139,'soriaTeam','EQUIPO J SORIA ',65,66,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'equipojsoria@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
+INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',67,68,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
+INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
@@ -2456,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 1fc55876e..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 */;
@@ -132,7 +134,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','account','account','userPassword',
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','account','mainAccountBank','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemCategory','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','psico','hr','answer','alexm@%','0000-00-00 00:00:00','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','ticketDms','alexm@%','0000-00-00 00:00:00','Insert,Update','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ticketDms','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','edi','employee','ekt','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','sage','administrative','taxType','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','psico','hr','fellow','alexm@%','0000-00-00 00:00:00','Select','');
@@ -333,7 +335,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Cubos','ale
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','state','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','travel','alexm@%','0000-00-00 00:00:00','Delete','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','edi_bucket_type','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','edi_bucket','alexm@%','0000-00-00 00:00:00','Select','');
@@ -420,9 +422,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Movimientos
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Movimientos_revisar','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','handmadeBoss','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bank','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Ordenes','alexm@%','0000-00-00 00:00:00','Select,Update','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','bank','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','awb','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Origen','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pago','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@@ -757,7 +757,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','alexm@%','0000-
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','buy','alexm@%','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','saleGoal','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','component','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','Entradas','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleComponent','alexm@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','arcRead','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@@ -780,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','');
@@ -900,7 +899,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','postgresql','hr','calendar_employe
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','ticket','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticket','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketCollection','alexm@%','0000-00-00 00:00:00','Select','');
-INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketDms','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ticketDocumentation','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketDms','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','ektEntryAssign','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
@@ -1362,6 +1360,24 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','warehousePickup','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','warehousePickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','warehousePickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','warehousePickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','component','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','config','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','componentType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDms','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','itemShelvingSale','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','tagAbbreviation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','ticketTracking','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','item','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Update');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','ticketDms','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Delete','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','agencyExtraCharge','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','sale_freightComponent','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
+INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accounting','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
+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 */;
@@ -1595,6 +1611,8 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','weight',
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','clonedFrom','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','cmrFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','editorFk','0000-00-00 00:00:00','Update');
+INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','config','truckLength','0000-00-00 00:00:00','Select');
+INSERT IGNORE INTO `columns_priv` VALUES ('','vn','production','item','isBoxPickingMode','0000-00-00 00:00:00','Update');
/*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `procs_priv` DISABLE KEYS */;
@@ -1644,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');
@@ -1670,22 +1686,22 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','mail_insert','PROCEDURE',
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_fixMisfit','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','employee','buy_tarifas_entry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','calculoremesas','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
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 ('','vn2008','handmadeBoss','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','productionAssi','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','artificialBoss','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','deliveryAssistant','preordenarruta','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','pay','PROCEDURE','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');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_addChild','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+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');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','item_comparative','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','calculoremesas','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','entryEditor','item_getVolume','FUNCTION','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','clientgetmana','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_scan','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@@ -1700,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');
@@ -1719,7 +1733,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','administrative','accountshor
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','raidupdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana','lastdayofweek','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','artificialBoss','raidupdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','adminBoss','nest_delete','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','invoicefromclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicefromclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoicefromticket','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@@ -1729,7 +1742,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','entry_splitbyshelvi
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoiceintaxmakebydua','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','invoiceintax_getfromentries','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoiceintax_getfromentries','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','adminBoss','nest_child_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','invoiceoutbooking','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','invoiceoutbooking','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','clienttaxarea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
@@ -1755,7 +1767,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','ticket_clone','P
INSERT IGNORE INTO `procs_priv` VALUES ('','cache','employee','available_refresh','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','ticket_clone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','ticket_clone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','itemproposal','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','payment_add','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','timebusiness_calculatebyuser','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','itemsale_byweek','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','itemsale_byweek','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@@ -1782,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');
@@ -1856,10 +1867,10 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionAssi','timebusiness_
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','timecontrol_geterror','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','travel_weeklyclone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByBuy','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerAssist','itemproposal','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
-INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getsuppliersdebt','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','handmadeBoss','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','bi','productionAssi','rutasanalyze','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionPlus','workerCreateExternal','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionAssi','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_NOW','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UNIX_TIMESTAMP','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_DATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@@ -1997,6 +2008,8 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','travel_getDetailFromCo
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','intrastat_estimateNet','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_controlSource','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
+INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2015,7 +2028,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','adminOfficer','{\"access\": 0, \"v
INSERT IGNORE INTO `global_priv` VALUES ('','administrative','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','agency','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 20000, \"max_user_connections\": 50, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','buyerAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
@@ -2028,17 +2041,18 @@ INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_q
INSERT IGNORE INTO `global_priv` VALUES ('','delivery','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}');
+INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
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}');
-INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','hrBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
@@ -2047,6 +2061,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','itBoss','{\"access\": 541165846527
INSERT IGNORE INTO `global_priv` VALUES ('','itManagement','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','itemPicker','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
+INSERT IGNORE INTO `global_priv` VALUES ('','logisticAssist','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenance','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
@@ -2059,9 +2074,9 @@ INSERT IGNORE INTO `global_priv` VALUES ('','packager','{\"access\":0,\"version
INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','palletizerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','preservedBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','production','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','production','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','productionAssi','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
-INSERT IGNORE INTO `global_priv` VALUES ('','productionBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
+INSERT IGNORE INTO `global_priv` VALUES ('','productionBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','productionPlus','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','root','{\"access\": 549755781119, \"version_id\": 100705, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','salesAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql
index 930b44341..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 */;
@@ -2830,21 +2836,6 @@ CREATE TABLE `tarifa_warehouse__` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #5744 Deprecated 2023-06-06\nAlmacena los valores de gasto por almacen';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `v_clientes_jerarquia`
---
-
-DROP TABLE IF EXISTS `v_clientes_jerarquia`;
-/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `v_clientes_jerarquia` AS SELECT
- 1 AS `Id_Cliente`,
- 1 AS `Cliente`,
- 1 AS `Comercial`,
- 1 AS `Jefe` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Temporary table structure for view `v_ventas_contables`
--
@@ -4577,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 */;
@@ -4977,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 */;
@@ -6235,7 +6228,7 @@ BEGIN
FROM vn.component WHERE code = 'manaClaim';
SELECT id INTO vManaBankId
- FROM vn.bank WHERE code = 'mana';
+ FROM vn.accounting WHERE code = 'mana';
SELECT id INTO vManaGreugeTypeId
FROM vn.greugeType WHERE code = 'mana';
@@ -7082,7 +7075,7 @@ BEGIN
ENGINE = MEMORY
SELECT Id_Ticket
FROM vn2008.Tickets t
- JOIN vn.invoiceOut io ON io.id = t.Factura
+ JOIN vn.invoiceOut io ON io.`ref` = t.Factura
WHERE year(io.issued) = vYear
AND month(io.issued) = vMonth;
@@ -8442,11 +8435,7 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`()
BEGIN
- DECLARE vDateShort DATETIME;
-
- SET vDateShort = TIMESTAMPADD(MONTH, -1, util.VN_CURDATE());
-
- DELETE FROM cache.departure_limit WHERE Fecha < vDateShort;
+ DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -8827,7 +8816,7 @@ CREATE TABLE `expedition_PrintOut` (
`expeditionFk` int(11) NOT NULL,
`ticketFk` int(11) NOT NULL,
`addressFk` int(11) NOT NULL,
- `street` varchar(100) NOT NULL DEFAULT ' ',
+ `street` varchar(42) NOT NULL DEFAULT ' ',
`postalCode` varchar(10) NOT NULL DEFAULT ' ',
`city` varchar(100) NOT NULL DEFAULT ' ',
`shopName` varchar(100) NOT NULL DEFAULT ' ',
@@ -9447,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 */;
@@ -9528,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 */;
@@ -9832,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 */;
@@ -11793,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',
@@ -11807,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 */;
@@ -11900,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 */;
@@ -11971,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',
@@ -11979,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 */;
@@ -12426,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,
@@ -12442,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 */;
@@ -12693,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,
@@ -12706,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 */;
@@ -12732,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 */;
@@ -13109,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 ;;
@@ -13213,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
@@ -14389,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 ;;
@@ -14471,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
@@ -15876,7 +15874,7 @@ p: BEGIN
FROM vn.`client` WHERE id = vCustomer;
SELECT account INTO vAccount
- FROM vn.bank WHERE id = vBank;
+ FROM vn.accounting WHERE id = vBank;
DELETE FROM vn.XDiario
WHERE SUBCTA = vSubaccount
@@ -16156,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 */;
@@ -16202,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 */;
@@ -16419,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,
@@ -16440,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 */;
@@ -17450,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 */;
@@ -18124,9 +18126,9 @@ BEGIN
LIMIT 10000000000000000000
) sub GROUP BY ASIEN
)sub2 ON sub2.ASIEN = x.ASIEN
- LEFT JOIN ( SELECT DISTINCT(account),cu.code
- FROM vn.bank b
- JOIN vn.currency cu ON cu.id = b.currencyFk
+ LEFT JOIN ( SELECT DISTINCT(a.account),cu.code
+ FROM vn.accounting a
+ JOIN vn.currency cu ON cu.id = a.currencyFk
WHERE cu.code <> 'EUR' -- no se informa cuando la divisa en EUR
)sub3 ON sub3.account = x.SUBCTA
WHERE x.enlazadoSage = FALSE
@@ -19361,12 +19363,12 @@ BEGIN
FROM vn.expense e
UNION
SELECT company_getCode(vCompanyFk),
- b.account,
- UCASE(b.bank),
+ a.account,
+ UCASE(a.bank),
''
- FROM vn.bank b
- WHERE b.isActive
- AND b.`account`
+ FROM vn.accounting a
+ WHERE a.isActive
+ AND a.`account`
UNION
SELECT CodigoEmpresa,
CodigoCuenta,
@@ -19506,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 */;
@@ -19582,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 */;
@@ -19877,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',
@@ -19895,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 */;
@@ -19978,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;
@@ -24441,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',
@@ -24449,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 */;
@@ -24467,7 +24475,7 @@ CREATE TABLE `debug` (
`user` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`host` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`variable` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
- `value` varchar(255) DEFAULT NULL,
+ `value` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `created` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Log de depuración';
@@ -24513,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`),
@@ -24546,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 */;
@@ -24620,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 */;
@@ -26627,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 */;
@@ -27060,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 */;
@@ -27077,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 */;
@@ -27364,25 +27377,6 @@ CREATE TABLE `balanceNestTree` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `bank`
---
-
-DROP TABLE IF EXISTS `bank`;
-/*!50001 DROP VIEW IF EXISTS `bank`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `bank` AS SELECT
- 1 AS `id`,
- 1 AS `bank`,
- 1 AS `account`,
- 1 AS `cash`,
- 1 AS `entityFk`,
- 1 AS `isActive`,
- 1 AS `currencyFk`,
- 1 AS `code` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `bankEntity`
--
@@ -27409,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 */;
@@ -27497,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 */;
@@ -27803,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,
@@ -27827,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`),
@@ -27858,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 */;
@@ -28030,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 */;
@@ -28084,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 */;
@@ -28113,7 +28113,7 @@ CREATE TABLE `claim` (
`ticketFk` int(11) DEFAULT NULL,
`hasToPickUp` tinyint(1) NOT NULL,
`packages` smallint(10) unsigned DEFAULT 0 COMMENT 'packages received by the client',
- `rma` varchar(100) DEFAULT NULL,
+ `rma__` varchar(100) DEFAULT NULL,
`responsabilityRate` decimal(3,2) GENERATED ALWAYS AS ((5 - `responsibility`) / 4) VIRTUAL,
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
@@ -28160,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 */;
@@ -28400,19 +28401,19 @@ CREATE TABLE `claimResult` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
--- Table structure for table `claimRma`
+-- Table structure for table `claimRma__`
--
-DROP TABLE IF EXISTS `claimRma`;
+DROP TABLE IF EXISTS `claimRma__`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `claimRma` (
+CREATE TABLE `claimRma__` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`code` varchar(100) NOT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`workerFk` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='kkeada el 2024-02-26 por Pablo';
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -28567,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',
@@ -28582,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 */;
@@ -29212,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 ',
@@ -29314,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 */;
@@ -29329,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 */;
@@ -29445,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,
@@ -29484,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 */;
@@ -30078,6 +30083,7 @@ CREATE TABLE `department` (
`clientFk` int(11) DEFAULT NULL COMMENT 'Cuenta de cliente que se utiliza para los compras de consumo departamental',
`twoFactor` enum('email') DEFAULT NULL COMMENT 'Default user two-factor auth type',
`pbxQueue` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `workerActivityTypeFk` varchar(20) DEFAULT NULL COMMENT 'Indica la actitividad que desempeña por defecto ese departamento',
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`),
KEY `fk_department_Trabajadores1_idx` (`workerFk`),
@@ -30086,9 +30092,11 @@ CREATE TABLE `department` (
KEY `department_FK` (`clientFk`),
KEY `department_FK_1` (`parentFk`),
KEY `department_queue_FK` (`pbxQueue`),
+ KEY `department_workerActivityType_FK` (`workerActivityTypeFk`),
CONSTRAINT `department_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `department_FK_1` FOREIGN KEY (`parentFk`) REFERENCES `department` (`id`),
CONSTRAINT `department_queue_FK` FOREIGN KEY (`pbxQueue`) REFERENCES `pbx`.`queue` (`name`) ON UPDATE CASCADE,
+ CONSTRAINT `department_workerActivityType_FK` FOREIGN KEY (`workerActivityTypeFk`) REFERENCES `workerActivityType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -30201,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 */;
@@ -30423,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 */;
@@ -31754,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,
@@ -31764,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 */;
@@ -31799,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 */;
@@ -31895,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,
@@ -31905,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 */;
@@ -31968,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 */;
@@ -32184,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',
@@ -32196,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 */;
@@ -32375,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,
@@ -32383,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 */;
@@ -32656,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 */;
@@ -33007,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',
@@ -33018,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 */;
@@ -33322,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',
@@ -34059,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 */;
@@ -34209,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 */;
@@ -34436,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 */;
@@ -34703,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,
@@ -34718,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 */;
@@ -34835,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,
@@ -34848,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 */;
@@ -34974,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 */;
@@ -35082,6 +35106,7 @@ CREATE TABLE `parking` (
`sectorFk` int(11) NOT NULL DEFAULT 2,
`code` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`pickingOrder` int(11) DEFAULT NULL,
+ `editorFk` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code_UNIQUE` (`code`),
KEY `parking_fk1_idx` (`sectorFk`),
@@ -35089,6 +35114,34 @@ CREATE TABLE `parking` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla con los parkings del altillo';
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `parkingLog`
+--
+
+DROP TABLE IF EXISTS `parkingLog`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `parkingLog` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `originFk` int(11) DEFAULT NULL,
+ `userFk` int(10) unsigned DEFAULT NULL,
+ `action` set('insert','update','delete','select') NOT NULL,
+ `creationDate` timestamp NULL DEFAULT current_timestamp(),
+ `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `changedModel` enum('Parking','SaleGroup','SaleGroupDetail') NOT NULL DEFAULT 'Parking',
+ `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
+ `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
+ `changedModelId` int(11) NOT NULL,
+ `changedModelValue` varchar(45) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `logParkinguserFk` (`userFk`),
+ KEY `parkingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
+ KEY `parkingLog_originFk` (`originFk`,`creationDate`),
+ CONSTRAINT `parkingOriginFk` FOREIGN KEY (`originFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `parkingUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `payDem`
--
@@ -35775,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',
@@ -35800,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 */;
@@ -35867,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 */;
@@ -36117,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`
--
@@ -36177,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 */;
@@ -36642,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 */;
@@ -36997,6 +37068,7 @@ CREATE TABLE `saleGroupDetail` (
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`saleFk` int(11) NOT NULL,
`saleGroupFk` int(11) NOT NULL,
+ `editorFk` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `saleGroupDetail_UN` (`saleFk`),
KEY `saleGroupDetail_FK_1` (`saleGroupFk`),
@@ -37306,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 */;
@@ -37518,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 */;
@@ -37856,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 */;
@@ -37935,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 */;
@@ -38800,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 */;
@@ -38954,7 +39033,7 @@ CREATE TABLE `ticketLog` (
`action` set('insert','update','delete','select') NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
- `changedModel` enum('Ticket','Sale','TicketWeekly','TicketTracking','TicketService','TicketRequest','TicketRefund','TicketPackaging','TicketObservation','TicketDms','Expedition','Sms','SaleGroup') NOT NULL DEFAULT 'Ticket',
+ `changedModel` enum('Ticket','Sale','TicketWeekly','TicketTracking','TicketService','TicketRequest','TicketRefund','TicketPackaging','TicketObservation','TicketDms','Expedition','Sms') NOT NULL DEFAULT 'Ticket',
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
`changedModelId` int(11) NOT NULL,
@@ -39554,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 */;
@@ -39846,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',
@@ -39859,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 */;
@@ -39970,49 +40051,6 @@ CREATE TABLE `trolley` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `unary`
---
-
-DROP TABLE IF EXISTS `unary`;
-/*!50001 DROP VIEW IF EXISTS `unary`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `unary` AS SELECT
- 1 AS `id`,
- 1 AS `parent` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `unaryScan`
---
-
-DROP TABLE IF EXISTS `unaryScan`;
-/*!50001 DROP VIEW IF EXISTS `unaryScan`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `unaryScan` AS SELECT
- 1 AS `unaryFk`,
- 1 AS `name`,
- 1 AS `created`,
- 1 AS `type` */;
-SET character_set_client = @saved_cs_client;
-
---
--- Temporary table structure for view `unaryScanLine`
---
-
-DROP TABLE IF EXISTS `unaryScanLine`;
-/*!50001 DROP VIEW IF EXISTS `unaryScanLine`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `unaryScanLine` AS SELECT
- 1 AS `id`,
- 1 AS `code`,
- 1 AS `created`,
- 1 AS `unaryScanFk` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `userConfig`
--
@@ -40312,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,
@@ -40322,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 */;
@@ -40376,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 */;
@@ -40648,13 +40688,30 @@ DROP TABLE IF EXISTS `workerActivity`;
CREATE TABLE `workerActivity` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created` timestamp NULL DEFAULT current_timestamp(),
- `model` enum('COM','ENT','TPV','ENC','LAB','ETI') NOT NULL,
+ `model` enum('COM','ENT','TPV','ENC','LAB','ETI','APP') NOT NULL,
`workerFk` int(10) unsigned NOT NULL,
- `event` enum('open','close','insert','delete','update','refresh') NOT NULL,
+ `event` enum('open','close','insert','delete','update','refresh') DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
+ `workerActivityTypeFk` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_workerActivity_worker` (`workerFk`),
- CONSTRAINT `fk_workerActivity_worker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ KEY `workerActivity_workerActivityType_FK` (`workerActivityTypeFk`),
+ CONSTRAINT `fk_workerActivity_worker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `workerActivity_workerActivityType_FK` FOREIGN KEY (`workerActivityTypeFk`) REFERENCES `workerActivityType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `workerActivityType`
+--
+
+DROP TABLE IF EXISTS `workerActivityType`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `workerActivityType` (
+ `code` varchar(20) NOT NULL,
+ `description` varchar(45) NOT NULL,
+ PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -40770,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',
@@ -40779,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 */;
@@ -41268,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,
@@ -41295,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 */;
@@ -41486,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 */;
@@ -41564,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 */;
@@ -41819,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 */ ;;
@@ -41829,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
@@ -42130,24 +42190,6 @@ DELIMITER ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-/*!50106 DROP EVENT IF EXISTS `sale_checkWithoutComponents` */;;
-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 = utf8mb4 */ ;;
-/*!50003 SET character_set_results = utf8mb4 */ ;;
-/*!50003 SET collation_connection = utf8mb4_general_ci */ ;;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
-/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;;
-/*!50003 SET @saved_time_zone = @@time_zone */ ;;
-/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`jgallego`@`%`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE)) */ ;;
-/*!50003 SET time_zone = @saved_time_zone */ ;;
-/*!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 */ ;;
/*!50106 DROP EVENT IF EXISTS `ticket_doRecalc` */;;
DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
@@ -42310,6 +42352,7 @@ BEGIN
CALL vn.addressTaxArea();
SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea;
+
DROP TEMPORARY TABLE
tmp.addressCompany,
tmp.addressTaxArea;
@@ -43954,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 ;
@@ -46090,7 +46136,7 @@ BEGIN
-- Inserta los asientos contables
SELECT account INTO vAccount
- FROM bank WHERE id = vBank;
+ FROM accounting WHERE id = vBank;
SELECT accountingAccount INTO vSubaccount
FROM `client` WHERE id = vClient;
@@ -46303,6 +46349,45 @@ 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 FUNCTION IF EXISTS `travel_hasUniqueAwb` */;
+/*!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` FUNCTION `travel_hasUniqueAwb`(vSelf INT
+) RETURNS tinyint(1)
+ READS SQL DATA
+BEGIN
+/**
+ * Comprueba que el travel pasado tiene un AWB lógico,
+ * no se pueden tener varios AWB asociados al mismo DUA
+ *
+ * @param vSelf Id del travel
+ */
+ DECLARE vHasUniqueAwb BOOL DEFAULT TRUE;
+
+ SELECT NOT COUNT(t2.awbFk) INTO vHasUniqueAwb
+ FROM entry e
+ JOIN travel t ON t.id = e.travelFk
+ JOIN duaEntry de ON de.entryFk = e.id
+ JOIN duaEntry de2 ON de2.duaFk = de.duaFk
+ JOIN entry e2 ON e2.id = de2.entryFk
+ JOIN travel t2 ON t2.id = e2.travelFk
+ WHERE t.id = vSelf
+ AND t2.awbFk <> t.awbFk;
+
+ RETURN vHasUniqueAwb;
+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 FUNCTION IF EXISTS `validationCode` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -46716,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 */ ;
@@ -47078,6 +47278,267 @@ 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 `balanceNestTree_addChild` */;
+/*!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 `balanceNestTree_addChild`(
+ vSelf INT,
+ vName VARCHAR(45)
+)
+BEGIN
+/**
+ * Agrega un nuevo nodo hijo a un nodo existente dentro de la estructura
+ * de árbol de vn.balanceNestTree.
+ *
+ * @param vSelf Identificador del nodo
+ * @param vName Nombre del nuevo nodo hijo
+ */
+ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree');
+ DECLARE vLeft INT;
+
+ CREATE OR REPLACE TEMPORARY TABLE tAux
+ SELECT 0 lft;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE tAux
+ SET lft = (SELECT lft
+ FROM ', vTable,
+ ' WHERE id = ?)')
+ USING vSelf;
+
+ SELECT lft INTO vLeft FROM tAux;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable, '
+ SET rgt = rgt + 2
+ WHERE rgt > ?
+ ORDER BY rgt DESC')
+ USING vLeft;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable, '
+ SET lft = lft + 2
+ WHERE lft > ?
+ ORDER BY lft DESC')
+ USING vLeft;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'INSERT INTO ', vTable, ' (name, lft, rgt)
+ VALUES(?, ? + 1, ? + 2)')
+ USING vName,
+ vLeft,
+ vLeft;
+
+ DROP TEMPORARY TABLE tAux;
+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 `balanceNestTree_delete` */;
+/*!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 `balanceNestTree_delete`(
+ vSelf INT
+)
+BEGIN
+/**
+ * Elimina un nodo dentro de la estructura de árbol de vn.balanceNestTree.
+ *
+ * @param vSelf Identificador del nodo
+ */
+ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree');
+ DECLARE vRight INT;
+ DECLARE vLeft INT;
+ DECLARE vWidth INT;
+
+ CREATE OR REPLACE TEMPORARY TABLE tAux
+ SELECT 0 rgt, 0 lft, 0 wdt;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE tAux a
+ JOIN ', vTable, ' t
+ SET a.rgt = t.rgt,
+ a.lft = t.lft,
+ a.wdt = t.rgt - t.lft + 1
+ WHERE t.id = ?')
+ USING vSelf;
+
+ SELECT rgt, lft, wdt
+ INTO vRight, vLeft, vWidth
+ FROM tAux;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'DELETE FROM ', vTable,
+ ' WHERE lft BETWEEN ? AND ?')
+ USING vLeft, vRight;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ ' SET rgt = rgt - ?
+ WHERE rgt > ?
+ ORDER BY rgt')
+ USING vWidth,vRight;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ ' SET lft = lft - ?
+ WHERE lft > ?
+ ORDER BY lft')
+ USING vWidth, vRight;
+
+ DROP TEMPORARY TABLE tAux;
+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 `balanceNestTree_move` */;
+/*!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 `balanceNestTree_move`(
+ vSelf INT,
+ vFather INT
+)
+BEGIN
+/**
+ * Mueve un nodo dentro de la estructura de árbol de vn.balanceNestTree.
+ *
+ * @param vSelf Identificador del nodo
+ * @param vFather Identificador del nuevo padre del nodo
+ */
+ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree');
+ DECLARE vRight INT;
+ DECLARE vLeft INT;
+ DECLARE vWidth INT;
+ DECLARE vFatherRight INT;
+ DECLARE vFatherLeft INT;
+ DECLARE vGap INT;
+
+ CREATE OR REPLACE TEMPORARY TABLE tAux
+ SELECT 0 rgt, 0 lft, 0 wdt, 0 frg, 0 flf;
+
+ -- Averiguamos el ancho de la rama
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE tAux a
+ JOIN ', vTable, ' t
+ SET a.wdt = t.rgt - t.lft + 1
+ WHERE t.id = ?')
+ USING vSelf;
+
+ -- Averiguamos la posicion del nuevo padre
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE tAux a
+ JOIN ', vTable, ' t
+ SET a.frg = t.rgt,
+ a.flf = t.lft
+ WHERE t.id = ?')
+ USING vFather;
+
+ SELECT wdt, frg, flf
+ INTO vWidth, vFatherRight, vFatherLeft
+ FROM tAux;
+
+ -- 1º Incrementamos los valores de todos los nodos a la derecha
+ -- del punto de inserción (vFatherRight) , para hacer sitio
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ 'SET rgt = rgt + ?
+ WHERE rgt >= ?
+ ORDER BY rgt DESC')
+ USING vWidth,
+ vFatherRight;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ 'SET lft = lft + ?
+ WHERE lft >= ?
+ ORDER BY lft DESC')
+ USING vWidth,
+ vFatherRight;
+
+ -- Es preciso recalcular los valores del nodo en el
+ -- caso de que estuviera a la derecha del nuevo padre
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE tAux a
+ JOIN ', vTable, ' t
+ SET a.rgt = t.rgt,
+ a.lft = t.lft
+ WHERE t.id = ?')
+ USING vSelf;
+
+ SELECT lft, rgt, frg - lft
+ INTO vLeft, vRight, vGap
+ FROM tAux;
+
+ -- 2º Incrementamos el valor de todos los nodos a
+ -- trasladar hasta alcanzar su nueva posicion
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ 'SET lft = lft + ?
+ WHERE lft BETWEEN ? AND ?
+ ORDER BY lft DESC')
+ USING vGap,
+ vLeft,
+ vRight;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ 'SET rgt = rgt + ?
+ WHERE rgt BETWEEN ? AND ?
+ ORDER BY rgt DESC')
+ USING vGap,
+ vLeft,
+ vRight;
+
+ -- 3º Restaremos a todos los nodos resultantes, a la derecha
+ -- de la posicion arrancada el ancho de la rama escindida
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ 'SET lft = lft - ?
+ WHERE lft > ?
+ ORDER BY lft')
+ USING vWidth,
+ vLeft;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'UPDATE ', vTable,
+ 'SET rgt = rgt - ?
+ WHERE rgt > ?
+ ORDER BY rgt')
+ USING vWidth,
+ vRight;
+
+ DROP TEMPORARY TABLE tAux;
+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 `bankEntity_checkBic` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -47129,13 +47590,11 @@ BEGIN
INSERT INTO mail (receiver,replyTo,subject,body)
SELECT 'administracion@verdnatura.es' receiver,
'noreply@verdnatura.es' replyTo,
- CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') subject,
- CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') body
- FROM vn.bankPolicy bp
- LEFT JOIN vn.supplier s
- ON s.id = bp.supplierFk
- LEFT JOIN vn.bank b
- ON b.id = bp.accountingFk
+ CONCAT('El seguro de la poliza ',a.id,' ',a.bank,' ha finalizado.') subject,
+ CONCAT('El seguro de la poliza ',a.id,' ',a.bank,' ha finalizado.') body
+ FROM bankPolicy bp
+ LEFT JOIN supplier s ON s.id = bp.supplierFk
+ LEFT JOIN accounting a ON a.id = bp.accountingFk
WHERE bp.insuranceExpired = util.VN_CURDATE();
END ;;
DELIMITER ;
@@ -48063,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 ;
@@ -48081,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
@@ -48107,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(
@@ -48291,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)
@@ -48305,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
@@ -48317,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
@@ -48325,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,
@@ -48344,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
@@ -48376,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),
@@ -48410,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,
@@ -48443,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))
@@ -48458,7 +48933,7 @@ BEGIN
SELECT vZoneFk id;
CALL zone_getOptionsForShipment(vShipped, TRUE);
-
+
-- Reparto
INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFK,
@@ -48472,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;
@@ -48489,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
@@ -48525,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;
@@ -48564,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 */ ;
@@ -48651,48 +49127,43 @@ DELIMITER ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`()
BEGIN
- DECLARE vDateShort DATETIME;
- DECLARE vOneYearAgo DATE;
- DECLARE vFourYearsAgo DATE;
- DECLARE vFiveYearsAgo DATE;
- DECLARE v18Month DATE;
- DECLARE v26Month DATE;
- DECLARE v3Month DATE;
+/**
+ * Purges outdated data to optimize performance.
+ * Exercise caution when executing.
+ */
+ DECLARE v2Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 MONTH;
+ DECLARE v3Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 3 MONTH;
+ DECLARE v18Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 18 MONTH;
+ DECLARE v26Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 26 MONTH;
+ 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 vTrashId VARCHAR(15);
- DECLARE v2Years DATE;
- DECLARE v5Years DATE;
-
- SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH;
- SET vOneYearAgo = util.VN_CURDATE() - INTERVAL 1 YEAR;
- SET vFourYearsAgo = util.VN_CURDATE() - INTERVAL 4 YEAR;
- SET vFiveYearsAgo = util.VN_CURDATE() - INTERVAL 5 YEAR;
- SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH;
- SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH;
- SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH;
- SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR;
- SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR;
+ DECLARE vCompanyBlk INT;
DELETE FROM workerActivity WHERE created < v2Years;
- DELETE FROM ticketParking WHERE created < vDateShort;
- DELETE FROM routesMonitor WHERE dated < vDateShort;
- DELETE FROM workerTimeControlLog WHERE created < vDateShort;
- DELETE FROM `message` WHERE sendDate < vDateShort;
- DELETE FROM messageInbox WHERE sendDate < vDateShort;
- DELETE FROM messageInbox WHERE sendDate < vDateShort;
- DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo;
+ DELETE FROM ticketParking WHERE created < v2Months;
+ DELETE FROM routesMonitor WHERE dated < v2Months;
+ DELETE FROM workerTimeControlLog WHERE created < v2Months;
+ DELETE FROM `message` WHERE sendDate < v2Months;
+ DELETE FROM messageInbox WHERE sendDate < v2Months;
+ DELETE FROM messageInbox WHERE sendDate < v2Months;
+ DELETE FROM workerTimeControl WHERE timed < v4Years;
DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0;
- DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_CURDATE());
- DELETE FROM entryLog WHERE creationDate < vDateShort;
- DELETE IGNORE FROM expedition WHERE created < v26Month;
- DELETE FROM sms WHERE created < v18Month;
- DELETE FROM saleTracking WHERE created < vOneYearAgo;
- DELETE FROM ticketTracking WHERE created < v18Month;
- DELETE tobs FROM ticketObservation tobs
+ DELETE FROM ticketDown WHERE created < util.yesterday();
+ DELETE FROM entryLog WHERE creationDate < v2Months;
+ 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
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 < vOneYearAgo;
- DELETE FROM sharingCart where ended < vDateShort;
- DELETE FROM sharingClient where ended < vDateShort;
+ 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;
+ DELETE FROM sharingCart where ended < v2Months;
+ DELETE FROM sharingClient where ended < v2Months;
DELETE tw.* FROM ticketWeekly tw
LEFT JOIN sale s ON s.ticketFk = tw.ticketFk
LEFT JOIN ticketRequest tr ON tr.ticketFk = tw.ticketFk
@@ -48700,145 +49171,183 @@ BEGIN
WHERE s.id IS NULL
AND tr.id IS NULL
AND ts.id IS NULL;
- DELETE FROM claim WHERE ticketCreated < vFourYearsAgo;
- DELETE FROM message WHERE sendDate < vDateShort;
- -- Robert ubicacion anterior de trevelLog comentario para debug
- DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month;
+ DELETE FROM claim WHERE ticketCreated < v4Years;
+ -- Robert ubicacion anterior de travelLog comentario para debug
+ DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Months;
DELETE bm
FROM buyMark bm
JOIN buy b ON b.id = bm.id
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
- WHERE t.landed <= vDateShort;
- DELETE b FROM vn.buy b
- JOIN vn.entryConfig e ON e.defaultEntry = b.entryFk
- WHERE b.created < vDateShort;
- DELETE FROM vn.itemShelvingLog WHERE created < vDateShort;
- DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort;
- DELETE FROM vn.itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR;
- DELETE FROM printQueue WHERE statusCode = 'printed' AND created < vDateShort;
- DELETE FROM ticketLog WHERE creationDate <= vFiveYearsAgo;
+ WHERE t.landed <= v2Months;
+ DELETE b FROM buy b
+ JOIN entryConfig e ON e.defaultEntry = b.entryFk
+ WHERE b.created < v2Months;
+ DELETE FROM itemShelvingLog WHERE created < v2Months;
+ DELETE FROM stockBuyed WHERE creationDate < v2Months;
+ DELETE FROM itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR;
+ DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months;
+ DELETE FROM ticketLog WHERE creationDate <= v5Years;
-- Equipos duplicados
DELETE w.*
FROM workerTeam w
- JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated
+ JOIN (
+ SELECT id, team, workerFk, COUNT(*) - 1 duplicated
FROM workerTeam
GROUP BY team,workerFk
HAVING duplicated
- ) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id;
+ ) d ON d.team = w.team
+ AND d.workerFk = w.workerFk
+ AND d.id <> w.id;
DELETE sc
FROM saleComponent sc
JOIN sale s ON s.id= sc.saleFk
JOIN ticket t ON t.id= s.ticketFk
- WHERE t.shipped < v18Month;
+ WHERE t.shipped < v18Months;
DELETE c
- FROM vn.claim c
- JOIN vn.claimState cs ON cs.id = c.claimStateFk
- WHERE cs.description = "Anulado" AND
- c.created < vDateShort;
- DELETE
- FROM vn.expeditionTruck
- WHERE eta < v3Month;
+ FROM claim c
+ JOIN claimState cs ON cs.id = c.claimStateFk
+ WHERE cs.description = 'Anulado'
+ AND c.created < v2Months;
- DELETE FROM XDiario WHERE FECHA < v3Month OR FECHA IS NULL;
- -- borrar travels sin entradas
- DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
- CREATE TEMPORARY TABLE tmp.thermographToDelete
+ DELETE FROM expeditionTruck WHERE eta < v3Months;
+ DELETE FROM XDiario WHERE FECHA < v3Months OR FECHA IS NULL;
+
+ -- Borrar travels sin entradas
+ CREATE OR REPLACE TEMPORARY TABLE tThermographToDelete
SELECT th.id,th.dmsFk
- FROM vn.travel t
- LEFT JOIN vn.entry e ON e.travelFk = t.id
- JOIN vn.travelThermograph th ON th.travelFk = t.id
- WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
+ FROM travel t
+ LEFT JOIN entry e ON e.travelFk = t.id
+ JOIN travelThermograph th ON th.travelFk = t.id
+ WHERE t.shipped < v3Months
+ AND e.travelFk IS NULL;
SELECT dt.id INTO vTrashId
- FROM vn.dmsType dt
+ FROM dmsType dt
WHERE dt.code = 'trash';
- UPDATE tmp.thermographToDelete th
- JOIN vn.dms d ON d.id = th.dmsFk
+ UPDATE tThermographToDelete th
+ JOIN dms d ON d.id = th.dmsFk
SET d.dmsTypeFk = vTrashId;
DELETE th
- FROM tmp.thermographToDelete tmp
- JOIN vn.travelThermograph th ON th.id = tmp.id;
+ FROM tThermographToDelete tmp
+ JOIN travelThermograph th ON th.id = tmp.id;
DELETE t
- FROM vn.travel t
- LEFT JOIN vn.entry e ON e.travelFk = t.id
- WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
-
+ 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
- WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE());
-
+ 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
- DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
- CREATE TEMPORARY TABLE tmp.entryToDelete
+ CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
SELECT e.*
- FROM vn.entry e
- LEFT JOIN vn.buy b ON b.entryFk = e.id
- JOIN vn.entryConfig ec ON e.id != ec.defaultEntry
- WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL;
+ FROM entry e
+ LEFT JOIN buy b ON b.entryFk = e.id
+ JOIN entryConfig ec ON e.id <> ec.defaultEntry
+ WHERE e.dated < v3Months
+ AND b.entryFK IS NULL;
DELETE e
- FROM vn.entry e
- JOIN tmp.entryToDelete tmp ON tmp.id = e.id;
+ FROM entry e
+ JOIN tEntryToDelete tmp ON tmp.id = e.id;
-- borrar de route registros menores a 4 años
- DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete;
- CREATE TEMPORARY TABLE tmp.routeToDelete
+ CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete
SELECT *
- FROM vn.route r
- WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE());
+ FROM route r
+ WHERE created < v4Years;
- UPDATE tmp.routeToDelete tmp
- JOIN vn.dms d ON d.id = tmp.gestdocFk
+ UPDATE tRouteToDelete tmp
+ JOIN dms d ON d.id = tmp.gestdocFk
SET d.dmsTypeFk = vTrashId;
DELETE r
- FROM tmp.routeToDelete tmp
- JOIN vn.route r ON r.id = tmp.id;
+ FROM tRouteToDelete tmp
+ JOIN route r ON r.id = tmp.id;
-- borrar registros de dua y awb menores a 2 años
- DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
- CREATE TEMPORARY TABLE tmp.duaToDelete
+ CREATE OR REPLACE TEMPORARY TABLE tDuaToDelete
SELECT *
- FROM vn.dua
- WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE());
+ FROM dua
+ WHERE operated < v2Years;
- UPDATE tmp.duaToDelete tm
- JOIN vn.dms d ON d.id = tm.gestdocFk
+ UPDATE tDuaToDelete tm
+ JOIN dms d ON d.id = tm.gestdocFk
SET d.dmsTypeFk = vTrashId;
DELETE d
- FROM tmp.duaToDelete tmp
- JOIN vn.dua d ON d.id = tmp.id;
+ FROM tDuaToDelete tmp
+ JOIN dua d ON d.id = tmp.id;
DELETE a
- FROM vn.awb a
- LEFT JOIN vn.travel t ON t.awbFk = a.id
+ FROM awb a
+ LEFT JOIN travel t ON t.awbFk = a.id
WHERE a.created < v2Years
AND t.id IS NULL;
-- Borra los registros de collection y ticketcollection
- DELETE FROM vn.collection WHERE created < vDateShort;
+ DELETE FROM collection WHERE created < v2Months;
+ DELETE FROM travelLog WHERE creationDate < v3Months;
- DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
- DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
- DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
-
- DELETE FROM travelLog WHERE creationDate < v3Month;
-
- CALL shelving_clean;
+ CALL shelving_clean();
DELETE FROM chat WHERE dated < v5Years;
+ DELETE tt FROM ticketTracking tt
+ JOIN ticket t ON tt.ticketFk = t.id
+ WHERE t.shipped <= v2Months;
- DELETE tt FROM ticketTracking tt JOIN vn.ticket t ON tt.ticketFk = t.id
- WHERE t.shipped <= vDateShort;
+ 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
+ JOIN (
+ SELECT MAX(tl.id)ids
+ 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'
+ AND t.isDeleted
+ AND tw.ticketFk IS NULL
+ GROUP BY t.id
+ ) sub ON sub.ids = tl.id
+ WHERE tl.creationDate <= v2Months;
+ DELETE t
+ FROM ticket t
+ JOIN tTicketDelete tmp ON tmp.ticketFk = t.id;
+
+ DELETE sl
+ FROM saleLabel sl
+ JOIN sale s ON s.id = sl.saleFk
+ JOIN ticket t ON t.id = s.ticketFk
+ WHERE t.shipped < v2Months;
+
+ -- Tickets Nulos PAK 11/10/2016
+ SELECT id INTO vCompanyBlk FROM company WHERE code = 'BLK';
+ UPDATE ticket
+ SET companyFk = vCompanyBlk
+ WHERE clientFk = (SELECT id FROM client WHERE name = 'AUTOCONSUMO')
+ AND companyFk <> vCompanyBlk;
+
+ DROP TEMPORARY TABLE tTicketDelete,
+ tThermographToDelete,
+ tEntryToDelete,
+ tDuaToDelete,
+ tRouteToDelete;
+
+ -- Other schemas
+ DELETE FROM hedera.`order` WHERE date_send < v18Months;
+ DELETE FROM pbx.cdr WHERE call_date < v18Months;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -49820,7 +50329,8 @@ BEGIN
FROM receipt r
JOIN `client` c ON c.id = r.clientFk
JOIN tmp.client tc ON tc.id = c.id
- JOIN bank b ON r.bankFk = b.id AND b.code = 'mana'
+ JOIN accounting a ON r.bankFk = a.id
+ AND a.code = 'mana'
WHERE r.payed > vFromDated
AND r.payed <= util.VN_CURDATE()
UNION ALL
@@ -50284,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);
@@ -50591,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
@@ -50629,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
@@ -50645,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,
@@ -50662,7 +51188,6 @@ proc:BEGIN
vWarehouseFk,
vItemPackingTypeFk,
vStateFk,
- vLockName,
vWagons,
vTrainFk,
vLinesLimit,
@@ -50672,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;
@@ -50809,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
@@ -50852,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;
@@ -50873,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;
@@ -51119,81 +51651,81 @@ BEGIN
* @param vSelf company id
* @param vMonthAgo time interval to be consulted
*/
- DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE());
- DECLARE vCurrencyEuroFk INT;
- DECLARE vStartDate DATE;
- DECLARE vInvalidBalances DOUBLE;
+ DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE());
+ DECLARE vCurrencyEuroFk INT;
+ DECLARE vStartDate DATE;
+ DECLARE vInvalidBalances DOUBLE;
- SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig;
- SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR';
+ SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig;
+ SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR';
- DROP TEMPORARY TABLE IF EXISTS tOpeningBalances;
- CREATE TEMPORARY TABLE tOpeningBalances (
- supplierFk INT NOT NULL,
- companyFk INT NOT NULL,
- openingBalances DOUBLE NOT NULL,
- closingBalances DOUBLE NOT NULL,
- currencyFk INT NOT NULL,
- PRIMARY KEY (supplierFk, companyFk, currencyFk)
- ) ENGINE = MEMORY;
+ DROP TEMPORARY TABLE IF EXISTS tOpeningBalances;
+ CREATE TEMPORARY TABLE tOpeningBalances (
+ supplierFk INT NOT NULL,
+ companyFk INT NOT NULL,
+ openingBalances DOUBLE NOT NULL,
+ closingBalances DOUBLE NOT NULL,
+ currencyFk INT NOT NULL,
+ PRIMARY KEY (supplierFk, companyFk, currencyFk)
+ ) ENGINE = MEMORY;
- -- Calculates the opening and closing balance for each supplier
- INSERT INTO tOpeningBalances
- SELECT supplierFk,
- companyFk,
- SUM(amount * isBeforeStarting) AS openingBalances,
- SUM(amount) closingBalances,
- currencyFk
- FROM (
- SELECT p.supplierFk,
+ -- Calculates the opening and closing balance for each supplier
+ INSERT INTO tOpeningBalances
+ SELECT supplierFk,
+ companyFk,
+ SUM(amount * isBeforeStarting) AS openingBalances,
+ SUM(amount) closingBalances,
+ currencyFk
+ FROM (
+ SELECT p.supplierFk,
p.companyFk,
IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount,
p.dueDated < vStartingDate isBeforeStarting,
p.currencyFk
- FROM payment p
- WHERE p.received > vStartDate
- AND p.companyFk = vSelf
- UNION ALL
- SELECT r.supplierFk,
+ FROM payment p
+ WHERE p.received > vStartDate
+ AND p.companyFk = vSelf
+ UNION ALL
+ SELECT r.supplierFk,
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
- WHERE r.issued > vStartDate
- AND r.isBooked
- AND r.companyFk = vSelf
- ) sub GROUP BY companyFk, supplierFk, currencyFk;
+ 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
+ ) sub GROUP BY companyFk, supplierFk, currencyFk;
- DROP TEMPORARY TABLE IF EXISTS tPendingDuedates;
- CREATE TEMPORARY TABLE tPendingDuedates (
- id INT auto_increment,
+ DROP TEMPORARY TABLE IF EXISTS tPendingDuedates;
+ CREATE TEMPORARY TABLE tPendingDuedates (
+ id INT auto_increment,
expirationId INT,
- dated DATE,
- supplierFk INT NOT NULL,
- companyFk INT NOT NULL,
- amount DECIMAL(10, 2) NOT NULL,
- currencyFk INT NOT NULL,
- pending DECIMAL(10, 2) DEFAULT 0,
- balance DECIMAL(10, 2) DEFAULT 0,
- endingBalance DECIMAL(10, 2) DEFAULT 0,
- isPayment BOOLEAN,
- isReconciled BOOLEAN,
- PRIMARY KEY (id),
- INDEX (supplierFk, companyFk, currencyFk)
- ) ENGINE = MEMORY;
+ dated DATE,
+ supplierFk INT NOT NULL,
+ companyFk INT NOT NULL,
+ amount DECIMAL(10, 2) NOT NULL,
+ currencyFk INT NOT NULL,
+ pending DECIMAL(10, 2) DEFAULT 0,
+ balance DECIMAL(10, 2) DEFAULT 0,
+ endingBalance DECIMAL(10, 2) DEFAULT 0,
+ isPayment BOOLEAN,
+ isReconciled BOOLEAN,
+ PRIMARY KEY (id),
+ INDEX (supplierFk, companyFk, currencyFk)
+ ) ENGINE = MEMORY;
- INSERT INTO tPendingDuedates (
- expirationId,
- dated,
- supplierFk,
- companyFk,
- amount,
- currencyFk,
- isPayment,
- isReconciled
- )SELECT p.id,
+ INSERT INTO tPendingDuedates (
+ expirationId,
+ dated,
+ supplierFk,
+ companyFk,
+ amount,
+ currencyFk,
+ isPayment,
+ isReconciled
+ )SELECT p.id,
p.dueDated,
p.supplierFk,
p.companyFk,
@@ -51212,80 +51744,80 @@ 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)
AND r.isBooked
AND r.companyFk = vSelf
ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id;
- -- Now, we calculate the outstanding amount for each receipt in descending order
- SET @risk := 0.0;
- SET @supplier := 0.0;
- SET @company := 0.0;
- SET @moneda := 0.0;
- SET @pending := 0.0;
- SET @day := util.VN_CURDATE();
+ -- Now, we calculate the outstanding amount for each receipt in descending order
+ SET @risk := 0.0;
+ SET @supplier := 0.0;
+ SET @company := 0.0;
+ SET @moneda := 0.0;
+ SET @pending := 0.0;
+ SET @day := util.VN_CURDATE();
- UPDATE tPendingDuedates vp
- LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk
- AND vp.supplierFk = si.supplierFk
- AND vp.currencyFk = si.currencyFk
- SET vp.balance = @risk := (
- IF (
- @company <> vp.companyFk
- OR @supplier <> vp.supplierFk
- OR @moneda <> vp.currencyFk,
- IFNULL(si.openingBalances, 0),
- @risk
- ) +
- vp.amount
- ),
- -- if there is a change of company or supplier or currency, the balance is reset
- vp.pending = @pending := IF (
- @company <> vp.companyFk
- OR @supplier <> vp.supplierFk
- OR @moneda <> vp.currencyFk
- OR @day <> vp.dated,
- vp.amount * (NOT vp.isPayment),
- @pending + vp.amount
- ),
- vp.companyFk = @company := vp.companyFk,
- vp.supplierFk = @supplier := vp.supplierFk,
- vp.currencyFk = @moneda := vp.currencyFk,
- vp.dated = @day := vp.dated,
- vp.balance = @risk,
- vp.pending = @pending;
+ UPDATE tPendingDuedates vp
+ LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk
+ AND vp.supplierFk = si.supplierFk
+ AND vp.currencyFk = si.currencyFk
+ SET vp.balance = @risk := (
+ IF (
+ @company <> vp.companyFk
+ OR @supplier <> vp.supplierFk
+ OR @moneda <> vp.currencyFk,
+ IFNULL(si.openingBalances, 0),
+ @risk
+ ) +
+ vp.amount
+ ),
+ -- if there is a change of company or supplier or currency, the balance is reset
+ vp.pending = @pending := IF (
+ @company <> vp.companyFk
+ OR @supplier <> vp.supplierFk
+ OR @moneda <> vp.currencyFk
+ OR @day <> vp.dated,
+ vp.amount * (NOT vp.isPayment),
+ @pending + vp.amount
+ ),
+ vp.companyFk = @company := vp.companyFk,
+ vp.supplierFk = @supplier := vp.supplierFk,
+ vp.currencyFk = @moneda := vp.currencyFk,
+ vp.dated = @day := vp.dated,
+ vp.balance = @risk,
+ vp.pending = @pending;
- CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY
- SELECT expirationId,
- dated,
- supplierFk,
- companyFk,
- currencyFk,
- balance
- FROM tPendingDuedates
- WHERE balance < vInvalidBalances
- AND balance > - vInvalidBalances;
-
- DELETE vp.*
- FROM tPendingDuedates vp
- JOIN tRowsToDelete rd ON (
- vp.dated < rd.dated
- OR (vp.dated = rd.dated AND vp.expirationId <= rd.expirationId)
- )
- AND vp.supplierFk = rd.supplierFk
- AND vp.companyFk = rd.companyFk
- AND vp.currencyFk = rd.currencyFk
- WHERE vp.isPayment = FALSE;
+ CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY
+ SELECT expirationId,
+ dated,
+ supplierFk,
+ companyFk,
+ currencyFk,
+ balance
+ FROM tPendingDuedates
+ WHERE balance < vInvalidBalances
+ AND balance > - vInvalidBalances;
- SELECT vp.expirationId,
- vp.dated,
- vp.supplierFk,
+ DELETE vp.*
+ FROM tPendingDuedates vp
+ JOIN tRowsToDelete rd ON (
+ vp.dated < rd.dated
+ OR (vp.dated = rd.dated AND vp.expirationId <= rd.expirationId)
+ )
+ AND vp.supplierFk = rd.supplierFk
+ AND vp.companyFk = rd.companyFk
+ AND vp.currencyFk = rd.currencyFk
+ WHERE NOT vp.isPayment;
+
+ SELECT vp.expirationId,
+ vp.dated,
+ vp.supplierFk,
vp.companyFk,
vp.currencyFk,
vp.amount,
@@ -51295,16 +51827,20 @@ BEGIN
vp.isPayment,
vp.isReconciled,
vp.endingBalance,
- cr.amount clientRiskAmount
- 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
- AND cr.companyFk = vp.companyFk;
-
- DROP TEMPORARY TABLE tOpeningBalances;
- DROP TEMPORARY TABLE tPendingDuedates;
- DROP TEMPORARY TABLE tRowsToDelete;
+ cr.amount clientRiskAmount,
+ 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
+ AND cr.companyFk = vp.companyFk;
+
+ DROP TEMPORARY TABLE tOpeningBalances;
+ DROP TEMPORARY TABLE tPendingDuedates;
+ DROP TEMPORARY TABLE tRowsToDelete;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -51385,6 +51921,122 @@ 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 `confection_controlSource` */;
+/*!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 `confection_controlSource`(
+ vDated DATE,
+ vScopeDays INT,
+ vMaxAlertLevel INT,
+ vWarehouseFk INT
+)
+BEGIN
+/**
+ * Obtiene la información para el control de confección,
+ * ya sean tickets y/o entradas.
+ *
+ * @param vDated Fecha a calcular
+ * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo.
+ * @param vMaxAlertLevel Id nivel de alerta
+ * @param vWarehouseFk Id de almacén
+ */
+ DECLARE vEndingDate DATETIME DEFAULT util.dayEnd(vDated) + INTERVAL vScopeDays DAY;
+
+ SELECT t.shipped,
+ t.id ticketFk,
+ s.id saleFk,
+ s.quantity,
+ s.concept,
+ ABS(s.reserved) isReserved,
+ i.category,
+ it.name itemType,
+ t.nickname,
+ wh.name warehouse,
+ t.warehouseFk warehouseFk,
+ a.provinceFk,
+ am.agencyFk,
+ ct.description,
+ stock.visible,
+ stock.available
+ FROM ticket t
+ JOIN agencyMode am ON am.id = t.agencyModeFk
+ JOIN warehouse wh ON wh.id = t.warehouseFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN confectionType ct ON ct.id = it.making
+ JOIN `address` a on a.id = t.addressFk
+ LEFT JOIN ticketState tls on tls.ticketFk = t.id
+ LEFT JOIN
+ (
+ SELECT item_id,
+ SUM(visible) visible,
+ SUM(available) available
+ FROM (
+ SELECT a.item_id,
+ 0 visible,
+ a.available
+ FROM cache.cache_calc cc
+ LEFT JOIN cache.available a ON a.calc_id = cc.id
+ WHERE cc.cache_id IN ('visible', 'available')
+ AND cc.params = CONCAT(vWarehouseFk, "/", util.VN_CURDATE())
+ UNION ALL
+ SELECT v.item_id,
+ v.visible,
+ 0
+ FROM cache.cache_calc cc
+ LEFT JOIN cache.visible v ON v.calc_id = cc.id
+ WHERE cc.cacheName IN ('visible', 'available')
+ AND cc.params = vWarehouseFk
+ ) sub
+ GROUP BY item_id
+ ) stock ON stock.item_id = s.itemFk
+ WHERE it.making
+ AND tls.alertLevel < vMaxAlertLevel
+ AND wh.hasConfectionTeam
+ AND t.shipped BETWEEN vDated AND vEndingDate
+ AND s.quantity > 0
+ UNION ALL
+ SELECT tr.shipped,
+ e.id,
+ NULL,
+ b.quantity,
+ i.name,
+ NULL,
+ i.category,
+ NULL,
+ whi.name,
+ who.name,
+ NULL,
+ NULL,
+ NULL,
+ ct.description,
+ NULL,
+ NULL
+ FROM buy b
+ JOIN `entry` e ON e.id = b.entryFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN warehouse whi ON whi.id = tr.warehouseInFk
+ JOIN warehouse who ON who.id = tr.warehouseOutFk
+ JOIN item i ON i.id = b.itemFk
+ JOIN itemType it ON it.id = i.typeFk
+ JOIN confectionType ct ON ct.id = it.making
+ WHERE who.hasConfectionTeam
+ AND it.making
+ AND tr.shipped BETWEEN vDated AND vEndingDate;
+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 `conveyorExpedition_Add` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -51519,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 */ ;
@@ -52188,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;
@@ -52777,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 */ ;
@@ -55313,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',
@@ -55496,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
@@ -55543,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
@@ -55600,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
@@ -55876,10 +56614,13 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(
+ vDuaFk INT
+)
BEGIN
/**
- * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
+ * Borra los valores de duaTax y sus vctos. y los vuelve a
+ * crear en base a la tabla duaEntry.
*
* @param vDuaFk Id del dua a recalcular
*/
@@ -55903,7 +56644,7 @@ BEGIN
LEAVE l;
END IF;
- CALL vn2008.recibidaIvaInsert(vInvoiceInFk);
+ CALL invoiceInTax_recalc(vInvoiceInFk);
CALL invoiceInDueDay_recalc(vInvoiceInFk);
END LOOP;
@@ -56080,6 +56821,76 @@ 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 `invoiceInTax_recalc` */;
+/*!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 `invoiceInTax_recalc`(
+ vInvoiceInFk INT
+)
+BEGIN
+/**
+ * Recalcula y actualiza los impuestos de la factura
+ * usando la última tasa de cambio y detalles de compra.
+ *
+ * @param vInvoiceInFk Id de factura recibida
+ */
+ DECLARE vRate DOUBLE DEFAULT 1;
+ DECLARE vExpenseFk VARCHAR(10);
+
+ SELECT `value` INTO vRate
+ FROM referenceRate rr
+ JOIN invoiceIn ii ON ii.id = vInvoiceInFk
+ WHERE rr.dated <= ii.issued
+ AND rr.currencyFk = ii.currencyFk
+ ORDER BY dated DESC
+ LIMIT 1;
+
+ DELETE FROM invoiceInTax WHERE invoiceInFk = vInvoiceInFk;
+
+ SELECT id INTO vExpenseFk
+ FROM expense
+ WHERE code = 'extraCommGoodsAcquisition';
+
+ IF vExpenseFk IS NULL THEN
+ CALL util.throw('Expense extraCommGoodsAcquisition not exists');
+ END IF;
+
+ INSERT INTO invoiceInTax(
+ invoiceInFk,
+ taxableBase,
+ expenseFk,
+ foreignValue,
+ taxTypeSageFk,
+ transactionTypeSageFk
+ )
+ SELECT ii.id,
+ SUM(b.buyingValue * b.quantity) / vRate bi,
+ vExpenseFk,
+ IF(c.code = 'EUR', NULL, SUM(b.buyingValue * b.quantity)),
+ s.taxTypeSageFk,
+ s.transactionTypeSageFk
+ FROM invoiceIn ii
+ JOIN currency c ON c.id = ii.currencyFk
+ JOIN `entry` e ON e.invoiceInFk = ii.id
+ JOIN supplier s ON s.id = e.supplierFk
+ JOIN buy b ON b.entryFk = e.id
+ LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk
+ AND rr.dated = ii.issued
+ WHERE ii.id = vInvoiceInFk
+ HAVING bi IS NOT NULL;
+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 `invoiceIn_booking` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -57656,224 +58467,6 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `itemProposal` */;
-/*!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 `itemProposal`(
- vSelf INT,
- vTicketFk INT,
- vShowType BOOL
-)
-BEGIN
-/**
-* Propone articulos disponibles ordenados, con la cantidad
-* de veces usado y segun sus caracteristicas.
-*
-* @param vSelf Id de artículo
-* @param vTicketFk Id de ticket
-* @param vShowType Mostrar tipos
-*/
- DECLARE vWarehouseFk INT;
- DECLARE vShipped DATE;
- DECLARE vCalcFk INT;
- DECLARE vTypeFk INT;
- DECLARE vPriority INT DEFAULT 1;
-
- DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag7 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag8 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
-
- DECLARE vValue1 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue5 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue6 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
-
- SELECT warehouseFk, shipped
- INTO vWarehouseFk, vShipped
- FROM ticket
- WHERE id = vTicketFk;
-
- SELECT typeFk,
- tag5,
- value5,
- tag6,
- value6,
- tag7,
- value7,
- tag8,
- value8,
- t.name,
- it.value
- INTO vTypeFk,
- vTag5,
- vValue5,
- vTag6,
- vValue6,
- vTag7,
- vValue7,
- vTag8,
- vValue8,
- vTag1,
- vValue1
- FROM item i
- LEFT JOIN itemTag it ON it.itemFk = i.id
- AND it.priority = vPriority
- LEFT JOIN tag t ON t.id = it.tagFk
- WHERE i.id = vSelf;
-
- CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
-
- SELECT i.id itemFk,
- i.longName,
- i.subName,
- i.tag5,
- i.value5,
- (i.value5 <=> vValue5) match5,
- i.tag6,
- i.value6,
- (i.value6 <=> vValue6) match6,
- i.tag7,
- i.value7,
- (i.value7 <=> vValue7) match7,
- i.tag8,
- i.value8,
- (i.value8 <=> vValue8) match8,
- a.available,
- IFNULL(ip.counter, 0) `counter`,
- IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity,
- iss.visible located
- FROM item i
- JOIN cache.available a ON a.item_id = i.id
- LEFT JOIN itemProposal ip ON ip.mateFk = i.id
- AND ip.itemFk = vSelf
- LEFT JOIN itemTag it ON it.itemFk = i.id
- AND it.priority = vPriority
- LEFT JOIN tag t ON t.id = it.tagFk
- LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
- AND lb.warehouse_id = vWarehouseFk
- LEFT JOIN buy b ON b.id = lb.buy_id
- LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id
- AND iss.warehouseFk = vWarehouseFk
- WHERE a.calc_id = vCalcFk
- AND a.available > 0
- AND IF(vShowType, i.typeFk = vTypeFk, TRUE)
- AND i.id <> vSelf
- ORDER BY `counter` DESC,
- (t.name = vTag1) DESC,
- (it.value = vValue1) DESC,
- (i.tag5 = vTag5) DESC,
- match5 DESC,
- (i.tag6 = vTag6) DESC,
- match6 DESC,
- (i.tag7 = vTag7) DESC,
- match7 DESC,
- (i.tag8 = vTag8) DESC,
- match8 DESC;
-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 `itemProposal_beta` */;
-/*!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 `itemProposal_beta`(vItemFk INT, vTicketFk INT)
-BEGIN
-
- DECLARE vWarehouseFk INT;
- DECLARE vShipped DATE;
- DECLARE vCalcFk INT;
- DECLARE vTypeFk INT;
- DECLARE vResultsMax INT DEFAULT 10;
-
- DECLARE vTag1 VARCHAR(25);
- DECLARE vTag5 VARCHAR(25);
- DECLARE vTag6 VARCHAR(25);
- DECLARE vTag7 VARCHAR(25);
- DECLARE vTag8 VARCHAR(25);
-
- DECLARE vValue1 VARCHAR(50);
- DECLARE vValue5 VARCHAR(50);
- DECLARE vValue6 VARCHAR(50);
- DECLARE vValue7 VARCHAR(50);
- DECLARE vValue8 VARCHAR(50);
-
- SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped
- FROM vn.ticket
- WHERE id = vTicketFk;
-
- SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
- INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
- FROM vn.item i
- LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
- LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
- WHERE i.id = vItemFk;
-
- CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
-
- SELECT i.id itemFk,
- i.longName,
- i.subName,
- i.tag5,
- i.value5,
- (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5,
- i.tag6,
- i.value6,
- (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6,
- i.tag7,
- i.value7,
- (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7,
- i.tag8,
- i.value8,
- (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8,
- a.available,
- IFNULL(ip.counter,0) counter
- FROM vn.item i
- JOIN cache.available a ON a.item_id = i.id
- LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
- LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
- LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
- WHERE a.calc_id = vCalcFk
- AND available > 0
- AND i.typeFk = vTypeFk
- AND i.id != vItemFk
- ORDER BY counter DESC,
- (t1.name = vTag1 COLLATE utf8_general_ci) DESC,
- (it1.value = vValue1 COLLATE utf8_general_ci) DESC,
- (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC,
- (i.value5 = vValue5 COLLATE utf8_general_ci) DESC,
- (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC,
- (i.value6 = vValue6 COLLATE utf8_general_ci) DESC,
- (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC,
- (i.value7 = vValue7 COLLATE utf8_general_ci) DESC,
- (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC,
- (i.value8 = vValue8 COLLATE utf8_general_ci) DESC
- LIMIT vResultsMax;
-
-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 `itemRefreshTags` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -59632,10 +60225,11 @@ BEGIN
ish.visible,
p.sectorFk,
it.workerFk buyer,
- CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage,
+ ic.url,
+ i.image,
ish.isChecked,
CASE
- WHEN s.notPrepared > sm.parked THEN 0
+ WHEN IFNULL (s.notPrepared, 0) > sm.parked THEN 0
WHEN sm.visible > sm.parked THEN 1
ELSE 2
END priority
@@ -59645,7 +60239,7 @@ BEGIN
JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
- JOIN (
+ LEFT JOIN (
SELECT s.itemFk, sum(s.quantity) notPrepared
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
@@ -61357,87 +61951,98 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getSimilar`(vItemFk INT, vWarehouseFk INT, vDate DATE, vIsShowedByType BOOL)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getSimilar`(
+ vSelf INT,
+ vWarehouseFk INT,
+ vDated DATE,
+ vShowType BOOL
+)
BEGIN
-
/**
- * Propone articulos similares para posible cambio,
- * ordenado con la cantidad de veces usado y segun sus caracteristicas
- *
- * @param vItemFk item id
- * @param vWarehouseFk warehouse id
- * @param vDate fecha para revisar disponible
- * @param vIsShowedByType para mostrar solo artículos de ese tipo
- */
+* Propone articulos disponibles ordenados, con la cantidad
+* de veces usado y segun sus caracteristicas.
+*
+* @param vSelf Id de artículo
+* @param vWarehouseFk Id de almacen
+* @param vDated Fecha
+* @param vShowType Mostrar tipos
+*/
+ DECLARE vCalcFk INT;
+ DECLARE vTypeFk INT;
+ DECLARE vPriority INT DEFAULT 1;
- DECLARE vCalcFk INT;
- DECLARE vTypeFk INT;
-
- DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag7 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vTag8 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
-
- DECLARE vValue1 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue5 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue6 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
- DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
+ CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-
- SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
- INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
- FROM vn.item i
- LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
- LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
- WHERE i.id = vItemFk;
-
- CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDate);
-
- SELECT i.id itemFk,
- i.longName,
- i.subName,
- i.tag5,
- i.value5,
- (i.value5 <=> vValue5) match5,
- i.tag6,
- i.value6,
- (i.value6 <=> vValue6) match6,
- i.tag7,
- i.value7,
- (i.value7 <=> vValue7) match7,
- i.tag8,
- i.value8,
- (i.value8 <=> vValue8) match8,
- a.available,
- IFNULL(ip.counter,0) counter,
- IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity
- FROM vn.item i
- JOIN cache.available a ON a.item_id = i.id
- LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
- LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
- LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
- LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
+ -- Añadido temporalmente para ver si ya no sucede el cuelgue de db
+ SET vShowType = TRUE;
+
+ WITH itemTags AS (
+ SELECT i.id,
+ typeFk,
+ tag5,
+ value5,
+ tag6,
+ value6,
+ tag7,
+ value7,
+ tag8,
+ value8,
+ t.name,
+ it.value
+ FROM vn.item i
+ LEFT JOIN vn.itemTag it ON it.itemFk = i.id
+ AND it.priority = vPriority
+ LEFT JOIN vn.tag t ON t.id = it.tagFk
+ WHERE i.id = vSelf
+ )
+ SELECT i.id itemFk,
+ i.longName,
+ i.subName,
+ i.tag5,
+ i.value5,
+ (i.value5 <=> its.value5) match5,
+ i.tag6,
+ i.value6,
+ (i.value6 <=> its.value6) match6,
+ i.tag7,
+ i.value7,
+ (i.value7 <=> its.value7) match7,
+ i.tag8,
+ i.value8,
+ (i.value8 <=> its.value8) match8,
+ a.available,
+ IFNULL(ip.counter, 0) `counter`,
+ IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity,
+ iss.visible located
+ FROM vn.item i
+ JOIN cache.available a ON a.item_id = i.id
+ AND a.calc_id = vCalcFk
+ LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
+ AND ip.itemFk = vSelf
+ LEFT JOIN vn.itemTag it ON it.itemFk = i.id
+ AND it.priority = vPriority
+ LEFT JOIN vn.tag t ON t.id = it.tagFk
+ LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
+ AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
- WHERE a.calc_id = vCalcFk
- AND available > 0
- AND IF(vIsShowedByType, i.typeFk = vTypeFk, TRUE)
- AND i.id != vItemFk
- ORDER BY counter DESC,
- (t1.name = vTag1) DESC,
- (it1.value = vValue1) DESC,
- (i.tag6 = vTag6) DESC,
- (i.value6 = vValue6) DESC,
- (i.tag5 = vTag5) DESC,
- (i.value5 = vValue5) DESC,
- (i.tag7 = vTag7) DESC,
- (i.value7 = vValue7) DESC,
- (i.tag8 = vTag8) DESC,
- (i.value8 = vValue8) DESC
- LIMIT 30;
-
-
+ LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
+ AND iss.warehouseFk = vWarehouseFk
+ JOIN itemTags its
+ WHERE a.available > 0
+ AND IF(vShowType, i.typeFk = its.typeFk, TRUE)
+ AND i.id <> vSelf
+ ORDER BY `counter` DESC,
+ (t.name = its.name) DESC,
+ (it.value = its.value) DESC,
+ (i.tag5 = its.tag5) DESC,
+ match5 DESC,
+ (i.tag6 = its.tag6) DESC,
+ match6 DESC,
+ (i.tag7 = its.tag7) DESC,
+ match7 DESC,
+ (i.tag8 = its.tag8) DESC,
+ match8 DESC
+ LIMIT 100;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -63059,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 */ ;
@@ -63826,6 +64453,103 @@ 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 `payment_add` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `payment_add`(
+ vDated DATE,
+ vSupplierFk INT,
+ vAmount DOUBLE,
+ vCurrencyFk INT,
+ vForeignValue DOUBLE,
+ vBankFk INT,
+ vPayMethodFk INT,
+ vExpenseFk DOUBLE,
+ vConcept VARCHAR(40),
+ vCompanyFk INT)
+BEGIN
+/**
+ * Registra un pago realizado a un proveedor y
+ * su correspondiente registro en caja.
+ *
+ * @param vDated Fecha del pago
+ * @param vSupplierFk Id del proveedor
+ * @param vAmount Cantidad a pagar
+ * @param vCurrencyFk Id de la moneda
+ * @param vForeignValue Tipo de cambio utilizado
+ * @param vBankFk Id del banco
+ * @param vPayMethodFk Id del método de pago
+ * @param vExpenseFk Id de gasto
+ * @param vConcept Concepto del pago
+ * @param vCompanyFk Id de la empresa
+ * @return paymentFk Id de pago insertado
+ */
+ INSERT INTO till(
+ concept,
+ serie,
+ `number`,
+ `out`,
+ dated,
+ isAccountable,
+ bankFk,
+ workerFk,
+ companyFk,
+ isConciliate
+ )
+ SELECT CONCAT('n/pago a ', `name`),
+ 'R',
+ vSupplierFk,
+ vAmount,
+ vDated,
+ 1,
+ vBankFk,
+ account.myUser_getId(),
+ vCompanyFk,
+ 1
+ FROM supplier
+ WHERE id = vSupplierFk;
+
+ INSERT INTO payment(
+ received,
+ dueDated,
+ supplierFk,
+ amount,
+ currencyFk,
+ divisa,
+ bankFk,
+ payMethodFk,
+ bankingFees,
+ concept,
+ companyFk
+ )
+ VALUES(
+ vDated,
+ vDated,
+ vSupplierFk,
+ vAmount,
+ vCurrencyFk,
+ IF(NOT vForeignValue, NULL, vForeignValue),
+ vBankFk,
+ vPayMethodFk,
+ vExpenseFk,
+ vConcept,
+ vCompanyFk
+ );
+
+ SELECT LAST_INSERT_ID() paymentFk;
+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 `prepareClientList` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -64315,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
@@ -64867,6 +65597,89 @@ 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 `remittance_calc` */;
+/*!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 `remittance_calc`(
+ vDated DATE
+)
+BEGIN
+/**
+* Calcula los datos de remesa, incluyendo el importe,
+* el vencimiento, y otros datos relevantes.
+*
+* @param vDated Fecha a calcular
+* @return tmp.remittance
+*/
+ CREATE OR REPLACE TEMPORARY TABLE tmp.remittance
+ SELECT CONCAT(s.nif, REPEAT('0', 12 - LENGTH(s.nif))) cif,
+ c.id clientFk,
+ c.name client,
+ c.fi,
+ sub.paymentDate,
+ 0 invoiceAmount,
+ CAST(sub.receipt AS DECIMAL(10,2)) receiptAmount,
+ 0 currentAmount,
+ sub.companyFk,
+ c.socialName,
+ CAST(sub.receipt AS DECIMAL(10,2)) totalAmount,
+ CAST(sub.receipt AS DECIMAL(10,2)) balance,
+ s.name company,
+ co.code companyCode,
+ c.accountingAccount,
+ c.iban,
+ c.hasSepaVnl,
+ c.hasCoreVnl,
+ c.hasLcr,
+ be.bic,
+ be.`name` entityName
+ FROM client c
+ JOIN (
+ SELECT risk.companyFk,
+ c.id,
+ SUM(risk.amount) receipt,
+ IF((c.dueDay + graceDays) MOD 30.001 <= DAY(vDated),
+ LAST_DAY(vDated - INTERVAL 1 MONTH) + INTERVAL (c.dueDay + graceDays) MOD 30.001 DAY,
+ LAST_DAY(vDated - INTERVAL 2 MONTH) + INTERVAL (c.dueDay + graceDays) MOD 30.001 DAY
+ ) paymentDate
+ FROM client c
+ JOIN payMethod pm ON pm.id = c.payMethodFk
+ JOIN (
+ SELECT cr.companyFk, cr.clientFk, cr.amount
+ FROM client c
+ JOIN clientRisk cr ON cr.clientFk = c.id
+ JOIN payMethod pm ON pm.id = c.payMethodFk
+ WHERE pm.code = 'bankDraft'
+ UNION ALL
+ SELECT io.companyFk, io.clientFk, - io.amount
+ FROM invoiceOut io
+ JOIN client c ON c.id = io.clientFk
+ JOIN payMethod pm ON pm.id = c.payMethodFk
+ WHERE io.dued > vDated
+ AND pm.code = 'bankDraft'
+ AND pm.outstandingDebt
+ AND io.amount > 0
+
+ ) risk ON risk.clientFk = c.id
+ GROUP BY risk.companyFk, c.id
+ HAVING receipt > 10
+ ) sub ON sub.id = c.id
+ JOIN supplier s ON s.id = sub.companyFk
+ JOIN company co ON co.id = sub.companyFk
+ LEFT JOIN bankEntity be ON be.id = c.bankEntityFk;
+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 `reportLabelCollection_get` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -66154,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 */ ;
@@ -66193,89 +67301,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 = 'NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP PROCEDURE IF EXISTS `sale_checkNoComponents` */;
-/*!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 */ ;
-DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME)
-BEGIN
-/**
- * Comprueba que las ventas creadas entre un rango de fechas tienen componentes
- *
- * @param vCreatedFrom inicio del rango
- * @param vCreatedTo fin del rango
- */
- DECLARE v_done BOOL DEFAULT FALSE;
- DECLARE vSaleFk INTEGER;
- DECLARE vTicketFk INTEGER;
- DECLARE vConcept VARCHAR(50);
- DECLARE vCur CURSOR FOR
- SELECT s.id
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- JOIN item i ON i.id = s.itemFk
- JOIN itemType tp ON tp.id = i.typeFk
- JOIN itemCategory ic ON ic.id = tp.categoryFk
- LEFT JOIN tmp.coste c ON c.id = s.id
- WHERE s.created >= vCreatedFrom AND s.created <= vCreatedTo
- AND c.id IS NULL
- AND t.agencyModeFk IS NOT NULL
- AND t.isDeleted IS FALSE
- AND t.warehouseFk = 60
- AND ic.merchandise != FALSE
- GROUP BY s.id;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET v_done = TRUE;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.coste;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.coste;
- CREATE TEMPORARY TABLE tmp.coste
- (PRIMARY KEY (id)) ENGINE = MEMORY
- SELECT s.id
- FROM sale s
- JOIN item i ON i.id = s.itemFk
- JOIN itemType tp ON tp.id = i.typeFk
- JOIN itemCategory ic ON ic.id = tp.categoryFk
- JOIN saleComponent sc ON sc.saleFk = s.id
- JOIN component c ON c.id = sc.componentFk
- JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 6
- WHERE s.created >= vCreatedFrom
- AND ic.merchandise != FALSE;
-
- OPEN vCur;
-
- l: LOOP
- SET v_done = FALSE;
- FETCH vCur INTO vSaleFk;
-
- IF v_done THEN
- LEAVE l;
- END IF;
-
- SELECT ticketFk, concept
- INTO vTicketFk, vConcept
- FROM sale
- WHERE id = vSaleFk;
-
- CALL sale_calculateComponent(vSaleFk, 'renewPrices');
- END LOOP;
-
- CLOSE vCur;
- DROP TEMPORARY TABLE tmp.coste;
-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_getBoxPickingList` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -66313,7 +67338,7 @@ BEGIN
s.quantity,
MAKETIME(pb.HH,pb.mm,0) etd,
pb.routeFk,
- FLOOR(s.quantity / ish.packing) stickers,
+ FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
b.packagingFk
FROM sale s
@@ -66332,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
@@ -66346,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;
@@ -66451,7 +67478,10 @@ DECLARE vIsCollection BOOL;
IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity,
MIN(iss.created) picked,
IF(sm.id, TRUE, FALSE) hasMistake,
- sg.sectorFk
+ sg.sectorFk,
+ b.packing,
+ b.grouping,
+ o.code
FROM tmp.ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN ticket tt ON tt.id = t.id
@@ -67003,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
@@ -67090,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');
@@ -67117,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;
@@ -67838,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 */ ;
@@ -68615,7 +69603,7 @@ BEGIN
'payment'
FROM payment p
LEFT JOIN currency c ON c.id = p.currencyFk
- LEFT JOIN bank b ON b.id = p.bankFk
+ LEFT JOIN accounting a ON a.id = p.bankFk
LEFT JOIN payMethod pm ON pm.id = p.payMethodFk
LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id
WHERE p.received > '2014-12-31'
@@ -68823,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 ;;
@@ -68868,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 */ ;
@@ -70725,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 */ ;
@@ -71083,7 +72094,8 @@ BEGIN
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered'))
AND t.id = vTicketFk
AND t.refFk IS NULL
- GROUP BY t.id);
+ GROUP BY t.id
+ );
CALL ticket_close();
@@ -78070,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
*
*/
@@ -78078,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);
@@ -78103,7 +79116,7 @@ BEGIN
PRIMARY KEY zoneFkk (zoneFk, geoFk),
INDEX(geoFk))
ENGINE = MyISAM;
-
+
OPEN cur1;
cur1Loop: LOOP
SET vIsDone = FALSE;
@@ -78111,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 | -
---|
',
- ' Relación de envíos.
',
- 'Dia: ', v_Date, '
');
-
- WHILE NOT done DO
-
- SET txt = CONCAT(txt, '
',
- '
-
'
- , ' ', MyAlias, '
-
-
- Ticket ', MyIdTicket,'
-
-
- ', MyImporte, ' €
-
'
- , ' ', MyDomicilio, '(', MyPoblacion, ')');
-
- FETCH rs INTO MyIdTicket, MyAlias, MyImporte, MyDomicilio, MyPoblacion;
-
- END WHILE;
-
- SET txt = CONCAT(
- txt,
- '',
- '
',
- ' ',
- '
Puede acceder al detalle de los albaranes haciendo click sobre el número de Ticket',
- ' Muchas gracias por su confianza
',
- '
C.Postal | -Número de zona | -Precio | -Zona | -Almacén | -Salix | -
---|
{{ $t('postalCode') }} | +{{ $t('zoneFk') }} | +{{ $t('price') }} | +{{ $t('zone') }} | +{{ $t('warehouse') }} | ++ |
---|---|---|---|---|---|
{{ zone.zn.name }} | +{{ zone.zoneFk }} | +{{ zone.z.price }} | +{{ zone.z.name }} | +{{ zone.w.name }} | ++ + https://salix.verdnatura.es/#!/zone/ + {{zone.zoneFk}} + /location?q=%7B%22search%22:%22 + {{zone.zn.name}} + %22%7D | +
{{$t('fields.previousSalesVolume')}}: | +{{$t('fields.previousSellsVolume')}}: |
-
-
-
+
|
|
---|---|---|---|
{{$t('fields.forecastedSalesVolume')}}: |
-
-
-
- |
- ||
{{$t('fields.forecastedPurchases')}}: | -
-
-
-
+
|
||
{{$t('fields.personFilling')}}: |
-
-
-
+
|
{{$t('fields.phone')}}: |
-
-
-
+
|