7773-testToMaster_2430 #2774

Merged
alexm merged 368 commits from 7773-testToMaster_2430 into master 2024-07-23 06:21:03 +00:00
307 changed files with 4762 additions and 3112 deletions
Showing only changes of commit 31f537ae28 - Show all commits

View File

@ -1,3 +1,83 @@
# Version 24.28 - 2024-07-09
### Added 🆕
- feat boxPicking refs #7357 by:sergiodt
- feat boxPicking refs #7357 (origin/7357_dipole_review) by:sergiodt
- feat:concurrency issue refs #6861 by:Carlos Andrés
- feat expeditionPalletPrint refs #5210 by:sergiodt
- feat front-reservas refs #6861 (origin/6861-Reservas-front) by:sergiodt
- feat itemShelving_filterBuyer refs #7023 by:sergiodt
- feat itemShelvingLog refs #7168 by:sergiodt
- feat itemShelvingSale refs #6861 by:sergiodt
- feat: previas con reserva refs #6861 by:Carlos Andrés
- feat: previas con sitema de reservas refs #6861 by:Carlos Andrés
- feat: previas con sitema de reservas refs #6861 (origin/6861-Pasar-modo-trabajo-de-previa-a-reservas) by:Carlos Andrés
- feat refactor setParking REGEXP refs #7575 (origin/7575_setParking_regExp) by:sergiodt
- feat: refs #6238 add travelKgPercentage table and model (origin/6238-addPercentage) by:jorgep
- feat: refs #6286 check if is teamBoss (origin/6286-setRightWorkerTimeControlAcls) by:jorgep
- feat: refs #6701 Fix error by:guillermo
- feat: refs #6861 trigger by:sergiodt
- feat: refs #7027 mailError managed by:jgallego
- feat: refs #7168 Added vRecords param in proc by:guillermo
- feat: refs #7168 Minor change by:guillermo
- feat: refs #7216 logUnpaid (origin/7216-clientUnpaid) by:jgallego
- feat: refs #7216 triggers by:jgallego
- feat: refs #7296 by:robert
- feat: refs #7296 drop column expeditionTruckFk by:robert
- feat: refs #7490 Changes (origin/7490-duaInvoiceInBooking) by:guillermo
- feat: refs #7545 Deleted hasIncoterms client column (origin/7545-hasIncoterms) by:guillermo
- feat: refs #7555 remove account.password__ by:alexm
- feat: return sql check error by:alexm
- feat roadmap refs #7195 by:sergiodt
- #refs 5890 feat:add assignCollection by:sergiodt
- refs#5890 feat: delete trigger and modify getTickets by:sergiodt
- refs #5890 feat:itemShelving_add by:sergiodt
- refs #5890 feat:reserves by:sergiodt
- refs #5890 feat:trigger by:sergiodt
- refs #5890 feat: triggers by:sergiodt
- refs #6861 feat: getLock by:sergiodt
- refs #6861 feat: obsrevation by:sergiodt
- refs #6861 feat: previas a reservas by:sergiodt
- refs #6861 feat:reserve previos by:sergiodt
- refs #6861 feat: reservePrevious by:sergiodt
- refs #6861 feat:reserveWithReservation by:sergiodt
- refs #6861 feat:sectoCollection reserve by:sergiodt
- refs #6861 feat: skipTest by:sergiodt
- refs #6861 feat: trigger by:sergiodt
### Changed 📦
- feat refactor setParking REGEXP refs #7575 (origin/7575_setParking_regExp) by:sergiodt
- refactor: refs #5447 changed models by:Jon
- refactor: refs #6238 drop useless round by:jorgep
- refactor: refs #6286 replace name by:jorgep
- refactor: refs #6701 Refactor claim_ratio_routine by:guillermo
- refactor: refs #7490 Added final update by:guillermo
- refactor: refs #7490 Deleted update duaInvoiceInBooking by:guillermo
- refactor: refs #7490 Minor changes by:guillermo
- refactor: refs #7519 Minor change by:guillermo
### Fixed 🛠️
- acls, fixtures, models by:carlossa
- fix: refs #6238 delete unused SQL script by:jorgep
- fix: refs #6238 insert ignore by:jorgep
- fix: refs #6238 use scheme by:jorgep
- fix: refs #6286 replace id for reason by:jorgep
- fix: refs #6286 update WorkerTimeControl permissions by:jorgep
- fix(WorkerIncome): refs #7409 fix models by:alexm
- refs #5890 fix: dev by:sergiodt
- refs #6897 fix entry Salix by:carlossa
- refs #6897 fix es.yml by:carlossa
- refs #6897 fix redirection by:carlossa
- refs #6897 fix remove by:carlossa
- refs #7406 fix back by:carlossa
- refs #7406 fix pr by:carlossa
- refs #7409 fix acls by:carlossa
- refs #7409 fix back (origin/7409-workerIncome) by:carlossa
- refs #7409 fix pr by:carlossa
# Version 24.24 - 2024-06-11 # Version 24.24 - 2024-06-11
### Added 🆕 ### Added 🆕
@ -22,6 +102,7 @@
- feat: refs #7438 Added volume to item_valuateInventory by:guillermo - feat: refs #7438 Added volume to item_valuateInventory by:guillermo
- feat: refs #7438 Requested changes and little changes by:guillermo - feat: refs #7438 Requested changes and little changes by:guillermo
- refs #6281 feat:buyFk in itemShelving by:sergiodt - refs #6281 feat:buyFk in itemShelving by:sergiodt
- feat: refs #6449 item ID is displayed in the sale line by:jorgep
### Changed 📦 ### Changed 📦

View File

@ -60,15 +60,17 @@ module.exports = Self => {
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions); if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
for (let ticket of tickets) { for (let ticket of tickets) {
let observations = ticket.observaciones.split(' '); if (ticket.observaciones) {
let observations = ticket.observaciones.split(' ');
for (let observation of observations) { for (let observation of observations) {
const salesPerson = ticket.salesPersonFk; const salesPerson = ticket.salesPersonFk;
if (observation.startsWith('#') || observation.startsWith('@')) { if (observation.startsWith('#') || observation.startsWith('@')) {
await models.Chat.send(ctx, await models.Chat.send(ctx,
observation, observation,
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson}) $t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
); );
}
} }
} }
} }

View File

@ -4,15 +4,7 @@ describe('collection getSales()', () => {
const collectionOrTicketFk = 999999; const collectionOrTicketFk = 999999;
const print = true; const print = true;
const source = 'CHECKER'; const source = 'CHECKER';
const ctx = beforeAll.getCtx();
beforeAll(() => {
ctx = {
req: {
accessToken: {userId: 9},
headers: {origin: 'http://localhost'},
}
};
});
it('should return a collection with tickets, placements and barcodes settled correctly', async() => { it('should return a collection with tickets, placements and barcodes settled correctly', async() => {
const tx = await models.Collection.beginTransaction({}); const tx = await models.Collection.beginTransaction({});

View File

@ -1,15 +1,7 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('collection getTickets()', () => { describe('collection getTickets()', () => {
let ctx; const ctx = beforeAll.getCtx();
beforeAll(async() => {
ctx = {
req: {
accessToken: {userId: 9},
headers: {origin: 'http://localhost'}
}
};
});
it('should get tickets, sales and barcodes from collection', async() => { it('should get tickets, sales and barcodes from collection', async() => {
const tx = await models.Collection.beginTransaction({}); const tx = await models.Collection.beginTransaction({});

View File

@ -1,20 +1,7 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('setSaleQuantity()', () => { describe('setSaleQuantity()', () => {
beforeAll(async() => { beforeAll.mockLoopBackContext();
const activeCtx = {
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it('should change quantity sale', async() => { it('should change quantity sale', async() => {
const tx = await models.Ticket.beginTransaction({}); const tx = await models.Ticket.beginTransaction({});

View File

@ -3,7 +3,7 @@
<soap:Header> <soap:Header>
<mrw:AuthInfo> <mrw:AuthInfo>
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia> <mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
<mrw:CodigoAbonado><%= mrw.subscriberCode %></mrw:CodigoAbonado> <mrw:CodigoAbonado><%= expeditionData.clientType %></mrw:CodigoAbonado>
<mrw:CodigoDepartamento/> <mrw:CodigoDepartamento/>
<mrw:UserName><%= mrw.user %></mrw:UserName> <mrw:UserName><%= mrw.user %></mrw:UserName>
<mrw:Password><%= mrw.password %></mrw:Password> <mrw:Password><%= mrw.password %></mrw:Password>

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
@ -57,14 +50,16 @@ module.exports = Self => {
DATE_FORMAT(t.shipped, '%d/%m/%Y') created, DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
t.shipped, t.shipped,
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference, CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth,'0') serviceType, LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth, '0') serviceType,
IF(mw.weekdays, 'S', 'N') weekDays, IF(mw.weekdays, 'S', 'N') weekDays,
oa.description deliveryObservation oa.description deliveryObservation,
LPAD(ms.clientType, mc.clientTypeWidth, '0') clientType
FROM expedition e FROM expedition e
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 +71,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

@ -1,22 +1,7 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('getStarredModules()', () => { describe('getStarredModules()', () => {
const activeCtx = { const ctx = beforeAll.getCtx();
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {req: activeCtx};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it(`should return the starred modules for a given user`, async() => { it(`should return the starred modules for a given user`, async() => {
const newStarred = await models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1}); const newStarred = await models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1});

View File

@ -1,24 +1,8 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('setPosition()', () => { describe('setPosition()', () => {
const activeCtx = { const ctx = beforeAll.getCtx();
accessToken: {userId: 9}, beforeAll.mockLoopBackContext();
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {
req: activeCtx
};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it('should increase the orders module position by replacing it with clients and vice versa', async() => { it('should increase the orders module position by replacing it with clients and vice versa', async() => {
const tx = await models.StarredModule.beginTransaction({}); const tx = await models.StarredModule.beginTransaction({});

View File

@ -1,24 +1,7 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('toggleStarredModule()', () => { describe('toggleStarredModule()', () => {
const activeCtx = { const ctx = beforeAll.getCtx();
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {
req: activeCtx
};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it('should create a new starred module and then remove it by calling the method again with same args', async() => { it('should create a new starred module and then remove it by calling the method again with same args', async() => {
const starredModule = await models.StarredModule.toggleStarredModule(ctx, 'order'); const starredModule = await models.StarredModule.toggleStarredModule(ctx, 'order');
@ -26,7 +9,7 @@ describe('toggleStarredModule()', () => {
expect(starredModules.length).toEqual(1); expect(starredModules.length).toEqual(1);
expect(starredModule.moduleFk).toEqual('order'); expect(starredModule.moduleFk).toEqual('order');
expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId); expect(starredModule.workerFk).toEqual(ctx.req.accessToken.userId);
expect(starredModule.position).toEqual(starredModules.length); expect(starredModule.position).toEqual(starredModules.length);
await models.StarredModule.toggleStarredModule(ctx, 'order'); await models.StarredModule.toggleStarredModule(ctx, 'order');

View File

@ -1,12 +1,12 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('userConfig getUserConfig()', () => { describe('userConfig getUserConfig()', () => {
const ctx = beforeAll.getCtx();
it(`should return the configuration data of a given user`, async() => { it(`should return the configuration data of a given user`, async() => {
const tx = await models.Item.beginTransaction({}); const tx = await models.Item.beginTransaction({});
const options = {transaction: tx}; const options = {transaction: tx};
try { try {
const ctx = {req: {accessToken: {userId: 9}}};
const result = await models.UserConfig.getUserConfig(ctx, options); const result = await models.UserConfig.getUserConfig(ctx, options);
expect(result.warehouseFk).toEqual(1); expect(result.warehouseFk).toEqual(1);

View File

@ -25,6 +25,9 @@
}, },
"isSocialNameUnique": { "isSocialNameUnique": {
"type": "boolean" "type": "boolean"
},
"continentFk": {
"type": "number"
} }
}, },
"relations": { "relations": {
@ -32,6 +35,11 @@
"type": "belongsTo", "type": "belongsTo",
"model": "Currency", "model": "Currency",
"foreignKey": "currencyFk" "foreignKey": "currencyFk"
},
"continent": {
"type": "belongsTo",
"model": "Continent",
"foreignKey": "continentFk"
} }
}, },
"acls": [ "acls": [

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

@ -1,12 +1,13 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('loopback model MailAliasAccount', () => { describe('loopback model MailAliasAccount', () => {
const ctx = beforeAll.getCtx();
it('should add a mail Alias', async() => { it('should add a mail Alias', async() => {
const tx = await models.MailAliasAccount.beginTransaction({}); const tx = await models.MailAliasAccount.beginTransaction({});
let error; let error;
try { try {
const options = {transaction: tx, accessToken: {userId: 9}}; const options = {transaction: tx, ctx};
await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options); await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
await tx.rollback(); await tx.rollback();
@ -23,7 +24,7 @@ describe('loopback model MailAliasAccount', () => {
let error; let error;
try { try {
const options = {transaction: tx, accessToken: {userId: 9}}; const options = {transaction: tx, ctx};
await models.MailAliasAccount.create({mailAlias: 3, account: 5}, options); await models.MailAliasAccount.create({mailAlias: 3, account: 5}, options);
await tx.rollback(); await tx.rollback();

View File

@ -9,21 +9,36 @@
}, },
"properties": { "properties": {
"id": { "id": {
"id": true, "id": true,
"type": "number", "type": "number",
"forceId": false "forceId": false
}, },
"name": { "name": {
"type": "string" "type": "string"
}, },
"code": { "code": {
"type": "string" "type": "string"
}, },
"isInventory": { "isInventory": {
"type": "number" "type": "number"
}, },
"isManaged":{ "isManaged": {
"type": "boolean" "type": "boolean"
},
"countryFk": {
"type": "number"
}
},
"relations": {
"country": {
"type": "belongsTo",
"model": "Country",
"foreignKey": "countryFk"
},
"address": {
"type": "belongsTo",
"model": "Address",
"foreignKey": "addressFk"
} }
}, },
"acls": [ "acls": [
@ -34,5 +49,11 @@
"permission": "ALLOW" "permission": "ALLOW"
} }
], ],
"scope" : {"where": {"isForTicket": {"neq": 0}}} "scope": {
"where": {
"isForTicket": {
"neq": 0
}
}
}
} }

View File

@ -10,7 +10,6 @@ async function init() {
host: process.env.DB_HOST, host: process.env.DB_HOST,
port: process.env.DB_PORT port: process.env.DB_PORT
}); });
const bootOptions = {dataSources}; const bootOptions = {dataSources};
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
app.boot(bootOptions, app.boot(bootOptions,
@ -33,3 +32,4 @@ module.exports = {
if (require.main === module) if (require.main === module)
init(); init();

View File

@ -84,7 +84,7 @@ async function test() {
'loopback/**/*[sS]pec.js', 'loopback/**/*[sS]pec.js',
'modules/*/back/**/*.[sS]pec.js' 'modules/*/back/**/*.[sS]pec.js'
], ],
helpers: [] helpers: [`back/vn-jasmine.js`],
}; };
if (PARALLEL) { if (PARALLEL) {
@ -114,7 +114,6 @@ async function test() {
if (opts.ci) if (opts.ci)
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT; runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
// runner.loadConfigFile('back/jasmine.json');
runner.loadConfig(config); runner.loadConfig(config);
process.env.SPEC_IS_RUNNING = true; process.env.SPEC_IS_RUNNING = true;
await runner.execute(); await runner.execute();

48
back/vn-jasmine.js Normal file
View File

@ -0,0 +1,48 @@
const LoopBackContext = require('loopback-context');
const getAccessToken = (userId = 9) => {
return {accessToken: {userId}};
};
const DEFAULT_HEADERS = {headers: {origin: 'http://localhost'}};
const default_before_all = userId => {
return {
req: {
...getAccessToken(userId),
...DEFAULT_HEADERS,
...{__: value => value}
},
args: {}
};
};
const default_loopback_ctx = userId => {
return {
...getAccessToken(userId),
...default_before_all(userId),
http: {
...default_before_all(userId)
},
args: {}
};
};
function vnBeforeAll() {
Object.assign(beforeAll, {getCtx: default_before_all, mockLoopBackContext});
}
const mockLoopBackContext = userId => {
const activeCtx = default_loopback_ctx(userId);
beforeAll(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
return activeCtx;
};
module.exports = {
mockLoopBackContext
};
(function init() {
vnBeforeAll();
})();

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','11114','cf0f80142fed798c3307565a69158d7dba9276c4','2024-06-25 09:25:54','11115'); INSERT INTO `version` VALUES ('vn-database','11117','5558e69e648c3819d4a1edf86f8df4b94d36e71a','2024-07-09 07:39:39','11141');
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);
@ -644,6 +644,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10849','15-invoiceInLog.sql','je
INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10852','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL);
@ -776,6 +777,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','je
INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10976','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10977','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-18 07:40:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10978','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:33',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10978','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-11 08:32:33',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10983','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10984','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10984','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10988','00-pbx_prefix.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-04-11 17:00:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10988','00-pbx_prefix.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-04-11 17:00:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10990','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10990','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
@ -844,24 +846,39 @@ INSERT INTO `versionLog` VALUES ('vn-database','11068','00-firstScript.sql','jen
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','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','11073','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',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','11081','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',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','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','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','11086','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-06-27 10:02:02',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','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','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','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','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','11099','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11100','00-modifyTimeControlAcls.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11101','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11102','00-createTravelKgPercentage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11103','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11104','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',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','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','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','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','11110','00-clientUnpaid.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11111','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',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); 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);
INSERT INTO `versionLog` VALUES ('vn-database','11116','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11117','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-07-09 07:39:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11134','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-05 11:02:07',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11139','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-07-08 10:58:01',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 */;
@ -958,6 +975,7 @@ INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11
INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL); INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL);
INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783); INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783);
INSERT INTO `role` VALUES (130,'reviewer','Revisor de producción',1,'2024-06-11 00:00:00','2024-06-11 00:00:00',10578); INSERT INTO `role` VALUES (130,'reviewer','Revisor de producción',1,'2024-06-11 00:00:00','2024-06-11 00:00:00',10578);
INSERT INTO `role` VALUES (131,'supplier','Privilegios básicos de un proveedor',1,'2024-07-05 10:18:58','2024-07-05 10:18:58',19295);
INSERT INTO `roleInherit` VALUES (1,1,2,NULL); INSERT INTO `roleInherit` VALUES (1,1,2,NULL);
INSERT INTO `roleInherit` VALUES (2,1,3,NULL); INSERT INTO `roleInherit` VALUES (2,1,3,NULL);
@ -1228,6 +1246,8 @@ 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 `roleInherit` VALUES (371,36,35,NULL);
INSERT INTO `roleInherit` VALUES (372,126,13,19295);
INSERT INTO `roleInherit` VALUES (373,131,2,19295);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@ -1886,12 +1906,12 @@ INSERT INTO `ACL` VALUES (772,'Route','getExpeditionSummary','READ','ALLOW','ROL
INSERT INTO `ACL` VALUES (773,'WorkerTimeControl','login','READ','ALLOW','ROLE','timeControl'); INSERT INTO `ACL` VALUES (773,'WorkerTimeControl','login','READ','ALLOW','ROLE','timeControl');
INSERT INTO `ACL` VALUES (774,'WorkerTimeControl','getClockIn','READ','ALLOW','ROLE','timeControl'); INSERT INTO `ACL` VALUES (774,'WorkerTimeControl','getClockIn','READ','ALLOW','ROLE','timeControl');
INSERT INTO `ACL` VALUES (775,'WorkerTimeControl','clockIn','WRITE','ALLOW','ROLE','timeControl'); INSERT INTO `ACL` VALUES (775,'WorkerTimeControl','clockIn','WRITE','ALLOW','ROLE','timeControl');
INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','teamBoss');
INSERT INTO `ACL` VALUES (779,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (779,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','developer');
INSERT INTO `ACL` VALUES (780,'WorkerTimeControl','updateWorkerTimeControlMail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (780,'WorkerTimeControl','updateMailState','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','teamBoss');
INSERT INTO `ACL` VALUES (782,'WorkerTimeControl','getMailStates','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (782,'WorkerTimeControl','getMailStates','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee');
@ -1941,7 +1961,6 @@ INSERT INTO `ACL` VALUES (830,'InvoiceIn','*','READ','ALLOW','ROLE','deliveryBos
INSERT INTO `ACL` VALUES (831,'InvoiceIn','exchangeRateUpdate','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (831,'InvoiceIn','exchangeRateUpdate','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (832,'AgencyLog','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (832,'AgencyLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (833,'AgencyWorkCenter','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (833,'AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (834,'AgencyMode','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (835,'Agency','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (835,'Agency','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (836,'Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant'); INSERT INTO `ACL` VALUES (836,'Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `ACL` VALUES (837,'AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant'); INSERT INTO `ACL` VALUES (837,'AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');
@ -1983,6 +2002,24 @@ INSERT INTO `ACL` VALUES (874,'Roadmap','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (875,'RoadmapStop','*','WRITE','ALLOW','ROLE','palletizerBoss'); INSERT INTO `ACL` VALUES (875,'RoadmapStop','*','WRITE','ALLOW','ROLE','palletizerBoss');
INSERT INTO `ACL` VALUES (876,'RoadmapStop','*','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (876,'RoadmapStop','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (877,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (877,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (878,'MrwConfig','getLabel','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (879,'AgencyMode','*','*','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `ACL` VALUES (880,'Collection','assignCollection','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (881,'TrainingCourse','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (882,'TrainingCourseType','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (883,'TrainingCenter','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (884,'Worker','__get__trainingCourse','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (885,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (886,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (887,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (888,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (889,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (890,'WorkerTimeControl','updateMailState','WRITE','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (891,'TravelKgPercentage','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (892,'WorkerIncome','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (893,'PayrollComponent','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (894,'Worker','__get__incomes','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (895,'ItemShelvingLog','*','READ','ALLOW','ROLE','production');
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');

View File

@ -259,7 +259,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran'
INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','salesPerson','inter','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','salesPerson','inter','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Articles','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Articles','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -281,8 +281,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','inter','ale
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb','alexm@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','agency','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','agency','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buySource','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buy_edi','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -313,7 +311,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Cajas','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb','juan@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Compres','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buy_edi','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buy_edi','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','ACL','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','ACL','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -348,7 +345,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','empresa','alex
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','sectorType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','sectorType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Tintas','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Tintas','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Movimientos','juan@%','0000-00-00 00:00:00','Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Movimientos','juan@%','0000-00-00 00:00:00','Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','guillermo@10.5.1.3','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Compres','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -364,7 +361,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','tickets_
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select','');
@ -372,9 +369,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','flight','jenki
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','zones','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','zones','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','warehouse_pickup','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','businessReasonEnd','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','businessCalendar','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','buy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','business','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buySource','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','budgetNotes','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','budgetNotes','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','specialLabels','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','specialLabels','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetDms','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetDms','alexm@%','0000-00-00 00:00:00','Select,Insert','');
@ -383,7 +380,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','grafana','offerList','juan@d
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bookingPlanner','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bookingPlanner','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetInvoiceIn','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetInvoiceIn','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','beach','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','beach','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','business','alexm@%','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','business','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_revisar','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_revisar','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Movimientos_mark','alexm@%','0000-00-00 00:00:00','Select,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Movimientos_mark','alexm@%','0000-00-00 00:00:00','Select,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -414,7 +411,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Movimientos
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','handmadeBoss','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','handmadeBoss','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Ordenes','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Ordenes','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','awb','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Origen','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Origen','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pago','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pago','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awb','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awb','alexm@%','0000-00-00 00:00:00','Update','');
@ -485,7 +481,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','absenceType','alexm@%','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Entradas_Auto','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Entradas_Auto','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tblContadores','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tblContadores','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','buyMark','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendar','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendar','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendarHolidays','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendarHolidays','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claim','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','claim','alexm@%','0000-00-00 00:00:00','Select','');
@ -638,7 +633,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeGroup','a
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','floramondoNotOfferDay__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','floramondoNotOfferDay__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','fuelType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','fuelType','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeDMS','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeDMS','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','manager','genericAllocation','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeComponent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeComponent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppe','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppe','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','glsExpedition__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','glsExpedition__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -744,7 +738,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','mrw','guille
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mrwService','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mrwService','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppePlan','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppePlan','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','accountingConfig','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','accountingConfig','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','buy','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','buy','alexm@%','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','saleGoal','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','saleGoal','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
@ -759,9 +753,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','moving','guill
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDetail','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDetail','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDms','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machineDms','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','vehicle','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','vehicle','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awb','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awb','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machine','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','machine','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','buy','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_dits','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_dits','alexm@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','coolerBoss','rotacion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bi','coolerBoss','rotacion','alexm@%','0000-00-00 00:00:00','Select','');
@ -909,7 +902,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketService','a
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketServiceType','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','ticketServiceType','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketState','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketState','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketStateToday','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketStateToday','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','claims_ratio','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greugeType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greugeType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','time','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','time','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketWeekly','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketWeekly','alexm@%','0000-00-00 00:00:00','Select','');
@ -1404,6 +1396,12 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guill
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 ('','vn','greenhouseBoss','business','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','teamBoss','business','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketServiceType','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','business','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierAgencyTerm','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientRate','guillermo@db-proxy1.servers.dc.verdnatura.es','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','');
@ -1422,6 +1420,17 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','expedition
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','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','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',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','sorterLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','genericAllocation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','businessReasonEnd','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buySource','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','salesPerson','claims_ratio','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran_gestdoc','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','albaran_state','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','deliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','deliveryNoteDms','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','deliveryNoteState','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 */;
@ -1481,6 +1490,10 @@ 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','employee','business','workerFk','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','id','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','departmentFk','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','business','companyCodeFk','0000-00-00 00:00:00','Select');
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');
@ -2018,7 +2031,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','developer','user_hasrouti
INSERT IGNORE INTO `procs_priv` VALUES ('','account','grafana','user_hasRole','FUNCTION','jgallego@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','account','grafana','user_hasRole','FUNCTION','jgallego@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','time_generate','PROCEDURE','jenkins@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','time_generate','PROCEDURE','jenkins@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addbyclaim','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addbyclaim','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvingtransfer','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addlist','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_addlist','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_selfconsumption','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_selfconsumption','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','item_getsimilar','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','item_getsimilar','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2070,7 +2082,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_add','
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_getsaledate','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_getsaledate','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_filterbuyer','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_filterbuyer','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addbyclaim','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addbyclaim','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelvingtransfer','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addlist','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_addlist','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_selfconsumption','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemshelving_selfconsumption','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','item_getsimilar','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','item_getsimilar','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2185,7 +2196,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"vers
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
@ -2201,7 +2212,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"ver
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\":101106,\"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\":101106,\"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}');
INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
@ -2220,6 +2231,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','salesPerson','{\"access\": 0, \"is
INSERT IGNORE INTO `global_priv` VALUES ('','salesTeamBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','salesTeamBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','salix','{\"access\":33555456,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','salix','{\"access\":33555456,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','sysadmin','{\"access\": 201326592, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','sysadmin','{\"access\": 201326592, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','teamBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
/*!40000 ALTER TABLE `global_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `global_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

File diff suppressed because it is too large Load Diff

View File

@ -3616,6 +3616,46 @@ 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`.`clientUnpaid_beforeInsert`
BEFORE INSERT ON `clientUnpaid`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
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`.`clientUnpaid_beforeUpdate`
BEFORE UPDATE ON `clientUnpaid`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
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`.`cmr_beforeDelete` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`cmr_beforeDelete`
BEFORE DELETE ON `cmr` BEFORE DELETE ON `cmr`
FOR EACH ROW FOR EACH ROW
@ -4671,11 +4711,9 @@ BEGIN
IF NEW.isBooked = OLD.isBooked AND ( IF NEW.isBooked = OLD.isBooked AND (
NOT (NEW.supplierFk <=> OLD.supplierFk) OR NOT (NEW.supplierFk <=> OLD.supplierFk) OR
NOT (NEW.dated <=> OLD.dated) OR NOT (NEW.dated <=> OLD.dated) OR
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.travelFk <=> OLD.travelFk) OR
NOT (NEW.companyFk <=> OLD.companyFk) OR NOT (NEW.companyFk <=> OLD.companyFk) OR
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
NOT (NEW.typeFk <=> OLD.typeFk) NOT (NEW.typeFk <=> OLD.typeFk)
) THEN ) THEN
@ -6144,6 +6182,7 @@ DELIMITER ;;
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SET NEW.userFk = account.myUser_getId(); SET NEW.userFk = account.myUser_getId();
SET NEW.available = NEW.visible;
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -6160,48 +6199,20 @@ 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`.`itemShelving_afterInsert`
AFTER INSERT ON `itemShelving`
FOR EACH ROW
INSERT INTO vn.itemShelvingLog( itemShelvingFk,
workerFk,
accion,
itemFk,
shelvingFk,
visible,
`grouping`,
packing)
VALUES( NEW.id,
NEW.userFk,
'CREA REGISTRO',
NEW.itemFk,
NEW.shelvingFk,
NEW.visible,
NEW.`grouping`,
NEW.packing
) */;;
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`.`itemShelving_beforeUpdate` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate`
BEFORE UPDATE ON `itemShelving` BEFORE UPDATE ON `itemShelving`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NEW.userFk IS NULL THEN IF NEW.userFk IS NULL THEN
SET NEW.userFk = account.myUser_getId(); SET NEW.userFk = account.myUser_getId();
END IF; END IF;
IF (NEW.visible <> OLD.visible) THEN
SET NEW.available = GREATEST(NEW.available + NEW.visible - OLD.visible, 0);
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -6220,7 +6231,8 @@ DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate`
AFTER UPDATE ON `itemShelving` AFTER UPDATE ON `itemShelving`
FOR EACH ROW FOR EACH ROW
INSERT INTO itemShelvingLog BEGIN
INSERT INTO itemShelvingLog
SET itemShelvingFk = NEW.id, SET itemShelvingFk = NEW.id,
workerFk = account.myUser_getId(), workerFk = account.myUser_getId(),
accion = 'CAMBIO', accion = 'CAMBIO',
@ -6228,7 +6240,10 @@ INSERT INTO itemShelvingLog
shelvingFk = NEW.shelvingFk, shelvingFk = NEW.shelvingFk,
visible = NEW.visible, visible = NEW.visible,
`grouping` = NEW.`grouping`, `grouping` = NEW.`grouping`,
packing = NEW.packing */;; packing = NEW.packing,
available = NEW.available;
END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_client = @saved_cs_client */ ;
@ -6297,12 +6312,12 @@ DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert`
AFTER INSERT ON `itemShelvingSale` AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
UPDATE vn.sale UPDATE sale s
SET isPicked = TRUE JOIN operator o ON o.workerFk = account.myUser_getId()
WHERE id = NEW.saleFk; SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
WHERE id = NEW.saleFk;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10924,4 +10939,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-25 7:27:06 -- Dump completed on 2024-07-09 5:48:24

View File

@ -314,5 +314,4 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`)
SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option` SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option`
FROM mysql.roles_mapping FROM mysql.roles_mapping
WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost; WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;

View File

@ -115,10 +115,13 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
VALUES VALUES
(1, 978, 1, 0, 2000, 9, 0); (1, 978, 1, 0, 2000, 9, 0);
INSERT INTO hedera.orderConfig (`id`, `employeeFk`, `defaultAgencyFk`, `guestMethod`, `guestAgencyFk`, `reserveTime`, `defaultCompanyFk`)
VALUES (1, 1, 2, 'PICKUP', 1, '00:20:00', 442);
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`) INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
VALUES VALUES
(1101, 'brucewayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es','1101'), (1101, 'brucewayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es','1101'),
(1102, 'petterparker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en','1102'), (1102, 'petterparker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 131, 1, 'PetterParker@mydomain.com', 'en','1102'),
(1103, 'clarkkent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr','1103'), (1103, 'clarkkent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr','1103'),
(1104, 'tonystark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es','1104'), (1104, 'tonystark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es','1104'),
(1105, 'maxeisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt','1105'), (1105, 'maxeisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt','1105'),
@ -301,6 +304,17 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 10; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 10;
UPDATE `vn`.`agencyMode` SET `description` = 'inhouse pickup' WHERE `id` = 1;
UPDATE `vn`.`agencyMode` SET `description` = 'Super-Man delivery' WHERE `id` = 2;
UPDATE `vn`.`agencyMode` SET `description` = 'Teleportation device' WHERE `id` = 3;
UPDATE `vn`.`agencyMode` SET `description` = 'Entanglement' WHERE `id` = 4;
UPDATE `vn`.`agencyMode` SET `description` = 'Quantum break device' WHERE `id` = 5;
UPDATE `vn`.`agencyMode` SET `description` = 'Walking' WHERE `id` = 6;
UPDATE `vn`.`agencyMode` SET `description` = 'Gotham247' WHERE `id` = 7;
UPDATE `vn`.`agencyMode` SET `description` = 'Gotham247Expensive' WHERE `id` = 8;
UPDATE `vn`.`agencyMode` SET `description` = 'Other agency' WHERE `id` = 10;
UPDATE `vn`.`agencyMode` SET `description` = 'Refund' WHERE `id` = 23;
UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com'; UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com';
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23; UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
@ -528,7 +542,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`)
(5, 'Administrative', 'administrative'), (5, 'Administrative', 'administrative'),
(6, 'Weight', 'weight'), (6, 'Weight', 'weight'),
(7, 'InvoiceOut', 'invoiceOut'), (7, 'InvoiceOut', 'invoiceOut'),
(8, 'DropOff', 'dropOff'); (8, 'DropOff', 'dropOff'),
(9, 'Sustitución', 'substitution');
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`) INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
VALUES VALUES
@ -978,6 +993,14 @@ INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`
(2, 3, 10, 10, 10, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 0, 1, util.VN_CURDATE()), (2, 3, 10, 10, 10, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 0, 1, util.VN_CURDATE()),
(3, 13, 8.5, 10, 7.5, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 1, 2, util.VN_CURDATE()); (3, 13, 8.5, 10, 7.5, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 1, 2, util.VN_CURDATE());
INSERT INTO `vn`.`itemMinimumQuantity`(`itemFk`, `quantity`, `started`, `ended`, `warehouseFk`)
VALUES
(1, 5, util.VN_CURDATE() - INTERVAL 2 MONTH, util.VN_CURDATE() + INTERVAL 1 MONTH, 1),
(2, 10, util.VN_CURDATE() - INTERVAL 2 DAY, util.VN_CURDATE() - INTERVAL 1 DAY, 2),
(3, 15, util.VN_CURDATE() + INTERVAL 3 DAY, util.VN_CURDATE() + INTERVAL 2 WEEK, 3),
(2, 10, util.VN_CURDATE() + INTERVAL 2 MONTH, NULL, 5),
(4, 8, util.VN_CURDATE() - INTERVAL 3 MONTH, NULL, NULL);
INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`) INSERT INTO `vn`.`expeditionBoxVol`(`boxFk`, `m3`, `ratio`)
VALUES VALUES
(71,0.141,1); (71,0.141,1);
@ -1477,7 +1500,8 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5), (5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6), (6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10); (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`) INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
VALUES VALUES
@ -1488,7 +1512,9 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'), (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''); (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
VALUES VALUES
@ -2868,7 +2894,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 +2908,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`)
@ -3230,7 +3258,6 @@ INSERT IGNORE INTO vn.itemType
workerFk = 103, workerFk = 103,
isInventory = TRUE, isInventory = TRUE,
life = 10, life = 10,
density = 250,
itemPackingTypeFk = NULL, itemPackingTypeFk = NULL,
temperatureFk = 'warm'; temperatureFk = 'warm';
@ -3889,11 +3916,40 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
(1, '2001-05-17', 1, 5), (1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5); (1, '2001-05-18', 1, 5);
INSERT INTO vn.payrollComponent
(id, name, isSalaryAgreed, isVariable, isException)
VALUES
(1, 'Salario1', 1, 0, 0),
(2, 'Salario2', 1, 1, 0),
(3, 'Salario3', 1, 0, 1);
INSERT INTO dipole.printer (id, description)
VALUES(1, '');
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode, INSERT INTO vn.workerIncome
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments) (debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL); VALUES
(1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
(1001.00, 800.00, 2, '2000-01-01', 1106, NULL);
INSERT INTO dipole.printer (id, description)
VALUES(1, '');
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
INSERT INTO vn.accountDetail
(id, value, accountDetailTypeFk, supplierAccountFk)
VALUES
(21, 'ES12345B12345678', 3, 241),
(35, 'ES12346B12345679', 3, 241);
INSERT INTO vn.accountDetailType
(id, description)
VALUES
(1, 'IBAN'),
(2, 'SWIFT'),
(3, 'Referencia Remesas'),
(4, 'Referencia Transferencias'),
(5, 'Referencia Nominas'),
(6, 'ABA');

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_afterDelete`
AFTER DELETE ON `mailAliasAccount`
FOR EACH ROW
BEGIN
INSERT INTO userLog
SET `action` = 'delete',
`changedModel` = 'MailAliasAccount',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeInsert`
BEFORE INSERT ON `mailAliasAccount`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeUpdate`
BEFORE UPDATE ON `mailAliasAccount`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -59,7 +59,7 @@ BEGIN
JOIN vn.saleComponent sc ON sc.saleFk = s.id JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE ct.code = 'FREIGHT' WHERE ct.code = 'freight'
AND r.created BETWEEN vDatedFrom AND vDatedTo AND r.created BETWEEN vDatedFrom AND vDatedTo
GROUP BY r.id GROUP BY r.id
) sub ON sub.routeFk = r.Id_Ruta ) sub ON sub.routeFk = r.Id_Ruta

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `bi`.`tarifa_componentes_series` VIEW `bi`.`tarifa_componentes_series`
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`, AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
`ct`.`type` AS `Serie`, `ct`.`name` AS `Serie`,
`ct`.`isBase` AS `base`, `ct`.`isBase` AS `base`,
`ct`.`isMargin` AS `margen` `ct`.`isMargin` AS `margen`
FROM `vn`.`componentType` `ct` FROM `vn`.`componentType` `ct`

View File

@ -117,7 +117,7 @@ proc: BEGIN
)sub )sub
GROUP BY sub.itemFk; GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange; DROP TEMPORARY TABLE tmp.itemCalc, tItemRange, tmp.itemList;
CALL cache_calc_end (vCalc); CALL cache_calc_end (vCalc);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -121,7 +121,7 @@ proc: BEGIN
)sub )sub
GROUP BY sub.itemFk; GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, itemRange; DROP TEMPORARY TABLE tmp.itemCalc, itemRange, tmp.itemList;
CALL cache_calc_end (vCalc); CALL cache_calc_end (vCalc);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,13 +1,13 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`visible_refresh`(OUT v_calc INT, v_refresh BOOL, v_warehouse INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`visible_refresh`(OUT v_calc INT, v_refresh BOOL, v_warehouse INT)
proc: BEGIN proc:BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN BEGIN
CALL cache_calc_unlock (v_calc); CALL cache_calc_unlock (v_calc);
RESIGNAL; RESIGNAL;
END; END;
CALL cache_calc_start (v_calc, v_refresh, 'visible', v_warehouse); CALL cache_calc_start (v_calc, v_refresh, 'visible', v_warehouse);
IF !v_refresh THEN IF !v_refresh THEN
LEAVE proc; LEAVE proc;
@ -15,22 +15,23 @@ proc: BEGIN
-- Calculamos el stock hasta ayer -- Calculamos el stock hasta ayer
CALL `cache`.stock_refresh(false); CALL cache.stock_refresh(false);
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
(PRIMARY KEY (item_id)) (PRIMARY KEY (item_id))
ENGINE = MEMORY ENGINE = MEMORY
SELECT item_id, amount stock, amount visible FROM `cache`.stock SELECT item_id, amount stock, amount visible
FROM cache.stock
WHERE warehouse_id = v_warehouse; WHERE warehouse_id = v_warehouse;
-- Calculamos los movimientos confirmados de hoy -- Calculamos los movimientos confirmados de hoy
CALL vn.item_GetVisible(v_warehouse, NULL); CALL vn.item_calcVisible(NULL, v_warehouse);
DELETE FROM visible WHERE calc_id = v_calc; DELETE FROM visible WHERE calc_id = v_calc;
INSERT INTO visible (calc_id, item_id,visible) INSERT INTO visible (calc_id, item_id,visible)
SELECT v_calc, item_id, visible FROM tmp.itemVisible; SELECT v_calc, item_id, visible FROM tmp.itemVisible;
CALL cache_calc_end (v_calc); CALL cache_calc_end (v_calc);
DROP TEMPORARY TABLE tmp.itemVisible; DROP TEMPORARY TABLE tmp.itemVisible;
END$$ END$$

View File

@ -7,7 +7,6 @@ BEGIN
*/ */
DECLARE vRewriteKop INT DEFAULT NULL; DECLARE vRewriteKop INT DEFAULT NULL;
DECLARE vTruncatePutOrder INT DEFAULT NULL; DECLARE vTruncatePutOrder INT DEFAULT NULL;
DECLARE vBarcode CHAR(15) DEFAULT NULL;
DECLARE vKop INT; DECLARE vKop INT;
DECLARE vPutOrderFk BIGINT; DECLARE vPutOrderFk BIGINT;
@ -16,17 +15,6 @@ BEGIN
FROM ekt FROM ekt
WHERE id = vSelf; WHERE id = vSelf;
-- Generates the barcode
SELECT CONCAT(
LPAD(IFNULL(auction,0), 3, 0),
LPAD(IFNULL(klo, 99), 2, 0),
LPAD(DAYOFYEAR(fec), 3, 0),
COALESCE(agj, RIGHT(batchNumber,7), id))
INTO vBarcode
FROM ekt
WHERE id = vSelf;
-- Rewrites the kop parameter -- Rewrites the kop parameter
IF vKop IS NULL THEN IF vKop IS NULL THEN
@ -46,10 +34,9 @@ BEGIN
-- Refresh EKT -- Refresh EKT
UPDATE ekt SET UPDATE ekt
barcode = vBarcode SET kop = vKop,
,kop = vKop putOrderFk = vTruncatePutOrder
,putOrderFk = vTruncatePutOrder
WHERE id = vSelf; WHERE id = vSelf;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -2,7 +2,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `edi`.`ektRecent` VIEW `edi`.`ektRecent`
AS SELECT `e`.`id` AS `id`, AS SELECT `e`.`id` AS `id`,
`e`.`barcode` AS `barcode`,
`e`.`entryYear` AS `entryYear`, `e`.`entryYear` AS `entryYear`,
`e`.`batchNumber` AS `batchNumber`, `e`.`batchNumber` AS `batchNumber`,
`e`.`deliveryNumber` AS `deliveryNumber`, `e`.`deliveryNumber` AS `deliveryNumber`,

View File

@ -1,16 +1,15 @@
DROP PROCEDURE IF EXISTS floranet.catalogue_get;
DELIMITER $$ DELIMITER $$
$$ $$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
READS SQL DATA READS SQL DATA
proc:BEGIN proc:BEGIN
/** /**
* Returns list, price and all the stuff regarding the floranet items. * Returns list, price and all the stuff regarding the floranet items, for the designed shop
* *
* @param vLanded Delivery date * @param vLanded Delivery date
* @param vPostalCode Delivery address postal code * @param vPostalCode Delivery address postal code
*/ */
DECLARE vAddressFk INT;
DECLARE vLastCatalogueFk INT; DECLARE vLastCatalogueFk INT;
DECLARE vLockName VARCHAR(20); DECLARE vLockName VARCHAR(20);
DECLARE vLockTime INT; DECLARE vLockTime INT;
@ -21,7 +20,7 @@ proc:BEGIN
RESIGNAL; RESIGNAL;
END; END;
SET vLockName = 'catalogue_get'; SET vLockName = 'catalogue_get';
SET vLockTime = 15; SET vLockTime = 15;
@ -32,6 +31,15 @@ proc:BEGIN
SELECT MAX(id) INTO vLastCatalogueFk SELECT MAX(id) INTO vLastCatalogueFk
FROM catalogue; FROM catalogue;
SELECT addressFk
INTO vAddressFk
FROM addressPostCode apc
WHERE apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
-- Aquí hay que incluir los criterios de selección de tienda
LIMIT 1;
INSERT INTO catalogue( INSERT INTO catalogue(
name, name,
price, price,
@ -51,17 +59,14 @@ proc:BEGIN
it.name, it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image), CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description, i.description,
apc.addressFk vAddressFk
FROM vn.item i FROM vn.item i
JOIN (SELECT itemFk, SUM(quantity * cost) price JOIN (SELECT itemFk, SUM(quantity * cost) price
FROM recipe FROM recipe
GROUP BY itemFk) r ON r.itemFk = i.id GROUP BY itemFk) r ON r.itemFk = i.id
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN addressPostCode apc JOIN addressPostCode apc ON addressFk = vAddressFk
ON apc.dayOfWeek = dayOfWeek(vLanded) JOIN vn.address a ON a.id = vAddressFk;
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
JOIN vn.address a ON a.id = apc.addressFk;
SELECT * SELECT *
FROM catalogue FROM catalogue

View File

@ -1,8 +1,6 @@
DROP PROCEDURE IF EXISTS floranet.deliveryDate_get;
DELIMITER $$ DELIMITER $$
$$ $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
READS SQL DATA READS SQL DATA
BEGIN BEGIN
/** /**

View File

@ -101,7 +101,7 @@ proc:BEGIN
vNewTicketFk, vNewTicketFk,
c.itemFk, c.itemFk,
CONCAT('Entrega: ',c.name), CONCAT('Entrega: ',c.name),
- c.price, - apc.deliveryCost,
1 1
FROM catalogue c FROM catalogue c
JOIN addressPostCode apc JOIN addressPostCode apc
@ -119,7 +119,7 @@ proc:BEGIN
vNewTicketFk, vNewTicketFk,
r.elementFk, r.elementFk,
i.longName, i.longName,
r.cost, 0,
r.quantity r.quantity
FROM catalogue c FROM catalogue c
JOIN recipe r ON r.itemFk = c.itemFk JOIN recipe r ON r.itemFk = c.itemFk

View File

@ -25,11 +25,7 @@ BEGIN
JOIN vn.warehouse w ON w.id = p.warehouseFk JOIN vn.warehouse w ON w.id = p.warehouseFk
ORDER BY warehouseFk, `grouping`; ORDER BY warehouseFk, `grouping`;
DROP TEMPORARY TABLE CALL vn.ticketCalculatePurge();
tmp.ticketCalculateItem, DROP TEMPORARY TABLE tmp.item;
tmp.ticketComponentPrice,
tmp.ticketComponent,
tmp.ticketLot,
tmp.zoneGetShipped;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -56,11 +56,23 @@ BEGIN
CALL util.throw ('ORDER_ROW_UNAVAILABLE'); CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF; END IF;
SELECT IFNULL(minQuantity, 0) INTO vMinQuantity WITH itemMinQuantityPriority AS (
FROM vn.item SELECT quantity,
WHERE id = vItem; ROW_NUMBER() OVER (
PARTITION BY itemFk
ORDER BY warehouseFk IS NULL
) priority
FROM vn.itemMinimumQuantity
WHERE itemFk = vItem
AND `started` <= vShipment
AND (`ended` >= vShipment OR `ended` IS NULL)
AND (warehouseFk = vWarehouse OR warehouseFk IS NULL)
)
SELECT quantity INTO vMinQuantity
FROM itemMinQuantityPriority
WHERE priority = 1;
IF vAmount < LEAST(vMinQuantity, vAvailable) THEN IF vAmount < LEAST(IFNULL(vMinQuantity, 0), vAvailable) THEN
CALL util.throw ('quantityLessThanMin'); CALL util.throw ('quantityLessThanMin');
END IF; END IF;

View File

@ -0,0 +1,22 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`claim_changeState`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-06-06 07:52:46.000'
ON COMPLETION PRESERVE
ENABLE
DO BEGIN
DECLARE vClaimState INT;
SELECT id INTO vClaimState
FROM claimState cs
WHERE cs.code = 'canceled';
UPDATE claim c
JOIN claimState cs ON cs.id = c.claimStateFk
SET c.claimStateFk = vClaimState
WHERE c.created < util.VN_CURDATE() - INTERVAL 2 MONTH
AND cs.code IN('incomplete','coming','waiting','out');
END$$
DELIMITER ;

View File

@ -6,19 +6,6 @@ BEGIN
* identificando y notificando los asientos descuadrados * identificando y notificando los asientos descuadrados
* y ajustando los saldos en caso necesario. * y ajustando los saldos en caso necesario.
*/ */
INSERT INTO mail (receiver, subject, body)
SELECT 'cau@verdnatura.es',
'Asientos descuadrados',
GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n')
FROM (
SELECT ASIEN,
SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon
FROM XDiario
WHERE NOT enlazado
GROUP BY ASIEN
HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01
) sub
HAVING COUNT(*);
UPDATE XDiario xd UPDATE XDiario xd
JOIN ( JOIN (

View File

@ -0,0 +1,25 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_updateCoordinates`(
vTicketFk INT,
vLongitude INT,
vLatitude INT)
BEGIN
/**
* Actualiza las coordenadas de una dirección.
*
* @param vTicketFk Id del ticket
* @param vLongitude Longitud de la dirección
* @param vLatitude Latitud de la dirección
*/
DECLARE vAddressFK INT;
SELECT addressFK INTO vAddressFK
FROM ticket
WHERE id = vTicketFk;
UPDATE address
SET longitude = vLongitude,
latitude = vLatitude
WHERE id = vAddressFK;
END$$
DELIMITER ;

View File

@ -45,8 +45,7 @@ BEGIN
CALL catalog_componentPrepare(); CALL catalog_componentPrepare();
DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; CREATE OR REPLACE TEMPORARY TABLE tmp.ticketCalculateItem(
CREATE TEMPORARY TABLE tmp.ticketCalculateItem(
itemFk INT(11) NOT NULL, itemFk INT(11) NOT NULL,
available INT(11), available INT(11),
producer VARCHAR(50), producer VARCHAR(50),
@ -60,11 +59,11 @@ BEGIN
price DECIMAL(10,2), price DECIMAL(10,2),
priceKg DECIMAL(10,2), priceKg DECIMAL(10,2),
`grouping` INT(10) UNSIGNED, `grouping` INT(10) UNSIGNED,
minQuantity INT(10) UNSIGNED,
PRIMARY KEY `itemFk` (`itemFk`) PRIMARY KEY `itemFk` (`itemFk`)
) ENGINE = MEMORY DEFAULT CHARSET=utf8; ) ENGINE = MEMORY DEFAULT CHARSET=utf8;
OPEN cTravelTree; OPEN cTravelTree;
l: LOOP l: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
@ -136,7 +135,7 @@ BEGIN
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
INSERT INTO tmp.ticketCalculateItem ( INSERT INTO tmp.ticketCalculateItem(
itemFk, itemFk,
available, available,
producer, producer,
@ -149,9 +148,9 @@ BEGIN
origin, origin,
price, price,
priceKg, priceKg,
`grouping`) `grouping`,
SELECT minQuantity)
tl.itemFk, SELECT tl.itemFk,
SUM(tl.available) available, SUM(tl.available) available,
p.name producer, p.name producer,
i.name item, i.name item,
@ -163,7 +162,8 @@ BEGIN
o.code origin, o.code origin,
bl.price, bl.price,
bl.priceKg, bl.priceKg,
bl.`grouping` bl.`grouping`,
mq.quantity
FROM tmp.ticketLot tl FROM tmp.ticketLot tl
JOIN item i ON tl.itemFk = i.id JOIN item i ON tl.itemFk = i.id
LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible
@ -179,12 +179,28 @@ BEGIN
) sub ) sub
GROUP BY itemFk GROUP BY itemFk
) bl ON bl.itemFk = tl.itemFk ) bl ON bl.itemFk = tl.itemFk
WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk LEFT JOIN (
WITH itemMinQuantityPriority AS (
SELECT itemFk,
quantity,
ROW_NUMBER() OVER (
PARTITION BY itemFk
ORDER BY warehouseFk IS NULL
) priority
FROM vn.itemMinimumQuantity
WHERE `started` <= vShipped
AND (`ended` >= vShipped OR `ended` IS NULL)
AND (warehouseFk = vWarehouseFk OR warehouseFk IS NULL)
)
SELECT itemFk, quantity
FROM itemMinQuantityPriority
WHERE priority = 1
) mq ON mq.itemFk = tl.itemFk
WHERE tl.zoneFk = vZoneFk
AND tl.warehouseFk = vWarehouseFk
GROUP BY tl.itemFk GROUP BY tl.itemFk
ON DUPLICATE KEY UPDATE available = available + VALUES(available); ON DUPLICATE KEY UPDATE available = available + VALUES(available);
END LOOP; END LOOP;
CLOSE cTravelTree; CLOSE cTravelTree;
END$$ END$$
DELIMITER ; DELIMITER ;

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

@ -26,16 +26,16 @@ BEGIN
vErrorNumber = MYSQL_ERRNO, vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT; vErrorMsg = MESSAGE_TEXT;
CALL util.debugAdd('collection_assign', JSON_OBJECT(
'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'lockName', vLockName,
'userFk', vUserFk
)); -- Tmp
IF vLockName IS NOT NULL THEN IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName); DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('collection_assign', JSON_OBJECT(
'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'lockName', vLockName,
'userFk', vUserFk
)); -- Tmp
END IF; END IF;
RESIGNAL; RESIGNAL;
END; END;
@ -47,9 +47,9 @@ BEGIN
INTO vHasTooMuchCollections, INTO vHasTooMuchCollections,
vLockName 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');

View File

@ -7,27 +7,32 @@ 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
SELECT c.id collectionFk, ENGINE = MEMORY
date(c.created) created, SELECT c.id collectionFk,
COUNT(DISTINCT tc.ticketFk) ticketTotalCount DATE(c.created) created,
FROM collection c COUNT(DISTINCT tc.ticketFk) ticketTotalCount
JOIN ticketCollection tc ON tc.collectionFk = c.id FROM collection c
JOIN sale s ON s.ticketFk = tc.ticketFk JOIN ticketCollection tc ON tc.collectionFk = c.id
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk JOIN sale s ON s.ticketFk = tc.ticketFk
JOIN state s2 ON s2.id = ts.stateFk JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
JOIN productionConfig pc JOIN state s2 ON s2.id = ts.stateFk
JOIN vn.state ss on ss.code = 'PREPARED' JOIN productionConfig pc
LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id JOIN vn.state ss ON ss.code = 'PREPARED'
WHERE c.workerFk = vWorkerFk LEFT JOIN vn.saleTracking st ON st.saleFk = s.id
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge AND st.stateFk = ss.id
AND s.quantity != 0 WHERE c.workerFk = vWorkerFk
AND s2.order < pc.pendingCollectionsOrder AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
GROUP BY c.id AND s.quantity
HAVING COUNT(*) > COUNT(DISTINCT st.id); AND s2.order < pc.pendingCollectionsOrder
GROUP BY c.id
HAVING COUNT(*) > COUNT(DISTINCT st.id);
SELECT * FROM tCollection; SELECT * FROM tmp.collection;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -34,10 +34,10 @@ BEGIN
pc.collection_assign_lockname pc.collection_assign_lockname
INTO vHasTooMuchCollections, INTO vHasTooMuchCollections,
vLockName vLockName
FROM tCollection tc FROM tmp.collection c
JOIN productionConfig pc; JOIN productionConfig pc;
DROP TEMPORARY TABLE tCollection; DROP TEMPORARY TABLE tmp.collection;
IF vHasTooMuchCollections THEN IF vHasTooMuchCollections THEN
CALL util.throw('There are pending collections'); CALL util.throw('There are pending collections');

View File

@ -53,17 +53,17 @@ BEGIN
vErrorNumber = MYSQL_ERRNO, vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT; vErrorMsg = MESSAGE_TEXT;
CALL util.debugAdd('collection_new', JSON_OBJECT(
'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'lockName', vLockName,
'userFk', vUserFk,
'ticketFk', vTicketFk
)); -- Tmp
IF vLockName IS NOT NULL THEN IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName); DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('collection_new', JSON_OBJECT(
'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'lockName', vLockName,
'userFk', vUserFk,
'ticketFk', vTicketFk
)); -- Tmp
END IF; END IF;
RESIGNAL; RESIGNAL;
END; END;

View File

@ -1,15 +1,18 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_setParking`(IN `vCollectionFk` VARCHAR(8), IN `vParkingFk` INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_setParking`(
proc: BEGIN vSelf INT,
vParkingFk INT
)
BEGIN
/** /**
* Aparca una colección en un parking. * Aparca una colección en un parking.
* *
* @param vCollectionFk Id de la colección * @param vSelf Id colección
* @param vParkingFk Id del parking * @param vParkingFk Id parking
*/ */
REPLACE vn.ticketParking(ticketFk, parkingFk) REPLACE ticketParking(ticketFk, parkingFk)
SELECT tc.ticketFk, vParkingFk SELECT tc.ticketFk, vParkingFk
FROM vn.ticketCollection tc FROM ticketCollection tc
WHERE tc.collectionFk = vCollectionFk; WHERE tc.collectionFk = vSelf;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -16,9 +16,9 @@ BEGIN
SET @order = 0; SET @order = 0;
DROP TEMPORARY TABLE IF EXISTS tmp.newSaleList; DROP TEMPORARY TABLE IF EXISTS tNewSaleList;
CREATE TEMPORARY TABLE tmp.newSaleList CREATE TEMPORARY TABLE tNewSaleList
SELECT id as saleFk, @order := @order + 1 as orden SELECT id as saleFk, @order := @order + 1 as orden
FROM vn.sale FROM vn.sale
WHERE ticketFk = vTargetTicketFk WHERE ticketFk = vTargetTicketFk
@ -28,7 +28,8 @@ BEGIN
SELECT ns.saleFk, sc.componentFk, sc.value SELECT ns.saleFk, sc.componentFk, sc.value
FROM vn.saleComponent sc FROM vn.saleComponent sc
JOIN tmp.saleList s ON s.saleFk = sc.saleFk JOIN tmp.saleList s ON s.saleFk = sc.saleFk
JOIN tmp.newSaleList ns ON ns.orden = s.orden; JOIN tNewSaleList ns ON ns.orden = s.orden;
DROP TEMPORARY TABLE tNewSaleList;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -81,7 +81,7 @@ BEGIN
AND (NOT e.isBooked OR NOT e.isConfirmed) AND (NOT e.isBooked OR NOT e.isConfirmed)
), ),
notBookedEntries AS ( notBookedEntries AS (
SELECT e.id SELECT entryFk
FROM vn.duaEntry FROM vn.duaEntry
WHERE duaFk = vDuaFk WHERE duaFk = vDuaFk
AND NOT customsValue AND NOT customsValue

View File

@ -18,7 +18,7 @@ BEGIN
AND e.id = vSelf; AND e.id = vSelf;
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
CALL util.throw('Entry is not editable'); CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -13,60 +13,45 @@ BEGIN
DECLARE vBuyStickers INT; DECLARE vBuyStickers INT;
DECLARE vDone BOOLEAN DEFAULT FALSE; DECLARE vDone BOOLEAN DEFAULT FALSE;
DECLARE cur CURSOR FOR DECLARE cur CURSOR FOR
SELECT bb.id buyFk, SELECT bb.id buyFk,
FLOOR(ish.visible / ish.packing) ishStickers, FLOOR(ish.visible / ish.packing) ishStickers,
bb.stickers buyStickers bb.stickers buyStickers
FROM vn.itemShelving ish FROM itemShelving ish
JOIN (SELECT b.id, b.itemFk, b.stickers JOIN (SELECT b.id, b.itemFk, b.stickers
FROM vn.buy b FROM buy b
WHERE b.entryFk = vFromEntryFk
ORDER BY b.stickers DESC
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci
GROUP BY ish.id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Cantidades de la matrícula que exceden la de las entradas
SELECT ish.itemFk,
i.longName,
FLOOR(ish.visible / ish.packing) AS etiEnMatricula,
bb.stickers etiEnEntrada
FROM vn.itemShelving ish
JOIN vn.item i ON i.id = ish.itemFk
LEFT JOIN (SELECT b.id, b.itemFk, b.stickers
FROM vn.buy b
WHERE b.entryFk = vFromEntryFk WHERE b.entryFk = vFromEntryFk
ORDER BY b.stickers DESC ORDER BY b.stickers DESC
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci AND bb.stickers >= FLOOR(ish.visible / ish.packing)
AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing) WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
AND NOT ish.isSplit
GROUP BY ish.id; GROUP BY ish.id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN cur; OPEN cur;
read_loop: LOOP read_loop: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers; FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers;
IF vDone THEN IF vDone THEN
LEAVE read_loop; LEAVE read_loop;
END IF; END IF;
IF vIshStickers = vBuyStickers THEN IF vIshStickers = vBuyStickers THEN
UPDATE vn.buy UPDATE buy
SET entryFk = vToEntryFk SET entryFk = vToEntryFk
WHERE id = vBuyFk; WHERE id = vBuyFk;
ELSE ELSE
UPDATE vn.buy UPDATE buy
SET stickers = stickers - vIshStickers, SET stickers = stickers - vIshStickers,
quantity = stickers * packing quantity = stickers * packing
WHERE id = vBuyFk; WHERE id = vBuyFk;
INSERT INTO vn.buy(entryFk, INSERT INTO buy(entryFk,
itemFk, itemFk,
quantity, quantity,
buyingValue, buyingValue,
@ -117,13 +102,16 @@ BEGIN
weight, weight,
deliveryFk, deliveryFk,
itemOriginalFk itemOriginalFk
FROM vn.buy FROM buy
WHERE id = vBuyFk; WHERE id = vBuyFk;
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID(); UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
END IF; END IF;
END LOOP;
UPDATE itemShelving
SET isSplit = TRUE
WHERE shelvingFk = vShelvingFk;
END LOOP;
CLOSE cur; CLOSE cur;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -9,7 +9,16 @@ BEGIN
*/ */
DECLARE vPrinterFk INT; DECLARE vPrinterFk INT;
DECLARE vUserFk INT DEFAULT account.myUser_getId(); DECLARE vUserFk INT DEFAULT account.myUser_getId();
DECLARE vIsInExpeditionPallet BOOL;
SELECT COUNT(id) INTO vIsInExpeditionPallet
FROM expeditionPallet
WHERE id = vSelf;
IF NOT vIsInExpeditionPallet THEN
CALL util.throw("ExpeditionPallet not exists");
END IF;
SELECT o.labelerFk INTO vPrinterFk SELECT o.labelerFk INTO vPrinterFk
FROM operator o FROM operator o
WHERE o.workerFk = vUserFk; WHERE o.workerFk = vUserFk;

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,31 @@ 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 vDistinctTransactions INT;
DECLARE vHasRepeatedTransactions BOOL;
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE iit.invoiceInFk = vSelf
AND iis.taxAreaFk = 'CEE'
AND iit.transactionTypeSageFk;
IF vDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
SELECT TRUE INTO vHasRepeatedTransactions
FROM invoiceInTax
WHERE invoiceInFk = vSelf
GROUP BY transactionTypeSageFk
HAVING COUNT(transactionTypeSageFk) > 1
LIMIT 1;
IF vHasRepeatedTransactions THEN
CALL util.throw ('This invoice contains repeated types of transactions');
END IF;
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
ENGINE = MEMORY ENGINE = MEMORY

View File

@ -59,5 +59,7 @@ BEGIN
WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo
AND p.sectorFk = vSectorFk AND p.sectorFk = vSectorFk
ORDER BY p.pickingOrder; ORDER BY p.pickingOrder;
DROP TEMPORARY TABLE tmp.stockMisfit;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,43 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_GetVisible`(vWarehouse SMALLINT, vItem INT)
BEGIN
DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, util.VN_CURDATE());
INSERT INTO tmp.itemVisible (item_id, visible)
SELECT item_id, SUM(amount) amount
FROM (
SELECT i.itemFk AS item_id, quantity AS amount
FROM itemTicketOut i
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
JOIN state s ON s.id = ts.stateFk
LEFT JOIN (SELECT DISTINCT saleFk
FROM saleTracking st
JOIN state s ON s.id = st.stateFk
WHERE st.created > util.VN_CURDATE()
AND (s.isPicked OR st.isChecked)
) stPrevious ON `stPrevious`.`saleFk` = i.saleFk
WHERE i.warehouseFk = vWarehouse
AND (vItem IS NULL OR i.itemFk = vItem)
AND (s.isPicked OR i.reserved OR stPrevious.saleFk )
AND i.shipped >= util.VN_CURDATE() AND i.shipped < vTomorrow
UNION ALL
SELECT iei.itemFk, quantity
FROM itemEntryIn iei
WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > util.VN_CURDATE()*/)
AND iei.landed >= util.VN_CURDATE() AND iei.landed < vTomorrow
AND iei.warehouseInFk = vWarehouse
AND (vItem IS NULL OR iei.itemFk = vItem)
AND iei.isVirtualStock is FALSE
UNION ALL
SELECT itemFk, quantity
FROM itemEntryOut
WHERE isDelivered != FALSE
AND shipped >= util.VN_CURDATE() AND shipped < vTomorrow
AND warehouseOutFk = vWarehouse
AND (vItem IS NULL OR itemFk = vItem)
) t
GROUP BY item_id
ON DUPLICATE KEY UPDATE
visible = IFNULL(stock,0) + VALUES(visible);
END$$
DELIMITER ;

View File

@ -0,0 +1,56 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_calcVisible`(
vSelf INT,
vWarehouseFk INT
)
BEGIN
/**
* Calcula el visible de un artículo o de todos.
*
* @param vWarehouse Warehouse id
* @param vSelf Item id
* @param tmp.itemVisible(item_id, stock, visible)
*/
DECLARE vDated DATE DEFAULT util.VN_CURDATE();
DECLARE vTomorrow DATETIME DEFAULT util.tomorrow();
INSERT INTO tmp.itemVisible(item_id, visible)
SELECT itemFk, SUM(quantity)
FROM (
SELECT i.itemFk, i.quantity
FROM itemTicketOut i
LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk
JOIN `state` s ON s.id = ts.stateFk
LEFT JOIN (
SELECT DISTINCT st.saleFk
FROM saleTracking st
JOIN state s ON s.id = st.stateFk
WHERE st.created > vDated
AND (s.isPicked OR st.isChecked)
) stPrevious ON `stPrevious`.`saleFk` = i.saleFk
WHERE IFNULL(vWarehouseFk, i.warehouseFk) = i.warehouseFk
AND (vSelf IS NULL OR i.itemFk = vSelf)
AND (s.isPicked OR i.reserved OR stPrevious.saleFk)
AND i.shipped >= vDated AND i.shipped < vTomorrow
UNION ALL
SELECT itemFk, quantity
FROM itemEntryIn
WHERE isReceived
AND landed >= vDated AND landed < vTomorrow
AND IFNULL(vWarehouseFk, warehouseInFk) = warehouseInFk
AND (vSelf IS NULL OR itemFk = vSelf)
AND NOT isVirtualStock
UNION ALL
SELECT itemFk, quantity
FROM itemEntryOut
WHERE isDelivered
AND shipped >= vDated
AND shipped < vTomorrow
AND IFNULL(vWarehouseFk, warehouseOutFk) = warehouseOutFk
AND (vSelf IS NULL OR itemFk = vSelf)
) t
GROUP BY itemFk
ON DUPLICATE KEY UPDATE
visible = IFNULL(stock, 0) + VALUES(visible);
END$$
DELIMITER ;

View File

@ -2,94 +2,84 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(
vItemFk INT, vItemFk INT,
vWarehouseFk INT, vWarehouseFk INT,
vDate DATETIME vDated DATETIME
) )
BEGIN BEGIN
/** /**
* @vItemFk item a buscar * Calcula el balance de un artículo.
* @vWarehouseFk almacen donde buscar *
* @vDate Si la fecha es null, muestra el histórico desde el inventario. * @vItemFk Id de artículo
* Si la fecha no es null, muestra histórico desde la fecha de vDate. * @vWarehouseFk Id de almacén
* @vDated Fecha a calcular, si es NULL muestra el histórico desde el inventario
*/ */
DECLARE vDateInventory DATETIME; DECLARE vDateInventory DATETIME
DEFAULT (
SELECT IF(vDated, uc.mockUtcTime, c.inventoried)
FROM config c
JOIN util.config uc
);
DECLARE vSupplierInventoryFk INT
DEFAULT (SELECT supplierFk FROM inventoryConfig);
IF vDate IS NULL THEN IF NOT vSupplierInventoryFk OR NOT vDateInventory THEN
SELECT inventoried INTO vDateInventory CALL util.throw('Config variables are not set');
FROM config;
ELSE
SELECT mockUtcTime INTO vDateInventory
FROM util.config;
END IF; END IF;
CREATE OR REPLACE TEMPORARY TABLE tItemDiary( CREATE OR REPLACE TEMPORARY TABLE tItemDiary
shipped DATE, ENGINE = MEMORY
`in` INT(11),
`out` INT(11),
alertLevel INT(11),
stateName VARCHAR(20),
`name` VARCHAR(50),
reference VARCHAR(50),
origin INT(11),
clientFk INT(11),
isPicked INT(11),
isTicket TINYINT(1),
lineFk INT(11),
`order` TINYINT(3) UNSIGNED,
clientType VARCHAR(20),
claimFk INT(10) UNSIGNED,
inventorySupplierFk INT(10)
);
INSERT INTO tItemDiary
WITH entriesIn AS ( WITH entriesIn AS (
SELECT tr.landed shipped, SELECT 'entry' originType,
e.id originId,
tr.landed shipped,
b.quantity `in`, b.quantity `in`,
NULL `out`, NULL `out`,
st.alertLevel , st.alertLevel ,
st.name stateName, st.name stateName,
s.name `name`,
e.invoiceNumber reference, e.invoiceNumber reference,
e.id origin, 'supplier' entityType,
s.id clientFk, s.id entityId,
s.name entityName,
IF(st.`code` = 'DELIVERED', TRUE, FALSE) isPicked, IF(st.`code` = 'DELIVERED', TRUE, FALSE) isPicked,
FALSE isTicket, FALSE isTicket,
b.id lineFk, b.id lineFk,
NULL `order`, NULL `order`,
NULL clientType, NULL clientType,
NULL claimFk, NULL claimFk,
ec.inventorySupplierFk vSupplierInventoryFk inventorySupplierFk
FROM vn.buy b FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.state st ON st.`code` = IF( tr.landed < util.VN_CURDATE() JOIN vn.state st ON st.`code` = IF(tr.landed < util.VN_CURDATE()
OR (util.VN_CURDATE() AND tr.isReceived), OR (util.VN_CURDATE() AND tr.isReceived),
'DELIVERED', 'DELIVERED',
'FREE') 'FREE')
JOIN vn.entryConfig ec
WHERE tr.landed >= vDateInventory WHERE tr.landed >= vDateInventory
AND vWarehouseFk = tr.warehouseInFk AND tr.warehouseInFk = vWarehouseFk
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid AND NOT e.isRaid
), entriesOut AS ( ),
SELECT tr.shipped, entriesOut AS (
SELECT 'entry',
e.id originType,
tr.shipped,
NULL, NULL,
b.quantity, b.quantity,
st.alertLevel, st.alertLevel,
st.name stateName, st.name stateName,
s.name ,
e.invoiceNumber, e.invoiceNumber,
e.id entryFk, 'supplier' entityType,
s.id supplierFk, s.id entityId,
s.name,
IF(st.`code` = 'DELIVERED' , TRUE, FALSE), IF(st.`code` = 'DELIVERED' , TRUE, FALSE),
FALSE isTicket, FALSE isTicket,
b.id, b.id,
NULL `order`, NULL `order`,
NULL clientType, NULL clientType,
NULL claimFk, NULL claimFk,
ec.inventorySupplierFk vSupplierInventoryFk
FROM vn.buy b FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk JOIN vn.travel tr ON tr.id = e.travelFk
@ -99,86 +89,108 @@ BEGIN
OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived), OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived),
'DELIVERED', 'DELIVERED',
'FREE') 'FREE')
JOIN vn.entryConfig ec
WHERE tr.shipped >= vDateInventory WHERE tr.shipped >= vDateInventory
AND vWarehouseFk = tr.warehouseOutFk AND tr.warehouseOutFk = vWarehouseFk
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL) AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
AND b.itemFk = vItemFk AND b.itemFk = vItemFk
AND NOT e.isExcludedFromAvailable AND NOT e.isExcludedFromAvailable
AND NOT w.isFeedStock AND NOT w.isFeedStock
AND NOT e.isRaid AND NOT e.isRaid
), sales AS ( ),
SELECT DATE(t.shipped) shipped, sales AS (
s.quantity, WITH itemSales AS (
st2.alertLevel, SELECT DATE(t.shipped) shipped,
st2.name, s.quantity,
t.nickname, st2.alertLevel,
t.refFk, st2.name,
t.id ticketFk, t.refFk,
t.clientFk, t.id ticketFk,
s.id saleFk, 'client' entityType,
st.`order`, t.clientFk entityId,
c.typeFk, t.nickname,
cb.claimFk s.id saleFk,
FROM vn.sale s st.`order`,
JOIN vn.ticket t ON t.id = s.ticketFk c.typeFk,
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id cb.claimFk
LEFT JOIN vn.state st ON st.`code` = ts.`code` FROM vn.sale s
JOIN vn.client c ON c.id = t.clientFk JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(), LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
'DELIVERED', LEFT JOIN vn.state st ON st.code = ts.code
IF (t.shipped > util.dayEnd(util.VN_CURDATE()), JOIN vn.client c ON c.id = t.clientFk
'FREE', JOIN vn.state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
IFNULL(ts.code, 'FREE'))) 'DELIVERED',
LEFT JOIN vn.claimBeginning cb ON s.id = cb.saleFk IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
WHERE t.shipped >= vDateInventory 'FREE',
AND s.itemFk = vItemFk IFNULL(st.code, 'FREE')))
AND vWarehouseFk = t.warehouseFk LEFT JOIN vn.claimBeginning cb ON cb.saleFk = s.id
),sale AS ( WHERE t.shipped >= vDateInventory
SELECT s.shipped, AND s.itemFk = vItemFk
AND t.warehouseFk = vWarehouseFk
)
SELECT 'ticket',
s.ticketFk,
s.shipped,
NULL `in`, NULL `in`,
s.quantity, s.quantity,
s.alertLevel, s.alertLevel,
s.name, s.name,
s.nickname,
s.refFk, s.refFk,
s.ticketFk, s.entityType,
s.clientFk, s.entityId,
IF(stk.saleFk, TRUE, NULL), s.nickname,
IF(stk.saleFk, TRUE, FALSE),
TRUE, TRUE,
s.saleFk, s.saleFk,
s.`order`, s.`order`,
s.typeFk, s.typeFk,
s.claimFk, s.claimFk,
NULL NULL
FROM sales s FROM itemSales s
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED' LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
AND stk.stateFk = stPrep.id AND stk.stateFk = stPrep.id
GROUP BY s.saleFk GROUP BY s.saleFk
) SELECT shipped, ),
`in`, orders AS (
`out`, SELECT 'order' originType,
alertLevel, o.id originId,
stateName, r.shipment,
`name`, NULL 'in',
reference, r.amount,
origin, NULL alertLevel,
clientFk, NULL stateName,
isPicked, NULL invoiceNumber,
isTicket, 'client' entityType,
lineFk, c.id,
`order`, c.name,
clientType, FALSE,
claimFk, FALSE isTicket,
inventorySupplierFk NULL buyFk,
FROM entriesIn NULL 'order',
c.typeFk,
NULL claimFk,
NULL
FROM hedera.orderRow r
JOIN hedera.`order` o ON o.id = r.orderFk
JOIN vn.client c ON c.id = o.customer_id
WHERE r.shipment >= vDateInventory
AND r.warehouseFk = vWarehouseFk
AND r.created >= (
SELECT SUBTIME(util.VN_NOW(), reserveTime)
FROM hedera.orderConfig
)
AND NOT o.confirmed
AND r.itemFk = vItemFk
)
SELECT * FROM entriesIn
UNION ALL UNION ALL
SELECT * FROM entriesOut SELECT * FROM entriesOut
UNION ALL UNION ALL
SELECT * FROM sale SELECT * FROM sales
UNION ALL
SELECT * FROM orders
ORDER BY shipped, ORDER BY shipped,
(inventorySupplierFk = clientFk) DESC, (inventorySupplierFk = entityId) DESC,
alertLevel DESC, alertLevel DESC,
isTicket, isTicket,
`order` DESC, `order` DESC,
@ -186,19 +198,20 @@ BEGIN
`in` DESC, `in` DESC,
`out` DESC; `out` DESC;
IF vDate IS NULL THEN IF vDated IS NULL THEN
SET @a := 0; SET @a := 0;
SET @currentLineFk := 0; SET @currentLineFk := 0;
SET @shipped := ''; SET @shipped := '';
SELECT DATE(@shipped:= t.shipped) shipped, SELECT t.originType,
t.originId,
DATE(@shipped:= t.shipped) shipped,
t.alertLevel, t.alertLevel,
t.stateName, t.stateName,
t.origin,
t.reference, t.reference,
t.clientFk, t.entityType,
t.name, t.entityId,
t.entityName,
t.`in` invalue, t.`in` invalue,
t.`out`, t.`out`,
@a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance, @a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
@ -214,37 +227,41 @@ BEGIN
t.`order` t.`order`
FROM tItemDiary t FROM tItemDiary t
LEFT JOIN alertLevel a ON a.id = t.alertLevel; LEFT JOIN alertLevel a ON a.id = t.alertLevel;
ELSE ELSE
SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a
FROM tItemDiary FROM tItemDiary
WHERE shipped < vDate; WHERE shipped < vDated;
SELECT vDate shipped, SELECT NULL originType,
0 alertLevel, NULL originId,
0 stateName, vDated shipped,
0 origin, NULL alertLevel,
'' reference, NULL stateName,
0 clientFk, NULL reference,
NULL entityType,
NULL entityId,
'Inventario calculado', 'Inventario calculado',
@a invalue, @a invalue,
NULL `out`, NULL `out`,
@a balance, @a balance,
0 lastPreparedLineFk, NULL lastPreparedLineFk,
0 isTicket, NULL isTicket,
0 lineFk, NULL lineFk,
0 isPicked, NULL isPicked,
0 clientType, NULL clientType,
0 claimFk, NULL claimFk,
NULL `order` NULL `order`
UNION ALL UNION ALL
SELECT shipped, SELECT originType,
originId,
shipped,
alertlevel, alertlevel,
stateName, stateName,
origin, reference,
reference, entityType,
clientFk, entityId,
name, `in`, entityName,
`in`,
`out`, `out`,
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0), @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
0, 0,
@ -255,7 +272,7 @@ BEGIN
claimFk, claimFk,
`order` `order`
FROM tItemDiary FROM tItemDiary
WHERE shipped >= vDate; WHERE shipped >= vDated;
END IF; END IF;
DROP TEMPORARY TABLE tItemDiary; DROP TEMPORARY TABLE tItemDiary;

View File

@ -76,5 +76,7 @@ BEGIN
i.quantity amount i.quantity amount
FROM tmp.itemAtp i FROM tmp.itemAtp i
HAVING amount != 0; HAVING amount != 0;
DROP TEMPORARY TABLE tmp.itemAtp;
END$$ END$$
DELIMITER ; DELIMITER ;

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,
@ -64,22 +63,22 @@ BEGIN
WHEN b.groupingMode = 'grouping' THEN b.grouping WHEN b.groupingMode = 'grouping' THEN b.grouping
WHEN b.groupingMode = 'packing' THEN b.packing WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1 ELSE 1
END AS minQuantity, END 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

@ -6,7 +6,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_setVisibleDisc
vAddressFk INT) vAddressFk INT)
BEGIN BEGIN
/** /**
* Procedimiento para dar dar de baja/alta un item, si vAddressFk es NULL se entiende que se da de alta y se toma el addressFk de la configuración * Procedimiento para dar dar de baja/alta un item, si vAdressFk es NULL
* se entiende que se da de alta y se toma el addressFk de la configuración
* *
* @param vItemFk Identificador del ítem * @param vItemFk Identificador del ítem
* @param vWarehouseFk id del warehouse * @param vWarehouseFk id del warehouse

View File

@ -1,15 +1,16 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`multipleInventory`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`multipleInventory`(
vDate DATE, vDate DATE,
vWarehouseFk TINYINT, vWarehouseFk TINYINT,
vMaxDays TINYINT vMaxDays TINYINT
) )
proc: BEGIN proc: BEGIN
DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY; DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
DECLARE vDateFrom DATE DEFAULT vDate; DECLARE vDateFrom DATE DEFAULT vDate;
DECLARE vDateTo DATETIME; DECLARE vDateTo DATETIME;
DECLARE vDateToTomorrow DATETIME; DECLARE vDateToTomorrow DATETIME;
DECLARE vDefaultDayRange INT; DECLARE vDefaultDayRange INT;
DECLARE vCalcFk INT;
IF vDate < util.VN_CURDATE() THEN IF vDate < util.VN_CURDATE() THEN
LEAVE proc; LEAVE proc;
@ -36,9 +37,11 @@ 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
FROM ( FROM (
SELECT s.itemFk, - s.quantity quantity SELECT s.itemFk, - s.quantity quantity
FROM sale s FROM sale s
@ -69,56 +72,29 @@ 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, UPDATE tmp.itemInventory ai
ai.visible = sub.Subtotal, JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
ai.avalaible = sub.Subtotal, SET ai.inventory = iic.quantity,
ai.sd = sub.Subtotal; ai.visible = iic.quantity,
ai.avalaible = iic.quantity,
ai.sd = iic.quantity;
-- Cálculo del visible -- Cálculo del visible
UPDATE tmp.itemInventory ai CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
JOIN (
SELECT itemFk Id_Article, SUM(quantity) Subtotal CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
FROM ( (PRIMARY KEY (item_id))
SELECT s.itemFk, s.quantity ENGINE = MEMORY
FROM sale s SELECT item_id, visible
JOIN ticket t ON t.id = s.ticketFk FROM cache.visible
JOIN warehouse w ON w.id = t.warehouseFk WHERE calc_id = vCalcFk;
WHERE t.shipped >= vDate
AND t.shipped < vDateTomorrow UPDATE tmp.itemInventory it
AND (NOT isPicked AND NOT t.isLabeled AND t.refFk IS NULL) JOIN tItemVisibleCalc ivc ON ivc.item_id = it.id
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk SET it.visible = it.visible + ivc.visible;
AND w.isComparative
UNION ALL
SELECT b.itemFk, - b.quantity
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
JOIN warehouse w ON w.id = t.warehouseInFk
WHERE t.landed = vDate
AND NOT t.isReceived
AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
AND w.isComparative
UNION ALL
SELECT b.itemFk, b.quantity
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
JOIN warehouse w ON w.id = t.warehouseOutFk
WHERE t.shipped = vDate
AND NOT t.isReceived
AND NOT e.isExcludedFromAvailable
AND NOT e.isRaid
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
AND w.isComparative
) sub2
GROUP BY itemFk
) sub ON ai.id = sub.Id_Article
SET ai.visible = ai.visible + sub.Subtotal;
-- Calculo del disponible -- Calculo del disponible
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
@ -189,6 +165,8 @@ proc: BEGIN
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.itemTravel, tmp.itemTravel,
tmp.itemCalc, tmp.itemCalc,
tmp.itemAtp; tmp.itemAtp,
END$$ tItemInventoryCalc,
DELIMITER ; tItemVisibleCalc;
END$$
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

@ -104,5 +104,6 @@ BEGIN
) sub; ) sub;
DROP TEMPORARY TABLE tmp.whiteTicket; DROP TEMPORARY TABLE tmp.whiteTicket;
DROP TEMPORARY TABLE tmp.sectorTypeTicket; DROP TEMPORARY TABLE tmp.sectorTypeTicket;
DROP TEMPORARY TABLE tmp.productionBuffer;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,17 +1,25 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(IN `vSaleGroupFk` VARCHAR(8), IN `vParkingFk` INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_setParking`(
proc: BEGIN vSaleGroupFk VARCHAR(8),
vParkingFk INT
)
BEGIN
/** /**
* Aparca una preparación previa en un parking * Aparca una preparación previa en un parking.
* *
* @param vSaleGroupFk id de la preparación previa * @param vSaleGroupFk id de la preparación previa
* @param vParkingFk id del parking * @param vParkingFk id del parking
*/ */
UPDATE vn.saleGroup sg DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RESIGNAL;
END;
UPDATE saleGroup sg
SET sg.parkingFk = vParkingFk SET sg.parkingFk = vParkingFk
WHERE sg.id = vSaleGroupFk WHERE sg.id = vSaleGroupFk
AND sg.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE()); AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK;
CALL vn.ticket_setNextState(vn.ticket_get(vSaleGroupFk)); CALL ticket_setNextState(ticket_get(vSaleGroupFk));
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -8,7 +8,7 @@ BEGIN
JOIN vn.component c ON c.id = sc.componentFk JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE s.ticketFk = vTicketFk WHERE s.ticketFk = vTicketFk
AND ct.`type` = 'otros'; AND ct.code = 'other';
UPDATE vn.sale s UPDATE vn.sale s
JOIN ( JOIN (

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,21 +5,32 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblem`(
BEGIN BEGIN
/** /**
* Update column sale.problem with a problem code * Update column sale.problem with a problem code
*
* @param vProblemCode Code to set or unset * @param vProblemCode Code to set or unset
* @table tmp.sale(saleFk, hasProblem, isProblemCalcNeeded) * @table tmp.sale(saleFk, hasProblem, isProblemCalcNeeded)
*/ */
UPDATE tmp.sale ts DECLARE vSaleFk INT;
JOIN sale s ON s.id = ts.saleFk DECLARE vHasProblem INT;
SET s.problem = NULL DECLARE vDone BOOL;
WHERE NOT ts.isProblemCalcNeeded; DECLARE vSaleList CURSOR FOR SELECT saleFk, hasProblem FROM tmp.sale;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DELETE FROM tmp.sale WHERE NOT isProblemCalcNeeded; OPEN vSaleList;
l: LOOP
SET vDone = FALSE;
FETCH vSaleList INTO vSaleFk, vHasProblem;
UPDATE sale s IF vDone THEN
JOIN tmp.sale ts ON ts.saleFk = s.id LEAVE l;
SET s.problem = CONCAT( END IF;
IF(ts.hasProblem,
CONCAT(s.problem, ',', vProblemCode), UPDATE sale
REPLACE(s.problem, vProblemCode , ''))); SET problem = CONCAT(
IF(vHasProblem,
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , '')))
WHERE id = vSaleFk;
END LOOP;
CLOSE vSaleList;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,6 +1,9 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`setParking`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`setParking`(
proc: BEGIN vParam VARCHAR(8),
vParkingCode VARCHAR(8)
)
BEGIN
/** /**
* Aparca una colección, un ticket, un saleGroup o un shelving en un parking * Aparca una colección, un ticket, un saleGroup o un shelving en un parking
* *
@ -8,54 +11,41 @@ proc: BEGIN
* @param vParkingCode código del parking * @param vParkingCode código del parking
*/ */
DECLARE vParkingFk INT; DECLARE vParkingFk INT;
DECLARE vIsSaleGroup BOOL; DECLARE vLastWeek DATE;
DECLARE vIsTicket BOOL;
DECLARE vIsCollection BOOL;
SET vParkingCode = replace(vParkingCode,' ',''); DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
SET vParkingCode = REPLACE(vParkingCode, ' ', '');
SELECT id INTO vParkingFk SELECT id INTO vParkingFk
FROM vn.parking FROM parking
WHERE code = vParkingCode COLLATE utf8_unicode_ci; WHERE code = vParkingCode COLLATE utf8_unicode_ci;
IF vParkingFk IS NULL THEN IF vParkingFk IS NULL THEN
CALL util.throw('parkingNotExist'); CALL util.throw('parkingNotExist');
LEAVE proc;
END IF; END IF;
-- Se comprueba si es una preparación previa START TRANSACTION;
SELECT COUNT(*) INTO vIsSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vParam;
IF vIsSaleGroup THEN SET vLastWeek = util.VN_CURDATE() - INTERVAL 1 WEEK;
CALL vn.saleGroup_setParking(vParam, vParkingFk);
LEAVE proc; -- Comprobamos si es una prep. previa, ticket, colección o shelving
IF (SELECT TRUE FROM saleGroup WHERE id = vParam) THEN
CALL saleGroup_setParking(vParam, vParkingFk);
ELSEIF (SELECT TRUE FROM ticket WHERE id = vParam AND shipped >= vLastWeek) THEN
CALL ticket_setParking(vParam, vParkingFk);
ELSEIF (SELECT TRUE FROM `collection` WHERE id = vParam AND created >= vLastWeek) THEN
CALL collection_setParking(vParam, vParkingFk);
ELSEIF (SELECT TRUE FROM shelving WHERE code = vParam COLLATE utf8_unicode_ci) THEN
CALL shelving_setParking(vParam, vParkingFk);
ELSE
CALL util.throw('paramNotExist');
END IF; END IF;
-- Se comprueba si es un ticket COMMIT;
SELECT COUNT(*) INTO vIsTicket
FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END$$ END$$
DELIMITER ; DELIMITER ;

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

@ -3,14 +3,14 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(
BEGIN BEGIN
DECLARE done INT DEFAULT FALSE; DECLARE done INT DEFAULT FALSE;
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket; DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
CALL vn.productionControl(vWarehouserFk,0) ; CALL vn.productionControl(vWarehouserFk,0) ;
DROP TEMPORARY TABLE IF EXISTS tmp.ticket; DROP TEMPORARY TABLE IF EXISTS tTicket;
CREATE TEMPORARY TABLE tmp.ticket CREATE TEMPORARY TABLE tTicket
SELECT ticketFk SELECT ticketFk
FROM tmp.productionBuffer FROM tmp.productionBuffer
JOIN alertLevel al ON al.code = 'FREE' JOIN alertLevel al ON al.code = 'FREE'
@ -31,5 +31,6 @@ BEGIN
END LOOP; END LOOP;
CLOSE cur1; CLOSE cur1;
DROP TEMPORARY TABLE tTicket, tmp.productionBuffer;
END$$ END$$
DELIMITER ; DELIMITER ;

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,8 +52,8 @@ 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$$
DELIMITER ; DELIMITER ;

View File

@ -65,6 +65,8 @@ BEGIN
IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN
CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS');
END IF; END IF;
DROP TEMPORARY TABLE tmp.zoneGetShipped;
END IF; END IF;
INSERT INTO ticket ( INSERT INTO ticket (

View File

@ -20,7 +20,8 @@ BEGIN
JOIN itemCategory ic ON ic.id = tp.categoryFk JOIN itemCategory ic ON ic.id = tp.categoryFk
JOIN saleComponent sc ON sc.saleFk = s.id JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1 JOIN componentType ct ON ct.id = c.typeFk
AND ct.code = 'cost'
WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo
AND ic.merchandise; AND ic.merchandise;

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;
@ -39,9 +42,16 @@ BEGIN
DECLARE vIsDuplicateMail BOOL; DECLARE vIsDuplicateMail BOOL;
DECLARE vSubject VARCHAR(150); DECLARE vSubject VARCHAR(150);
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,16 +98,22 @@ 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,
saleOrig.quantity, saleOrig.quantity,
saleOrig.price, saleOrig.price,
saleOrig.discount, saleOrig.discount,
saleOrig.priceFixed, saleOrig.priceFixed,
saleOrig.isPriceFixed saleOrig.isPriceFixed
FROM sale saleOrig FROM sale saleOrig
WHERE saleOrig.ticketFk = vTicketFk; WHERE saleOrig.ticketFk = vTicketFk;
@ -123,20 +139,20 @@ BEGIN
,attenderFk, ,attenderFk,
ticketFk) ticketFk)
SELECT description, SELECT description,
ordered, ordered,
shipped, shipped,
quantity, quantity,
price, price,
itemFk, itemFk,
clientFk, clientFk,
response, response,
total, total,
buyed, buyed,
requesterFk, requesterFk,
attenderFk, attenderFk,
vNewTicket vNewTicket
FROM ticketRequest FROM ticketRequest
WHERE ticketFk =vTicketFk; WHERE ticketFk =vTicketFk;
SELECT id INTO vSalesPersonFK SELECT id INTO vSalesPersonFK
FROM observationType FROM observationType
@ -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;
@ -197,6 +213,6 @@ BEGIN
END; END;
END LOOP; END LOOP;
CLOSE rsTicket; CLOSE rsTicket;
DROP TEMPORARY TABLE IF EXISTS tmp.time; DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -66,7 +66,7 @@ BEGIN
JOIN vn.componentType ct ON ct.id = c.typeFk JOIN vn.componentType ct ON ct.id = c.typeFk
JOIN vn.sale s ON s.id = sc.saleFk JOIN vn.sale s ON s.id = sc.saleFk
JOIN tmp.ticket t ON t.ticketFk = s.ticketFk JOIN tmp.ticket t ON t.ticketFk = s.ticketFk
WHERE ct.code = 'FREIGHT' WHERE ct.code = 'freight'
GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk
SET tf.freight = sb.freight; SET tf.freight = sb.freight;
@ -88,7 +88,7 @@ BEGIN
-- Margin -- Margin
UPDATE tmp.ticketFloramondo tf UPDATE tmp.ticketFloramondo tf
JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost, JOIN (SELECT SUM(IF(ct.code = 'cost',sc.value, 0)) cost,
SUM(IF(ct.isMargin, sc.value, 0)) margin, SUM(IF(ct.isMargin, sc.value, 0)) margin,
t.ticketFk t.ticketFk
FROM vn.saleComponent sc FROM vn.saleComponent sc

View File

@ -1,14 +1,21 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(vSelf INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(
vSelf INT
)
BEGIN BEGIN
/** /**
* Cambia el estado del ticket al siguiente estado según la tabla state * Cambia el estado del ticket al siguiente estado según la tabla state.
* *
* @param vSelf id dle ticket * @param vSelf Id ticket
*/ */
DECLARE vStateFk INT; DECLARE vStateFk INT;
DECLARE vNewStateFk INT; DECLARE vNewStateFk INT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RESIGNAL;
END;
SELECT stateFk INTO vStateFk SELECT stateFk INTO vStateFk
FROM ticketState FROM ticketState
WHERE ticketFk = vSelf; WHERE ticketFk = vSelf;
@ -17,6 +24,10 @@ BEGIN
FROM state FROM state
WHERE id = vStateFk; WHERE id = vStateFk;
IF vNewStateFk IS NULL THEN
CALL util.throw('The ticket not have next state');
END IF;
INSERT INTO ticketTracking(stateFk, ticketFk, userFk) INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
VALUES (vNewStateFk, vSelf, account.myUser_getId()); VALUES (vNewStateFk, vSelf, account.myUser_getId());
END$$ END$$

View File

@ -1,11 +1,14 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setParking`(IN `vTicketFk` VARCHAR(8), IN `vParkingFk` INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setParking`(
proc: BEGIN vSelf INT,
vParkingFk INT
)
BEGIN
/** /**
* Aparca un ticket en un parking * Aparca un ticket en un parking.
* *
* @param vTicketFk id del ticket * @param vSelf Id ticket
* @param vParkingFk id del parking * @param vParkingFk Id parking
*/ */
DECLARE vDone INT DEFAULT FALSE; DECLARE vDone INT DEFAULT FALSE;
DECLARE vCollectionTicketFk INT; DECLARE vCollectionTicketFk INT;
@ -14,16 +17,21 @@ proc: BEGIN
FROM ticket t FROM ticket t
LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id
LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk
WHERE t.id = vTicketFk; WHERE t.id = vSelf;
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;
INSERT INTO vn.ticketParking(ticketFk, parkingFk) INSERT INTO vn.ticketParking(ticketFk, parkingFk)
SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk
FROM ticket t FROM ticket t
LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id
LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk
WHERE t.id = vTicketFk WHERE t.id = vSelf
ON DUPLICATE KEY UPDATE parkingFk = vParkingFk; ON DUPLICATE KEY UPDATE parkingFk = vParkingFk;
OPEN vCursor; OPEN vCursor;

View File

@ -10,18 +10,28 @@ BEGIN
* @param vProblemCode Code to set or unset * @param vProblemCode Code to set or unset
* @table tmp.ticket(ticketFk, hasProblem, isProblemCalcNeeded) * @table tmp.ticket(ticketFk, hasProblem, isProblemCalcNeeded)
*/ */
UPDATE ticket t DECLARE vTicketFk INT;
JOIN tmp.ticket tt ON tt.ticketFk = t.id DECLARE vHasProblem INT;
SET t.problem = NULL DECLARE vDone BOOL;
WHERE NOT tt.isProblemCalcNeeded; DECLARE vTicketList CURSOR FOR SELECT ticketFk, hasProblem FROM tmp.ticket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DELETE FROM tmp.ticket WHERE NOT isProblemCalcNeeded;
UPDATE ticket t OPEN vTicketList;
JOIN tmp.ticket tt ON tt.ticketFk = t.id l: LOOP
SET t.problem = CONCAT( SET vDone = FALSE;
IF(tt.hasProblem, FETCH vTicketList INTO vTicketFk, vHasProblem;
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , ''))); IF vDone THEN
LEAVE l;
END IF;
UPDATE ticket
SET problem = CONCAT(
IF(vHasProblem,
CONCAT(problem, ',', vProblemCode),
REPLACE(problem, vProblemCode , '')))
WHERE id = vTicketFk;
END LOOP;
CLOSE vTicketList;
END$$ END$$
DELIMITER ; DELIMITER ;

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,60 +21,56 @@ 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,
t.agencyModeFk = pc.defautlAgencyMode, t.agencyModeFk = pc.defautlAgencyMode,
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,106 +1,143 @@
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 vSelf INT,
vItemPackingTypeFk 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.
* *
* @param vTicketFk Identificador de vn.ticket * @param vSelf Id ticket
* @param vOriginalItemPackingTypeFk Tipo para el que se reserva el número de ticket original * @param vItemPackingTypeFk Tipo para el que se reserva el número de ticket original
* @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk) * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk)
*/ */
DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H'; DECLARE vItemPackingTypeFk VARCHAR(1) DEFAULT 'H';
DECLARE vNewTicketFk INT; DECLARE vNewTicketFk INT;
DECLARE vPackingTypesToSplit INT; DECLARE vPackingTypesToSplit INT;
DECLARE vDone INT DEFAULT FALSE; DECLARE vDone INT DEFAULT FALSE;
DECLARE vErrorNumber INT;
DECLARE vErrorMsg TEXT;
DECLARE cur1 CURSOR FOR DECLARE vSaleGroup CURSOR FOR
SELECT itemPackingTypeFk SELECT itemPackingTypeFk
FROM tmp.saleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL WHERE itemPackingTypeFk IS NOT NULL
ORDER BY (itemPackingTypeFk = vOriginalItemPackingTypeFk) DESC; ORDER BY (itemPackingTypeFk = vItemPackingTypeFk) DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DELETE FROM vn.sale DECLARE EXIT HANDLER FOR SQLEXCEPTION
WHERE quantity = 0 BEGIN
AND ticketFk = vTicketFk; GET DIAGNOSTICS CONDITION 1
vErrorNumber = MYSQL_ERRNO,
vErrorMsg = MESSAGE_TEXT;
DROP TEMPORARY TABLE IF EXISTS tmp.sale; CALL util.debugAdd('ticket_splitItemPackingType', JSON_OBJECT(
CREATE TEMPORARY TABLE tmp.sale 'errorNumber', vErrorNumber,
'errorMsg', vErrorMsg,
'ticketFk', vSelf
)); -- Tmp
ROLLBACK;
RESIGNAL;
END;
START TRANSACTION;
SELECT id
FROM sale
WHERE ticketFk = vSelf
AND NOT quantity
FOR UPDATE;
DELETE FROM sale
WHERE NOT quantity
AND ticketFk = vSelf;
CREATE OR REPLACE TEMPORARY TABLE tSale
(PRIMARY KEY (id)) (PRIMARY KEY (id))
SELECT s.id, i.itemPackingTypeFk , IFNULL(sv.litros, 0) litros ENGINE = MEMORY
FROM vn.sale s SELECT s.id, i.itemPackingTypeFk, IFNULL(sv.litros, 0) litros
JOIN vn.item i ON i.id = s.itemFk FROM sale s
LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id JOIN item i ON i.id = s.itemFk
WHERE s.ticketFk = vTicketFk; LEFT JOIN saleVolume sv ON sv.saleFk = s.id
WHERE s.ticketFk = vSelf;
DROP TEMPORARY TABLE IF EXISTS tmp.saleGroup; CREATE OR REPLACE TEMPORARY TABLE tSaleGroup
CREATE TEMPORARY TABLE tmp.saleGroup ENGINE = MEMORY
SELECT itemPackingTypeFk , sum(litros) AS totalLitros SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tmp.sale FROM tSale
GROUP BY itemPackingTypeFk; GROUP BY itemPackingTypeFk;
SELECT COUNT(*) INTO vPackingTypesToSplit SELECT COUNT(*) INTO vPackingTypesToSplit
FROM tmp.saleGroup FROM tSaleGroup
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
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vTicketFk, vItemPackingTypeFk); VALUES(vSelf, vItemPackingTypeFk);
WHEN 1 THEN WHEN 1 THEN
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
SELECT vTicketFk, itemPackingTypeFk SELECT vSelf, itemPackingTypeFk
FROM tmp.saleGroup FROM tSaleGroup
WHERE itemPackingTypeFk IS NOT NULL; WHERE itemPackingTypeFk IS NOT NULL;
ELSE ELSE
OPEN cur1; OPEN vSaleGroup;
FETCH vSaleGroup INTO vItemPackingTypeFk;
FETCH cur1 INTO vItemPackingTypeFk;
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vTicketFk, vItemPackingTypeFk); VALUES(vSelf, vItemPackingTypeFk);
read_loop: LOOP l: LOOP
FETCH cur1 INTO vItemPackingTypeFk; SET vDone = FALSE;
FETCH vSaleGroup INTO vItemPackingTypeFk;
IF vDone THEN IF vDone THEN
LEAVE read_loop; LEAVE l;
END IF; END IF;
CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); CALL ticket_Clone(vSelf, vNewTicketFk);
INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk)
VALUES(vNewTicketFk, vItemPackingTypeFk); VALUES(vNewTicketFk, vItemPackingTypeFk);
END LOOP; END LOOP;
CLOSE cur1; CLOSE vSaleGroup;
UPDATE vn.sale s SELECT s.id
JOIN tmp.sale ts ON ts.id = s.id FROM sale s
JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
FOR UPDATE;
UPDATE sale s
JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk
SET s.ticketFk = t.ticketFk; SET s.ticketFk = t.ticketFk;
SELECT itemPackingTypeFk INTO vItemPackingTypeFk SELECT itemPackingTypeFk INTO vItemPackingTypeFk
FROM tmp.saleGroup sg FROM tSaleGroup sg
WHERE NOT ISNULL(sg.itemPackingTypeFk) WHERE sg.itemPackingTypeFk IS NOT NULL
ORDER BY sg.itemPackingTypeFk ORDER BY sg.itemPackingTypeFk
LIMIT 1; LIMIT 1;
UPDATE vn.sale s UPDATE sale s
JOIN tmp.sale ts ON ts.id = s.id JOIN tSale ts ON ts.id = s.id
JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk
SET s.ticketFk = t.ticketFk SET s.ticketFk = t.ticketFk
WHERE ts.itemPackingTypeFk IS NULL; WHERE ts.itemPackingTypeFk IS NULL;
END CASE; END CASE;
DROP TEMPORARY TABLE tmp.sale; COMMIT;
DROP TEMPORARY TABLE tmp.saleGroup;
DROP TEMPORARY TABLE
tSale,
tSaleGroup;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -9,6 +9,8 @@ BEGIN
*/ */
DECLARE vLastIn DATETIME ; DECLARE vLastIn DATETIME ;
DECLARE vIsMiddleOdd BOOLEAN ; DECLARE vIsMiddleOdd BOOLEAN ;
DECLARE vMailTo VARCHAR(50) DEFAULT NULL;
DECLARE vUserName VARCHAR(50) DEFAULT NULL;
IF (vTimed IS NULL) THEN IF (vTimed IS NULL) THEN
SET vTimed = util.VN_NOW(); SET vTimed = util.VN_NOW();
@ -57,5 +59,18 @@ BEGIN
VALUES('in', NULL); VALUES('in', NULL);
END IF; END IF;
IF (SELECT option1 IS NULL AND option2 IS NULL FROM tmp.workerTimeControlDirection) THEN
SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName)
INTO vMailTo, vUserName
FROM account.user u
JOIN worker w ON w.bossFk = u.id
WHERE w.id = vWorkerFk;
CALL mail_insert(
vMailTo,
vMailTo,
'Error al fichar',
CONCAT(vUserName, ' tiene problemas para fichar'));
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -103,6 +103,7 @@ BEGIN
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
geoCollision, geoCollision,
tmp.zone, tmp.zone,
tmp.zoneNodes; tmp.zoneNodes,
tmp.zoneOption;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -3,18 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert
BEFORE INSERT ON `delivery` BEFORE INSERT ON `delivery`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF (NEW.longitude IS NOT NULL
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL) AND NEW.latitude IS NOT NULL
AND NEW.ticketFK IS NOT NULL)
THEN THEN
UPDATE address CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
SET longitude = NEW.longitude,
latitude = NEW.latitude
WHERE id IN (
SELECT addressFK
FROM ticket
WHERE id = NEW.ticketFk
);
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -3,18 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate
BEFORE UPDATE ON `delivery` BEFORE UPDATE ON `delivery`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF (NEW.longitude IS NOT NULL
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL) AND NEW.latitude IS NOT NULL
AND NEW.ticketFK IS NOT NULL)
THEN THEN
UPDATE address CALL address_updateCoordinates(NEW.ticketFk, NEW.longitude, NEW.latitude);
SET longitude = NEW.longitude,
latitude = NEW.latitude
WHERE id IN (
SELECT addressFK
FROM ticket
WHERE id = NEW.ticketFk
);
END IF; END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -11,11 +11,9 @@ BEGIN
IF NEW.isBooked = OLD.isBooked AND ( IF NEW.isBooked = OLD.isBooked AND (
NOT (NEW.supplierFk <=> OLD.supplierFk) OR NOT (NEW.supplierFk <=> OLD.supplierFk) OR
NOT (NEW.dated <=> OLD.dated) OR NOT (NEW.dated <=> OLD.dated) OR
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.travelFk <=> OLD.travelFk) OR
NOT (NEW.companyFk <=> OLD.companyFk) OR NOT (NEW.companyFk <=> OLD.companyFk) OR
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
NOT (NEW.typeFk <=> OLD.typeFk) NOT (NEW.typeFk <=> OLD.typeFk)
) THEN ) THEN

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_afterDelete`
AFTER DELETE ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
INSERT INTO itemLog
SET `action` = 'delete',
`changedModel` = 'ItemMinimumQuantity',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeInsert`
BEFORE INSERT ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemMinimumQuantity_beforeUpdate`
BEFORE UPDATE ON `itemMinimumQuantity`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving _afterDelete` CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterDelete`
AFTER DELETE ON `itemShelving` AFTER DELETE ON `itemShelving`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_afterDelete`
AFTER DELETE ON `productionConfig`
FOR EACH ROW
BEGIN
INSERT INTO productionConfig
SET `action` = 'delete',
`changedModel` = 'ProductionConfig',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_beforeInsert`
BEFORE INSERT ON `productionConfig`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`productionConfig_beforeUpdate`
BEFORE UPDATE ON `productionConfig`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -19,4 +19,4 @@ FROM (
) )
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`) JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
) )
WHERE `ct`.`type` = 'coste' WHERE `ct`.`code` = 'cost'

View File

@ -16,6 +16,6 @@ FROM (
) )
JOIN `vn`.`componentType` `ct` ON( JOIN `vn`.`componentType` `ct` ON(
`ct`.`id` = `c`.`typeFk` `ct`.`id` = `c`.`typeFk`
AND `ct`.`type` = 'agencia' AND `ct`.`code` = 'freight'
) )
) )

Some files were not shown because too many files have changed in this diff Show More