8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
2238 changed files with 18822 additions and 38821 deletions
Showing only changes of commit f7f7df55f5 - Show all commits

View File

@ -1,3 +1,251 @@
# Version 24.36 - 2024-09-03
### Added 🆕
- chore: refs #7524 WIP limit call by:jorgep
- chore: refs #7524 modify ormConfig table col (origin/7524-warmfix-modifyColumn) by:jorgep
- feat(update-user): refs #7848 add twoFactor by:alexm
- feat: #3199 Requested changes by:guillermo
- feat: refs #3199 Added more scopes ticket_recalcByScope by:guillermo
- feat: refs #3199 Added one more scope ticket_recalcByScope by:guillermo
- feat: refs #3199 Created ticket_recalcItemTaxCountryByScope by:guillermo
- feat: refs #3199 Requested changes by:guillermo
- feat: refs #7346 add multiple feature by:jgallego
- feat: refs #7346 backTest checks new implementation by:jgallego
- feat: refs #7346 mas intuitivo by:jgallego
- feat: refs #7514 Changes to put srt log (origin/7514-srtLog) by:guillermo
- feat: refs #7524 add default limit (origin/7524-limitSelect) by:jorgep
- feat: refs #7524 add mock limit on find query by:jorgep
- feat: refs #7524 wip remote hooks by:jorgep
- feat: refs #7562 Requested changes by:guillermo
- feat: refs #7567 Changed time to call event by:guillermo
- feat: refs #7567 Requested changes by:guillermo
- feat: refs #7710 pr revision by:jgallego
- feat: refs #7710 test fixed (origin/7710-cloneWithTicketPackaging, 7710-cloneWithTicketPackaging) by:jgallego
- feat: refs #7712 Fix by:guillermo
- feat: refs #7712 Unify by:guillermo
- feat: refs #7712 sizeLimit (origin/7712-sizeLimit) by:guillermo
- feat: refs #7758 Add code mandateType and accountDetailType by:ivanm
- feat: refs #7758 Modify code lowerCamelCase and UNIQUE by:ivanm
- feat: refs #7758 accountDetailType fix deploy error by:ivanm
- feat: refs #7784 Changes in entry-order-pdf by:guillermo
- feat: refs #7784 Requested changes by:guillermo
- feat: refs #7799 Added Fk in vn.item.itemPackingTypeFk by:guillermo
- feat: refs #7800 Added company Fk by:guillermo
- feat: refs #7842 Added editorFk in vn.host by:guillermo
- feat: refs #7860 Update new packagings (origin/7860-newPackaging) by:guillermo
- feat: refs #7862 roadmap new fields by:ivanm
- feat: refs #7882 Added quadMindsConfig table by:guillermo
### Changed 📦
- refactor: refs #7567 Fix and improvement by:guillermo
- refactor: refs #7567 Minor change by:guillermo
- refactor: refs #7756 Fix tests by:guillermo
- refactor: refs #7798 Drop bi.Greuges_comercial_detail by:guillermo
- refactor: refs #7848 adapt to lilium by:alexm
### Fixed 🛠️
- feat: refs #7710 test fixed (origin/7710-cloneWithTicketPackaging, 7710-cloneWithTicketPackaging) by:jgallego
- feat: refs #7758 accountDetailType fix deploy error by:ivanm
- fix(salix): #7283 ItemFixedPrice duplicated (origin/7283_itemFixedPrice_duplicated) by:Javier Segarra
- fix: refs #7346 minor error (origin/7346, 7346) by:jgallego
- fix: refs #7355 remove and tests accounts (origin/7355-accountMigration2) by:carlossa
- fix: refs #7355 remove and tests accounts by:carlossa
- fix: refs #7524 default limit select by:jorgep
- fix: refs #7756 Foreign keys invoiceOut (origin/7756-fixRefFk) by:guillermo
- fix: refs #7756 id 0 by:guillermo
- fix: refs #7800 tpvMerchantEnable PRIMARY KEY (origin/7800-tpvMerchantEnable) by:guillermo
- fix: refs #7800 tpvMerchantEnable PRIMARY KEY by:guillermo
- fix: refs #7916 itemShelving_transfer (origin/test, test) by:guillermo
- fix: refs #pako Deleted duplicated version by:guillermo
# Version 24.34 - 2024-08-20
### Added 🆕
- #6900 feat: clear empty by:jorgep
- #6900 feat: empty commit by:jorgep
- chore: refs #6900 beautify code by:jorgep
- chore: refs #6989 add config model by:jorgep
- feat workerActivity refs #6078 by:sergiodt
- feat: #6453 Refactor (origin/6453-orderConfirm) by:guillermo
- feat: #6453 Rollback always split by itemPackingType by:guillermo
- feat: deleted worker module code & redirect to Lilium by:Jon
- feat: refs #6453 Added new ticket search by:guillermo
- feat: refs #6453 Fixes by:guillermo
- feat: refs #6453 Minor changes by:guillermo
- feat: refs #6453 Requested changes by:guillermo
- feat: refs #6900 drop section by:jorgep
- feat: refs #7283 order by desc date by:jorgep
- feat: refs #7323 add locale by:jorgep
- feat: refs #7323 redirect to lilium by:jorgep
- feat: refs #7646 delete scannableCodeType by:robert
- feat: refs #7713 Created ACLLog by:guillermo
- feat: refs #7774 (origin/7774-ticket_cloneWeekly) by:robert
- feat: refs #7774 #7774 Changes ticket_cloneWeekly by:guillermo
- feat: refs #7774 ticket_cloneWeekly by:robert
### Changed 📦
- refactor: refs #6453 Major changes by:guillermo
- refactor: refs #6453 Minor changes by:guillermo
- refactor: refs #6453 order_confirmWithUser by:guillermo
- refactor: refs #7646 #7646 Deleted scannable* variables productionConfig by:guillermo
- refactor: refs #7820 Deprecated silexACL by:guillermo
### Fixed 🛠️
- #6900 fix: #6900 rectificative filter by:jorgep
- #6900 fix: empty commit by:jorgep
- fix(orders_filter): add sourceApp accepts by:alexm
- fix: refs #6130 commit lint by:pablone
- fix: refs #6453 order_confirmWithUser by:guillermo
- fix: refs #7283 sql by:jorgep
- fix: refs #7713 ACL Log by:guillermo
- test: fix claim descriptor redirect to lilium by:alexm
- test: fix ticket redirect to lilium by:alexm
- test: fix ticket sale e2e by:alexm
# Version 24.32 - 2024-08-06
### Added 🆕
- chore: refs #7197 add supplierActivityFk filter by:jorgep
- feat checkExpeditionPrintOut refs #7751 by:sergiodt
- feat(defaulter_filter): add department by:alexm
- feat: redirect to lilium page not found by:alexm
- feat: refactor buyUltimate refs #7736 by:Carlos Andrés
- feat: refs #6403 add delete by:pablone
- feat: refs #7126 Added manaClaim calc by:guillermo
- feat: refs #7126 Refactor and added columns in bs.waste table & proc by:guillermo
- feat: refs #7197 filter by correcting by:jorgep
- feat: refs #7297 add new columns by:pablone
- feat: refs #7356 new parameters in sql for Weekly tickets front by:Jon
- feat: refs #7401 redirect lilium by:pablone
- feat: refs #7511 Fix tests by:guillermo
- feat: refs #7511 Rename to multiConfig tables by:guillermo
- feat: refs #7589 Added display (item_valuateInventory) by:guillermo
- feat: refs #7589 Added vItemTypeFk & vItemCategoryFk (item_valuateInventory) by:guillermo
- feat: refs #7681 Changes by:guillermo
- feat: refs #7681 Optimization and refactor by:guillermo
- feat: refs #7683 drop temporary table by:robert
- feat: refs #7683 productionControl by:robert
- feat: refs #7728 Added throw due date by:guillermo
- feat: refs #7740 Ticket before update added restriction by:guillermo
- feat(salix): #7648 Add field for endpoint as buyLabel report by:Javier Segarra
- feat(salix): #7648 remove white line by:Javier Segarra
- feat: tabla config dias margen vctos. refs #7728 by:Carlos Andrés
### Changed 📦
- eat: refactor buyUltimate refs #7736 by:Carlos Andrés
- feat: refactor buyUltimate refs #7736 by:Carlos Andrés
- feat: refs #7681 Optimization and refactor by:guillermo
- refactor: refs #7126 Requested changes by:guillermo
- refactor: refs #7511 Minor change by:guillermo
- refactor: refs #7640 Multipleinventory available by:guillermo
- refactor: refs #7681 Changes by:guillermo
- refactor: refs #7681 Requested changes by:guillermo
### Fixed 🛠️
- add prefix (hotFix_liliumRedirection) by:alexm
- fix(client_filter): add recovery by:alexm
- fix: defaulter filter correct sql (6943-fix_defaulter_filter) by:alexm
- fix(deletExpeditions): merge test → dev by:guillermo
- fix: refs #6403 fix mrw cancel shipment return type by:pablone
- fix: refs #7126 Added addressWaste type by:guillermo
- fix: refs #7126 Fix by:guillermo
- fix: refs #7126 Minor change by:guillermo
- fix: refs #7126 Primary key no unique data by:guillermo
- fix: refs #7126 Slow update by:guillermo
- fix: refs #7511 Minor change by:guillermo
- fix: refs #7546 Deleted insert util.binlogQueue by:guillermo
- fix: refs #7811 Variables pm2 by:guillermo
- fix: without path by:alexm
# 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
### Added 🆕
@ -22,6 +270,7 @@
- feat: refs #7438 Added volume to item_valuateInventory by:guillermo
- feat: refs #7438 Requested changes and little changes by:guillermo
- refs #6281 feat:buyFk in itemShelving by:sergiodt
- feat: refs #6449 item ID is displayed in the sale line by:jorgep
### Changed 📦

View File

@ -28,7 +28,7 @@ Pull from repository.
Run this commands on project root directory to install Node dependencies.
```
$ npm install
$ pnpm install
$ gulp install
```

View File

@ -20,9 +20,14 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const [, , [{collectionFk}]] =
await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
[userId], myOptions);
const randStr = Math.random().toString(36).substring(3);
const result = await Self.rawSql(`
CALL vn.collection_assign(?, @vCollectionFk);
SELECT @vCollectionFk ?
`, [userId, randStr], myOptions);
// Por si entra en SELECT FOR UPDATE una o varias veces
const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr];
if (!collectionFk) throw new UserError('There are not picking tickets');
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);

View File

@ -0,0 +1,29 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('assignCollection', {
description: 'Assign a collection',
accessType: 'WRITE',
http: {
path: `/assignCollection`,
verb: 'POST'
},
returns: {
type: ['object'],
root: true
},
});
Self.assignCollection = async(ctx, options) => {
const userId = ctx.req.accessToken.userId;
const myOptions = {userId};
if (typeof options == 'object')
Object.assign(myOptions, options);
const [info, info2, [{'@vCollectionFk': collectionFk}]] = await Self.rawSql(
'CALL vn.collection_getAssigned(?, @vCollectionFk);SELECT @vCollectionFk', [userId], myOptions);
if (!collectionFk) throw new UserError('There are not picking tickets');
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
return collectionFk;
};
};

View File

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

View File

@ -37,6 +37,7 @@ module.exports = Self => {
const promises = [];
const [tickets] = await Self.rawSql(`CALL vn.collection_getTickets(?)`, [id], myOptions);
const sales = await Self.rawSql(`
SELECT s.ticketFk,
sgd.saleGroupFk,
@ -56,19 +57,20 @@ module.exports = Self => {
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
sh.code,
IFNULL(p2.code, p.code) parkingCode,
IFNULL(p2.pickingOrder, p.pickingOrder) pickingOrder,
p2.code parkingCode,
p2.pickingOrder pickingOrder,
p.code parkingCodePrevia,
p.pickingOrder pickingOrderPrevia,
iss.id itemShelvingSaleFk,
iss.isPicked
FROM ticketCollection tc
LEFT JOIN collection c ON c.id = tc.collectionFk
JOIN ticket t ON t.id = tc.ticketFk
JOIN sale s ON s.ticketFk = t.id
JOIN sale s ON s.ticketFk = tc.ticketFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
JOIN item i ON i.id = s.itemFk
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
JOIN itemShelvingSale iss ON iss.saleFk = s.id
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
LEFT JOIN parking p ON p.id = sh.parkingFk
@ -76,17 +78,57 @@ module.exports = Self => {
LEFT JOIN origin o ON o.id = i.originFk
WHERE tc.collectionFk = ?
GROUP BY s.id, ish.id, p.code, p2.code
ORDER BY pickingOrder;`, [id], myOptions);
UNION ALL
SELECT s.ticketFk,
sgd.saleGroupFk,
s.id saleFk,
s.itemFk,
i.longName,
i.size,
ic.color,
o.code origin,
ish.packing,
ish.grouping,
s.isAdded,
s.originalQuantity,
s.quantity,
iss.quantity,
SUM(iss.quantity) OVER (PARTITION BY s.id ORDER BY ish.id),
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY p.pickingOrder),
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) ,
sh.code,
p2.code,
p2.pickingOrder,
p.code,
p.pickingOrder,
iss.id itemShelvingSaleFk,
iss.isPicked
FROM sectorCollection sc
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleGroupFk = sg.id
JOIN sale s ON s.id = sgd.saleFk
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
JOIN item i ON i.id = s.itemFk
JOIN itemShelvingSale iss ON iss.saleFk = s.id
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
LEFT JOIN parking p ON p.id = sh.parkingFk
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
LEFT JOIN origin o ON o.id = i.originFk
WHERE sc.id = ?
AND sgd.saleGroupFk
GROUP BY s.id, ish.id, p.code, p2.code`, [id, id], myOptions);
if (print)
await Self.rawSql(`CALL vn.collection_printSticker(?, ?)`, [id, null], myOptions);
const collection = {collectionFk: id, tickets: []};
if (tickets && tickets.length) {
for (const ticket of tickets) {
const ticketId = ticket.ticketFk;
if (ticket.observaciones != '') {
for (observation of ticket.observaciones.split(' ')) {
if (ticket.observation) {
for (observation of ticket.observation?.split(' ')) {
if (['#', '@'].includes(observation.charAt(0))) {
promises.push(Self.app.models.Chat.send(ctx, observation,
$t('The ticket is in preparation', {
@ -100,11 +142,11 @@ module.exports = Self => {
if (sales && sales.length) {
const barcodes = await Self.rawSql(`
SELECT s.id saleFk, b.code, c.id
FROM vn.sale s
LEFT JOIN vn.itemBarcode b ON b.itemFk = s.itemFk
LEFT JOIN vn.buy c ON c.itemFk = s.itemFk
LEFT JOIN vn.entry e ON e.id = c.entryFk
LEFT JOIN vn.travel tr ON tr.id = e.travelFk
FROM sale s
LEFT JOIN itemBarcode b ON b.itemFk = s.itemFk
LEFT JOIN buy c ON c.itemFk = s.itemFk
LEFT JOIN entry e ON e.id = c.entryFk
LEFT JOIN travel tr ON tr.id = e.travelFk
WHERE s.ticketFk = ?
AND tr.landed >= util.VN_CURDATE() - INTERVAL 1 YEAR`,
[ticketId], myOptions);

View File

@ -0,0 +1,36 @@
const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('ticket assignCollection()', () => {
let ctx;
let options;
let tx;
beforeEach(async() => {
ctx = {
req: {
accessToken: {userId: 1106},
headers: {origin: 'http://localhost'},
__: value => value
},
args: {}
};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: ctx.req});
options = {transaction: tx};
tx = await models.Sale.beginTransaction({});
options.transaction = tx;
});
afterEach(async() => {
if (tx) await tx.rollback();
});
it('should throw an error when there is not picking tickets', async() => {
try {
await models.Collection.assignCollection(ctx, options);
} catch (e) {
expect(e.message).toEqual('There are not picking tickets');
}
});
});

View File

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

View File

@ -1,15 +1,7 @@
const models = require('vn-loopback/server/server').models;
describe('collection getTickets()', () => {
let ctx;
beforeAll(async() => {
ctx = {
req: {
accessToken: {userId: 9},
headers: {origin: 'http://localhost'}
}
};
});
const ctx = beforeAll.getCtx();
it('should get tickets, sales and barcodes from collection', async() => {
const tx = await models.Collection.beginTransaction({});
@ -26,8 +18,8 @@ describe('collection getTickets()', () => {
expect(collectionTickets.tickets[1].ticketFk).toEqual(2);
expect(collectionTickets.tickets[2].ticketFk).toEqual(23);
expect(collectionTickets.tickets[0].sales[0].ticketFk).toEqual(1);
expect(collectionTickets.tickets[0].sales[1].ticketFk).toEqual(1);
expect(collectionTickets.tickets[0].sales[2].ticketFk).toEqual(1);
expect(collectionTickets.tickets[1].sales.length).toEqual(0);
expect(collectionTickets.tickets[2].sales.length).toEqual(0);
expect(collectionTickets.tickets[0].sales[0].Barcodes.length).toBeTruthy();
await tx.rollback();

View File

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

View File

@ -24,7 +24,7 @@ module.exports = Self => {
try {
const options = {transaction: tx, userId: ctx.req.accessToken.userId};
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options);
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileMultiConfig', null, options);
const updatableFiles = [];
for (const file of files) {
@ -54,7 +54,7 @@ module.exports = Self => {
const tables = await Self.rawSql(`
SELECT fileName, toTable, file
FROM edi.tableConfig
FROM edi.tableMultiConfig
WHERE file IN (?)`, [fileNames], options);
for (const table of tables) {
@ -85,9 +85,9 @@ module.exports = Self => {
for (const file of updatableFiles) {
console.log(`Updating file ${file.name} checksum...`);
await Self.rawSql(`
UPDATE edi.fileConfig
SET checksum = ?
WHERE name = ?`,
UPDATE edi.fileMultiConfig
SET checksum = ?
WHERE name = ?`,
[file.checksum, file.name], options);
}
@ -228,7 +228,7 @@ module.exports = Self => {
await Self.rawSql(sqlTemplate, [filePath], options);
await Self.rawSql(`
UPDATE edi.tableConfig
UPDATE edi.tableMultiConfig
SET updated = ?
WHERE fileName = ?
`, [Date.vnNew(), baseName], options);

View File

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

View File

@ -13,7 +13,7 @@ module.exports = Self => {
required: true
}],
returns: {
type: ['object'],
type: 'boolean',
root: true
},
http: {
@ -27,9 +27,9 @@ module.exports = Self => {
const mrw = await models.MrwConfig.findOne();
const {externalId} = await models.Expedition.findById(expeditionFk);
const clientType = await models.MrwConfig.getClientType(expeditionFk);
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
const renderedXml = ejs.render(template, {mrw, externalId});
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
const response = await axios.post(mrw.url, renderedXml, {
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'
@ -39,6 +39,7 @@ module.exports = Self => {
const xmlString = response.data;
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
return xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return result.toLowerCase().includes('se ha cancelado correctamente');
};
};

View File

@ -3,7 +3,7 @@
<soap:Header>
<mrw:AuthInfo>
<mrw:CodigoFranquicia><%= mrw.franchiseCode %></mrw:CodigoFranquicia>
<mrw:CodigoAbonado><%= mrw.subscriberCode %></mrw:CodigoAbonado>
<mrw:CodigoAbonado><%= clientType %></mrw:CodigoAbonado>
<mrw:CodigoDepartamento/>
<mrw:UserName><%= mrw.user %></mrw:UserName>
<mrw:Password><%= mrw.password %></mrw:Password>
@ -25,7 +25,7 @@
</mrw:Direccion>
<mrw:Nif><%= expeditionData.fi %></mrw:Nif>
<mrw:Nombre><%= expeditionData.clientName %></mrw:Nombre>
<mrw:Telefono><%= expeditionData.phone %></mrw:Telefono>
<mrw:Telefono><%= expeditionData.mobile %></mrw:Telefono>
<mrw:Observaciones><%= expeditionData.deliveryObservation %></mrw:Observaciones>
</mrw:DatosEntrega>
<mrw:DatosServicio>

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');
module.exports = Self => {
@ -23,23 +19,21 @@ module.exports = Self => {
}
});
Self.createShipment = async(expeditionFk, options) => {
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
Self.createShipment = async expeditionFk => {
const models = Self.app.models;
const mrw = await models.MrwConfig.findOne(null, myOptions);
const mrw = await Self.getConfig();
const clientType = await models.MrwConfig.getClientType(expeditionFk);
if (!mrw)
throw new UserError(`Some mrwConfig parameters are not set`);
const today = Date.vnNew();
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 =
`SELECT
@ -53,67 +47,45 @@ module.exports = Self => {
co.code countryCode,
c.fi,
c.name clientName,
c.phone,
IFNULL(a.mobile, c.mobile) mobile,
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
t.shipped,
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,
oa.description deliveryObservation
ta.description deliveryObservation
FROM expedition e
JOIN ticket t ON e.ticketFk = t.id
JOIN agencyMode am ON am.id = t.agencyModeFk
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 address a ON t.addressFk = a.id
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
LEFT JOIN observationType ot ON ot.id = oa.observationTypeFk
AND ot.code = 'delivery'
LEFT JOIN ticketObservation ta ON ta.ticketFk = t.id
AND ta.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'agency')
JOIN province p ON a.provinceFk = p.id
JOIN country co ON co.id = p.countryFk
JOIN mrwConfig mc
WHERE e.id = ?
LIMIT 1`;
const [expeditionData] = await Self.rawSql(query, [expeditionFk], myOptions);
const [expeditionData] = await Self.rawSql(query, [expeditionFk]);
if (!expeditionData)
throw new UserError(`This expedition is not a MRW shipment`);
const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today)
if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today.setHours(0, 0, 0, 0))
throw new UserError(`This ticket has a shipped date earlier than today`);
const shipmentResponse = await sendXmlDoc('createShipment', {mrw, expeditionData}, 'application/soap+xml');
const shipmentId = getTextByTag(shipmentResponse, 'NumeroEnvio');
const shipmentResponse = await Self.sendXmlDoc(
__dirname + `/createShipment.ejs`,
{mrw, expeditionData, clientType},
'application/soap+xml'
);
const shipmentId = Self.getTextByTag(shipmentResponse, 'NumeroEnvio');
if (!shipmentId)
throw new UserError(getTextByTag(shipmentResponse, 'Mensaje'));
if (!shipmentId) throw new UserError(Self.getTextByTag(shipmentResponse, 'Mensaje'));
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml');
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
if (tx) await tx.commit();
const file = await models.MrwConfig.getLabel(shipmentId, clientType);
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

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

View File

@ -0,0 +1,37 @@
module.exports = Self => {
Self.remoteMethod('getLabel', {
description: 'Return a base64Binary label from de MRW WebService',
accessType: 'READ',
accepts: [{
arg: 'shipmentId',
type: 'string',
required: true
},
{
arg: 'clientType',
type: 'string',
required: true
},
],
returns: {
type: 'string',
root: true
},
http: {
path: `/getLabel`,
verb: 'GET'
}
});
Self.getLabel = async(shipmentId, clientType) => {
const mrw = await Self.getConfig();
const getLabelResponse = await Self.sendXmlDoc(
__dirname + `/getLabel.ejs`,
{mrw, shipmentId, clientType},
'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 fs = require('fs');
const filter = {notificationFk: 'mrw-deadline'};
const mockBase64Binary = 'base64BinaryString';
const ticket1 = {
'id': '44',
@ -28,25 +29,49 @@ const expedition1 = {
'editorFk': 100
};
let tx;
let options;
describe('MRWConfig createShipment()', () => {
beforeEach(async() => {
options = tx = undefined;
tx = await models.MrwConfig.beginTransaction({});
options = {transaction: tx};
beforeAll(async() => {
await models.Agency.create(
{'id': 999, 'name': 'mrw'},
options
{'id': 999, 'name': 'mrw'}
);
await models.AgencyMode.create(
{'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'},
options
{'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'}
);
await models.MrwService.create(
{'agencyModeCodeFk': 'mrw', 'clientType': '000001', 'serviceType': 105, 'kg': 10}
);
await createMrwConfig();
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(
{
'id': 1,
@ -54,68 +79,82 @@ describe('MRWConfig createShipment()', () => {
'user': 'user',
'password': 'password',
'franchiseCode': 'franchiseCode',
'subscriberCode': 'subscriberCode'
}, options
'subscriberCode': 'subscriberCode',
'clientTypeWidth': 6
}
);
}
await models.Application.rawSql(
`INSERT INTO vn.mrwService
SET agencyModeCodeFk = 'mrw',
clientType = 1,
serviceType = 1,
kg = 1`, null, options
);
await models.Ticket.create(ticket1, options);
await models.Expedition.create(expedition1, options);
});
afterEach(async() => {
await tx.rollback();
});
async function getLastNotification() {
return models.NotificationQueue.findOne({
order: 'id DESC',
where: filter
});
}
it('should create a shipment and return a base64Binary label', 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()));
const {file} = await models.MrwConfig.createShipment(expedition1.id, options);
const {file} = await models.MrwConfig.createShipment(expedition1.id);
expect(file).toEqual(mockBase64Binary);
});
it('should fail if mrwConfig has no data', async() => {
let error;
await models.MrwConfig.destroyAll();
await models.MrwConfig.createShipment(expedition1.id).catch(e => {
error = e;
}).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();
});
it('should fail if expeditionFk is not a MrwExpedition', async() => {
let error;
await models.MrwConfig.createShipment(undefined, options).catch(e => {
await models.MrwConfig.createShipment(15).catch(e => {
error = e;
}).finally(async() => {
expect(error.message).toEqual(`This expedition is not a MRW shipment`);
expect(error.message).toEqual(`ClientType not available`);
});
});
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;
const yesterday = Date.vnNew();
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;
}).finally(async() => {
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

@ -11,13 +11,6 @@ module.exports = Self => {
arg: 'filter',
type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
http: {source: 'query'}
},
{
arg: 'search',
type: 'string',
description: 'Value to filter',
http: {source: 'query'}
},
],
returns: {
@ -29,13 +22,11 @@ module.exports = Self => {
verb: 'GET',
},
});
Self.filter = async(ctx, filter, options) => {
Self.filter = async(filter = {}, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
filter = ctx?.filter ?? {};
const conn = Self.dataSource.connector;
const where = buildFilter(filter?.where, (param, value) => {
switch (param) {
@ -50,31 +41,33 @@ module.exports = Self => {
};
}
}) ?? {};
delete ctx.filter.where;
delete filter.where;
const stmts = [];
let stmt;
stmt = new ParameterizedSQL(`
SELECT
pc.townFk,
t.provinceFk,
p.countryFk,
pc.code,
t.name as town,
p.name as province,
c.name country
FROM
postCode pc
JOIN town t on t.id = pc.townFk
JOIN province p on p.id = t.provinceFk
JOIN country c on c.id = p.countryFk
SELECT
pc.townFk,
t.provinceFk,
p.countryFk,
pc.code,
t.name as town,
p.name as province,
c.name country
FROM
postCode pc
JOIN town t on t.id = pc.townFk
JOIN province p on p.id = t.provinceFk
JOIN country c on c.id = p.countryFk
`);
stmt.merge(conn.makeSuffix({where, ...ctx}));
stmt.merge(conn.makeSuffix({where}));
stmt.merge(conn.makeLimit(filter));
const itemsIndex = stmts.push(stmt) - 1;
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
return itemsIndex === 0 ? result : result[itemsIndex];
};
};

View File

@ -6,12 +6,9 @@ describe('Postcode filter()', () => {
const options = {transaction: tx};
try {
const ctx = {
filter: {
},
const results = await models.Postcode.filter({
limit: 1
};
const results = await models.Postcode.filter(ctx, options);
}, options);
expect(results.length).toEqual(1);
await tx.rollback();
@ -26,14 +23,11 @@ describe('Postcode filter()', () => {
const options = {transaction: tx};
try {
const ctx = {
filter: {
where: {
search: 46,
}
},
};
const results = await models.Postcode.filter(ctx, options);
const results = await models.Postcode.filter({
where: {
search: 46,
}
}, options);
expect(results.length).toEqual(4);
await tx.rollback();
@ -48,14 +42,9 @@ describe('Postcode filter()', () => {
const options = {transaction: tx};
try {
const ctx = {
filter: {
where: {
search: 'Alz',
}
},
};
const results = await models.Postcode.filter(ctx, options);
const results = await models.Postcode.filter({where: {
search: 'Alz',
}}, options);
expect(results.length).toEqual(1);
await tx.rollback();
@ -70,14 +59,9 @@ describe('Postcode filter()', () => {
const options = {transaction: tx};
try {
const ctx = {
filter: {
where: {
search: 'one',
}
},
};
const results = await models.Postcode.filter(ctx, options);
const results = await models.Postcode.filter({where: {
search: 'one',
}}, options);
expect(results.length).toEqual(4);
await tx.rollback();
@ -92,14 +76,11 @@ describe('Postcode filter()', () => {
const options = {transaction: tx};
try {
const ctx = {
filter: {
where: {
search: 'Ec',
}
},
};
const results = await models.Postcode.filter(ctx, options);
const results = await models.Postcode.filter({
where: {
search: 'Ec',
}
}, options);
expect(results.length).toEqual(1);
await tx.rollback();

View File

@ -1,22 +1,7 @@
const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('getStarredModules()', () => {
const activeCtx = {
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {req: activeCtx};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
const ctx = beforeAll.getCtx();
it(`should return the starred modules for a given user`, async() => {
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 LoopBackContext = require('loopback-context');
describe('setPosition()', () => {
const activeCtx = {
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {
req: activeCtx
};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
const ctx = beforeAll.getCtx();
beforeAll.mockLoopBackContext();
it('should increase the orders module position by replacing it with clients and vice versa', async() => {
const tx = await models.StarredModule.beginTransaction({});

View File

@ -1,24 +1,7 @@
const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('toggleStarredModule()', () => {
const activeCtx = {
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {
req: activeCtx
};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
const ctx = beforeAll.getCtx();
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');
@ -26,7 +9,7 @@ describe('toggleStarredModule()', () => {
expect(starredModules.length).toEqual(1);
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);
await models.StarredModule.toggleStarredModule(ctx, 'order');

View File

@ -22,7 +22,7 @@ module.exports = Self => {
const url = await Self.app.models.Url.findOne({
where: {
appName,
environment: process.env.NODE_ENV || 'development'
environment: process.env.NODE_ENV || 'dev'
}
});
return url?.url;

View File

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

View File

@ -20,7 +20,7 @@ module.exports = Self => {
}
});
Self.renderer = async (expeditionFk) => {
Self.renderer = async expeditionFk => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
@ -109,7 +109,7 @@ module.exports = Self => {
const ticket = expedition.ticket();
const sender = ticket.company().client();
const shipped = ticket.shipped.toISOString();
const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk)
const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk);
const data = {
viaexpressConfig,
sender,

View File

@ -0,0 +1,29 @@
module.exports = Self => {
Self.remoteMethodCtx('killSession', {
description: 'Kill session',
accepts: [{
arg: 'userId',
type: 'integer',
description: 'The user id',
required: true,
}, {
arg: 'created',
type: 'date',
description: 'The created time',
required: true,
}],
accessType: 'WRITE',
http: {
path: `/killSession`,
verb: 'POST'
}
});
Self.killSession = async function(ctx, userId, created) {
await Self.app.models.VnUser.userSecurity(ctx, ctx.req.accessToken.userId);
const tokens = await Self.app.models.AccessToken.find({where: {userId, created}});
if (!tokens?.length) return;
for (const token of tokens)
await Self.app.models.AccessToken.deleteById(token.id);
};
};

View File

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

View File

@ -67,7 +67,9 @@ module.exports = Self => {
if (vnUser.twoFactor === 'email') {
const $ = Self.app.models;
const code = String(Math.floor(Math.random() * 999999));
const min = 100000;
const max = 999999;
const code = String(Math.floor(Math.random() * (max - min + 1)) + min);
const maxTTL = ((60 * 1000) * 5); // 5 min
await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
userFk: vnUser.id,

View File

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

View File

@ -24,6 +24,10 @@ module.exports = Self => {
arg: 'lang',
type: 'string',
description: 'The user lang'
}, {
arg: 'twoFactor',
type: 'string',
description: 'The user twoFactor'
}
],
http: {
@ -32,8 +36,8 @@ module.exports = Self => {
}
});
Self.updateUser = async(ctx, id, name, nickname, email, lang) => {
Self.updateUser = async(ctx, id, name, nickname, email, lang, twoFactor) => {
await Self.userSecurity(ctx, id);
await Self.upsertWithWhere({id}, {name, nickname, email, lang});
await Self.upsertWithWhere({id}, {name, nickname, email, lang, twoFactor});
};
};

View File

@ -58,7 +58,7 @@ module.exports = Self => {
fields: ['name', 'twoFactor']
}, myOptions);
if (user.name !== username)
if (user.name.toLowerCase() !== username.toLowerCase())
throw new UserError('Authentication failed');
await authCode.destroy(myOptions);

View File

@ -0,0 +1,50 @@
module.exports = Self => {
Self.remoteMethodCtx('add', {
description: 'Add activity if the activity is different or is the same but have exceed time for break',
accessType: 'WRITE',
accepts: [
{
arg: 'code',
type: 'string',
description: 'Code for activity'
},
{
arg: 'model',
type: 'string',
description: 'Origin model from insert'
},
],
http: {
path: `/add`,
verb: 'POST'
}
});
Self.add = async(ctx, code, model, options) => {
const userId = ctx.req.accessToken.userId;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
return await Self.rawSql(`
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
SELECT ?, ?, ?
FROM workerTimeControlParams wtcp
LEFT JOIN (
SELECT wa.workerFk,
wa.created,
wat.code
FROM workerActivity wa
LEFT JOIN workerActivityType wat ON wat.code = wa.workerActivityTypeFk
WHERE wa.workerFk = ?
ORDER BY wa.created DESC
LIMIT 1
) sub ON TRUE
WHERE sub.workerFk IS NULL
OR sub.code <> ?
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcp.dayBreak;`
, [userId, code, model, userId, code], myOptions);
};
};

View File

@ -0,0 +1,30 @@
const {models} = require('vn-loopback');
describe('workerActivity insert()', () => {
const ctx = beforeAll.getCtx(1106);
it('should insert in workerActivity', async() => {
const tx = await models.WorkerActivity.beginTransaction({});
let count = 0;
const options = {transaction: tx};
try {
await models.WorkerActivityType.create(
{'code': 'STOP', 'description': 'STOP'}, options
);
await models.WorkerActivity.add(ctx, 'STOP', 'APP', options);
count = await models.WorkerActivity.count(
{'workerFK': 1106}, options
);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
expect(count).toEqual(1);
});
});

View File

@ -28,6 +28,9 @@
"Company": {
"dataSource": "vn"
},
"Config": {
"dataSource": "vn"
},
"Continent": {
"dataSource": "vn"
},
@ -64,6 +67,9 @@
"EmailUser": {
"dataSource": "vn"
},
"Expedition_PrintOut": {
"dataSource": "vn"
},
"Image": {
"dataSource": "vn"
},
@ -112,6 +118,9 @@
"NotificationSubscription": {
"dataSource": "vn"
},
"OrmConfig": {
"dataSource": "vn"
},
"Province": {
"dataSource": "vn"
},
@ -166,6 +175,9 @@
"ViaexpressConfig": {
"dataSource": "vn"
},
"VnToken": {
"dataSource": "vn"
},
"VnUser": {
"dataSource": "vn"
},
@ -189,5 +201,8 @@
},
"RouteConfig": {
"dataSource": "vn"
},
"MrwService": {
"dataSource": "vn"
}
}

View File

@ -3,6 +3,7 @@ module.exports = Self => {
require('../methods/collection/setSaleQuantity')(Self);
require('../methods/collection/previousLabel')(Self);
require('../methods/collection/getTickets')(Self);
require('../methods/collection/assignCollection')(Self);
require('../methods/collection/assign')(Self);
require('../methods/collection/getSales')(Self);
};

22
back/models/config.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "Config",
"base": "VnModel",
"options": {
"mysql": {
"table": "config"
}
},
"properties": {
"inventoried": {
"type": "date"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
]
}

View File

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

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "salix.defaultViewConfig"
"table": "salix.defaultViewMultiConfig"
}
},
"properties": {

View File

@ -0,0 +1,22 @@
{
"name": "Expedition_PrintOut",
"base": "VnModel",
"options": {
"mysql": {
"table": "dipole.expedition_PrintOut"
}
},
"properties": {
"expeditionFk": {
"type": "number",
"id": true,
"description": "id expeditionFk"
},
"itemFk": {
"type": "number"
},
"isChecked": {
"type": "boolean"
}
}
}

View File

@ -1,4 +1,60 @@
module.exports = Self => {
require('../methods/mrw-config/createShipment')(Self);
require('../methods/mrw-config/getLabel')(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');
};
Self.getClientType = async function(expeditionFk) {
if (!expeditionFk) throw new UserError(`No expeditionFk defined`);
const {clientTypeWidth} = await Self.getConfig();
const result = await Self.app.models.Expedition.findById(expeditionFk,
{include: [{
relation: 'ticket',
scope: {
include: {
relation: 'agencyMode',
scope: {
include: {
relation: 'mrwService',
}
}
}
}
}]}
);
const clientType = result?.ticket()?.agencyMode()?.mrwService()?.clientType;
if (!clientType || !clientTypeWidth) throw new UserError(`ClientType not available`);
return clientType.toString().padStart(clientTypeWidth, '0');
};
};

View File

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

View File

@ -0,0 +1,33 @@
{
"name": "MrwService",
"base": "VnModel",
"options": {
"mysql": {
"table": "mrwService"
}
},
"properties": {
"agencyModeCodeFk": {
"id": true,
"type": "string",
"required": true
},
"clientType": {
"type": "number",
"required": true
},
"serviceType": {
"type": "number"
},
"kg": {
"type": "number"
}
},
"relations": {
"agency": {
"type": "hasOne",
"model": "AgencyMode",
"foreignKey": "code"
}
}
}

View File

@ -0,0 +1,26 @@
{
"name": "OrmConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "ormConfig"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"selectLimit": {
"type": "number"
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
}
]
}

View File

@ -9,7 +9,8 @@
"properties": {
"code": {
"id": true,
"type": "string"
"type": "string",
"required": true
}
},
"relations": {

View File

@ -3,15 +3,21 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "productionConfig"
"table": "productionConfig"
}
},
},
"properties": {
"id": {
"type": "number",
"required": true,
"id": true
},
"sectorFromCode": {
"type": "string"
},
"sectorToCode": {
"type": "string"
},
"backupPrinterNotificationDelay": {
"type": "string"
}

View File

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

View File

@ -12,7 +12,8 @@
"type": "number"
},
"name": {
"type": "string"
"type": "string",
"required": true
}
},
"relations": {

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "userConfig"
"table": "userMultiConfig"
}
},
"properties": {

5
back/models/vn-token.js Normal file
View File

@ -0,0 +1,5 @@
const vnModel = require('vn-loopback/common/models/vn-model');
module.exports = function(Self) {
vnModel(Self);
require('../methods/vn-token/killSession')(Self);
};

22
back/models/vn-token.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "VnToken",
"base": "AccessToken",
"options": {
"mysql": {
"table": "salix.AccessToken"
}
},
"properties": {
"created": {
"type": "date"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "userId"
}
},
"hidden": ["id"]
}

View File

@ -101,9 +101,10 @@ module.exports = function(Self) {
const headers = httpRequest.headers;
const origin = headers.origin;
const defaultHash = '/reset-password?access_token=$token$';
const defaultHash = '!/reset-password?access_token=$token$';
const recoverHashes = {
hedera: 'verificationToken=$token$'
hedera: '!verificationToken=$token$',
lilium: '/resetPassword?access_token=$token$'
};
const app = info.options?.app;
@ -115,7 +116,7 @@ module.exports = function(Self) {
const params = {
recipient: info.email,
lang: user.lang,
url: origin + '/#!' + recoverHash
url: origin + '/#' + recoverHash
};
const options = Object.assign({}, info.options);

View File

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

View File

@ -0,0 +1,3 @@
module.exports = Self => {
require('../methods/workerActivity/add')(Self);
};

View File

@ -22,18 +22,18 @@
},
"description": {
"type": "string"
}
},
"relations": {
"workerFk": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"relations": {
"workerFk": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"workerActivityTypeFk": {
"type": "belongsTo",
"model": "WorkerActivityType",
"foreignKey": "workerActivityTypeFk"
}
"workerActivityTypeFk": {
"type": "belongsTo",
"model": "WorkerActivityType",
"foreignKey": "workerActivityTypeFk"
}
}
}

View File

@ -2,6 +2,6 @@ apps:
- script: ./loopback/server/server.js
name: salix-back
instances: 1
max_restarts: 3
restart_delay: 15000
max_restarts: 0
autorestart: false
node_args: --tls-min-v1.0 --openssl-legacy-provider

View File

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

View File

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

@ -9,7 +9,7 @@
},
"vn": {
"view": {
"expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345"
"expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e"
}
}
}

File diff suppressed because it is too large Load Diff

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 ('','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','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','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','');
@ -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','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','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','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','');
@ -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 ('','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','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 ('','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','');
@ -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 ('','vn2008','buyer','Tintas','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Movimientos','juan@%','0000-00-00 00:00:00','Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','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','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','');
@ -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','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','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','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','');
@ -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','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 ('','vn','employee','businessReasonEnd','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
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','employee','business','alexm@%','0000-00-00 00:00:00','Select','');
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','administrative','buy','alexm@db-proxy2.servers.dc.verdnatura.es','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','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','');
@ -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','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','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','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','');
@ -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 ('','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 ('','vn','employee','awb','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Origen','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pago','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awb','alexm@%','0000-00-00 00:00:00','Update','');
@ -468,6 +464,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Reservas
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','address','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','pbx','grafana','queue','root@localhost','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','address','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountingType','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelvingStock_byWarehouse','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -485,7 +482,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','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 ('','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','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','');
@ -638,7 +634,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','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','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','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','');
@ -647,7 +642,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','pgcMaster','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','inventoryFailure','alexm@%','0000-00-00 00:00:00','Select','');
@ -744,7 +739,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','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','buyer','buy','alexm@%','0000-00-00 00:00:00','Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','buy','carlosap@10.5.1.8','0000-00-00 00:00:00','Select,Update,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','packager','packingSiteLog','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
@ -759,9 +754,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','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','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','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 ('','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','');
@ -784,6 +778,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleState
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleEvent','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','cooler','Tintas','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','itemBotanical','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','productionConfigLog','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','signInLog','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','ticketTracking','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionState','alexm@%','0000-00-00 00:00:00','Select','');
@ -794,6 +789,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','printServerQueue__
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','buy','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Movimientos','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','buy','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemMinimumQuantity','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','receipt','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','producer','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','link','alexm@%','0000-00-00 00:00:00','Select','');
@ -909,7 +905,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','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 ('','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','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','');
@ -934,16 +929,14 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','tillConfig',
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','till','juan@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','till','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicleState','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicleInvoiceIn','alexm@%','0000-00-00 00:00:00','Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','sectorCollectionSaleGroup','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicleEvent','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicleDms','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','vehicle','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicle','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Agencias','alexm@%','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicleDms','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','expeditionStateType','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketState','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleInvoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','vehicleNotes','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicleState','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','volumeConfig','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','ticketTrackingState','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
@ -982,7 +975,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceCorre
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','XDiario','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','workerTimeControlMail','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerTimeControl','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bi','financial','Greuge_Evolution','alexm@%','0000-00-00 00:00:00','Select','');
@ -1011,7 +1004,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','calendar','juan@db-
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','campaign','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketService','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','report','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buyer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buyer','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','bs','grafana','defaulter','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','componentType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientManaCache','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1048,7 +1041,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','userSession','j
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','receipt','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','buy','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','calendarHolidays','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parking','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','parking','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','role','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','errorLogApp','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','continent','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1282,7 +1275,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bs','grafana','workerProductivityC
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','antenna','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','cmr','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','accounting','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditClassification','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','creditClassification','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketLog','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','moving','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimDevelopment','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1297,10 +1290,12 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','buffer','juan@db-p
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greuge','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select,Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','agencyIncoming','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','addressObservation','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','entryOrder','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','machineDms','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
@ -1350,7 +1345,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','warehouse
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','component','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','config','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','componentType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDms','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','priceFixed','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','itemShelvingSale','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logisticAssist','tagAbbreviation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','ticketTracking','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
@ -1361,7 +1356,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','sale_freight
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accounting','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accounting','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketRequest','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Vehiculos_consumo','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','budgetState','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleState','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','expeditionState','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','specialPrice','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -1384,6 +1381,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','professionalCategor
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','ticketObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNoteState','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deliveryNote','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','inventoryConfig','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','comparative','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','invoiceOutExpense','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','delivery','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','entry','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
@ -1396,25 +1395,75 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','waste','alexm@db-prox
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','grafana','visit','root@localhost','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','roadmapStop','guillermo@10.5.1.3','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','antenna','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','bufferPool','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','enteringLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','expeditionLoading','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','failureLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','movingLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBos','sorterLog','guillermo@10.5.1.3','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','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','itemMinimumQuantity','guillermo@db-proxy1.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 ('','vn','administrative','clientInforma','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','solunionCAP','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','clientUnpaid','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','pay_dem','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','invoiceOut','guillermo@10.5.1.3','0000-00-00 00:00:00','Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','invoiceOut','guillermo@10.5.1.3','0000-00-00 00:00:00','Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','accountDetail','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','accountDetail','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBoss','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','antenna','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','bufferPool','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','enteringLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','expeditionLoading','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','failureLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','movingLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenanceBoss','sorterLog','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
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 ('','hedera','employee','shelfMultiConfig','jenkins@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientConfig','carlosap@db-proxy1.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','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','buy','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','entryType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','claimDestination','juan@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','entryLog','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','dipole','grafana','expedition_PrintOut','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketObservation','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','recovery','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','observationType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientInforma','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','accountingType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','bankPolicyDetail','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','bankPolicyReview','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','bankPolicy','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','edi','hedera-web','imapMultiConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','salesAssistant','orderConfig','root@localhost','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemEntryOut','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemEntryIn','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingSale','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','packaging','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','rate','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleDms','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleInvoiceIn','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleNotes','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','saleGroup','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1474,28 +1523,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 ('','account','grafana','user','name','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','account','grafana','user','active','0000-00-00 00:00:00','Select');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','editorFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','expenseFkDeductible','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','withholdingSageFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','isVatDeductible','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','bookEntried','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','siiTrascendencyInvoiceInFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusTaxBreakFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusSubjectOpFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','cplusRectificationTypeFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','siiTypeInvoiceInFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','operated','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','booked','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','docFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','companyFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','created','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','currencyFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','supplierRef','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','issued','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','supplierFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','serial','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','serialNumber','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','administrative','invoiceIn','id','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','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','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');
@ -1904,7 +1935,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','invoiceoutboo
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticket_gettax','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','productionAssi','midnight','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','dipole','employee','expedition_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticketstateupdate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_transfer','PROCEDURE','alexm@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','itempacking','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','ticket_clone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','cache','employee','available_refresh','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@ -2034,7 +2065,7 @@ 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 ('','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','itemshelvingtransfer','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_addByCollection','PROCEDURE','carlosap@db-proxy1.servers.dc.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','item_getsimilar','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2086,7 +2117,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_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','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_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');
@ -2139,9 +2169,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByAwb'
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','hr','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','financial','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','supplier_statementWithEntries','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','XDiario_check','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','travel_getDetailFromContinent','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2151,6 +2179,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','artificialBoss','confection_co
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','remittance_calc','PROCEDURE','alexm@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','developer','connection_kill','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','client_getRisk','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','account','developer','user_hasRole','FUNCTION','root@localhost','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financialBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','balance_create','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPricesByEntry','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2160,6 +2189,19 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_recalcPrice
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_recalcPricesByBuy','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_nextTx','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_docompensation','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_setQuantity','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_unpicked','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_getAssigned','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_addWithReservation','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_addBySectorCollection','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','sectorCollection_hasSalesReserved','FUNCTION','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_reallocate','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemShelvingSale_setPicked','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','sectorCollection_getMyPartial','PROCEDURE','carlosap@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','grafana-write','item_ValuateInventory','PROCEDURE','guillermo@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','guest','ticketCalculatePurge','PROCEDURE','jenkins@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buy_getUltimate','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -2200,10 +2242,11 @@ 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 ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','grafana-write','{\"access\":0,\"version_id\":101106,\"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 ('','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\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','hrBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','invoicing','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
@ -2215,8 +2258,8 @@ INSERT IGNORE INTO `global_priv` VALUES ('','logisticAssist','{\"access\":0,\"v
INSERT IGNORE INTO `global_priv` VALUES ('','logisticBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','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 ('','maintenanceBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\"version_id\":101106,\"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 ('','marketingBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
@ -2235,6 +2278,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 ('','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 ('','teamBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
/*!40000 ALTER TABLE `global_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1 +1,10 @@
-- Executed after dump
CREATE USER 'vn'@'localhost';
GRANT SELECT,
INSERT,
UPDATE,
DELETE,
CREATE TEMPORARY TABLES,
EXECUTE,
TRIGGER
ON *.* TO 'vn'@'localhost';

View File

@ -10,9 +10,6 @@ SET foreign_key_checks = 0;
INSERT INTO util.config (id, environment, mockTime, mockUtcTime, mockEnabled)
VALUES (1, 'local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
INSERT INTO util.binlogQueue (code,logName, `position`)
VALUES ('mylogger', 'bin.000001', 4);
/* #5483
INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, maxLockTime, defaultSupplierFk)
VALUES(1, NULL, 1, 300, 1);
@ -314,5 +311,4 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`)
SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option`
FROM mysql.roles_mapping
WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost;
FLUSH PRIVILEGES;

View File

@ -108,6 +108,7 @@ INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
UPDATE `vn`.`worker` SET bossFk = 50 WHERE id = 49;
DELETE FROM `vn`.`worker` WHERE firstName ='customer';
@ -115,10 +116,13 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
VALUES
(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`)
VALUES
(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'),
(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'),
@ -301,6 +305,17 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
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 `code` = 'refund' WHERE `id` = 23;
@ -398,7 +413,7 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
(1103, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(1104, -30, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH));
INSERT INTO `vn`.`mandateType`(`id`, `name`)
INSERT INTO `vn`.`mandateType`(`id`, `code`)
VALUES
(1, 'B2B'),
(2, 'CORE'),
@ -528,7 +543,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`)
(5, 'Administrative', 'administrative'),
(6, 'Weight', 'weight'),
(7, 'InvoiceOut', 'invoiceOut'),
(8, 'DropOff', 'dropOff');
(8, 'DropOff', 'dropOff'),
(9, 'Sustitución', 'substitution');
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
VALUES
@ -567,6 +583,7 @@ INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`
VALUES
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL),
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
@ -617,7 +634,7 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
@ -728,45 +745,45 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3),
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5);
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`)
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`)
VALUES
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1),
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2),
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3),
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL),
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL),
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, NULL),
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL, NULL),
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL, NULL),
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL, NULL),
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(33, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(34, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1103, 'BEJAR', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
(35, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Somewhere in Philippines', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
(36, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Ant-Man Adventure', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL),
(37, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1110, 'Deadpool swords', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL);
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'hasHighRisk', 901.4),
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2, 'hasHighRisk', 901.4),
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3, NULL, NULL),
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL, NULL, NULL),
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL, NULL, NULL),
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, NULL, 'hasHighRisk', 901.4),
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, 'isTooLittle', NULL),
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasTicketRequest', NULL),
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, 'isFreezed', NULL),
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, 388.7),
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, 388.7),
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL, NULL, 'isFreezed', NULL),
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL, NULL, 'isTaxDataChecked', NULL),
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL, 'isTaxDataChecked', NULL),
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL, 'isTaxDataChecked', NULL),
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL, 'isTaxDataChecked', NULL),
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasTicketRequest, hasHighRisk', 901.4),
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, 'hasHighRisk', 901.4),
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, 901.4),
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(33, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(34, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1103, 'BEJAR', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(35, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Somewhere in Philippines', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(36, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1102, 'Ant-Man Adventure', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL),
(37, 1, 1, 1, 3, util.VN_CURDATE(), util.VN_CURDATE(), 1110, 'Deadpool swords', 123, NULL, 0, 1, 16, 0, util.VN_CURDATE(), NULL, NULL, NULL, NULL);
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
@ -839,9 +856,9 @@ INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`,
INSERT INTO `vn`.`greugeType`(`id`, `name`, `code`)
VALUES
(1, 'Diff', 'diff'),
(2, 'Recover', 'recover'),
(2, 'Recovery', 'recovery'),
(3, 'Mana', 'mana'),
(4, 'Reclaim', 'reclaim'),
(4, 'Claim', 'claim'),
(5, 'Heritage', 'heritage'),
(6, 'Miscellaneous', 'miscellaneous'),
(7, 'Freight Pickup', 'freightPickUp');
@ -978,6 +995,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()),
(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`)
VALUES
(71,0.141,1);
@ -1036,50 +1061,50 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`,
(2, 2, 2, 1, util.VN_CURDATE(), NULL),
(3, 3, 2, 4, util.VN_CURDATE(), NULL);
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`, `problem`)
VALUES
(1, 1, 1, 'Ranged weapon longbow 200cm', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(3, 1, 1, 'Ranged weapon longbow 200cm', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.74, 0, 0, 0, util.VN_CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE()),
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()),
(11, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(12, 4, 16, 'Melee weapon heavy shield 100cm', 20, 1.71, 0, 0, 0, util.VN_CURDATE()),
(13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE()),
(14, 1, 8, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()),
(15, 1, 19, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE()),
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(18, 4, 22, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(19, 1, 4, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)),
(20, 1, 5, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)),
(21, 1, 6, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(22, 1, 7, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(23, 1, 9, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(24, 1, 10, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(25, 4, 12, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(26, 4, 13, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(27, 4, 14, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(28, 4, 15, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(29, 4, 17, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(30, 4, 18, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()),
(32, 1, 24, 'Ranged weapon longbow 200cm', -1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()),
(34, 4, 28, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(35, 4, 29, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(37, 4, 31, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(36, 4, 30, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(39, 1, 32, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()),
(40, 2, 34, 'Melee weapon combat fist 15cm', 10.00, 3.91, 0, 0, 0, util.VN_CURDATE()),
(41, 2, 35, 'Melee weapon combat fist 15cm', 8.00, 3.01, 0, 0, 0, util.VN_CURDATE()),
(42, 2, 36, 'Melee weapon combat fist 15cm', 6.00, 2.50, 0, 0, 0, util.VN_CURDATE());
(1, 1, 1, 'Ranged weapon longbow 200cm', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
(3, 1, 1, 'Ranged weapon longbow 200cm', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 'hasComponentLack'),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.74, 0, 0, 0, util.VN_CURDATE(), NULL),
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE(), NULL),
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE(), NULL),
(11, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
(12, 4, 16, 'Melee weapon heavy shield 100cm', 20, 1.71, 0, 0, 0, util.VN_CURDATE(), NULL),
(13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE(), NULL),
(14, 1, 8, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
(15, 1, 19, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE(), NULL),
(16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 'hasComponentLack'),
(18, 4, 22, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 'hasComponentLack'),
(19, 1, 4, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 'hasComponentLack'),
(20, 1, 5, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 'hasComponentLack'),
(21, 1, 6, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 'hasComponentLack'),
(22, 1, 7, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(23, 1, 9, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(24, 1, 10, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(25, 4, 12, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(26, 4, 13, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(27, 4, 14, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(28, 4, 15, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(29, 4, 17, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(30, 4, 18, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE(), NULL),
(32, 1, 24, 'Ranged weapon longbow 200cm', -1, 8.07, 0, 0, 0, util.VN_CURDATE(), NULL),
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE(), NULL),
(34, 4, 28, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(35, 4, 29, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(37, 4, 31, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), NULL),
(36, 4, 30, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), 'hasComponentLack'),
(39, 1, 32, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(40, 2, 34, 'Melee weapon combat fist 15cm', 10.00, 3.91, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(41, 2, 35, 'Melee weapon combat fist 15cm', 8.00, 3.01, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack'),
(42, 2, 36, 'Melee weapon combat fist 15cm', 6.00, 2.50, 0, 0, 0, util.VN_CURDATE(), 'hasComponentLack');
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
VALUES
@ -1477,7 +1502,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),
(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),
(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`)
VALUES
@ -1488,25 +1514,30 @@ 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'),
(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'),
(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 `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1);
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`)
VALUES
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Colombia', 2, 1, '35074', '687', '2.0'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Mini', 3, 1, '1777', '13', '0.7'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation Short', 4, 1, '3182', '59', '0.6'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Crisantemo', 5, 1, '1747', '13', '0.7'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Lilium Oriental', 6, 1, '7182', '59', '0.6'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Alstroemeria', 7, 1, '1777', '13', '0.7'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 1, 1, '4181', '59', '0.6'),
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Cymbidium', 2, 1, '7268', '59', '0.6'),
('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Containers', 2, 1, '-74', '0', '0.0'),
('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Packagings', 3, 1, '-7', '0', '0.0'),
('DavidCharlesHaller', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Freight', 4, 1, '1100', '0', '0.0'),
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Funeral Accessories', 5, 1, '848', '-187', '-22.1'),
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', 6, 1, '186', '0', '0.0'),
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', 7, 1, '277', '0', '0.0');
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'),
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20');
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
VALUES
@ -1885,9 +1916,9 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
(1, 31, 4, 21, 2),
(2, 32, 3, 21, 3);
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`, `monthsToRefund`, `minShipped`)
VALUES
(1, 50);
(1, 5, 4, '2016-10-01');
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
VALUES
@ -1942,7 +1973,7 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`)
(21, 21),
(22, 22);
INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`)
INSERT INTO `vn`.`userMultiConfig` (`userFk`, `warehouseFk`, `companyFk`)
VALUES
(1, 1, 69),
(5, 1, 442),
@ -2868,7 +2899,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(5, 'modified-entry', 'An entry has been modified'),
(6, 'book-entry-deleted', 'accounting entries deleted'),
(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`;
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
@ -2881,7 +2913,8 @@ INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
(5, 9),
(6, 9),
(7, 9),
(8, 66);
(8, 66),
(9, 56);
TRUNCATE `util`.`notificationQueue`;
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
@ -3230,7 +3263,6 @@ INSERT IGNORE INTO vn.itemType
workerFk = 103,
isInventory = TRUE,
life = 10,
density = 250,
itemPackingTypeFk = NULL,
temperatureFk = 'warm';
@ -3845,6 +3877,13 @@ INSERT INTO `vn`.`ledgerCompany` SET
INSERT INTO `vn`.`ledgerConfig` SET
maxTolerance = 0.01;
INSERT INTO vn.trainingCourse (workerFk,trainingCourseTypeFk,centerFk,started,ended,hasDiscount,hasDiploma)
VALUES
(9,2,1,'2018-06-20 00:00:00.000','2020-06-24 00:00:00.000',0,1),
(9,1,2,'2018-06-20 00:00:00.000','2020-06-24 00:00:00.000',1,0),
(9,2,2,'2018-06-20 00:00:00.000','2020-06-24 00:00:00.000',1,1);
INSERT INTO vn.sectorCollection
SET id = 2,
userFk = 18,
@ -3882,3 +3921,54 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
(1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5);
INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(1, 1106, 1, '2000-01-01', '08:10', 1, 200.0, NULL, '');
INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(2, 1106, 2, '2001-01-01', '09:10', 0, 10.0, NULL, NULL);
INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
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 vn.workerIncome
(debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
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, code)
VALUES
(1, 'IBAN', 'iban'),
(2, 'SWIFT', 'swift'),
(3, 'Referencia Remesas', 'remRef'),
(4, 'Referencia Transferencias', 'trnRef'),
(5, 'Referencia Nominas', 'payRef'),
(6, 'ABA', 'aba');
INSERT IGNORE INTO ormConfig
SET id =1,
selectLimit = 1000;

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

@ -1,167 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`claim_ratio_routine`()
BEGIN
DECLARE vMonthToRefund INT DEFAULT 4;
/*
* PAK 2015-11-20
* Se trata de añadir a la tabla Greuges todos los
* cargos que luego vamos a utilizar para calcular el recobro
*/
-- Reclamaciones demasiado sensibles
INSERT INTO vn.greuge(shipped, clientFk, description,
amount, greugeTypeFk, ticketFk)
SELECT c.ticketCreated
, c.clientFk
, concat('Claim ', c.id,' : ', s.concept)
,round( -1 * ((c.responsibility -1)/4) * s.quantity *
s.price * (100 - s.discount) / 100, 2)
, 4
, s.ticketFk
FROM vn.sale s
JOIN vn.claimEnd ce ON ce.saleFk = s.id
JOIN vn.claim c ON c.id = ce.claimFk
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3;
-- Reclamaciones que pasan a Maná
INSERT INTO vn.greuge(shipped, clientFk, description,
amount, greugeTypeFk, ticketFk)
SELECT c.ticketCreated
, c.clientFk
, concat('Claim_mana ',c.id,' : ', s.concept)
,round( ((c.responsibility -1)/4) * s.quantity * s.price * (100 - s.discount) / 100, 2)
,3
,s.ticketFk
FROM vn.sale s
JOIN vn.claimEnd ce ON ce.saleFk = s.id
JOIN vn.claim c ON c.id = ce.claimFk
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3
AND c.isChargedToMana;
-- Marcamos para no repetir
UPDATE vn.claimEnd ce
JOIN vn.claim c ON c.id = ce.claimFk
SET ce.isGreuge = TRUE
WHERE ce.claimDestinationFk NOT IN (1,5)
AND NOT ce.isGreuge
AND c.claimStateFk = 3;
-- Recobros
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
CREATE TEMPORARY TABLE tmp.ticket_list
(PRIMARY KEY (Id_Ticket))
SELECT DISTINCT t.id Id_Ticket
FROM vn.saleComponent sc
JOIN vn.sale s ON sc.saleFk = s.id
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.ticketLastState ts ON ts.ticketFk = t.id
JOIN vn.ticketTracking tt ON tt.id = ts.ticketTrackingFk
JOIN vn.state st ON st.id = tt.stateFk
JOIN vn.alertLevel al ON al.code = 'DELIVERED'
WHERE sc.componentFk = 17
AND sc.isGreuge = 0
AND t.shipped >= '2016-10-01'
AND t.shipped < util.VN_CURDATE()
AND st.alertLevel >= al.id;
DELETE g.*
FROM vn.greuge g
JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket
WHERE g.greugeTypeFk = 2;
INSERT INTO vn.greuge(clientFk, description, amount,shipped,
greugeTypeFk, ticketFk)
SELECT t.clientFk
,concat('recobro ', s.ticketFk), - round(SUM(sc.value*s.quantity),2)
AS dif,
date(t.shipped)
, 2
,tt.Id_Ticket
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.id
JOIN vn.saleComponent sc
ON sc.saleFk = s.id AND sc.componentFk = 17
GROUP BY t.id
HAVING ABS(dif) > 1;
UPDATE vn.saleComponent sc
JOIN vn.sale s ON s.id = sc.saleFk
JOIN tmp.ticket_list tt ON tt.Id_Ticket = s.ticketFk
SET sc.isGreuge = 1
WHERE sc.componentFk = 17;
/*
* Recalculamos la ratio de las reclamaciones, que luego
* se va a utilizar en el recobro
*/
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
SELECT id, 0,0,0,0
FROM vn.client;
REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro)
SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones,
round(Reclamaciones / (12*fm.Consumo),4), 0
FROM bi.facturacion_media_anual fm
LEFT JOIN(
SELECT c.clientFk, round(sum(-1 * ((c.responsibility -1)/4) *
s.quantity * s.price * (100 - s.discount) / 100))
AS Reclamaciones
FROM vn.sale s
JOIN vn.claimEnd ce ON ce.saleFk = s.id
JOIN vn.claim c ON c.id = ce.claimFk
WHERE ce.claimDestinationFk NOT IN (1,5)
AND c.claimStateFk = 3
AND c.ticketCreated >= TIMESTAMPADD(YEAR, -1, util.VN_CURDATE())
GROUP BY c.clientFk
) claims ON claims.clientFk = fm.Id_Cliente;
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
UPDATE bi.claims_ratio cr
JOIN (
SELECT clientFk Id_Cliente, IFNULL(SUM(amount), 0) AS Greuge
FROM vn.greuge
WHERE shipped <= util.VN_CURDATE()
GROUP BY clientFk
) g ON g.Id_Cliente = cr.Id_Cliente
SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) /
(IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3));
-- Protección neonatos
UPDATE bi.claims_ratio cr
JOIN vn.firstTicketShipped fts ON fts.clientFk = cr.Id_Cliente
SET recobro = 0, Ratio = 0
WHERE fts.shipped > TIMESTAMPADD(MONTH,-1,util.VN_CURDATE());
-- CLIENTE 7983, JULIAN SUAU
UPDATE bi.claims_ratio SET recobro = LEAST(0.05, recobro) WHERE Id_Cliente = 7983;
-- CLIENTE 4358
UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 4358;
-- CLIENTE 5523, VERDECORA
UPDATE bi.claims_ratio SET recobro = GREATEST(0.12, recobro) WHERE Id_Cliente = 5523;
-- CLIENTE 15979, SERVEIS VETERINARIS
UPDATE bi.claims_ratio SET recobro = GREATEST(0.05, recobro) WHERE Id_Cliente = 15979;
-- CLIENTE 5189 i 8942, son de CSR i son el mateix client
UPDATE bi.claims_ratio cr
JOIN (SELECT sum(Consumo * recobro)/sum(Consumo) as recobro
FROM bi.claims_ratio
WHERE Id_Cliente IN ( 5189,8942)
) sub
SET cr.recobro = sub.recobro
WHERE Id_Cliente IN ( 5189,8942);
END$$
DELIMITER ;

View File

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

View File

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

View File

@ -1,31 +1,45 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
BEGIN
DECLARE vWeek INT;
DECLARE vYear INT;
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
SELECT week, year
INTO vWeek, vYear
FROM vn.time
WHERE dated = util.VN_CURDATE();
CALL cache.last_buy_refresh(FALSE);
REPLACE bs.waste
SELECT *, 100 * mermas / total as porcentaje
FROM (
SELECT buyer,
year,
week,
family,
itemFk,
itemTypeFk,
floor(sum(value)) as total,
floor(sum(IF(typeFk = 'loses', value, 0))) as mermas
FROM vn.saleValue
where year = vYear and week = vWeek
GROUP BY family, itemFk
) sub
ORDER BY mermas DESC;
SELECT YEAR(t.shipped),
WEEK(t.shipped, 4),
it.workerFk,
it.id,
s.itemFk,
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
SUM(IF(aw.`type`, s.quantity, 0)),
SUM(
IF(
aw.`type` = 'internal',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
),
SUM(
IF(
aw.`type` = 'external',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
)
FROM vn.sale s
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.address a FORCE INDEX (PRIMARY) ON a.id = t.addressFk
LEFT JOIN vn.addressWaste aw ON aw.addressFk = a.id
JOIN vn.warehouse w ON w.id = t.warehouseFk
JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = w.id
JOIN vn.buy b ON b.id = lb.buy_id
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
AND w.isManaged
GROUP BY i.id;
END$$
DELIMITER ;

View File

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

View File

@ -1,5 +1,10 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(
OUT `vCalc` INT,
`vRefresh` INT,
`vWarehouse` INT,
`vDated` DATE
)
proc: BEGIN
DECLARE vStartDate DATE;
DECLARE vReserveDate DATETIME;
@ -121,7 +126,7 @@ proc: BEGIN
)sub
GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, itemRange;
DROP TEMPORARY TABLE tmp.itemCalc, itemRange, tmp.itemList;
CALL cache_calc_end (vCalc);
END$$
DELIMITER ;

View File

@ -0,0 +1,31 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`(
`vItem` INT,
`vWarehouse` INT,
`vDated` DATE,
`vQuantity` INT
)
BEGIN
/**
* Immediately deduct/add an amount from the available cache (if exists).
*
* @param vItem The item id
* @param vWarehouse The warehouse id
* @param vDated Available cache date
* @param vQuantity The amount to be deducted from the cache
*/
DECLARE vCalc INT;
SELECT id INTO vCalc
FROM cache_calc
WHERE cacheName = 'available'
AND params = CONCAT_WS('/', vWarehouse, vDated);
IF vCalc IS NOT NULL THEN
UPDATE available
SET available = available - vQuantity
WHERE calc_id = vCalc
AND item_id = vItem;
END IF;
END$$
DELIMITER ;

View File

@ -4,7 +4,7 @@ proc: BEGIN
/**
* Crea o actualiza la cache con la última compra y fecha de cada
* artículo hasta ayer. Para obtener la última compra hasta una fecha
* determinada utilizar el procedimiento vn.buyUltimate().
* determinada utilizar el procedimiento vn.buy_getUltimate().
*
* @param vRefresh %TRUE para forzar el recálculo de la cache
*/
@ -30,7 +30,7 @@ proc: BEGIN
SELECT inventoried INTO started FROM vn.config LIMIT 1;
SET ended = util.VN_CURDATE(); -- TIMESTAMPADD(DAY, -1, util.VN_CURDATE());
CALL vn.buyUltimateFromInterval(NULL, started, ended);
CALL vn.buy_getUltimateFromInterval(NULL, NULL, started, ended);
DELETE FROM last_buy;

View File

@ -1,13 +1,13 @@
DELIMITER $$
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
BEGIN
CALL cache_calc_unlock (v_calc);
RESIGNAL;
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
LEAVE proc;
@ -15,22 +15,26 @@ proc: BEGIN
-- Calculamos el stock hasta ayer
CALL `cache`.stock_refresh(false);
CALL cache.stock_refresh(false);
CREATE OR REPLACE TEMPORARY TABLE tmp.itemVisible
(PRIMARY KEY (item_id))
ENGINE = MEMORY
SELECT item_id, amount stock, amount visible FROM `cache`.stock
WHERE warehouse_id = v_warehouse;
SELECT s.item_id, SUM(s.amount) stock, SUM(s.amount) visible
FROM stock s
JOIN vn.warehouse w ON w.id = s.warehouse_id
WHERE (v_warehouse IS NULL OR s.warehouse_id = v_warehouse)
AND w.isComparative
GROUP BY s.item_id;
-- 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;
INSERT INTO visible (calc_id, item_id,visible)
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;
END$$

View File

@ -7,7 +7,6 @@ BEGIN
*/
DECLARE vRewriteKop INT DEFAULT NULL;
DECLARE vTruncatePutOrder INT DEFAULT NULL;
DECLARE vBarcode CHAR(15) DEFAULT NULL;
DECLARE vKop INT;
DECLARE vPutOrderFk BIGINT;
@ -16,17 +15,6 @@ BEGIN
FROM ekt
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
IF vKop IS NULL THEN
@ -46,10 +34,9 @@ BEGIN
-- Refresh EKT
UPDATE ekt SET
barcode = vBarcode
,kop = vKop
,putOrderFk = vTruncatePutOrder
UPDATE ekt
SET kop = vKop,
putOrderFk = vTruncatePutOrder
WHERE id = vSelf;
END$$
DELIMITER ;

View File

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

View File

@ -1,22 +0,0 @@
DELIMITER $$
CREATE OR REPLACE
DEFINER=`root`@`localhost`
EVENT `floranet`.`clean`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-01-01 23:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO
BEGIN
DELETE
FROM `order`
WHERE created < CURDATE()
AND isPaid = FALSE;
DELETE c.*
FROM catalogue c
LEFT JOIN `order` o ON o.catalogueFk = c.id
WHERE c.created < CURDATE()
AND o.id IS NULL;
END$$
DELIMITER ;

View File

@ -1,16 +1,15 @@
DROP PROCEDURE IF EXISTS floranet.catalogue_get;
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
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 vPostalCode Delivery address postal code
*/
DECLARE vAddressFk INT;
DECLARE vLastCatalogueFk INT;
DECLARE vLockName VARCHAR(20);
DECLARE vLockTime INT;
@ -32,6 +31,15 @@ proc:BEGIN
SELECT MAX(id) INTO vLastCatalogueFk
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(
name,
price,
@ -51,17 +59,14 @@ proc:BEGIN
it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description,
apc.addressFk
vAddressFk
FROM vn.item i
JOIN (SELECT itemFk, SUM(quantity * cost) price
FROM recipe
GROUP BY itemFk) r ON r.itemFk = i.id
JOIN vn.itemType it ON it.id = i.typeFk
JOIN addressPostCode apc
ON apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
JOIN vn.address a ON a.id = apc.addressFk;
JOIN addressPostCode apc ON addressFk = vAddressFk
JOIN vn.address a ON a.id = vAddressFk;
SELECT *
FROM catalogue

View File

@ -1,8 +1,6 @@
DROP PROCEDURE IF EXISTS floranet.deliveryDate_get;
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
BEGIN
/**

View File

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

View File

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

View File

@ -1,8 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`(
vSelf INT,
vWarehouse INT,
vItem INT,
vWarehouse INT,
vItem INT,
vAmount INT)
BEGIN
/**
@ -47,20 +47,36 @@ BEGIN
FROM tmp.zoneGetShipped
WHERE warehouseFk = vWarehouse;
SELECT IFNULL(available, 0) INTO vAvailable
SELECT available INTO vAvailable
FROM tmp.ticketLot
WHERE warehouseFk = vWarehouse
AND itemFk = vItem;
IF vAvailable IS NULL THEN
SET vAvailable = 0;
END IF;
IF vAmount > vAvailable THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
SELECT IFNULL(minQuantity, 0) INTO vMinQuantity
FROM vn.item
WHERE id = vItem;
WITH itemMinQuantityPriority AS (
SELECT quantity,
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');
END IF;
@ -90,6 +106,8 @@ BEGIN
amount = vAdd,
price = vPrice;
CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd);
SET vRow = LAST_INSERT_ID();
INSERT INTO orderRowComponent (rowFk, componentFk, price)
@ -109,6 +127,6 @@ BEGIN
END IF;
COMMIT;
CALL vn.ticketCalculatePurge;
CALL vn.ticketCalculatePurge;
END$$
DELIMITER ;

View File

@ -1,59 +1,62 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(vSelf INT, vUserId INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(
vSelf INT,
vUserFk INT
)
BEGIN
/**
* Confirms an order, creating each of its tickets on the corresponding
* date, store and user.
* Confirms an order, creating each of its tickets
* on the corresponding date, store and user.
*
* @param vSelf The order identifier
* @param vUser The user identifier
*/
DECLARE vOk BOOL;
DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vWarehouse INT;
DECLARE vHasRows BOOL;
DECLARE vDone BOOL;
DECLARE vWarehouseFk INT;
DECLARE vShipment DATE;
DECLARE vTicket INT;
DECLARE vShipmentDayEnd DATETIME;
DECLARE vTicketFk INT;
DECLARE vNotes VARCHAR(255);
DECLARE vItem INT;
DECLARE vItemFk INT;
DECLARE vConcept VARCHAR(30);
DECLARE vAmount INT;
DECLARE vAvailable INT;
DECLARE vPrice DECIMAL(10,2);
DECLARE vSale INT;
DECLARE vRate INT;
DECLARE vRowId INT;
DECLARE vSaleFk INT;
DECLARE vRowFk INT;
DECLARE vPriceFixed DECIMAL(10,2);
DECLARE vDelivery DATE;
DECLARE vAddress INT;
DECLARE vIsConfirmed BOOL;
DECLARE vClientId INT;
DECLARE vCompanyId INT;
DECLARE vAgencyModeId INT;
DECLARE TICKET_FREE INT DEFAULT 2;
DECLARE vCalc INT;
DECLARE vIsLogifloraItem BOOL;
DECLARE vOldQuantity INT;
DECLARE vNewQuantity INT;
DECLARE vLanded DATE;
DECLARE vAddressFk INT;
DECLARE vClientFk INT;
DECLARE vCompanyFk INT;
DECLARE vAgencyModeFk INT;
DECLARE vCalcFk INT;
DECLARE vIsTaxDataChecked BOOL;
DECLARE cDates CURSOR FOR
SELECT zgs.shipped, r.warehouse_id
DECLARE vDates CURSOR FOR
SELECT zgs.shipped, r.warehouseFk
FROM `order` o
JOIN order_row r ON r.order_id = o.id
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
WHERE o.id = vSelf AND r.amount != 0
GROUP BY r.warehouse_id;
JOIN orderRow r ON r.orderFk = o.id
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouseFk
WHERE o.id = vSelf
AND r.amount
GROUP BY r.warehouseFk;
DECLARE cRows CURSOR FOR
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo
FROM order_row r
JOIN vn.item i ON i.id = r.item_id
WHERE r.amount != 0
AND r.warehouse_id = vWarehouse
AND r.order_id = vSelf
DECLARE vRows CURSOR FOR
SELECT r.id,
r.itemFk,
i.name,
r.amount,
r.price
FROM orderRow r
JOIN vn.item i ON i.id = r.itemFk
WHERE r.amount
AND r.warehouseFk = vWarehouseFk
AND r.orderFk = vSelf
ORDER BY r.rate DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
@ -62,26 +65,36 @@ BEGIN
END;
-- Carga los datos del pedido
SELECT o.date_send, o.address_id, o.note, a.clientFk,
o.company_id, o.agency_id, c.isTaxDataChecked
INTO vDelivery, vAddress, vNotes, vClientId,
vCompanyId, vAgencyModeId, vIsTaxDataChecked
FROM hedera.`order` o
SELECT o.date_send,
o.address_id,
o.note,
a.clientFk,
o.company_id,
o.agency_id,
c.isTaxDataChecked
INTO vLanded,
vAddressFk,
vNotes,
vClientFk,
vCompanyFk,
vAgencyModeFk,
vIsTaxDataChecked
FROM `order` o
JOIN vn.address a ON a.id = o.address_id
JOIN vn.client c ON c.id = a.clientFk
WHERE o.id = vSelf;
-- Verifica si el cliente tiene los datos comprobados
IF NOT vIsTaxDataChecked THEN
CALL util.throw ('clientNotVerified');
CALL util.throw('clientNotVerified');
END IF;
-- Carga las fechas de salida de cada almacen
CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
CALL vn.zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, FALSE);
-- Trabajador que realiza la accion
IF vUserId IS NULL THEN
SELECT employeeFk INTO vUserId FROM orderConfig;
IF vUserFk IS NULL THEN
SELECT employeeFk INTO vUserFk FROM orderConfig;
END IF;
START TRANSACTION;
@ -89,207 +102,188 @@ BEGIN
CALL order_checkEditable(vSelf);
-- Check order is not empty
SELECT COUNT(*) > 0 INTO vHasRows
FROM orderRow
WHERE orderFk = vSelf
AND amount > 0;
SELECT COUNT(*) > 0 INTO vOk
FROM order_row WHERE order_id = vSelf AND amount > 0;
IF NOT vOk THEN
CALL util.throw ('ORDER_EMPTY');
IF NOT vHasRows THEN
CALL util.throw('ORDER_EMPTY');
END IF;
-- Crea los tickets del pedido
OPEN cDates;
lDates:
LOOP
SET vTicket = NULL;
OPEN vDates;
lDates: LOOP
SET vTicketFk = NULL;
SET vDone = FALSE;
FETCH cDates INTO vShipment, vWarehouse;
FETCH vDates INTO vShipment, vWarehouseFk;
IF vDone THEN
LEAVE lDates;
END IF;
-- Busca un ticket existente que coincida con los parametros
WITH tPrevia AS
(SELECT DISTINCT s.ticketFk
SET vShipmentDayEnd = util.dayEnd(vShipment);
-- Busca un ticket libre disponible
WITH tPrevia AS (
SELECT DISTINCT s.ticketFk
FROM vn.sale s
JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
JOIN vn.ticket t ON t.id = s.ticketFk
WHERE t.shipped BETWEEN vShipment AND util.dayend(vShipment)
)
SELECT t.id INTO vTicket
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
)
SELECT t.id INTO vTicketFk
FROM vn.ticket t
JOIN vn.alertLevel al ON al.code = 'FREE'
LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id
JOIN hedera.`order` o
ON o.address_id = t.addressFk
AND vWarehouse = t.warehouseFk
AND o.date_send = t.landed
AND DATE(t.shipped) = vShipment
LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id
JOIN hedera.`order` o ON o.address_id = t.addressFk
AND t.shipped BETWEEN vShipment AND vShipmentDayEnd
AND t.warehouseFk = vWarehouseFk
AND o.date_send = t.landed
WHERE o.id = vSelf
AND t.refFk IS NULL
AND tp.ticketFk IS NULL
AND (tls.alertLevel IS NULL OR tls.alertLevel = al.id)
LIMIT 1;
-- Comprobamos si hay un ticket de previa disponible
IF vTicketFk IS NULL THEN
WITH tItemPackingTypeOrder AS (
SELECT GROUP_CONCAT(
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
) distinctItemPackingTypes,
o.address_id
FROM vn.item i
JOIN hedera.orderRow oro ON oro.itemFk = i.id
JOIN hedera.`order` o ON o.id = oro.orderFk
WHERE oro.orderFk = vSelf
),
tItemPackingTypeTicket AS (
SELECT t.id,
GROUP_CONCAT(
DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
) distinctItemPackingTypes
FROM vn.ticket t
JOIN vn.ticketState tls ON tls.ticketFk = t.id
JOIN vn.alertLevel al ON al.id = tls.alertLevel
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN tItemPackingTypeOrder ipto
WHERE t.shipped BETWEEN vShipment AND vShipmentDayEnd
AND t.refFk IS NULL
AND t.warehouseFk = vWarehouseFk
AND t.addressFk = ipto.address_id
AND al.code = 'ON_PREVIOUS'
GROUP BY t.id
)
SELECT iptt.id INTO vTicketFk
FROM tItemPackingTypeTicket iptt
JOIN tItemPackingTypeOrder ipto
WHERE INSTR(iptt.distinctItemPackingTypes, ipto.distinctItemPackingTypes)
LIMIT 1;
END IF;
-- Crea el ticket en el caso de no existir uno adecuado
IF vTicket IS NULL
THEN
IF vTicketFk IS NULL THEN
SET vShipment = IFNULL(vShipment, util.VN_CURDATE());
CALL vn.ticket_add(
vClientId,
vClientFk,
vShipment,
vWarehouse,
vCompanyId,
vAddress,
vAgencyModeId,
vWarehouseFk,
vCompanyFk,
vAddressFk,
vAgencyModeFk,
NULL,
vDelivery,
vUserId,
vLanded,
vUserFk,
TRUE,
vTicket
vTicketFk
);
ELSE
INSERT INTO vn.ticketTracking
SET ticketFk = vTicket,
userFk = vUserId,
stateFk = TICKET_FREE;
SET ticketFk = vTicketFk,
userFk = vUserFk,
stateFk = (SELECT id FROM vn.state WHERE code = 'FREE');
END IF;
INSERT IGNORE INTO vn.orderTicket
SET orderFk = vSelf,
ticketFk = vTicket;
ticketFk = vTicketFk;
-- Añade las notas
IF vNotes IS NOT NULL AND vNotes != ''
THEN
INSERT INTO vn.ticketObservation SET
ticketFk = vTicket,
observationTypeFk = 4 /* salesperson */ ,
IF vNotes IS NOT NULL AND vNotes <> '' THEN
INSERT INTO vn.ticketObservation
SET ticketFk = vTicketFk,
observationTypeFk = (SELECT id FROM vn.observationType WHERE code = 'salesPerson'),
`description` = vNotes
ON DUPLICATE KEY UPDATE
`description` = CONCAT(VALUES(`description`),'. ', `description`);
END IF;
-- Añade los movimientos y sus componentes
OPEN cRows;
OPEN vRows;
lRows: LOOP
SET vSaleFk = NULL;
SET vDone = FALSE;
FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
FETCH vRows INTO vRowFk, vItemFk, vConcept, vAmount, vPrice;
IF vDone THEN
LEAVE lRows;
END IF;
SET vSale = NULL;
SELECT s.id, s.quantity INTO vSale, vOldQuantity
SELECT s.id INTO vSaleFk
FROM vn.sale s
WHERE ticketFk = vTicket
WHERE ticketFk = vTicketFk
AND price = vPrice
AND itemFk = vItem
AND itemFk = vItemFk
AND discount = 0
LIMIT 1;
IF vSale THEN
IF vSaleFk THEN
UPDATE vn.sale
SET quantity = quantity + vAmount,
originalQuantity = quantity
WHERE id = vSale;
SELECT s.quantity INTO vNewQuantity
FROM vn.sale s
WHERE id = vSale;
WHERE id = vSaleFk;
ELSE
-- Obtiene el coste
SELECT SUM(rc.`price`) valueSum INTO vPriceFixed
FROM orderRowComponent rc
JOIN vn.component c ON c.id = rc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
WHERE rc.rowFk = vRowId;
JOIN vn.componentType ct ON ct.id = c.typeFk
AND ct.isBase
WHERE rc.rowFk = vRowFk;
INSERT INTO vn.sale
SET itemFk = vItem,
ticketFk = vTicket,
SET itemFk = vItemFk,
ticketFk = vTicketFk,
concept = vConcept,
quantity = vAmount,
price = vPrice,
priceFixed = vPriceFixed,
isPriceFixed = TRUE;
SET vSale = LAST_INSERT_ID();
SET vSaleFk = LAST_INSERT_ID();
INSERT INTO vn.saleComponent
(saleFk, componentFk, `value`)
SELECT vSale, rc.componentFk, rc.price
INSERT INTO vn.saleComponent (saleFk, componentFk, `value`)
SELECT vSaleFk, rc.componentFk, rc.price
FROM orderRowComponent rc
JOIN vn.component c ON c.id = rc.componentFk
WHERE rc.rowFk = vRowId
GROUP BY vSale, rc.componentFk;
WHERE rc.rowFk = vRowFk
GROUP BY vSaleFk, rc.componentFk;
END IF;
UPDATE order_row SET Id_Movimiento = vSale
WHERE id = vRowId;
-- Inserta en putOrder si la compra es de Floramondo
IF vIsLogifloraItem THEN
CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment);
SET @available := 0;
SELECT GREATEST(0,available) INTO @available
FROM cache.availableNoRaids
WHERE calc_id = vCalc
AND item_id = vItem;
UPDATE cache.availableNoRaids
SET available = GREATEST(0,available - vAmount)
WHERE item_id = vItem
AND calc_id = vCalc;
INSERT INTO edi.putOrder (
deliveryInformationID,
supplyResponseId,
quantity ,
EndUserPartyId,
EndUserPartyGLN,
FHAdminNumber,
saleFk
)
SELECT di.ID,
i.supplyResponseFk,
CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask),
o.address_id ,
vClientId,
IFNULL(ca.fhAdminNumber, fhc.defaultAdminNumber),
vSale
FROM edi.deliveryInformation di
JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID
JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientId
JOIN edi.floraHollandConfig fhc
JOIN hedera.`order` o ON o.id = vSelf
WHERE i.id = vItem
AND di.LatestOrderDateTime > util.VN_NOW()
AND vAmount > @available
LIMIT 1;
END IF;
UPDATE orderRow
SET saleFk = vSaleFk
WHERE id = vRowFk;
END LOOP;
CLOSE cRows;
CLOSE vRows;
END LOOP;
CLOSE vDates;
CLOSE cDates;
UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW()
UPDATE `order`
SET confirmed = TRUE,
confirm_date = util.VN_NOW()
WHERE id = vSelf;
COMMIT;

View File

@ -10,5 +10,5 @@ AS SELECT `q`.`name` AS `name`,
`c`.`ringInUse` AS `ringinuse`
FROM (
`pbx`.`queue` `q`
JOIN `pbx`.`queueConfig` `c` ON(`q`.`config` = `c`.`id`)
JOIN `pbx`.`queueMultiConfig` `c` ON(`q`.`config` = `c`.`id`)
)

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
BEFORE INSERT ON `ACL`
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 `salix`.`ACL_beforeUpdate`
BEFORE UPDATE ON `ACL`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -1,13 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `srt`.`moving_clean`
ON SCHEDULE EVERY 5 MINUTE
ON SCHEDULE EVERY 15 MINUTE
STARTS '2022-01-21 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
COMMENT 'Llama a srt.moving_clean para que elimine y notifique de registr'
DO BEGIN
CALL srt.moving_clean();
END$$
DO CALL srt.moving_clean()$$
DELIMITER ;

View File

@ -3,61 +3,69 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`moving_clean`()
BEGIN
/**
* Elimina movimientos por inactividad
*
*/
DECLARE vExpeditionFk INT;
DECLARE vBufferToFk INT;
DECLARE vBufferFromFk INT;
DECLARE done BOOL DEFAULT FALSE;
DECLARE cur CURSOR FOR
SELECT m.expeditionFk, m.bufferToFk, m.bufferFromFk
FROM srt.moving m
JOIN srt.config c
JOIN (SELECT bufferFk, SUM(isActive) hasBox
FROM srt.photocell
GROUP BY bufferFk) sub ON sub.bufferFk = m.bufferFromFk
WHERE m.created < TIMESTAMPADD(MINUTE, - c.movingMaxLife , util.VN_NOW())
DECLARE vStateOutFk INT
DEFAULT (SELECT id FROM expeditionState WHERE `description` = 'OUT');
DECLARE vDone BOOL;
DECLARE vSorter CURSOR FOR
SELECT m.expeditionFk, m.bufferFromFk
FROM moving m
JOIN (
SELECT bufferFk, SUM(isActive) hasBox
FROM photocell
GROUP BY bufferFk
) sub ON sub.bufferFk = m.bufferFromFk
WHERE m.created < (util.VN_NOW() - INTERVAL (SELECT movingMaxLife FROM config) MINUTE)
AND NOT sub.hasBox;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN cur;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
bucle: LOOP
OPEN vSorter;
l: LOOP
SET vDone = FALSE;
FETCH vSorter INTO vExpeditionFk, vBufferFromFk;
FETCH cur INTO vExpeditionFk, vBufferToFk, vBufferFromFk;
IF done THEN
LEAVE bucle;
IF vDone THEN
LEAVE l;
END IF;
DELETE FROM srt.moving
START TRANSACTION;
SELECT id
FROM moving
WHERE expeditionFk = vExpeditionFk
FOR UPDATE;
DELETE FROM moving
WHERE expeditionFk = vExpeditionFk;
UPDATE srt.expedition e
JOIN srt.expeditionState es ON es.description = 'OUT'
SET
bufferFk = NULL,
SELECT id
FROM expedition
WHERE id = vExpeditionFk
OR (bufferFk = vBufferFromFk AND `position` > 0)
FOR UPDATE;
UPDATE expedition
SET bufferFk = NULL,
`position` = NULL,
stateFk = es.id
WHERE e.id = vExpeditionFk;
stateFk = vStateOutFk
WHERE id = vExpeditionFk;
UPDATE srt.expedition e
SET e.`position` = e.`position` - 1
WHERE e.bufferFk = vBufferFromFk
AND e.`position` > 0;
CALL vn.mail_insert(
'pako@verdnatura.es, carles@verdnatura.es',
NULL,
CONCAT('Moving_clean. Expedition: ', vExpeditionFk, ' estaba parada'),
CONCAT('Expedition: ', vExpeditionFk,' vBufferToFk: ', vBufferToFk)
);
END LOOP bucle;
CLOSE cur;
UPDATE expedition
SET `position` = `position` - 1
WHERE bufferFk = vBufferFromFk
AND `position` > 0;
COMMIT;
END LOOP l;
CLOSE vSorter;
END$$
DELIMITER ;

View File

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

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`buffer_beforeInsert`
BEFORE INSERT ON `buffer`
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 `srt`.`buffer_beforeUpdate`
BEFORE UPDATE ON `buffer`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

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

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