hotfix-sepaCore #2678

Merged
carlossa merged 7 commits from hotfix-sepaCore into master 2024-07-05 05:52:16 +00:00
89 changed files with 1910 additions and 1279 deletions
Showing only changes of commit f4e1934354 - Show all commits

View File

@ -1,7 +1,3 @@
const axios = require('axios');
const {DOMParser} = require('xmldom');
const fs = require('fs');
const ejs = require('ejs');
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
module.exports = Self => { module.exports = Self => {
@ -23,23 +19,20 @@ module.exports = Self => {
} }
}); });
Self.createShipment = async(expeditionFk, options) => { Self.createShipment = async expeditionFk => {
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
const models = Self.app.models; const models = Self.app.models;
const mrw = await models.MrwConfig.findOne(null, myOptions); const mrw = await Self.getConfig();
if (!mrw) const today = Date.vnNew();
throw new UserError(`Some mrwConfig parameters are not set`); const [hours, minutes] = mrw?.expeditionDeadLine ? mrw.expeditionDeadLine.split(':').map(Number) : [0, 0];
const deadLine = Date.vnNew();
deadLine.setHours(hours, minutes, 0);
if (today > deadLine && (!mrw.notified || mrw.notified.setHours(0, 0, 0, 0) !== today.setHours(0, 0, 0, 0))) {
await models.NotificationQueue.create({notificationFk: 'mrw-deadline'});
await mrw.updateAttributes({notified: Date.vnNow()});
}
const query = const query =
`SELECT `SELECT
@ -64,7 +57,8 @@ module.exports = Self => {
JOIN ticket t ON e.ticketFk = t.id JOIN ticket t ON e.ticketFk = t.id
JOIN agencyMode am ON am.id = t.agencyModeFk JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN mrwService ms ON ms.agencyModeCodeFk = am.code JOIN mrwService ms ON ms.agencyModeCodeFk = am.code
LEFT JOIN mrwServiceWeekday mw ON mw.weekdays | 1 << WEEKDAY(t.landed) LEFT JOIN mrwServiceWeekday mw ON mw.agencyModeCodeFk = am.code
AND mw.weekDays & (1 << WEEKDAY(t.landed))
JOIN client c ON t.clientFk = c.id JOIN client c ON t.clientFk = c.id
JOIN address a ON t.addressFk = a.id JOIN address a ON t.addressFk = a.id
LEFT JOIN addressObservation oa ON oa.addressFk = a.id LEFT JOIN addressObservation oa ON oa.addressFk = a.id
@ -76,44 +70,25 @@ module.exports = Self => {
WHERE e.id = ? WHERE e.id = ?
LIMIT 1`; LIMIT 1`;
const [expeditionData] = await Self.rawSql(query, [expeditionFk], myOptions); const [expeditionData] = await Self.rawSql(query, [expeditionFk]);
if (!expeditionData) if (!expeditionData)
throw new UserError(`This expedition is not a MRW shipment`); throw new UserError(`This expedition is not a MRW shipment`);
const today = Date.vnNew(); if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today.setHours(0, 0, 0, 0))
today.setHours(0, 0, 0, 0);
if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today)
throw new UserError(`This ticket has a shipped date earlier than today`); throw new UserError(`This ticket has a shipped date earlier than today`);
const shipmentResponse = await sendXmlDoc('createShipment', {mrw, expeditionData}, 'application/soap+xml'); const shipmentResponse = await Self.sendXmlDoc(
const shipmentId = getTextByTag(shipmentResponse, 'NumeroEnvio'); __dirname + `/createShipment.ejs`,
{mrw, expeditionData},
'application/soap+xml'
);
const shipmentId = Self.getTextByTag(shipmentResponse, 'NumeroEnvio');
if (!shipmentId) if (!shipmentId) throw new UserError(Self.getTextByTag(shipmentResponse, 'Mensaje'));
throw new UserError(getTextByTag(shipmentResponse, 'Mensaje'));
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml'); const file = await models.MrwConfig.getLabel(shipmentId);
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
if (tx) await tx.commit();
return {shipmentId, file}; return {shipmentId, file};
}; };
function getTextByTag(xmlDoc, tag) {
return xmlDoc?.getElementsByTagName(tag)[0]?.textContent;
}
async function sendXmlDoc(xmlDock, params, contentType) {
const parser = new DOMParser();
const xmlTemplate = fs.readFileSync(__dirname + `/${xmlDock}.ejs`, 'utf-8');
const renderedTemplate = ejs.render(xmlTemplate, params);
const data = await axios.post(params.mrw.url, renderedTemplate, {
headers: {
'Content-Type': `${contentType}; charset=utf-8`
}
});
return parser.parseFromString(data.data, 'text/xml');
}
}; };

View File

@ -0,0 +1,27 @@
module.exports = Self => {
Self.remoteMethod('getLabel', {
description: 'Return a base64Binary label from de MRW WebService',
accessType: 'READ',
accepts: [{
arg: 'shipmentId',
type: 'string',
required: true
}],
returns: {
type: 'string',
root: true
},
http: {
path: `/getLabel`,
verb: 'GET'
}
});
Self.getLabel = async shipmentId => {
const mrw = await Self.getConfig();
const getLabelResponse = await Self.sendXmlDoc(__dirname + `/getLabel.ejs`, {mrw, shipmentId}, 'text/xml');
return Self.getTextByTag(getLabelResponse, 'EtiquetaFile');
};
};

View File

@ -2,6 +2,7 @@ const models = require('vn-loopback/server/server').models;
const axios = require('axios'); const axios = require('axios');
const fs = require('fs'); const fs = require('fs');
const filter = {notificationFk: 'mrw-deadline'};
const mockBase64Binary = 'base64BinaryString'; const mockBase64Binary = 'base64BinaryString';
const ticket1 = { const ticket1 = {
'id': '44', 'id': '44',
@ -28,25 +29,52 @@ const expedition1 = {
'editorFk': 100 'editorFk': 100
}; };
let tx;
let options;
describe('MRWConfig createShipment()', () => { describe('MRWConfig createShipment()', () => {
beforeEach(async() => { beforeAll(async() => {
options = tx = undefined;
tx = await models.MrwConfig.beginTransaction({});
options = {transaction: tx};
await models.Agency.create( await models.Agency.create(
{'id': 999, 'name': 'mrw'}, {'id': 999, 'name': 'mrw'}
options
); );
await models.AgencyMode.create( await models.AgencyMode.create(
{'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'}, {'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'}
options
); );
await createMrwConfig();
await models.Application.rawSql(
`INSERT INTO vn.mrwService
SET agencyModeCodeFk = 'mrw',
clientType = 1,
serviceType = 1,
kg = 1`, null
);
await models.Ticket.create(ticket1);
await models.Expedition.create(expedition1);
});
afterAll(async() => {
await cleanFixtures();
await models.Ticket.destroyAll(ticket1);
await models.Expedition.destroyAll(ticket1);
});
beforeEach(async() => {
const mockPostResponses = [
{data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')},
{data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')}
];
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
await cleanFixtures();
});
async function cleanFixtures() {
await models.NotificationQueue.destroyAll(filter);
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: null, notified: null});
}
async function createMrwConfig() {
await models.MrwConfig.create( await models.MrwConfig.create(
{ {
'id': 1, 'id': 1,
@ -55,67 +83,80 @@ describe('MRWConfig createShipment()', () => {
'password': 'password', 'password': 'password',
'franchiseCode': 'franchiseCode', 'franchiseCode': 'franchiseCode',
'subscriberCode': 'subscriberCode' 'subscriberCode': 'subscriberCode'
}, options }
); );
}
await models.Application.rawSql( async function getLastNotification() {
`INSERT INTO vn.mrwService return models.NotificationQueue.findOne({
SET agencyModeCodeFk = 'mrw', order: 'id DESC',
clientType = 1, where: filter
serviceType = 1,
kg = 1`, null, options
);
await models.Ticket.create(ticket1, options);
await models.Expedition.create(expedition1, options);
});
afterEach(async() => {
await tx.rollback();
}); });
}
it('should create a shipment and return a base64Binary label', async() => { it('should create a shipment and return a base64Binary label', async() => {
const mockPostResponses = [ const {file} = await models.MrwConfig.createShipment(expedition1.id);
{data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')},
{data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')}
];
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
const {file} = await models.MrwConfig.createShipment(expedition1.id, options);
expect(file).toEqual(mockBase64Binary); expect(file).toEqual(mockBase64Binary);
}); });
it('should fail if mrwConfig has no data', async() => { it('should fail if mrwConfig has no data', async() => {
let error; let error;
await models.MrwConfig.destroyAll();
await models.MrwConfig.createShipment(expedition1.id).catch(e => { await models.MrwConfig.createShipment(expedition1.id).catch(e => {
error = e; error = e;
}).finally(async() => { }).finally(async() => {
expect(error.message).toEqual(`Some mrwConfig parameters are not set`); expect(error.message).toEqual(`MRW service is not configured`);
}); });
await createMrwConfig();
expect(error).toBeDefined(); expect(error).toBeDefined();
}); });
it('should fail if expeditionFk is not a MrwExpedition', async() => { it('should fail if expeditionFk is not a MrwExpedition', async() => {
let error; let error;
await models.MrwConfig.createShipment(undefined, options).catch(e => { await models.MrwConfig.createShipment(undefined).catch(e => {
error = e; error = e;
}).finally(async() => { }).finally(async() => {
expect(error.message).toEqual(`This expedition is not a MRW shipment`); expect(error.message).toEqual(`This expedition is not a MRW shipment`);
}); });
}); });
it(' should fail if the creation date of this ticket is before the current date it', async() => { it('should fail if the creation date of this ticket is before the current date', async() => {
let error; let error;
const yesterday = Date.vnNew(); const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1); yesterday.setDate(yesterday.getDate() - 1);
await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday}, options);
await models.MrwConfig.createShipment(expedition1.id, options).catch(e => { await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday});
await models.MrwConfig.createShipment(expedition1.id).catch(e => {
error = e; error = e;
}).finally(async() => { }).finally(async() => {
expect(error.message).toEqual(`This ticket has a shipped date earlier than today`); expect(error.message).toEqual(`This ticket has a shipped date earlier than today`);
}); });
await models.Ticket.updateAll({id: ticket1.id}, {shipped: Date.vnNew()});
});
it('should send mail if you are past the dead line and is not notified today', async() => {
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null});
await models.MrwConfig.createShipment(expedition1.id);
const notification = await getLastNotification();
expect(notification.notificationFk).toEqual(filter.notificationFk);
});
it('should send mail if you are past the dead line and it is notified from another day', async() => {
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()});
await models.MrwConfig.createShipment(expedition1.id);
const notification = await getLastNotification();
expect(notification.notificationFk).toEqual(filter.notificationFk);
});
it('should not send mail if you are past the dead line and it is notified', async() => {
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()});
await models.MrwConfig.createShipment(expedition1.id);
const notification = await getLastNotification();
expect(notification).toEqual(null);
}); });
}); });

View File

@ -16,29 +16,34 @@ module.exports = Self => {
accessScopes: ['DEFAULT', 'read:multimedia']}); accessScopes: ['DEFAULT', 'read:multimedia']});
Self.renewToken = async function(ctx) { Self.renewToken = async function(ctx) {
const {accessToken: token} = ctx.req; let createTokenOptions = {};
let token; let isNotExceeded;
try {
token = ctx.req.accessToken;
const {courtesyTime} = await models.AccessTokenConfig.findOne({ const {courtesyTime} = await models.AccessTokenConfig.findOne({
fields: ['courtesyTime'] fields: ['courtesyTime']
}); });
const isNotExceeded = await Self.validateToken(ctx); isNotExceeded = await Self.validateToken(ctx);
if (isNotExceeded) if (isNotExceeded)
return token; return token;
// Schedule to remove current token // Schedule to remove current token
setTimeout(async() => { setTimeout(async() => {
let exists;
try { try {
const exists = await models.AccessToken.findById(token.id); exists = await models.AccessToken.findById(token.id);
exists && await Self.logout(token.id); exists && await Self.logout(token.id);
} catch (err) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(error);
const body = {error: error.message, now: Date.now(), userId: token?.userId ?? null, exists};
await handleError(body);
throw new Error(error);
} }
}, courtesyTime * 1000); }, courtesyTime * 1000);
// Get scopes // Get scopes
let createTokenOptions = {};
const {scopes} = token; const {scopes} = token;
if (scopes) if (scopes)
createTokenOptions = {scopes: [scopes[0]]}; createTokenOptions = {scopes: [scopes[0]]};
@ -47,5 +52,15 @@ module.exports = Self => {
const accessToken = await user.accessTokens.create(createTokenOptions); const accessToken = await user.accessTokens.create(createTokenOptions);
return {id: accessToken.id, ttl: accessToken.ttl}; return {id: accessToken.id, ttl: accessToken.ttl};
} catch (error) {
const body = {error: error.message, now: Date.now(), userId: token?.userId ?? null, createTokenOptions, isNotExceeded};
await handleError(body);
throw new Error(error);
}
}; };
}; };
async function handleError(body, tag = 'renewToken') {
body = JSON.stringify(body);
await models.Application.rawSql('CALL util.debugAdd(?,?);', [tag, body]);
}

View File

@ -61,4 +61,21 @@ describe('Renew Token', () => {
expect(error).toBeUndefined(); expect(error).toBeUndefined();
expect(response.id).toEqual(ctx.req.accessToken.id); expect(response.id).toEqual(ctx.req.accessToken.id);
}); });
it('throw error', async() => {
let error;
try {
await models.VnUser.renewToken({req: {token: null}});
} catch (e) {
error = e;
}
expect(error).toBeDefined();
const query = 'SELECT * FROM util.debug';
const debugLog = await models.Application.rawSql(query, null);
expect(debugLog.length).toEqual(1);
});
}); });

View File

@ -1,4 +1,35 @@
module.exports = Self => { module.exports = Self => {
require('../methods/mrw-config/createShipment')(Self); require('../methods/mrw-config/createShipment')(Self);
require('../methods/mrw-config/getLabel')(Self);
require('../methods/mrw-config/cancelShipment')(Self); require('../methods/mrw-config/cancelShipment')(Self);
const fs = require('fs');
const ejs = require('ejs');
const UserError = require('vn-loopback/util/user-error');
const {DOMParser} = require('xmldom');
const axios = require('axios');
Self.getConfig = async function() {
const mrw = await Self.app.models.MrwConfig.findOne(null);
if (!mrw) throw new UserError(`MRW service is not configured`);
return mrw;
};
Self.getTextByTag = function(xmlDoc, tag) {
return xmlDoc?.getElementsByTagName(tag)[0]?.textContent;
};
Self.sendXmlDoc = async function(path, params, contentType) {
const parser = new DOMParser();
const xmlTemplate = fs.readFileSync(path, 'utf-8');
const renderedTemplate = ejs.render(xmlTemplate, params);
const data = await axios.post(params.mrw.url, renderedTemplate, {
headers: {
'Content-Type': `${contentType}; charset=utf-8`
}
});
return parser.parseFromString(data.data, 'text/xml');
};
}; };

View File

@ -39,6 +39,12 @@
}, },
"defaultWeight": { "defaultWeight": {
"type": "number" "type": "number"
},
"expeditionDeadLine": {
"type": "string"
},
"notified":{
"type": "date"
} }
} }
} }

View File

@ -12,6 +12,12 @@
"required": true, "required": true,
"id": true "id": true
}, },
"sectorFromCode": {
"type": "string"
},
"sectorToCode": {
"type": "string"
},
"backupPrinterNotificationDelay": { "backupPrinterNotificationDelay": {
"type": "string" "type": "string"
} }

View File

@ -3,7 +3,7 @@ USE `util`;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `version` VALUES ('vn-database','11090','7adf4a373d19ce126adbc7b1077f69a74559c09a','2024-06-11 08:32:36','11094'); INSERT INTO `version` VALUES ('vn-database','11114','cf0f80142fed798c3307565a69158d7dba9276c4','2024-06-25 09:25:54','11115');
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','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); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
@ -834,19 +834,34 @@ INSERT INTO `versionLog` VALUES ('vn-database','11058','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','11059','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11059','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11060','00-createRoleReviewer.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11060','00-createRoleReviewer.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11061','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11061','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11063','00-roadmapAddress.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11063','01-roadmapStop.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11063','02-roadmapStopGrants.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11064','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11065','00-modifyInvoiceInPrivileges.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11065','00-modifyInvoiceInPrivileges.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11065','01-modifyInvoiceInAcls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11065','01-modifyInvoiceInAcls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11068','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11068','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11069','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11069','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11070','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11071','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11071','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11074','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11074','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11075','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-28 12:54:13',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11075','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-28 12:54:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11078','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11078','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11079','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 08:22:10',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11079','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 08:22:10',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11080','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 12:01:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11080','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-31 12:01:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11082','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11083','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-03 10:46:36',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11083','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-03 10:46:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11084','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11087','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:38:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11089','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11090','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11090','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11092','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-07 08:21:23',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','11092','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-07 08:21:23',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11093','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11096','00-addBuyerAcl.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 12:48:51',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11105','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-20 15:36:07',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11106','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11109','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-18 19:09:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11114','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-06-25 08:39:49',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -930,7 +945,7 @@ INSERT INTO `role` VALUES (109,'salesTeamBoss','Jefe de equipo de comerciales',1
INSERT INTO `role` VALUES (110,'palletizer','Paletizadores',1,'2022-12-02 13:56:22','2022-12-02 13:56:30',NULL); INSERT INTO `role` VALUES (110,'palletizer','Paletizadores',1,'2022-12-02 13:56:22','2022-12-02 13:56:30',NULL);
INSERT INTO `role` VALUES (111,'entryEditor','Entry editor',1,'2023-01-13 12:21:55','2023-01-13 12:21:55',NULL); INSERT INTO `role` VALUES (111,'entryEditor','Entry editor',1,'2023-01-13 12:21:55','2023-01-13 12:21:55',NULL);
INSERT INTO `role` VALUES (112,'maintenance','Personal de mantenimiento',1,'2023-01-19 07:23:35','2023-01-19 07:23:35',NULL); INSERT INTO `role` VALUES (112,'maintenance','Personal de mantenimiento',1,'2023-01-19 07:23:35','2023-01-19 07:23:35',NULL);
INSERT INTO `role` VALUES (114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 07:31:16','2023-05-17 13:07:21',NULL); INSERT INTO `role` VALUES (114,'maintenanceBoss','Jefe de mantenimiento',1,'2023-01-19 07:31:16','2024-06-14 08:56:41',19295);
INSERT INTO `role` VALUES (115,'itManagement','TI management',1,'2023-03-29 09:27:55','2023-03-29 09:28:04',NULL); INSERT INTO `role` VALUES (115,'itManagement','TI management',1,'2023-03-29 09:27:55','2023-03-29 09:28:04',NULL);
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 (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 (120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 09:07:21','2023-06-19 09:07:21',21709);
@ -1212,6 +1227,7 @@ INSERT INTO `roleInherit` VALUES (367,30,73,NULL);
INSERT INTO `roleInherit` VALUES (368,130,49,10578); INSERT INTO `roleInherit` VALUES (368,130,49,10578);
INSERT INTO `roleInherit` VALUES (369,50,130,10578); INSERT INTO `roleInherit` VALUES (369,50,130,10578);
INSERT INTO `roleInherit` VALUES (370,72,130,10578); INSERT INTO `roleInherit` VALUES (370,72,130,10578);
INSERT INTO `roleInherit` VALUES (371,36,35,NULL);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@ -1535,7 +1551,7 @@ INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'); 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 (387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','$owner');
INSERT INTO `ACL` VALUES (388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'); 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 (389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager');
INSERT INTO `ACL` VALUES (390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'); INSERT INTO `ACL` VALUES (390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager');
@ -1791,10 +1807,6 @@ INSERT INTO `ACL` VALUES (686,'MailForward','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (687,'ClientSms','find','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (687,'ClientSms','find','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (688,'ClientSms','create','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (688,'ClientSms','create','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss');
INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (692,'RoadmapStop','*','*','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (693,'RoadmapStop','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative');
@ -1863,7 +1875,7 @@ INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','emplo
INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (762,'Route','filter','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (763,'Route','getByWorker','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (764,'Route','getDeliveryPoint','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (764,'Route','getDeliveryPoint','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (765,'Route','getExternalCmrs','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (765,'Route','cmrs','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (766,'Route','getSuggestedTickets','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (766,'Route','getSuggestedTickets','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (767,'Route','getTickets','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (767,'Route','getTickets','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','employee');
@ -1939,8 +1951,6 @@ INSERT INTO `ACL` VALUES (840,'Locker','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (841,'Locker','*','*','ALLOW','ROLE','productionBoss'); INSERT INTO `ACL` VALUES (841,'Locker','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (842,'Worker','__get__locker','READ','ALLOW','ROLE','hr'); INSERT INTO `ACL` VALUES (842,'Worker','__get__locker','READ','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (843,'Worker','__get__locker','READ','ALLOW','ROLE','productionBoss'); INSERT INTO `ACL` VALUES (843,'Worker','__get__locker','READ','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (844,'RoadmapStop','*','*','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (845,'RoadmapStop','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (846,'Ticket','refund','WRITE','ALLOW','ROLE','logistic'); INSERT INTO `ACL` VALUES (846,'Ticket','refund','WRITE','ALLOW','ROLE','logistic');
INSERT INTO `ACL` VALUES (847,'RouteConfig','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (847,'RouteConfig','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (848,'InvoiceIn','updateInvoiceIn','WRITE','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (848,'InvoiceIn','updateInvoiceIn','WRITE','ALLOW','ROLE','administrative');
@ -1960,6 +1970,19 @@ INSERT INTO `ACL` VALUES (861,'InvoiceIn','toBook','WRITE','ALLOW','ROLE','buyer
INSERT INTO `ACL` VALUES (862,'InvoiceIn','deleteById','WRITE','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (862,'InvoiceIn','deleteById','WRITE','ALLOW','ROLE','buyer');
INSERT INTO `ACL` VALUES (863,'InvoiceIn','create','WRITE','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (863,'InvoiceIn','create','WRITE','ALLOW','ROLE','administrative');
INSERT INTO `ACL` VALUES (864,'InvoiceIn','create','WRITE','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (864,'InvoiceIn','create','WRITE','ALLOW','ROLE','buyer');
INSERT INTO `ACL` VALUES (865,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (866,'InvoiceOut','download','READ','ALLOW','ROLE','$owner');
INSERT INTO `ACL` VALUES (867,'InvoiceIn','*','READ','ALLOW','ROLE','maintenanceBoss');
INSERT INTO `ACL` VALUES (868,'InvoiceIn','*','READ','ALLOW','ROLE','maintenanceBos');
INSERT INTO `ACL` VALUES (869,'Ticket','editZone','WRITE','ALLOW','ROLE','buyer');
INSERT INTO `ACL` VALUES (870,'Entry','find','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (871,'RoadmapAddress','*','WRITE','ALLOW','ROLE','palletizerBoss');
INSERT INTO `ACL` VALUES (872,'RoadmapAddress','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (873,'Roadmap','*','WRITE','ALLOW','ROLE','palletizerBoss');
INSERT INTO `ACL` VALUES (874,'Roadmap','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (875,'RoadmapStop','*','WRITE','ALLOW','ROLE','palletizerBoss');
INSERT INTO `ACL` VALUES (876,'RoadmapStop','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (877,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@ -2280,7 +2303,7 @@ INSERT INTO `continent` VALUES (3,'África','AF');
INSERT INTO `continent` VALUES (4,'Europa','EU'); INSERT INTO `continent` VALUES (4,'Europa','EU');
INSERT INTO `continent` VALUES (5,'Oceanía','OC'); INSERT INTO `continent` VALUES (5,'Oceanía','OC');
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,25,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,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,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,0,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 (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 (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);
@ -2291,49 +2314,49 @@ INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1
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 (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 (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 (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,71,NULL,0,0,0,1,16,1,'/1/',NULL,1,'',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',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,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',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,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,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,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',78,79,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,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',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 (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',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 (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 (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',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,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 (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 (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',86,89,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,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',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,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 (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',92,95,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,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',96,97,NULL,72,0,0,1,0,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 (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',98,99,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,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,'spainTeam5','EQUIPO ESPAÑA 5',43,44,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL); INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',43,44,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',100,101,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,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',102,103,NULL,0,1,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',93,94,NULL,0,0,0,2,0,61,'/1/61/',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 (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 (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,'spainTeam2','EQUIPO ESPAÑA 2',47,48,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',0,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL); INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',47,48,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',1,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',49,50,24065,0,0,0,2,0,43,'/1/43/','es1_equipo',0,'es1@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL); INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',49,50,24065,0,0,0,2,0,43,'/1/43/','es1_equipo',1,'es1@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 (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 (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 (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',57,58,NULL,72,0,0,2,0,43,'/1/43/',NULL,0,NULL,1,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,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',0,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL); INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',57,58,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',1,'es3@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 (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,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,1,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,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',87,88,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,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',61,62,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 (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',63,64,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL); INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',61,62,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',65,66,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 (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 (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 (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 (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,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL); INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',65,66,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',69,70,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL); INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',67,68,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,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 `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 (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);

View File

@ -647,7 +647,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','pgcMaster','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','inventoryFailure','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','inventoryFailure','alexm@%','0000-00-00 00:00:00','Select','');
@ -982,7 +982,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceCorre
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','XDiario','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerTimeControl','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerTimeControl','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','financial','Greuge_Evolution','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bi','financial','Greuge_Evolution','alexm@%','0000-00-00 00:00:00','Select','');
@ -1048,7 +1048,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','userSession','j
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','receipt','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','receipt','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buy','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buy','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','calendarHolidays','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','calendarHolidays','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parking','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parking','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','role','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','role','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','errorLogApp','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','errorLogApp','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','continent','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','continent','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1300,7 +1300,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','g
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','entryOrder','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','entryOrder','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','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','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
@ -1350,7 +1350,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','warehouse
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','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','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','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','grafana','priceFixed','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
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','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','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','ticketTracking','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
@ -1361,7 +1361,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','sale_freight
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','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','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','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','grafana','ticketRequest','guillermo@10.5.1.3','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 ('','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 ('','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',''); 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','');
@ -1384,6 +1384,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','professionalCategor
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','ticketObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','ticketObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNoteState','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNoteState','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','comparative','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','invoiceOutExpense','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','invoiceOutExpense','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','delivery','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','delivery','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','entry','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','entry','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
@ -1398,23 +1399,29 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visit','root@lo
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','antenna','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','bufferPool','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','enteringLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','expeditionLoading','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','failureLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','movingLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','sorterLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientInforma','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientInforma','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','solunionCAP','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','solunionCAP','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientUnpaid','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientUnpaid','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pay_dem','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pay_dem','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','invoiceOut','guillermo@10.5.1.3','0000-00-00 00:00:00','Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','invoiceOut','guillermo@10.5.1.3','0000-00-00 00:00:00','Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','accountDetail','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','accountDetail','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','antenna','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','bufferPool','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','enteringLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','expeditionLoading','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','failureLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','movingLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','sorterLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1474,28 +1481,6 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','user_id','0
INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','extension','0000-00-00 00:00:00','Select'); INSERT IGNORE INTO `columns_priv` VALUES ('','pbx','grafana','sip','extension','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','name','0000-00-00 00:00:00','Select'); INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','name','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','active','0000-00-00 00:00:00','Select'); INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','active','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','editorFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','expenseFkDeductible','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','withholdingSageFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','isVatDeductible','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','bookEntried','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','siiTrascendencyInvoiceInFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusTaxBreakFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusSubjectOpFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusRectificationTypeFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','siiTypeInvoiceInFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','operated','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','booked','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','docFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','companyFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','created','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','currencyFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','supplierRef','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','issued','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','supplierFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','serial','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','serialNumber','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','id','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','routeFk','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','routeFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','name','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','name','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','beachFk','0000-00-00 00:00:00','Update'); INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','routesMonitor','beachFk','0000-00-00 00:00:00','Update');
@ -1904,7 +1889,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','invoiceoutboo
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticket_gettax','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticket_gettax','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','productionAssi','midnight','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','productionAssi','midnight','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','dipole','employee','expedition_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','dipole','employee','expedition_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticketstateupdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','itempacking','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','itempacking','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','ticket_clone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','ticket_clone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
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 ('','cache','employee','available_refresh','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@ -2151,6 +2135,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_co
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','alexm@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','alexm@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','developer','connection_kill','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','developer','connection_kill','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','client_getRisk','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','client_getRisk','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','account','developer','user_hasRole','FUNCTION','root@localhost','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2215,7 +2200,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','logisticAssist','{\"access\":0,\"v
INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"version_id\":100707,\"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 ('','maintenance','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true,\"version_id\":101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true,\"version_id\":101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');

File diff suppressed because it is too large Load Diff

View File

@ -2140,24 +2140,22 @@ BEGIN
END IF; END IF;
IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN
SELECT util.hasDateOverlapped(
SELECT COUNT(*) > 0 INTO isOverlapping started,
FROM business b ended,
WHERE (util.hasDateOverlapped(
NEW.started, NEW.started,
IFNULL(NEW.ended, b.started), IFNULL(NEW.ended, b.started)
b.started, ) isOverlapped INTO isOverlapping
IFNULL(b.ended, NEW.started)) FROM vn.business b
OR (NEW.ended <=> NULL AND b.ended <=> NULL)) WHERE workerFk = NEW.workerFK
AND b.id <> OLD.id AND b.id <> NEW.id
AND workerFk = OLD.workerFk; ORDER BY isOverlapped DESC
LIMIT 1;
IF isOverlapping THEN IF isOverlapping THEN
CALL util.throw ('IS_OVERLAPPING'); CALL util.throw ('IS_OVERLAPPING');
END IF; END IF;
END IF; END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -2366,7 +2364,15 @@ trig:BEGIN
LEAVE trig; LEAVE trig;
END IF; END IF;
IF NOT (NEW.entryFk <=> OLD.entryFk) OR
NOT (NEW.quantity <=> OLD.quantity) OR
NOT (NEW.buyingValue <=> OLD.buyingValue) OR
NOT (NEW.packing <=> OLD.packing)
THEN
CALL entry_isEditable(OLD.entryFk); CALL entry_isEditable(OLD.entryFk);
END IF;
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SELECT defaultEntry INTO vDefaultEntry SELECT defaultEntry INTO vDefaultEntry
@ -3010,6 +3016,52 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimRatio_afterInsert`
AFTER INSERT ON `claimRatio`
FOR EACH ROW
BEGIN
INSERT INTO clientRate(clientFk, `value`)
VALUES(NEW.clientFk, NEW.priceIncreasing)
ON DUPLICATE KEY UPDATE
`value` = VALUES(`value`);
END */;;
DELIMITER ;
/*!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_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 */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimRatio_afterUpdate`
AFTER UPDATE ON `claimRatio`
FOR EACH ROW
BEGIN
INSERT INTO clientRate(clientFk, `value`)
VALUES(NEW.clientFk, NEW.priceIncreasing)
ON DUPLICATE KEY UPDATE
`value` = VALUES(`value`);
END */;;
DELIMITER ;
/*!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_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 */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claimState_beforeInsert`
BEFORE INSERT ON `claimState` BEFORE INSERT ON `claimState`
FOR EACH ROW FOR EACH ROW
@ -3198,11 +3250,11 @@ BEGIN
END IF; END IF;
END IF; END IF;
IF !(NEW.salesPersonFk <=> OLD.salesPersonFk) THEN IF NOT (NEW.salesPersonFk <=> OLD.salesPersonFk) THEN
SET NEW.lastSalesPersonFk = IFNULL(NEW.salesPersonFk, OLD.salesPersonFk); SET NEW.lastSalesPersonFk = IFNULL(NEW.salesPersonFk, OLD.salesPersonFk);
END IF; END IF;
IF !(NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN IF NOT (NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN
SET NEW.isTaxDataChecked = 0; SET NEW.isTaxDataChecked = 0;
END IF; END IF;
END */;; END */;;
@ -3224,13 +3276,36 @@ DELIMITER ;;
AFTER UPDATE ON `client` AFTER UPDATE ON `client`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN IF NOT (NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN
UPDATE `address` SET isDefaultAddress = FALSE UPDATE `address` SET isDefaultAddress = FALSE
WHERE clientFk = NEW.id; WHERE clientFk = NEW.id;
UPDATE `address` SET isDefaultAddress = TRUE UPDATE `address` SET isDefaultAddress = TRUE
WHERE id = NEW.defaultAddressFk; WHERE id = NEW.defaultAddressFk;
END IF; END IF;
IF NEW.id <> OLD.id
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
OR NOT (NEW.socialName <=> OLD.socialName)
OR NOT (NEW.street <=> OLD.street)
OR NOT (NEW.accountingAccount <=> OLD.accountingAccount)
OR NOT (NEW.isVies <=> OLD.isVies)
OR NOT (NEW.fi <=> OLD.fi)
OR NOT (NEW.postcode <=> OLD.postcode)
OR NOT (NEW.city <=> OLD.city)
OR NOT (NEW.countryFk <=> OLD.countryFk)
OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
OR NOT (NEW.email <=> OLD.email)
OR NOT (NEW.iban <=> OLD.iban)
OR NOT (NEW.phone <=> OLD.phone)
OR NOT (NEW.mobile <=> OLD.mobile) THEN
UPDATE sage.clientSupplier
SET isSync = FALSE
WHERE idClientSupplier IN (NEW.id, OLD.id)
AND `type` = 'C';
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -4203,31 +4278,6 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionConfig_afterUpdate`
AFTER UPDATE ON `deviceProductionConfig`
FOR EACH ROW
BEGIN
IF NEW.isAllUsersAllowed = 1 OR NEW.isAllUsersAllowed = -1 THEN
SET @username := (SELECT account.myUser_getName());
INSERT INTO vn.mail (receiver, subject, body)
VALUES ('cau@verdnatura.es', 'Se ha activado la autenticación sin restricciones en la app',
CONCAT('El usuario ', @username,' ha habilitado la opción para que todos los usuarios puedan acceder a la app sin restricciones'));
END IF;
END */;;
DELIMITER ;
/*!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_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 */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionModels_beforeInsert`
BEFORE INSERT ON `deviceProductionModels` BEFORE INSERT ON `deviceProductionModels`
FOR EACH ROW FOR EACH ROW
@ -4618,9 +4668,20 @@ BEGIN
DECLARE vHasDistinctWarehouses BOOL; DECLARE vHasDistinctWarehouses BOOL;
DECLARE vTotalBuy INT; DECLARE vTotalBuy INT;
IF NEW.isBooked = OLD.isBooked THEN IF NEW.isBooked = OLD.isBooked AND (
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
NOT (NEW.dated <=> OLD.dated) OR
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
NOT (NEW.travelFk <=> OLD.travelFk) OR
NOT (NEW.companyFk <=> OLD.companyFk) OR
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
NOT (NEW.typeFk <=> OLD.typeFk)
) THEN
CALL entry_isEditable(OLD.id); CALL entry_isEditable(OLD.id);
ELSE ELSE
IF NEW.isBooked THEN IF NEW.isBooked THEN
SELECT COUNT(*) INTO vTotalBuy SELECT COUNT(*) INTO vTotalBuy
FROM buy FROM buy
@ -4894,8 +4955,7 @@ DELIMITER ;;
BEFORE INSERT ON `expedition` BEFORE INSERT ON `expedition`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
DECLARE intcounter INT; DECLARE vMaxCounter INT;
DECLARE vShipFk INT;
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
@ -4903,16 +4963,17 @@ BEGIN
UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk; UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk;
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter SELECT IFNULL(MAX(counter),0) + 1 INTO vMaxCounter
FROM expedition e FROM expedition e
INNER JOIN ticket t1 ON e.ticketFk = t1.id JOIN alertLevel al ON al.code = 'DELIVERED'
JOIN ticket t1 ON e.ticketFk = t1.id
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped)
AND t1.warehouseFk = t2.warehouseFk AND t1.warehouseFk = t2.warehouseFk
WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk WHERE t2.id = NEW.ticketFk AND ts.alertLevel < al.id AND t1.companyFk = t2.companyFk
AND t1.agencyModeFk = t2.agencyModeFk; AND t1.agencyModeFk = t2.agencyModeFk;
SET NEW.`counter` = intcounter; SET NEW.`counter` = vMaxCounter;
END IF; END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -8525,6 +8586,44 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterUpdate`
BEFORE UPDATE ON `supplier`
FOR EACH ROW
BEGIN
IF NEW.id <> OLD.id
OR NOT (NEW.name <=> OLD.name)
OR NOT (NEW.street <=> OLD.street)
OR NOT (NEW.account <=> OLD.account)
OR NOT (NEW.nif <=> OLD.nif)
OR NOT (NEW.isVies <=> OLD.isVies)
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
OR NOT (NEW.countryFk <=> OLD.countryFk)
OR NOT (NEW.postCode <=> OLD.postCode)
OR NOT (NEW.city <=> OLD.city)
OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
OR NOT (NEW.withholdingSageFk <=> OLD.withholdingSageFk) THEN
UPDATE sage.clientSupplier
SET isSync = FALSE
WHERE idClientSupplier IN (NEW.id, OLD.id)
AND `type` = 'P';
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_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 */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterDelete` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_afterDelete`
AFTER DELETE ON `supplier` AFTER DELETE ON `supplier`
FOR EACH ROW FOR EACH ROW
@ -10825,4 +10924,4 @@ USE `vn2008`;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-06-11 6:35:55 -- Dump completed on 2024-06-25 7:27:06

View File

@ -2868,7 +2868,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(5, 'modified-entry', 'An entry has been modified'), (5, 'modified-entry', 'An entry has been modified'),
(6, 'book-entry-deleted', 'accounting entries deleted'), (6, 'book-entry-deleted', 'accounting entries deleted'),
(7, 'zone-included','An email to notify zoneCollisions'), (7, 'zone-included','An email to notify zoneCollisions'),
(8, 'backup-printer-selected','A backup printer has been selected'); (8, 'backup-printer-selected','A backup printer has been selected'),
(9, 'mrw-deadline','The MRW deadline has passed');
TRUNCATE `util`.`notificationAcl`; TRUNCATE `util`.`notificationAcl`;
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
@ -2881,7 +2882,8 @@ INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
(5, 9), (5, 9),
(6, 9), (6, 9),
(7, 9), (7, 9),
(8, 66); (8, 66),
(9, 56);
TRUNCATE `util`.`notificationQueue`; TRUNCATE `util`.`notificationQueue`;
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`) INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
@ -3868,3 +3870,17 @@ INSERT INTO vn.sectorCollectionSaleGroup
SET id = 9, SET id = 9,
sectorCollectionFk = 3, sectorCollectionFk = 3,
saleGroupFk = 6; saleGroupFk = 6;
INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHolidaysNameFk, workCenterFk)
VALUES
(1, '2001-05-08', 1, 1),
(1, '2001-05-09', 1, 1),
(1, '2001-05-10', 1, 1),
(1, '2001-05-11', 1, 1),
(1, '2001-05-14', 1, 5),
(1, '2001-05-15', 1, 5),
(1, '2001-05-16', 1, 5),
(1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5);

View File

@ -21,7 +21,8 @@ BEGIN
DECLARE vTransactionExportTaxFreeFk INT; DECLARE vTransactionExportTaxFreeFk INT;
DECLARE vSerialDua VARCHAR(1) DEFAULT 'D'; DECLARE vSerialDua VARCHAR(1) DEFAULT 'D';
DECLARE vInvoiceTypeInformativeCode VARCHAR(1); DECLARE vInvoiceTypeInformativeCode VARCHAR(1);
DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2) ; DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2);
DECLARE vCompanyCode INT;
SELECT SiglaNacion INTO vCountryCanariasCode SELECT SiglaNacion INTO vCountryCanariasCode
FROM Naciones FROM Naciones
@ -31,9 +32,6 @@ BEGIN
FROM Naciones FROM Naciones
WHERE Nacion ='CEUTA Y MELILLA'; WHERE Nacion ='CEUTA Y MELILLA';
SELECT pendingServiceTransactionTypeFk INTO vDuaTransactionFk
FROM config;
SELECT id INTO vTaxImportFk SELECT id INTO vTaxImportFk
FROM taxType FROM taxType
WHERE code = 'import21'; WHERE code = 'import21';
@ -46,10 +44,14 @@ BEGIN
FROM taxType FROM taxType
WHERE code = 'import4'; WHERE code = 'import4';
SELECT definitiveExportTransactionTypeFk INTO vTransactionExportFk SELECT shipmentTransactionTypeFk,
FROM config; definitiveExportTransactionTypeFk,
pendingServiceTransactionTypeFk,
SELECT shipmentTransactionTypeFk INTO vTransactionExportTaxFreeFk company_getCode(vCompanyFk)
INTO vTransactionExportTaxFreeFk,
vTransactionExportFk,
vDuaTransactionFk,
vCompanyCode
FROM config; FROM config;
SELECT codeSage INTO vInvoiceTypeInformativeCode SELECT codeSage INTO vInvoiceTypeInformativeCode
@ -64,8 +66,6 @@ BEGIN
WHERE enlazadoSage = FALSE WHERE enlazadoSage = FALSE
AND Asiento <> 1 ; AND Asiento <> 1 ;
CALL clientSupplier_add(vCompanyFk);
CALL pgc_add(vCompanyFk);
CALL invoiceOut_manager(vYear, vCompanyFk); CALL invoiceOut_manager(vYear, vCompanyFk);
CALL invoiceIn_manager(vYear, vCompanyFk); CALL invoiceIn_manager(vYear, vCompanyFk);
@ -158,7 +158,7 @@ BEGIN
) )
SELECT 'EN' TipoEntrada, SELECT 'EN' TipoEntrada,
YEAR(x.FECHA) Ejercicio, YEAR(x.FECHA) Ejercicio,
company_getCode(vCompanyFk) AS CodigoEmpresa, vCompanyCode CodigoEmpresa,
x.ASIEN Asiento, x.ASIEN Asiento,
IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL), IF(EURODEBE <> 0 OR (EURODEBE = 0 AND EUROHABER IS NULL),
'D', 'H') CargoAbono, 'D', 'H') CargoAbono,
@ -291,20 +291,6 @@ BEGIN
WHERE m.CargoAbono = 'D' WHERE m.CargoAbono = 'D'
AND m.enlazadoSage = FALSE; AND m.enlazadoSage = FALSE;
-- Elimina cuentas de cliente/proveedor que no se utilizarán en la importación
DELETE cp
FROM clientesProveedores cp
LEFT JOIN movConta mc ON mc.codigoCuenta = cp.codigoCuenta
AND mc.enlazadoSage = FALSE
WHERE mc.codigoCuenta IS NULL;
-- Elimina cuentas contables que no se utilizarán en la importación
DELETE pc
FROM planCuentasPGC pc
LEFT JOIN movConta mc ON mc.codigoCuenta = pc.codigoCuenta
AND mc.enlazadoSage = FALSE
WHERE mc.codigoCuenta IS NULL;
-- DUAS -- DUAS
UPDATE movConta mci UPDATE movConta mci
JOIN vn.XDiario x ON x.ASIEN = mci.Asiento JOIN vn.XDiario x ON x.ASIEN = mci.Asiento
@ -411,5 +397,55 @@ BEGIN
AND importeDivisa > 0 AND importeDivisa > 0
AND ImporteAsiento < 0; AND ImporteAsiento < 0;
CREATE OR REPLACE TEMPORARY TABLE tmp.clientSupplier
(INDEX(idClientSupplier, `type`))
ENGINE = MEMORY
WITH client AS(
SELECT DISTINCT c.id
FROM sage.movConta mc
JOIN vn.client c ON c.accountingAccount = mc.CodigoCuenta
WHERE NOT enlazadoSage
),supplier AS(
SELECT DISTINCT s.id
FROM sage.movConta mc
JOIN vn.supplier s ON s.account = mc.CodigoCuenta
WHERE NOT enlazadoSage
),clientSupplierSync AS(
SELECT idClientSupplier, `type`
FROM sage.clientSupplier cs
WHERE isSync
)
SELECT idClientSupplier, `type`
FROM sage.clientSupplier cs
WHERE NOT isSync
UNION
SELECT id, 'C'
FROM client c
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = c.id
AND cs.Type ='C'
WHERE cs.idClientSupplier IS NULL
UNION
SELECT id, 'P'
FROM supplier s
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = s.id
AND cs.Type ='P'
WHERE cs.idClientSupplier IS NULL;
CALL clientSupplier_add(vCompanyFk);
INSERT IGNORE INTO sage.clientSupplier (companyFk, `type`, idClientSupplier, isSync)
SELECT vCompanyCode, `type`, idClientSupplier, FALSE
FROM tmp.clientSupplier;
DROP TEMPORARY TABLE tmp.clientSupplier;
CALL pgc_add(vCompanyFk);
-- Elimina cuentas contables que no se utilizarán en la importación
DELETE pc
FROM planCuentasPGC pc
LEFT JOIN movConta mc ON mc.codigoCuenta = pc.codigoCuenta
AND mc.enlazadoSage = FALSE
WHERE mc.codigoCuenta IS NULL;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,11 +1,16 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`clientSupplier_add`(vCompanyFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`clientSupplier_add`(
vCompanyFk INT
)
BEGIN BEGIN
/** /**
* Prepara los datos de clientes y proveedores para exportarlos a Sage * Inserta en la tabla sage.clientesProveedores los datos de clientes y proveedores
* @vCompanyFk Empresa dela que se quiere trasladar datos * que se actualizaran o se daran de alta en Sage
* @vCompanyFk Id de empresa
* @table tmp.clientSupplier(idClientSupplier, `type`)
*/ */
DECLARE vCountryCeutaMelillaFk INT; DECLARE vCountryCeutaMelillaFk INT;
DECLARE vCompanyCode INT DEFAULT company_getCode(vCompanyFk);
DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2); DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2);
SELECT SiglaNacion INTO vCountryCanariasCode SELECT SiglaNacion INTO vCountryCanariasCode
@ -45,7 +50,7 @@ BEGIN
Email1, Email1,
iban) iban)
SELECT SELECT
company_getCode(vCompanyFk), vCompanyCode,
'C', 'C',
c.id, c.id,
c.socialName, c.socialName,
@ -75,15 +80,14 @@ BEGIN
IFNULL(SUBSTR(c.email, 1, LOCATE(',', CONCAT(c.email, ','))-1), ''), IFNULL(SUBSTR(c.email, 1, LOCATE(',', CONCAT(c.email, ','))-1), ''),
IFNULL(c.iban, '') IFNULL(c.iban, '')
FROM vn.`client` c FROM vn.`client` c
JOIN clientLastTwoMonths clm ON clm.clientFk = c.id JOIN tmp.clientSupplier cs ON cs.idClientSupplier = c.id
LEFT JOIN vn.country cu ON cu.id = c.countryFk LEFT JOIN vn.country cu ON cu.id = c.countryFk
LEFT JOIN Naciones n ON n.countryFk = cu.id LEFT JOIN Naciones n ON n.countryFk = cu.id
LEFT JOIN vn.province p ON p.id = c.provinceFk LEFT JOIN vn.province p ON p.id = c.provinceFk
LEFT JOIN Provincias pr ON pr.provinceFk = p.id LEFT JOIN Provincias pr ON pr.provinceFk = p.id
WHERE c.isRelevant WHERE cs.type = 'C'
AND clm.companyFk = vCompanyFk
UNION ALL UNION ALL
SELECT company_getCode(vCompanyFk), SELECT vCompanyCode,
'P', 'P',
s.id, s.id,
s.name, s.name,
@ -107,18 +111,16 @@ BEGIN
IFNULL(s.transactionTypeSageFk, 0), IFNULL(s.transactionTypeSageFk, 0),
IFNULL(s.withholdingSageFk, '0'), IFNULL(s.withholdingSageFk, '0'),
IFNULL(SUBSTR(sc.email, 1, (COALESCE(NULLIF(LOCATE(',', sc.email), 0), 99) - 1)), ''), IFNULL(SUBSTR(sc.email, 1, (COALESCE(NULLIF(LOCATE(',', sc.email), 0), 99) - 1)), ''),
IFNULL(iban, '') IFNULL(sa.iban, '')
FROM vn.supplier s FROM vn.supplier s
JOIN supplierLastThreeMonths pl ON pl.supplierFk = s.id JOIN tmp.clientSupplier cs ON cs.idClientSupplier = s.id
LEFT JOIN vn.country co ON co.id = s.countryFk LEFT JOIN vn.country co ON co.id = s.countryFk
LEFT JOIN Naciones n ON n.countryFk = co.id LEFT JOIN Naciones n ON n.countryFk = co.id
LEFT JOIN vn.province p ON p.id = s.provinceFk LEFT JOIN vn.province p ON p.id = s.provinceFk
LEFT JOIN Provincias pr ON pr.provinceFk = p.id LEFT JOIN Provincias pr ON pr.provinceFk = p.id
LEFT JOIN vn.supplierContact sc ON sc.supplierFk = s.id LEFT JOIN vn.supplierContact sc ON sc.supplierFk = s.id
LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN vn.supplierAccount sa ON sa.supplierFk = s.id
WHERE pl.companyFk = vCompanyFk AND WHERE cs.type = 'P'
s.isActive AND GROUP BY s.id;
s.nif <> ''
GROUP BY pl.supplierFk, pl.companyFk;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,5 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`debugAdd`(vVariable VARCHAR(255), vValue VARCHAR(255)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`debugAdd`(
vVariable VARCHAR(255),
vValue TEXT
)
MODIFIES SQL DATA MODIFIES SQL DATA
BEGIN BEGIN
/** /**

View File

@ -26,6 +26,7 @@ BEGIN
JOIN province p ON p.id = c.provinceFk JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk LEFT JOIN autonomy a ON a.id = p.autonomyFk
JOIN country co ON co.id = p.countryFk JOIN country co ON co.id = p.countryFk
JOIN bs.clientDiedPeriod cdp ON cdp.countryFk = co.id
WHERE cd.warning = 'third' WHERE cd.warning = 'third'
AND cp.clientFk IS NULL AND cp.clientFk IS NULL
AND sp.salesPersonFk IS NULL AND sp.salesPersonFk IS NULL

View File

@ -13,21 +13,63 @@ BEGIN
* @param vCollectionFk Id de colección * @param vCollectionFk Id de colección
*/ */
DECLARE vHasTooMuchCollections BOOL; DECLARE vHasTooMuchCollections BOOL;
DECLARE vItemPackingTypeFk VARCHAR(1);
DECLARE vWarehouseFk INT;
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 30;
DECLARE vErrorNumber INT;
DECLARE vErrorMsg TEXT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT;
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('collection_assign', JSON_OBJECT(
'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'lockName', vLockName,
'userFk', vUserFk
)); -- Tmp
END IF;
RESIGNAL;
END;
-- Si hay colecciones sin terminar, sale del proceso -- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0,
INTO vHasTooMuchCollections collection_assign_lockname
INTO vHasTooMuchCollections,
vLockName
FROM productionConfig pc FROM productionConfig pc
LEFT JOIN tCollection ON TRUE; LEFT JOIN tmp.collection ON TRUE;
DROP TEMPORARY TABLE tCollection; DROP TEMPORARY TABLE tmp.collection;
IF vHasTooMuchCollections THEN IF vHasTooMuchCollections THEN
CALL util.throw('Hay colecciones pendientes'); CALL util.throw('Hay colecciones pendientes');
END IF; END IF;
SELECT warehouseFk, itemPackingTypeFk
INTO vWarehouseFk, vItemPackingTypeFk
FROM operator
WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/',
vLockName,
vWarehouseFk,
vItemPackingTypeFk
);
IF NOT GET_LOCK(vLockName, vLockTime) THEN
CALL util.throw(CONCAT('Cannot get lock: ', vLockName));
END IF;
-- Se eliminan las colecciones sin asignar que estan obsoletas -- Se eliminan las colecciones sin asignar que estan obsoletas
INSERT INTO ticketTracking(stateFk, ticketFk) INSERT INTO ticketTracking(stateFk, ticketFk)
SELECT s.id, tc.ticketFk SELECT s.id, tc.ticketFk
@ -75,5 +117,7 @@ BEGIN
UPDATE `collection` UPDATE `collection`
SET workerFk = vUserFk SET workerFk = vUserFk
WHERE id = vCollectionFk; WHERE id = vCollectionFk;
DO RELEASE_LOCK(vLockName);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -7,11 +7,15 @@ BEGIN
* @param vWorkerFk id del worker. * @param vWorkerFk id del worker.
* @table Devuelve tabla temporal con las colecciones pendientes * @table Devuelve tabla temporal con las colecciones pendientes
*/ */
DROP TEMPORARY TABLE IF EXISTS tCollection; DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RESIGNAL;
END;
CREATE TEMPORARY TABLE tCollection CREATE OR REPLACE TEMPORARY TABLE tmp.collection
ENGINE = MEMORY
SELECT c.id collectionFk, SELECT c.id collectionFk,
date(c.created) created, DATE(c.created) created,
COUNT(DISTINCT tc.ticketFk) ticketTotalCount COUNT(DISTINCT tc.ticketFk) ticketTotalCount
FROM collection c FROM collection c
JOIN ticketCollection tc ON tc.collectionFk = c.id JOIN ticketCollection tc ON tc.collectionFk = c.id
@ -19,15 +23,16 @@ BEGIN
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
JOIN state s2 ON s2.id = ts.stateFk JOIN state s2 ON s2.id = ts.stateFk
JOIN productionConfig pc JOIN productionConfig pc
JOIN vn.state ss on ss.code = 'PREPARED' JOIN vn.state ss ON ss.code = 'PREPARED'
LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id LEFT JOIN vn.saleTracking st ON st.saleFk = s.id
AND st.stateFk = ss.id
WHERE c.workerFk = vWorkerFk WHERE c.workerFk = vWorkerFk
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
AND s.quantity != 0 AND s.quantity
AND s2.order < pc.pendingCollectionsOrder AND s2.order < pc.pendingCollectionsOrder
GROUP BY c.id GROUP BY c.id
HAVING COUNT(*) > COUNT(DISTINCT st.id); HAVING COUNT(*) > COUNT(DISTINCT st.id);
SELECT * FROM tCollection; SELECT * FROM tmp.collection;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -28,6 +28,8 @@ BEGIN
DECLARE vLockName VARCHAR(215); DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 30; DECLARE vLockTime INT DEFAULT 30;
DECLARE vFreeWagonFk INT; DECLARE vFreeWagonFk INT;
DECLARE vErrorNumber INT;
DECLARE vErrorMsg TEXT;
DECLARE c1 CURSOR FOR DECLARE c1 CURSOR FOR
SELECT ticketFk, `lines`, m3 SELECT ticketFk, `lines`, m3
@ -47,12 +49,19 @@ BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
GET DIAGNOSTICS CONDITION 1
vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT;
IF vLockName IS NOT NULL THEN IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName); DO RELEASE_LOCK(vLockName);
CALL util.debugAdd(JSON_OBJECT( CALL util.debugAdd('collection_new', JSON_OBJECT(
'type', 'releaseLock', 'errorNumber', vErrorNumber,
'userFk', vUserFk 'errorMsg', vErrorMsg,
), vLockName); -- Tmp 'lockName', vLockName,
'userFk', vUserFk,
'ticketFk', vTicketFk
)); -- Tmp
END IF; END IF;
RESIGNAL; RESIGNAL;

View File

@ -8,7 +8,6 @@ BEGIN
*/ */
DECLARE vTaxRowLimit INT; DECLARE vTaxRowLimit INT;
DECLARE vLines INT; DECLARE vLines INT;
DECLARE vHasDistinctTransactions INT;
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig; SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
@ -20,17 +19,5 @@ BEGIN
IF vLines >= vTaxRowLimit THEN IF vLines >= vTaxRowLimit THEN
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit)); CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
END IF; END IF;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vInvoiceInFk
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -13,6 +13,19 @@ BEGIN
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo * @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
*/ */
DECLARE vFiscalYear INT; DECLARE vFiscalYear INT;
DECLARE vHasDistinctTransactions INT;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vSelf
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
ENGINE = MEMORY ENGINE = MEMORY

View File

@ -1,7 +1,14 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(
vShelvingFk VARCHAR(8),
vBarcode VARCHAR(22),
vQuantity INT,
vPackagingFk VARCHAR(10),
vGrouping INT,
vPacking INT,
vWarehouseFk INT
)
BEGIN BEGIN
/** /**
* Añade registro o lo actualiza si ya existe. * Añade registro o lo actualiza si ya existe.
* *
@ -23,12 +30,7 @@ BEGIN
SELECT barcodeToItem(vBarcode) INTO vItemFk; SELECT barcodeToItem(vBarcode) INTO vItemFk;
IF vBuyFk IS NULL THEN IF vBuyFk IS NULL THEN
CALL cache.last_buy_refresh(FALSE); CALL util.throw('The buy is required');
SELECT buy_id INTO vBuyFk
FROM cache.last_buy
WHERE item_id = vItemFk
AND warehouse_id = vWarehouseFk;
END IF; END IF;
IF vPacking IS NULL IF vPacking IS NULL

View File

@ -30,6 +30,7 @@ BEGIN
FROM sale s FROM sale s
JOIN ticket t ON t.id = s.ticketFk JOIN ticket t ON t.id = s.ticketFk
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
AND t.warehouseFk
AND s.quantity != 0 AND s.quantity != 0
AND (vItemFk IS NULL OR s.itemFk = vItemFk) AND (vItemFk IS NULL OR s.itemFk = vItemFk)
AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk)
@ -40,7 +41,7 @@ BEGIN
t.warehouseInFk t.warehouseInFk
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
LEFT JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDatedFrom AND vDatedTo WHERE t.landed BETWEEN vDatedFrom AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
AND !e.isExcludedFromAvailable AND !e.isExcludedFromAvailable
@ -53,7 +54,7 @@ BEGIN
t.warehouseOutFk t.warehouseOutFk
FROM buy b FROM buy b
JOIN entry e ON e.id = b.entryFk JOIN entry e ON e.id = b.entryFk
LEFT JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk) AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk)
AND !e.isExcludedFromAvailable AND !e.isExcludedFromAvailable

View File

@ -15,14 +15,13 @@ BEGIN
* @param vDated Fecha * @param vDated Fecha
* @param vShowType Mostrar tipos * @param vShowType Mostrar tipos
*/ */
DECLARE vCalcFk INT; DECLARE vAvailableCalcFk INT;
DECLARE vVisibleCalcFk INT;
DECLARE vTypeFk INT; DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1; DECLARE vPriority INT DEFAULT 1;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
-- Añadido temporalmente para que no se cuelgue la db
SET vShowType = TRUE;
WITH itemTags AS ( WITH itemTags AS (
SELECT i.id, SELECT i.id,
@ -65,21 +64,21 @@ BEGIN
WHEN b.groupingMode = 'packing' THEN b.packing WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1 ELSE 1
END AS minQuantity, END AS minQuantity,
iss.visible located, v.visible located,
b.price2 b.price2
FROM vn.item i FROM vn.item i
JOIN cache.available a ON a.item_id = i.id JOIN cache.available a ON a.item_id = i.id
AND a.calc_id = vCalcFk AND a.calc_id = vAvailableCalcFk
LEFT JOIN cache.visible v ON v.item_id = i.id
AND v.calc_id = vVisibleCalcFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf AND ip.itemFk = vSelf
LEFT JOIN vn.itemTag it ON it.itemFk = i.id LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk 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 LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
AND iss.warehouseFk = vWarehouseFk
JOIN itemTags its JOIN itemTags its
WHERE a.available > 0 WHERE a.available > 0
AND (i.typeFk = its.typeFk OR NOT vShowType) AND (i.typeFk = its.typeFk OR NOT vShowType)

View File

@ -36,9 +36,12 @@ proc: BEGIN
ADD `life` TINYINT NOT NULL DEFAULT '0'; ADD `life` TINYINT NOT NULL DEFAULT '0';
-- Calculo del inventario -- Calculo del inventario
UPDATE tmp.itemInventory ai CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc
JOIN ( (PRIMARY KEY (itemFk))
SELECT itemFk Id_Article, SUM(quantity) Subtotal ENGINE = MEMORY
SELECT itemFk,
SUM(quantity) quantity,
SUM(quantity) visible
FROM ( FROM (
SELECT s.itemFk, - s.quantity quantity SELECT s.itemFk, - s.quantity quantity
FROM sale s FROM sale s
@ -69,18 +72,13 @@ proc: BEGIN
AND w.isComparative AND w.isComparative
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT e.isRaid
) sub2 ) sub
GROUP BY itemFk GROUP BY itemFk;
) sub ON ai.id = sub.Id_Article
SET ai.inventory = sub.Subtotal,
ai.visible = sub.Subtotal,
ai.avalaible = sub.Subtotal,
ai.sd = sub.Subtotal;
-- Cálculo del visible -- Cálculo del visible
UPDATE tmp.itemInventory ai UPDATE tItemInventoryCalc iic
JOIN ( JOIN (
SELECT itemFk Id_Article, SUM(quantity) Subtotal SELECT itemFk, SUM(quantity) visible
FROM ( FROM (
SELECT s.itemFk, s.quantity SELECT s.itemFk, s.quantity
FROM sale s FROM sale s
@ -117,8 +115,15 @@ proc: BEGIN
AND w.isComparative AND w.isComparative
) sub2 ) sub2
GROUP BY itemFk GROUP BY itemFk
) sub ON ai.id = sub.Id_Article ) sub ON sub.itemFk = iic.itemFk
SET ai.visible = ai.visible + sub.Subtotal; SET iic.visible = iic.visible + sub.visible;
UPDATE tmp.itemInventory ai
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
SET ai.inventory = iic.quantity,
ai.visible = iic.visible,
ai.avalaible = iic.quantity,
ai.sd = iic.quantity;
-- Calculo del disponible -- Calculo del disponible
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
@ -189,6 +194,7 @@ proc: BEGIN
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.itemTravel, tmp.itemTravel,
tmp.itemCalc, tmp.itemCalc,
tItemInventoryCalc,
tmp.itemAtp; tmp.itemAtp;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -15,6 +15,11 @@ proc: BEGIN
DECLARE vEndingDate DATETIME; DECLARE vEndingDate DATETIME;
DECLARE vIsTodayRelative BOOLEAN; DECLARE vIsTodayRelative BOOLEAN;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RESIGNAL;
END;
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
INTO vEndingDate INTO vEndingDate
FROM productionConfig; FROM productionConfig;
@ -31,7 +36,8 @@ proc: BEGIN
CALL prepareClientList(); CALL prepareClientList();
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
(INDEX (ticketFk)) ENGINE = MEMORY (INDEX (ticketFk))
ENGINE = MEMORY
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
FROM tmp.productionTicket tt FROM tmp.productionTicket tt
JOIN ticket t ON t.id = tt.ticketFk; JOIN ticket t ON t.id = tt.ticketFk;

View File

@ -278,12 +278,11 @@ BEGIN
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra -- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
CALL buyUltimate(vWarehouseFk, vDate); CALL buyUltimate(vWarehouseFk, vDate);
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk) INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
SELECT ticketFk, problem, saleFk SELECT ticketFk, problem ,saleFk
FROM ( FROM (
SELECT tl.ticketFk, SELECT tl.ticketFk,
s.id saleFk , s.id saleFk,
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem, LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
MOD(s.quantity, b.`grouping`) hasRounding
FROM tmp.ticket_list tl FROM tmp.ticket_list tl
JOIN ticket t ON t.id = tl.ticketFk JOIN ticket t ON t.id = tl.ticketFk
AND t.warehouseFk = vWarehouseFk AND t.warehouseFk = vWarehouseFk
@ -291,9 +290,9 @@ BEGIN
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
JOIN buy b ON b.id = bu.buyFk JOIN buy b ON b.id = bu.buyFk
WHERE MOD(s.quantity, b.`grouping`)
GROUP BY tl.ticketFk GROUP BY tl.ticketFk
HAVING hasRounding )sub
) sub
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk; ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
END LOOP; END LOOP;
CLOSE vCursor; CLOSE vCursor;

View File

@ -5,10 +5,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplierPackaging_R
) )
BEGIN BEGIN
/** /**
* Selecciona los embalajes de un proveedor a partir de una fecha * Create a report with packaging balance
* *
* @param vFromDated Fecha de la que partir * @param vFromDated Starting date
* @param vSupplierFk Id del proveedor * @param vSupplierFk Supplier ID
*/ */
SET @vBalance = 0; SET @vBalance = 0;
SET @vItemFk = NULL; SET @vItemFk = NULL;
@ -22,7 +22,7 @@ BEGIN
landed, landed,
`in`, `in`,
`out`, `out`,
warehouse, sref,
buyingValue, buyingValue,
IF ( IF (
NOT (@vItemFk <=> sub.itemFk), NOT (@vItemFk <=> sub.itemFk),
@ -31,19 +31,20 @@ BEGIN
) balance, ) balance,
@vItemFk := sub.itemFk previousItemFk @vItemFk := sub.itemFk previousItemFk
FROM ( FROM (
SELECT supplierFk, SELECT sp.supplierFk,
itemFk, sp.itemFk,
longName, sp.longName,
supplier, sp.supplier,
CONCAT('E',entryFk) entryFk, CONCAT('E',sp.entryFk) entryFk,
landed, sp.landed,
`in`, sp.`in`,
`out`, sp.`out`,
warehouse, e.invoiceNumber sref,
buyingValue sp.buyingValue
FROM supplierPackaging FROM supplierPackaging sp
WHERE supplierFk = vSupplierFk JOIN entry e ON e.id = sp.entryFk
AND landed >= vFromDated WHERE sp.supplierFk = vSupplierFk
AND sp.landed >= vFromDated
UNION ALL UNION ALL
SELECT vSupplierFk, SELECT vSupplierFk,
itemFk, itemFk,
@ -68,7 +69,7 @@ BEGIN
DATE(t.shipped), DATE(t.shipped),
-LEAST(s.quantity,0) `in`, -LEAST(s.quantity,0) `in`,
GREATEST(s.quantity,0) `out`, GREATEST(s.quantity,0) `out`,
t.warehouseFk, t.cmrFk,
s.price * (100 - s.discount) / 100 s.price * (100 - s.discount) / 100
FROM sale s FROM sale s
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
@ -99,6 +100,7 @@ BEGIN
WHERE su.id = vSupplierFk WHERE su.id = vSupplierFk
AND t.shipped < vFromDated AND t.shipped < vFromDated
AND p.isPackageReturnable AND p.isPackageReturnable
AND NOT t.isDeleted
GROUP BY s.itemFk GROUP BY s.itemFk
UNION ALL UNION ALL
SELECT vSupplierFk, SELECT vSupplierFk,
@ -109,7 +111,7 @@ BEGIN
DATE(t.shipped), DATE(t.shipped),
-LEAST(tp.quantity,0) `in`, -LEAST(tp.quantity,0) `in`,
GREATEST(tp.quantity,0) `out`, GREATEST(tp.quantity,0) `out`,
t.warehouseFk, t.cmrFk,
0 0
FROM ticketPackaging tp FROM ticketPackaging tp
JOIN packaging p ON p.id = tp.packagingFk JOIN packaging p ON p.id = tp.packagingFk
@ -138,8 +140,9 @@ BEGIN
JOIN client c ON c.id = t.clientFk JOIN client c ON c.id = t.clientFk
JOIN supplier su ON su.nif = c.fi JOIN supplier su ON su.nif = c.fi
WHERE su.id = vSupplierFk WHERE su.id = vSupplierFk
AND t.shipped >= vFromDated AND t.shipped < vFromDated
AND p.isPackageReturnable AND p.isPackageReturnable
AND NOT t.isDeleted
GROUP BY p.itemFk GROUP BY p.itemFk
ORDER BY itemFk, landed, entryFk ORDER BY itemFk, landed, entryFk
) sub ) sub
@ -153,7 +156,7 @@ BEGIN
landed, landed,
CAST(`in` AS DECIMAL(10,0)) `in`, CAST(`in` AS DECIMAL(10,0)) `in`,
CAST(`out` AS DECIMAL(10,0)) `out`, CAST(`out` AS DECIMAL(10,0)) `out`,
warehouse, sref,
buyingValue, buyingValue,
balance balance
FROM tSupplierPackaging FROM tSupplierPackaging

View File

@ -9,6 +9,11 @@ BEGIN
*/ */
DECLARE vStateFk INT; DECLARE vStateFk INT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RESIGNAL;
END;
INSERT INTO ticket ( INSERT INTO ticket (
clientFk, clientFk,
shipped, shipped,

View File

@ -1,5 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(vTicketFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
vTicketFk INT
)
BEGIN BEGIN
/** /**
* Splita las lineas de ticket que no estan ubicadas * Splita las lineas de ticket que no estan ubicadas
@ -50,7 +52,7 @@ BEGIN
SET s.ticketFk = vNewTicketFk; SET s.ticketFk = vNewTicketFk;
END IF; END IF;
CALL ticketStateUpdate(vNewTicketFk, 'FIXING'); CALL ticket_setState(vNewTicketFk, 'FIXING');
DROP TEMPORARY TABLE tmp.SalesToSplit; DROP TEMPORARY TABLE tmp.SalesToSplit;
END$$ END$$

View File

@ -1,5 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(vDateFrom DATE, vDateTo DATE) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
vDateFrom DATE,
vDateTo DATE
)
BEGIN BEGIN
DECLARE vIsDone BOOL; DECLARE vIsDone BOOL;
DECLARE vLanding DATE; DECLARE vLanding DATE;
@ -41,7 +44,14 @@ BEGIN
DECLARE vMessage TEXT; DECLARE vMessage TEXT;
SET vIsDone = FALSE; SET vIsDone = FALSE;
FETCH rsTicket INTO vTicketFk,vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk,vShipment; FETCH rsTicket INTO
vTicketFk,
vClientFk,
vWarehouseFk,
vCompanyFk,
vAddressFk,
vAgencyModeFk,
vShipment;
IF vIsDone THEN IF vIsDone THEN
LEAVE myLoop; LEAVE myLoop;
@ -67,7 +77,7 @@ BEGIN
AND isDefaultAddress; AND isDefaultAddress;
END IF; END IF;
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE); CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk, FALSE);
SET vLanding = NULL; SET vLanding = NULL;
SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1; SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1;
@ -88,8 +98,14 @@ BEGIN
SET clonedFrom = vTicketFk SET clonedFrom = vTicketFk
WHERE id = vNewTicket; WHERE id = vNewTicket;
INSERT INTO sale (ticketFk, itemFk, concept, quantity, price, INSERT INTO sale (ticketFk,
discount, priceFixed, isPriceFixed) itemFk,
concept,
quantity,
price,
discount,
priceFixed,
isPriceFixed)
SELECT vNewTicket, SELECT vNewTicket,
saleOrig.itemFk, saleOrig.itemFk,
saleOrig.concept, saleOrig.concept,
@ -189,7 +205,7 @@ BEGIN
IF NOT vIsDuplicateMail THEN IF NOT vIsDuplicateMail THEN
CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage); CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage);
END IF; END IF;
CALL ticketStateUpdate (vNewTicket, 'FIXING'); CALL ticket_setState(vNewTicket, 'FIXING');
ELSE ELSE
CALL ticketCalculateClon(vNewTicket, vTicketFk); CALL ticketCalculateClon(vNewTicket, vTicketFk);
END IF; END IF;

View File

@ -18,7 +18,7 @@ BEGIN
com.id companyFk, com.id companyFk,
a.id addressFk, a.id addressFk,
c2.defaultAddressFk, c2.defaultAddressFk,
su.id supplierFk, IFNULL(sat.supplierFk, su.id) supplierFk,
t.landed t.landed
FROM ticket t FROM ticket t
JOIN ticketState ts ON ts.ticketFk = t.id JOIN ticketState ts ON ts.ticketFk = t.id
@ -28,7 +28,6 @@ BEGIN
JOIN `address` a ON a.id = t.addressFk JOIN `address` a ON a.id = t.addressFk
JOIN province p ON p.id = a.provinceFk JOIN province p ON p.id = a.provinceFk
JOIN country co ON co.id = p.countryFk JOIN country co ON co.id = p.countryFk
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN warehouse w ON w.id = t.warehouseFk JOIN warehouse w ON w.id = t.warehouseFk
JOIN company com ON com.id = t.companyFk JOIN company com ON com.id = t.companyFk
JOIN client c2 ON c2.id = com.clientFk JOIN client c2 ON c2.id = com.clientFk
@ -37,6 +36,10 @@ BEGIN
LEFT JOIN route r ON r.id = t.routeFk LEFT JOIN route r ON r.id = t.routeFk
LEFT JOIN worker wo ON wo.id = r.workerFk LEFT JOIN worker wo ON wo.id = r.workerFk
LEFT JOIN vehicle v ON v.id = r.vehicleFk LEFT JOIN vehicle v ON v.id = r.vehicleFk
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
LEFT JOIN agency ag ON ag.id = am.agencyFk
LEFT JOIN supplierAgencyTerm sat ON sat.agencyFk = ag.id
AND wo.isFreelance
WHERE al.code IN ('PACKED', 'DELIVERED') WHERE al.code IN ('PACKED', 'DELIVERED')
AND co.code <> 'ES' AND co.code <> 'ES'
AND am.name <> 'ABONO' AND am.name <> 'ABONO'

View File

@ -1,5 +1,9 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(
vTicketFk INT,
vTicketFutureFk INT,
vDated DATE
)
proc:BEGIN proc:BEGIN
/** /**
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo. * Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
@ -17,45 +21,41 @@ proc:BEGIN
FROM tmp.salesToSplit FROM tmp.salesToSplit
WHERE ticketFk = vTicketFk; WHERE ticketFk = vTicketFk;
SELECT count(*) INTO vTotalLines SELECT COUNT(*) INTO vTotalLines
FROM vn.sale s FROM sale s
WHERE s.ticketFk = vTicketFk; WHERE s.ticketFk = vTicketFk;
SET vHasFullProblem = (vTotalLines = vProblemLines); SET vHasFullProblem = (vTotalLines = vProblemLines);
-- Ticket completo -- Ticket completo
IF vHasFullProblem THEN IF vHasFullProblem THEN
UPDATE ticket
UPDATE vn.ticket
SET landed = vDated + INTERVAL 1 DAY, SET landed = vDated + INTERVAL 1 DAY,
shipped = vDated, shipped = vDated,
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname ) nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname)
WHERE id = vTicketFk; WHERE id = vTicketFk;
SELECT "moved" message, NULL ticketFuture; SELECT 'moved' message, NULL ticketFuture;
LEAVE proc; LEAVE proc;
END IF; END IF;
-- Ticket a futuro existe -- Ticket a futuro existe
IF vTicketFutureFk THEN IF vTicketFutureFk THEN
UPDATE sale s
UPDATE vn.sale s
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
SET s.ticketFk = vTicketFutureFk, SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept) s.concept = CONCAT('(s) ', s.concept)
WHERE ss.ticketFk = vTicketFk; WHERE ss.ticketFk = vTicketFk;
SELECT "future" message, NULL ticketFuture; SELECT 'future' message, NULL ticketFuture;
LEAVE proc; LEAVE proc;
END IF; END IF;
-- Ticket nuevo -- Ticket nuevo
CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk); CALL ticket_Clone(vTicketFk, vTicketFutureFk);
UPDATE vn.ticket t UPDATE ticket t
JOIN vn.productionConfig pc JOIN productionConfig pc
SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL), SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL),
t.landed = vDated + INTERVAL 1 DAY, t.landed = vDated + INTERVAL 1 DAY,
t.shipped = vDated, t.shipped = vDated,
@ -63,14 +63,14 @@ proc:BEGIN
t.zoneFk = pc.defaultZone t.zoneFk = pc.defaultZone
WHERE t.id = vTicketFutureFk; WHERE t.id = vTicketFutureFk;
UPDATE vn.sale s UPDATE sale s
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
SET s.ticketFk = vTicketFutureFk, SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept) s.concept = CONCAT('(s) ', s.concept)
WHERE sts.ticketFk = vTicketFk; WHERE sts.ticketFk = vTicketFk;
CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING'); CALL ticket_setState(vTicketFutureFk, 'FIXING');
SELECT "new" message,vTicketFutureFk ticketFuture; SELECT 'new' message, vTicketFutureFk ticketFuture;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,6 +1,9 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(vTicketFk INT, vOriginalItemPackingTypeFk VARCHAR(1)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_splitItemPackingType`(
proc:BEGIN vTicketFk INT,
vOriginalItemPackingTypeFk VARCHAR(1)
)
BEGIN
/** /**
* Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado. * Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado.
* Respeta el id inicial para el tipo propuesto. * Respeta el id inicial para el tipo propuesto.
@ -22,22 +25,27 @@ proc:BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RESIGNAL;
END;
DELETE FROM vn.sale DELETE FROM vn.sale
WHERE quantity = 0 WHERE quantity = 0
AND ticketFk = vTicketFk; AND ticketFk = vTicketFk;
DROP TEMPORARY TABLE IF EXISTS tmp.sale; CREATE OR REPLACE TEMPORARY TABLE tmp.sale
CREATE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (id)) (PRIMARY KEY (id))
ENGINE = MEMORY
SELECT s.id, i.itemPackingTypeFk , IFNULL(sv.litros, 0) litros SELECT s.id, i.itemPackingTypeFk , IFNULL(sv.litros, 0) litros
FROM vn.sale s FROM vn.sale s
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id
WHERE s.ticketFk = vTicketFk; WHERE s.ticketFk = vTicketFk;
DROP TEMPORARY TABLE IF EXISTS tmp.saleGroup; CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
CREATE TEMPORARY TABLE tmp.saleGroup ENGINE = MEMORY
SELECT itemPackingTypeFk , sum(litros) AS totalLitros SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tmp.sale FROM tmp.sale
GROUP BY itemPackingTypeFk; GROUP BY itemPackingTypeFk;
@ -45,10 +53,10 @@ proc:BEGIN
FROM tmp.saleGroup FROM tmp.saleGroup
WHERE itemPackingTypeFk IS NOT NULL; WHERE itemPackingTypeFk IS NOT NULL;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketIPT; CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
CREATE TEMPORARY TABLE tmp.ticketIPT ticketFk INT,
(ticketFk INT, itemPackingTypeFk VARCHAR(1)
itemPackingTypeFk VARCHAR(1)); ) ENGINE = MEMORY;
CASE vPackingTypesToSplit CASE vPackingTypesToSplit
WHEN 0 THEN WHEN 0 THEN
@ -89,7 +97,7 @@ proc:BEGIN
SELECT itemPackingTypeFk INTO vItemPackingTypeFk SELECT itemPackingTypeFk INTO vItemPackingTypeFk
FROM tmp.saleGroup sg FROM tmp.saleGroup sg
WHERE NOT ISNULL(sg.itemPackingTypeFk) WHERE sg.itemPackingTypeFk IS NOT NULL
ORDER BY sg.itemPackingTypeFk ORDER BY sg.itemPackingTypeFk
LIMIT 1; LIMIT 1;
@ -100,7 +108,8 @@ proc:BEGIN
WHERE ts.itemPackingTypeFk IS NULL; WHERE ts.itemPackingTypeFk IS NULL;
END CASE; END CASE;
DROP TEMPORARY TABLE tmp.sale; DROP TEMPORARY TABLE
DROP TEMPORARY TABLE tmp.saleGroup; tmp.sale,
tmp.saleGroup;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -12,23 +12,21 @@ BEGIN
END IF; END IF;
IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN
SELECT util.hasDateOverlapped(
SELECT COUNT(*) > 0 INTO isOverlapping started,
FROM business b ended,
WHERE (util.hasDateOverlapped(
NEW.started, NEW.started,
IFNULL(NEW.ended, b.started), IFNULL(NEW.ended, b.started)
b.started, ) isOverlapped INTO isOverlapping
IFNULL(b.ended, NEW.started)) FROM vn.business b
OR (NEW.ended <=> NULL AND b.ended <=> NULL)) WHERE workerFk = NEW.workerFK
AND b.id <> OLD.id AND b.id <> NEW.id
AND workerFk = OLD.workerFk; ORDER BY isOverlapped DESC
LIMIT 1;
IF isOverlapping THEN IF isOverlapping THEN
CALL util.throw ('IS_OVERLAPPING'); CALL util.throw ('IS_OVERLAPPING');
END IF; END IF;
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,11 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterUpdate`
AFTER UPDATE ON `claimRatio`
FOR EACH ROW
BEGIN
INSERT INTO clientRate(clientFk, `value`)
VALUES(NEW.clientFk, NEW.priceIncreasing)
ON DUPLICATE KEY UPDATE
`value` = VALUES(`value`);
END$$
DELIMITER ;

View File

@ -3,12 +3,35 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`client_afterUpdate`
AFTER UPDATE ON `client` AFTER UPDATE ON `client`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF !(NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN IF NOT (NEW.defaultAddressFk <=> OLD.defaultAddressFk) THEN
UPDATE `address` SET isDefaultAddress = FALSE UPDATE `address` SET isDefaultAddress = FALSE
WHERE clientFk = NEW.id; WHERE clientFk = NEW.id;
UPDATE `address` SET isDefaultAddress = TRUE UPDATE `address` SET isDefaultAddress = TRUE
WHERE id = NEW.defaultAddressFk; WHERE id = NEW.defaultAddressFk;
END IF; END IF;
IF NEW.id <> OLD.id
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
OR NOT (NEW.socialName <=> OLD.socialName)
OR NOT (NEW.street <=> OLD.street)
OR NOT (NEW.accountingAccount <=> OLD.accountingAccount)
OR NOT (NEW.isVies <=> OLD.isVies)
OR NOT (NEW.fi <=> OLD.fi)
OR NOT (NEW.postcode <=> OLD.postcode)
OR NOT (NEW.city <=> OLD.city)
OR NOT (NEW.countryFk <=> OLD.countryFk)
OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
OR NOT (NEW.email <=> OLD.email)
OR NOT (NEW.iban <=> OLD.iban)
OR NOT (NEW.phone <=> OLD.phone)
OR NOT (NEW.mobile <=> OLD.mobile) THEN
UPDATE sage.clientSupplier
SET isSync = FALSE
WHERE idClientSupplier IN (NEW.id, OLD.id)
AND `type` = 'C';
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -65,11 +65,11 @@ BEGIN
END IF; END IF;
END IF; END IF;
IF !(NEW.salesPersonFk <=> OLD.salesPersonFk) THEN IF NOT (NEW.salesPersonFk <=> OLD.salesPersonFk) THEN
SET NEW.lastSalesPersonFk = IFNULL(NEW.salesPersonFk, OLD.salesPersonFk); SET NEW.lastSalesPersonFk = IFNULL(NEW.salesPersonFk, OLD.salesPersonFk);
END IF; END IF;
IF !(NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN IF NOT (NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN
SET NEW.isTaxDataChecked = 0; SET NEW.isTaxDataChecked = 0;
END IF; END IF;
END$$ END$$

View File

@ -1,13 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`deviceProductionConfig_afterUpdate`
AFTER UPDATE ON `deviceProductionConfig`
FOR EACH ROW
BEGIN
IF NEW.isAllUsersAllowed = 1 OR NEW.isAllUsersAllowed = -1 THEN
SET @username := (SELECT account.myUser_getName());
INSERT INTO vn.mail (receiver, subject, body)
VALUES ('cau@verdnatura.es', 'Se ha activado la autenticación sin restricciones en la app',
CONCAT('El usuario ', @username,' ha habilitado la opción para que todos los usuarios puedan acceder a la app sin restricciones'));
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,26 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_afterUpdate`
BEFORE UPDATE ON `supplier`
FOR EACH ROW
BEGIN
IF NEW.id <> OLD.id
OR NOT (NEW.name <=> OLD.name)
OR NOT (NEW.street <=> OLD.street)
OR NOT (NEW.account <=> OLD.account)
OR NOT (NEW.nif <=> OLD.nif)
OR NOT (NEW.isVies <=> OLD.isVies)
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
OR NOT (NEW.countryFk <=> OLD.countryFk)
OR NOT (NEW.postCode <=> OLD.postCode)
OR NOT (NEW.city <=> OLD.city)
OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
OR NOT (NEW.withholdingSageFk <=> OLD.withholdingSageFk) THEN
UPDATE sage.clientSupplier
SET isSync = FALSE
WHERE idClientSupplier IN (NEW.id, OLD.id)
AND `type` = 'P';
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,11 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionTruck`
AS SELECT `rs`.`id` AS `id`,
`rs`.`roadmapFk` AS `roadmapFk`,
`rs`.`eta` AS `eta`,
`rs`.`description` AS `description`,
`rs`.`bufferFk` AS `bufferFk`,
`rs`.`created` AS `created`,
`rs`.`userFk` AS `userFk`
FROM `vn`.`roadmapStop` `rs`;

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
USE vn;
ALTER TABLE vn.productionConfig ADD itemOlderReviewHours int(11) DEFAULT 0 NOT NULL COMMENT 'Horas que se tienen en cuenta para comprobar si un ítem es más viejo.';

View File

@ -0,0 +1,12 @@
-- Place your SQL code here
ALTER TABLE vn.mrwConfig ADD IF NOT EXISTS notified TIMESTAMP NULL
COMMENT 'Date when it was notified that the web service deadline was exceeded';
INSERT IGNORE INTO util.notification
SET name = 'mrw-deadline',
description = 'The MRW deadline has passed';
INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFK)
SELECT LAST_INSERT_ID(), r.id
FROM account.role r
WHERE r.name = 'delivery'

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE TABLE sage.clientSupplier (
`companyFk` smallint(6) NOT NULL,
`type` ENUM('C','P') NOT NULL,
`idClientSupplier` INT NOT NULL,
`isSync` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`companyFk`,`idClientSupplier`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
COMMENT='Clients and suppliers present in Sage and their synchronization status';

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
USE vn;
ALTER TABLE vn.productionConfig ADD sectorFromCode varchar(15) NULL COMMENT 'Sector origen que se revisa ítems más nuevos al parkinear';
ALTER TABLE vn.productionConfig ADD sectorToCode varchar(15) NULL COMMENT 'Sector destino que se revisa ítems más nuevos al parkinear';
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_sector_FK FOREIGN KEY (sectorFromCode) REFERENCES vn.sector(code) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_sector_FK_1 FOREIGN KEY (sectorToCode) REFERENCES vn.sector(code) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,14 @@
-- Place your SQL code here
USE vn;
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelvingBuy_FK;
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2;
ALTER TABLE vn.itemShelving DROP INDEX itemShelving_UN;
ALTER TABLE vn.itemShelving ADD CONSTRAINT itemShelving_fk2 FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(code) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.itemShelving ADD CONSTRAINT itemShelvingBuy_FK FOREIGN KEY (buyFk) REFERENCES vn.buy(id) ON DELETE RESTRICT ON UPDATE RESTRICT;

View File

@ -0,0 +1,18 @@
-- Place your SQL code here
CREATE TABLE IF NOT EXISTS vn.travelKgPercentage (
value INT(3) PRIMARY KEY,
className VARCHAR(50)
);
INSERT IGNORE INTO vn.travelKgPercentage (value, className)
VALUES
(80, 'primary'),
(100, 'alert');
INSERT IGNORE INTO salix.ACL
SET model = 'TravelKgPercentage',
property = '*',
accessType = 'READ',
permission = 'ALLOW',
principalType = 'ROLE',
principalId = 'employee';

View File

@ -27,7 +27,7 @@
vn-id="country" vn-id="country"
ng-model="$ctrl.data.countryFk" ng-model="$ctrl.data.countryFk"
url="Countries" url="Countries"
fields="['id', 'country', 'code']" fields="['id', 'name', 'code']"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Country"> label="Country">

View File

@ -231,6 +231,6 @@
"You can only have one PDA": "You can only have one PDA", "You can only have one PDA": "You can only have one PDA",
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member", "Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member",
"It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated", "It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated",
"It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated" "It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated",
"Cannot add holidays on this day": "Cannot add holidays on this day"
} }

View File

@ -351,7 +351,7 @@
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas", "The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
"The line could not be marked": "La linea no puede ser marcada", "The line could not be marked": "La linea no puede ser marcada",
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
"They're not your subordinate": "No es tu subordinado/a.", "They're not your subordinate": "No es tu subordinado/a.",
"No results found": "No se han encontrado resultados", "No results found": "No se han encontrado resultados",
"InvoiceIn is already booked": "La factura recibida está contabilizada", "InvoiceIn is already booked": "La factura recibida está contabilizada",

View File

@ -13,7 +13,11 @@ module.exports = Self => {
Self.setUnverifiedPassword = async(id, pass, options) => { Self.setUnverifiedPassword = async(id, pass, options) => {
const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options); const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options);
if (emailVerified) throw new ForbiddenError('This password can only be changed by the user themselves'); if (emailVerified) {
throw new ForbiddenError(
'Through this procedure, it is not possible to modify the password of users with verified email'
);
}
await models.VnUser.setPassword(id, pass, options); await models.VnUser.setPassword(id, pass, options);
}; };

View File

@ -50,7 +50,7 @@ module.exports = function(Self) {
{ {
relation: 'country', relation: 'country',
scope: { scope: {
fields: ['id', 'country'] fields: ['id', 'name']
} }
}, },
{ {

View File

@ -54,7 +54,7 @@ module.exports = Self => {
{ {
relation: 'country', relation: 'country',
scope: { scope: {
fields: ['country'] fields: ['name']
} }
}, },
{ {

View File

@ -37,7 +37,7 @@ class Controller extends Section {
include: { include: {
relation: 'country', relation: 'country',
scope: { scope: {
fields: ['id', 'country'] fields: ['id', 'name']
} }
} }
} }

View File

@ -28,7 +28,7 @@ class Controller extends Section {
field: 'countryFk', field: 'countryFk',
autocomplete: { autocomplete: {
url: 'Countries', url: 'Countries',
showField: 'country', showField: 'name',
} }
}, },
{ {

View File

@ -48,7 +48,8 @@ module.exports = Self => {
'weight', 'weight',
'buyingValue', 'buyingValue',
'price2', 'price2',
'price3' 'price3',
'printedStickers'
], ],
include: { include: {
relation: 'item', relation: 'item',

View File

@ -0,0 +1,70 @@
module.exports = Self => {
Self.remoteMethod('getListItemNewer', {
description:
'Get boolean if any or specific item of the shelving has older created in another shelving or parking',
accessType: 'READ',
accepts: [{
arg: 'shelvingFk',
type: 'string',
required: true,
description: 'Shelving code'
},
{
arg: 'parking',
type: 'string',
required: true,
description: 'Parking code'
},
],
returns: {
type: 'Array',
root: true
},
http: {
path: `/getListItemNewer`,
verb: 'GET'
}
});
Self.getListItemNewer = async(shelvingFk, parking, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const [isParkingToReview] = await Self.rawSql(`
SELECT COUNT(p.id) parkingToReview
FROM vn.parking p
JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.productionConfig pc
WHERE p.code = ? AND s.code = pc.sectorToCode;`,
[parking], myOptions);
if (isParkingToReview['parkingToReview'] < 1) return [];
const result = await Self.rawSql(`
WITH tItemShelving AS(
SELECT is2.itemFk, is2.created, p.sectorFK, is2.id
FROM vn.itemShelving is2
JOIN vn.shelving sh ON sh.code = is2.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.productionConfig pc
WHERE is2.shelvingFk = ? AND s.code = pc.sectorFromCode
), tItemInSector AS (
SELECT is2.itemFk, is2.created, is2.shelvingFk
FROM vn.itemShelving is2
JOIN vn.shelving sh ON sh.code = is2.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk
JOIN vn.sector s ON s.id = p.sectorFk
JOIN vn.productionConfig pc
WHERE is2.shelvingFk <> ?
AND s.code = pc.sectorFromCode)
SELECT ti.itemFK, tis.shelvingFk
FROM tItemShelving ti
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
JOIN vn.productionConfig pc
WHERE ti.created > tis.created + INTERVAL pc.itemOlderReviewHours HOUR;`,
[shelvingFk, shelvingFk], myOptions);
return result;
};
};

View File

@ -1,63 +0,0 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('hasItemOlder', {
description:
'Get boolean if any or specific item of the shelving has older created in another shelving or parking',
accessType: 'READ',
accepts: [{
arg: 'shelvingFkIn',
type: 'string',
required: true,
description: 'Shelving code'
},
{
arg: 'parking',
type: 'string',
description: 'Parking code'
},
{
arg: 'shelvingFkOut',
type: 'string',
description: 'Shelving code'
},
{
arg: 'itemFk',
type: 'integer',
description: 'Item id'
}],
returns: {
type: 'boolean',
root: true
},
http: {
path: `/hasItemOlder`,
verb: 'GET'
}
});
Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => {
if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving');
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const result = await Self.rawSql(`
SELECT COUNT(ish.id) countItemOlder
FROM vn.itemShelving ish
JOIN (
SELECT ish.itemFk, created,shelvingFk
FROM vn.itemShelving ish
JOIN vn.shelving s ON ish.shelvingFk = s.code
WHERE ish.shelvingFk = ?
)sub ON sub.itemFK = ish.itemFk
JOIN vn.shelving s ON s.code = ish.shelvingFk
JOIN vn.parking p ON p.id = s.parkingFk
WHERE sub.created > ish.created
AND (p.code <> ? OR ? IS NULL)
AND (ish.shelvingFk <> ? OR ? IS NULL)
AND (ish.itemFk <> ? OR ? IS NULL)`,
[shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions);
return result[0]['countItemOlder'] > 0;
};
};

View File

@ -0,0 +1,45 @@
const {models} = require('vn-loopback/server/server');
describe('itemShelving getListItemNewer()', () => {
it('should return true because there is an older item', async() => {
const shelving = 'NCC';
const parking = 'A-47-1';
const sectorCamHighCode = 'CAMARA SECTOR D';
const sectorCamCode = 'NAVE ALGEMESI';
const sectorCamCodeHighId = 1;
const sectorCamCodeId = 9991;
const tx = await models.Sector.beginTransaction({});
const myOptions = {transaction: tx};
try {
const sectorHighCam = await models.Sector.findById(sectorCamCodeHighId, null, myOptions);
await sectorHighCam.updateAttributes({
code: sectorCamHighCode
});
const sectorCam = await models.Sector.findById(sectorCamCodeId, null, myOptions);
await sectorCam.updateAttributes({
code: sectorCamCode
});
const config = await models.ProductionConfig.findOne();
await config.updateAttributes({
sectorToCode: sectorCamHighCode,
sectorFromCode: sectorCamCode
});
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);
expect(result.length).toEqual(2);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -1,45 +0,0 @@
const {models} = require('vn-loopback/server/server');
describe('itemShelving hasOlder()', () => {
it('should return false because there are not older items', async() => {
const shelvingFkIn = 'GVC';
const shelvingFkOut = 'HEJ';
const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, null, shelvingFkOut);
expect(result).toBe(false);
});
it('should return false because there are not older items in parking', async() => {
const shelvingFkIn = 'HEJ';
const parking = '700-01';
const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking);
expect(result).toBe(false);
});
it('should return true because there is an older item', async() => {
const shelvingFkIn = 'UXN';
const shelvingFkOut = 'PCC';
const parking = 'A-01-1';
const itemFk = 1;
const tx = await models.ItemShelving.beginTransaction({});
const myOptions = {transaction: tx};
const filter = {where: {shelvingFk: shelvingFkOut}
};
try {
const itemShelvingBefore = await models.ItemShelving.findOne(filter, myOptions);
await itemShelvingBefore.updateAttributes({
itemFk: itemFk
}, myOptions);
const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking, null, null, myOptions);
expect(result).toBe(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -59,7 +59,7 @@ module.exports = Self => {
include: [{ include: [{
relation: 'country', relation: 'country',
scope: { scope: {
fields: ['id', 'country'] fields: ['id', 'name']
} }
}, { }, {
relation: 'taxClass', relation: 'taxClass',

View File

@ -4,5 +4,5 @@ module.exports = Self => {
require('../methods/item-shelving/getInventory')(Self); require('../methods/item-shelving/getInventory')(Self);
require('../methods/item-shelving/getAlternative')(Self); require('../methods/item-shelving/getAlternative')(Self);
require('../methods/item-shelving/updateFromSale')(Self); require('../methods/item-shelving/updateFromSale')(Self);
require('../methods/item-shelving/hasItemOlder')(Self); require('../methods/item-shelving/getListItemNewer')(Self);
}; };

View File

@ -41,14 +41,16 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
ids = ids.split(','); const downloadAddZip = async id => {
for (const id of ids) {
ctx.args = ctx.args || {}; ctx.args = ctx.args || {};
ctx.args.id = Number(id); ctx.args.id = Number(id);
const [data] = await models.Route.cmr(ctx, myOptions); const [data] = await models.Route.cmr(ctx, myOptions);
zip.file(`${id}.pdf`, data, {binary: true}); zip.file(`${id}.pdf`, data, {binary: true});
} };
ids = ids.split(',');
const promises = ids.map(id => downloadAddZip(id));
await Promise.all(promises);
const zipStream = zip.generateNodeStream({streamFiles: true}); const zipStream = zip.generateNodeStream({streamFiles: true});
return [zipStream, 'application/zip', `filename="cmrs.zip"`]; return [zipStream, 'application/zip', `filename="cmrs.zip"`];
}; };

View File

@ -20,21 +20,4 @@ module.exports = Self => {
require('../methods/route/cmrEmail')(Self); require('../methods/route/cmrEmail')(Self);
require('../methods/route/getExpeditionSummary')(Self); require('../methods/route/getExpeditionSummary')(Self);
require('../methods/route/getByWorker')(Self); require('../methods/route/getByWorker')(Self);
Self.validate('kmStart', validateDistance, {
message: 'Distance must be lesser than 4000'
});
Self.validate('kmEnd', validateDistance, {
message: 'Distance must be lesser than 4000'
});
function validateDistance(err) {
if (this.kmEnd) {
const routeTotalKm = this.kmEnd - this.kmStart;
const routeMaxKm = 4000;
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
err();
}
}
}; };

View File

@ -48,6 +48,9 @@
"priority": { "priority": {
"type": "number" "type": "number"
}, },
"roadmapStopFk": {
"type": "number"
},
"m3boxes": { "m3boxes": {
"type": "number" "type": "number"
}, },

View File

@ -55,7 +55,7 @@ module.exports = Self => {
{ {
relation: 'country', relation: 'country',
scope: { scope: {
fields: ['id', 'country', 'code'] fields: ['id', 'name', 'code']
} }
}, },
{ {

View File

@ -145,15 +145,10 @@ module.exports = Self => {
const newTicket = await models.Ticket.new(ctx, myOptions); const newTicket = await models.Ticket.new(ctx, myOptions);
const ticketRefund = await models.TicketRefund.findOne({
where: {refundTicketFk: ticketId}
}, myOptions);
if (negative && (withWarehouse || !ticketRefund?.id)) {
await models.TicketRefund.create({ await models.TicketRefund.create({
originalTicketFk: ticketId, originalTicketFk: ticketId,
refundTicketFk: newTicket.id refundTicketFk: newTicket.id
}, myOptions); }, myOptions);
}
return newTicket; return newTicket;
} }

View File

@ -140,7 +140,7 @@ module.exports = Self => {
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
await ticket.updateAttribute('isSigned', true, myOptions); await ticket.updateAttribute('isSigned', true, myOptions);
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [params.ticketFk, params.code], myOptions); await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticketId, 'DELIVERED'], myOptions);
if (ticket?.address()?.province()?.country()?.code != 'ES' && ticket.cmrFk) { if (ticket?.address()?.province()?.country()?.code != 'ES' && ticket.cmrFk) {
await models.Ticket.saveCmr(ctx, [ticketId], myOptions); await models.Ticket.saveCmr(ctx, [ticketId], myOptions);

View File

@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context'); const LoopBackContext = require('loopback-context');
describe('ticket state()', () => { xdescribe('ticket state()', () => {
const salesPersonId = 18; const salesPersonId = 18;
const employeeId = 1; const employeeId = 1;
const productionId = 49; const productionId = 49;
@ -113,6 +113,7 @@ describe('ticket state()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
spyOn(models.Chat, 'sendCheckingPresence').and.callThrough();
const ticket = await models.Ticket.create(sampleTicket, options); const ticket = await models.Ticket.create(sampleTicket, options);
activeCtx.accessToken.userId = salesPersonId; activeCtx.accessToken.userId = salesPersonId;
const assignedState = await models.State.findOne({where: {code: 'PICKER_DESIGNED'}}, options); const assignedState = await models.State.findOne({where: {code: 'PICKER_DESIGNED'}}, options);
@ -124,6 +125,7 @@ describe('ticket state()', () => {
expect(resAssigned.userFk).toBe(paramsAssigned.userFk); expect(resAssigned.userFk).toBe(paramsAssigned.userFk);
expect(resAssigned.userFk).toBe(1); expect(resAssigned.userFk).toBe(1);
expect(resAssigned.id).toBeDefined(); expect(resAssigned.id).toBeDefined();
expect(models.Chat.sendCheckingPresence).not.toHaveBeenCalled();
activeCtx.accessToken.userId = productionId; activeCtx.accessToken.userId = productionId;
const packedState = await models.State.findOne({where: {code: 'PACKED'}}, options); const packedState = await models.State.findOne({where: {code: 'PACKED'}}, options);
@ -183,5 +185,37 @@ describe('ticket state()', () => {
throw e; throw e;
} }
}); });
it('should not call sendCheckingPresence if sales.length is 0 because quantities are equal', async() => {
const tx = await models.TicketTracking.beginTransaction({});
spyOn(models.Chat, 'sendCheckingPresence').and.callThrough();
try {
const options = {transaction: tx};
const ticket = await models.Ticket.create(sampleTicket, options);
activeCtx.accessToken.userId = productionId;
const sampleSale = {
ticketFk: ticket.id,
itemFk: 1,
concept: 'Test',
quantity: 10,
originalQuantity: 10
};
await models.Sale.create(sampleSale, options);
const packedState = await models.State.findOne({where: {code: 'PACKED'}}, options);
const params = {ticketFk: ticket.id, stateFk: packedState.id};
await models.Ticket.state(ctx, params, options);
expect(models.Chat.sendCheckingPresence).not.toHaveBeenCalled();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
}); });

View File

@ -26,7 +26,6 @@ module.exports = Self => {
const models = Self.app.models; const models = Self.app.models;
const myOptions = {}; const myOptions = {};
let tx; let tx;
let newStateOrder;
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -41,16 +40,11 @@ module.exports = Self => {
throw new UserError('State cannot be blank'); throw new UserError('State cannot be blank');
if (params.stateFk) { if (params.stateFk) {
const {code, order} = await models.State.findById( const {code} = await models.State.findById(params.stateFk, {fields: ['code']}, myOptions);
params.stateFk,
{fields: ['code', 'order']},
myOptions);
params.code = code; params.code = code;
newStateOrder = order;
} else { } else {
const {id, order} = await models.State.findOne({where: {code: params.code}}, myOptions); const {id} = await models.State.findOne({where: {code: params.code}}, myOptions);
params.stateFk = id; params.stateFk = id;
newStateOrder = order;
} }
if (!params.userFk) { if (!params.userFk) {
@ -70,59 +64,7 @@ module.exports = Self => {
if ((ticketState && !oldStateAllowed) || !newStateAllowed) if ((ticketState && !oldStateAllowed) || !newStateAllowed)
throw new UserError(`You don't have enough privileges`, 'ACCESS_DENIED'); throw new UserError(`You don't have enough privileges`, 'ACCESS_DENIED');
const ticket = await models.Ticket.findById(params.ticketFk, { await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [params.ticketFk, params.code], myOptions);
include: [{
relation: 'client',
scope: {
fields: ['salesPersonFk']
}
}],
fields: ['id', 'clientFk']
}, myOptions);
const salesPersonFk = ticket.client().salesPersonFk;
const stateChecked = await models.State.findOne({fields: ['order'], where: {code: 'CHECKED'}});
if (salesPersonFk && newStateOrder >= stateChecked.order) {
const sales = await Self.rawSql(`
SELECT DISTINCT s.id,
s.itemFk,
s.concept,
s.originalQuantity AS oldQuantity,
s.quantity AS newQuantity
FROM vn.sale s
WHERE s.ticketFk = ?
AND s.originalQuantity IS NOT NULL
AND s.originalQuantity <> s.quantity
`, [params.ticketFk], myOptions);
if (sales.length) {
let changes = '';
const url = await models.Url.getUrl();
const $t = ctx.req.__;
for (let sale of sales) {
changes += `\r\n-` + $t('Changes in sales', {
itemId: sale.itemFk,
concept: sale.concept,
oldQuantity: sale.oldQuantity,
newQuantity: sale.newQuantity,
itemUrl: `${url}item/${sale.itemFk}/summary`
});
const currentSale = await models.Sale.findById(sale.id, null, myOptions);
await currentSale.updateAttributes({
originalQuantity: currentSale.quantity
}, myOptions);
}
const message = $t('Changed sale quantity', {
ticketId: ticket.id,
changes: changes,
ticketUrl: `${url}ticket/${ticket.id}/sale`
});
await models.Chat.sendCheckingPresence(ctx, salesPersonFk, message, myOptions);
}
}
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticket.id, params.code], myOptions);
const ticketTracking = await models.TicketTracking.findOne({ const ticketTracking = await models.TicketTracking.findOne({
where: {ticketFk: params.ticketFk}, where: {ticketFk: params.ticketFk},

View File

@ -56,6 +56,7 @@ module.exports = Self => {
const filter = { const filter = {
include: [ include: [
{relation: 'warehouse', scope: {fields: ['name']}}, {relation: 'warehouse', scope: {fields: ['name']}},
{relation: 'ticketCollections', scope: {fields: ['collectionFk']}},
{relation: 'agencyMode', scope: {fields: ['name']}}, {relation: 'agencyMode', scope: {fields: ['name']}},
{relation: 'zone', scope: {fields: ['name']}}, {relation: 'zone', scope: {fields: ['name']}},
{relation: 'client', {relation: 'client',

View File

@ -152,6 +152,11 @@
"type": "belongsTo", "type": "belongsTo",
"model": "Cmr", "model": "Cmr",
"foreignKey": "cmrFk" "foreignKey": "cmrFk"
},
"ticketCollections": {
"type": "hasMany",
"model": "TicketCollection",
"foreignKey": "ticketFk"
} }
} }
} }

View File

@ -138,7 +138,19 @@ module.exports = Self => {
b.stickers * b.stickers *
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
) as DECIMAL(10,0) ) as DECIMAL(10,0)
) as volumeKg ) as volumeKg,
GREATEST(
CAST(SUM(b.weight * b.stickers) AS INT),
CAST(
SUM(vc.aerealVolumetricDensity *
b.stickers *
IF(pkg.volume,
pkg.volume,
pkg.width * pkg.depth * pkg.height
) / 1000000
) AS INT
)
/ t.kg * 100, 0) percentageKg
FROM travel t FROM travel t
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id LEFT JOIN entry e ON e.travelFk = t.id

View File

@ -11,6 +11,9 @@
"Thermograph": { "Thermograph": {
"dataSource": "vn" "dataSource": "vn"
}, },
"TravelKgPercentage": {
"dataSource": "vn"
},
"TravelThermograph": { "TravelThermograph": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,21 @@
{
"name": "TravelKgPercentage",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "travelKgPercentage"
}
},
"properties": {
"value": {
"type": "number",
"id": true
},
"className": {
"type": "string"
}
}
}

View File

@ -110,8 +110,7 @@ module.exports = Self => {
workCenterFk: workCenter.workCenterFk workCenterFk: workCenter.workCenterFk
} }
}); });
if ((holiday && isFestive) && (workCenter.workcenterFk === holiday.workCenterFk))
if (holiday && isFestive)
throw new UserError(`Cannot add holidays on this day`); throw new UserError(`Cannot add holidays on this day`);
const absence = await models.Calendar.create({ const absence = await models.Calendar.create({

View File

@ -42,7 +42,9 @@ describe('worker setPassword()', () => {
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
expect(e.message).toEqual(`This password can only be changed by the user themselves`); expect(e.message).toEqual(
'Through this procedure, it is not possible to modify the password of users with verified email'
);
await tx.rollback(); await tx.rollback();
} }
}); });

View File

@ -11,7 +11,7 @@
? 'Click to allow the user to be disabled' ? 'Click to allow the user to be disabled'
: 'Click to exclude the user from getting disabled'}} : 'Click to exclude the user from getting disabled'}}
</vn-item> </vn-item>
<vn-item ng-if="!$ctrl.worker.user.emailVerified && $ctrl.vnConfig.storage.currentUserWorkerId !=$ctrl.worker.id" ng-click="setPassword.show()" translate> <vn-item ng-click="setPassword.show()" translate>
Change password Change password
</vn-item> </vn-item>
</slot-menu> </slot-menu>

View File

@ -1,19 +1,16 @@
<footer> <footer>
<!-- Action button block -->
<div class="buttons"> <div class="buttons">
<div class="columns"> <div class="columns">
<div class="size50"> <div class="size50">
<a href="https://verdnatura.es" target="_blank"> <a href="https://verdnatura.es" target="_blank">
<div class="btn"> <div class="btn">
<!-- <span class="icon vn-pa-sm"><img v-bind:src="getEmailSrc('action.png')"/></span> -->
<span class="text vn-pa-sm">{{ $t('buttons.webAcccess')}}</span> <span class="text vn-pa-sm">{{ $t('buttons.webAcccess')}}</span>
</div> </div>
</a> </a>
</div> </div>
<div class="size50"> <div class="size50">
<a href="https://goo.gl/forms/j8WSL151ZW6QtlT72" target="_blank"> <a href="https://form.jotformeu.com/91673677858377" target="_blank">
<div class="btn"> <div class="btn">
<!-- <span class="icon vn-pa-sm"><img v-bind:src="getEmailSrc('info.png')"/></span> -->
<span class="text vn-pa-sm">{{ $t('buttons.info')}}</span> <span class="text vn-pa-sm">{{ $t('buttons.info')}}</span>
</div> </div>
</a> </a>
@ -21,7 +18,6 @@
</div> </div>
</div> </div>
<!-- Networks block -->
<div class="networks"> <div class="networks">
<a href="https://www.facebook.com/Verdnatura" target="_blank"> <a href="https://www.facebook.com/Verdnatura" target="_blank">
<img v-bind:src="getEmailSrc('facebook.png')" alt="Facebook"/> <img v-bind:src="getEmailSrc('facebook.png')" alt="Facebook"/>
@ -37,11 +33,9 @@
</a> </a>
</div> </div>
<!-- Privacy block -->
<div class="privacy"> <div class="privacy">
<p>{{$t('fiscalAddress')}}</p> <p>{{$t('fiscalAddress')}}</p>
<p>{{$t('disclaimer')}}</p> <p>{{$t('disclaimer')}}</p>
<p>{{$t('privacy')}}</p> <p>{{$t('privacy')}}</p>
</div> </div>
<!-- Privacy block end -->
</footer> </footer>

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,5 @@
subject: Exceeding MRW Cut-off Time
title: Exceeding MRW Cut-off Time
greeting: Dear Team.
body: Please be informed that we have exceeded the cut-off time indicated by MRW. From this moment, all generated labels will have a delivery date for tomorrow.It is necessary to contact the MRW representatives to manage any urgencies or clarifications that may arise.
footer: Best regards.

View File

@ -0,0 +1,5 @@
subject: Superación de la Hora de Corte de MRW
title: Superación de la Hora de Corte de MRW
greeting: Estimado equipo.
body: Les informo que hemos superado la hora de corte indicada por MRW. A partir de este momento, todas las etiquetas generadas tendrán fecha de entrega para mañana.Es necesario que se pongan en contacto con los responsables de MRW para gestionar cualquier urgencia o aclaración que puedan necesitar.
footer: Saludos cordiales.

View File

@ -0,0 +1,10 @@
<email-body>
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p>{{$t('greeting')}}</p>
<p>{{$t('body')}}</p>
<p>{{$t('footer')}}</p>
</div>
</div>
</email-body>

View File

@ -0,0 +1,9 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'mrw-deadline',
components: {
'email-body': emailBody.build(),
}
};

View File

@ -9,7 +9,7 @@ module.exports = {
this.checkMainEntity(this.invoice); this.checkMainEntity(this.invoice);
this.client = await this.findOneFromDef('client', [this.reference]); this.client = await this.findOneFromDef('client', [this.reference]);
this.incoterms = this.incoterms =
await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]); await this.findOneFromDef('incoterms', [this.reference]);
if (!this.incoterms) if (!this.incoterms)
throw new UserError(`The address of the customer must have information about Incoterms and Customs Agent`); throw new UserError(`The address of the customer must have information about Incoterms and Customs Agent`);
}, },

View File

@ -1,52 +1,31 @@
SELECT pack.packages, WITH tickets AS(
SELECT id, packages, addressFk, weight
FROM ticket
WHERE refFk= ?
), volume AS(
SELECT SUM(volume) volume
FROM tickets t
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
), intrastat AS(
SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '. ' ) intrastat
FROM tickets t
JOIN vn.sale s ON t.id = s.ticketFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.intrastat ir ON ir.id = i.intrastatFk
)SELECT SUM(t.packages) packages,
a.incotermsFk, a.incotermsFk,
ic.name incotermsName, ic.name incotermsName,
t.weight, MAX(t.weight) weight,
ca.fiscalName customsAgentName, ca.fiscalName customsAgentName,
ca.street customsAgentStreet, ca.street customsAgentStreet,
ca.nif customsAgentNif, ca.nif customsAgentNif,
ca.phone customsAgentPhone, ca.phone customsAgentPhone,
ca.email customsAgentEmail, ca.email customsAgentEmail,
CAST(vol.volume AS DECIMAL (10,2)) volume, CAST(v.volume AS DECIMAL (10,2)) volume,
intr.intrastat i.intrastat
FROM vn.invoiceOut io FROM tickets t
JOIN vn.supplier su ON su.id = io.companyFk
JOIN vn.client c ON c.id = io.clientFk
LEFT JOIN vn.province p ON p.id = c.provinceFk
JOIN vn.ticket t ON t.refFk = io.ref
JOIN vn.address a ON a.id = t.addressFk JOIN vn.address a ON a.id = t.addressFk
JOIN vn.incoterms ic ON ic.code = a.incotermsFk JOIN vn.incoterms ic ON ic.code = a.incotermsFk
LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk
JOIN vn.sale s ON s.ticketFk = t.id JOIN volume v
JOIN ( JOIN intrastat i
SELECT SUM(volume) volume, COUNT(*) packages
FROM vn.invoiceOut io
JOIN vn.ticket t ON t.refFk = io.ref
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
WHERE t.refFk = ?
) vol
JOIN vn.itemTaxCountry itc ON itc.countryFk = su.countryFk
AND itc.itemFk = s.itemFk
JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
AND ios.taxAreaFk = 'WORLD'
JOIN vn.country cty ON cty.id = c.countryFk
JOIN vn.payMethod pm ON pm.id = c .payMethodFk
JOIN vn.company co ON co.id=io.companyFk
JOIN vn.supplierAccount sa ON sa.id=co.supplierAccountFk
JOIN (
SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '. ' ) intrastat
FROM vn.ticket t
JOIN vn.invoiceOut io ON io.ref = t.refFk
JOIN vn.sale s ON t.id = s.ticketFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.intrastat ir ON ir.id = i.intrastatFk
WHERE t.refFk = ?
) intr
JOIN (
SELECT SUM(packages) packages
FROM ticket
WHERE refFk = ?
) pack
WHERE t.refFk = ?
LIMIT 1