From 3e522b08b6c7fc93eb36b1721814f6efbfe428f0 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 11 Oct 2023 11:43:21 +0200 Subject: [PATCH 001/116] refs #6184 Added saveCmr --- modules/ticket/back/methods/ticket/saveCmr.js | 82 +++++++++++++++++++ .../ticket/back/methods/ticket/saveSign.js | 3 +- modules/ticket/back/models/ticket-methods.js | 1 + 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 modules/ticket/back/methods/ticket/saveCmr.js diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js new file mode 100644 index 000000000..ce39ba20a --- /dev/null +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -0,0 +1,82 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('saveCmr', { + description: 'Save sign', + accessType: 'WRITE', + accepts: + [ + { + arg: 'tickets', + type: ['number'], + required: true, + description: 'The tickets' + } + ], + http: { + path: `/saveCmr`, + verb: 'POST' + } + }); + + Self.saveCmr = async(ctx, tickets, options) => { + const models = Self.app.models; + const myOptions = {userId: ctx.req.accessToken.userId}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + for (const ticketId of tickets) { + const cmrFk = await models.Ticket.findOne( + {where: {id: ticketId}, + fields: ['cmrFk'] + }, myOptions); + + if (cmrFk) { + const dmsTypeCmr = await models.DmsType.findOne({ + where: {code: 'ticket'}, + fields: ['id'] + }, myOptions); + + const hasDmsCmr = await models.TicketDms.findOne({ + where: { ticketFk: ticketId }, + fields: ['dmsFk'], + include: { + relation: 'dms', + scope: { + where: { dmsTypeFk: dmsTypeCmr } + } + } + }, myOptions); + + if (!hasDmsCmr) { + const zip = await models.Route.downloadCmrsZip(ctx, cmr, myOptions); + const ticket = await models.Ticket.findById(ticketId, null, myOptions); + const ctxUploadFile = Object.assign({}, zip); + ctxUploadFile.args = { + warehouseId: ticket.warehouseFk, + companyId: ticket.companyFk, + dmsTypeId: dmsTypeCmr.id, + reference: '', + description: `Documento comprimido - CMR ${cmrFk}`, + hasFile: false + }; + await models.Dms.uploadFile(ctxUploadFile, myOptions); + } + } + } + if (tx) await tx.commit(); + return; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 9888328e7..015a95afb 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -91,7 +91,7 @@ module.exports = Self => { } ] }, myOptions); - const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); + const dmsType = await models.DmsType.findOne({where: {code: 'ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); if (ticket.route() === null) throw new UserError('Ticket without route'); @@ -131,6 +131,7 @@ module.exports = Self => { const ticket = await models.Ticket.findById(ticketId, null, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [ticketId, 'DELIVERED'], myOptions); + await models.Ticket.saveCmr(ticketId, myOptions); } if (tx) await tx.commit(); diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index 14cb104be..c932548e1 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -41,6 +41,7 @@ module.exports = function(Self) { require('../methods/ticket/collectionLabel')(Self); require('../methods/ticket/expeditionPalletLabel')(Self); require('../methods/ticket/saveSign')(Self); + require('../methods/ticket/saveCmr')(Self); require('../methods/ticket/invoiceTickets')(Self); require('../methods/ticket/docuwareDownload')(Self); }; From d9339af87e0fc92fd05dc5cc20499bd66963adb8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 11 Oct 2023 11:46:56 +0200 Subject: [PATCH 002/116] refs #6184 Insert in ticketCmr --- modules/ticket/back/methods/ticket/saveCmr.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index ce39ba20a..5df4d8ae7 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -22,7 +22,7 @@ module.exports = Self => { Self.saveCmr = async(ctx, tickets, options) => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; - let tx; + let tx, dms; if (typeof options == 'object') Object.assign(myOptions, options); @@ -68,7 +68,8 @@ module.exports = Self => { description: `Documento comprimido - CMR ${cmrFk}`, hasFile: false }; - await models.Dms.uploadFile(ctxUploadFile, myOptions); + dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); } } } From c0089b1fa0b38a0927a046d33c5905cb5f2a4fa2 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 11 Oct 2023 12:20:30 +0200 Subject: [PATCH 003/116] refs #6184 Added cmrFk in ticket model --- modules/ticket/back/methods/ticket/saveCmr.js | 12 +++++------- modules/ticket/back/models/ticket.json | 3 +++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 5df4d8ae7..06dc5b7fb 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -1,8 +1,6 @@ -const UserError = require('vn-loopback/util/user-error'); - module.exports = Self => { Self.remoteMethodCtx('saveCmr', { - description: 'Save sign', + description: 'Save cmr', accessType: 'WRITE', accepts: [ @@ -34,10 +32,10 @@ module.exports = Self => { try { for (const ticketId of tickets) { - const cmrFk = await models.Ticket.findOne( - {where: {id: ticketId}, - fields: ['cmrFk'] - }, myOptions); + const cmrFk = await models.Ticket.findOne({ + where: {id: ticketId}, + fields: ['cmrFk'] + }, myOptions); if (cmrFk) { const dmsTypeCmr = await models.DmsType.findOne({ diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index ec4193bed..b5f2b5ed9 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -63,6 +63,9 @@ }, "weight": { "type": "number" + }, + "cmrFk": { + "type": "number" } }, "relations": { From 3e70cb07e0c0cfdff874323b533ffdd41b738973 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 11 Oct 2023 14:20:35 +0200 Subject: [PATCH 004/116] refs #6184 Changes --- .../back/methods/route/downloadCmrsZip.js | 6 +- modules/route/back/models/cmr.json | 58 +++++++++++++++++++ modules/ticket/back/methods/ticket/saveCmr.js | 37 ++++++------ modules/ticket/back/models/ticket.json | 5 ++ 4 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 modules/route/back/models/cmr.json diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 532e019b6..c3379ab82 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -49,8 +49,12 @@ module.exports = Self => { try { for (let id of ids) { if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); + + const baseUrl = (ctx.req.headers.origin) + ? `${ctx.req.headers.origin}/api` + : `${ctx.req.headers.referer}api` const response = await axios.get( - `${ctx.req.headers.referer}api/Routes/${id}/cmr?access_token=${token.id}`, { + `${baseUrl}/Routes/${id}/cmr?access_token=${token.id}`, { ...myOptions, responseType: 'arraybuffer', }); diff --git a/modules/route/back/models/cmr.json b/modules/route/back/models/cmr.json new file mode 100644 index 000000000..0e2168bed --- /dev/null +++ b/modules/route/back/models/cmr.json @@ -0,0 +1,58 @@ +{ + "name": "Cmr", + "base": "VnModel", + "options": { + "mysql": { + "table": "cmr" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "truckPlate": { + "type": "number" + }, + "observations": { + "type": "string" + }, + "senderInstrucctions": { + "type": "string" + }, + "paymentInstruccions": { + "type": "string" + }, + "specialAgreements": { + "type": "string" + }, + "created": { + "type": "date" + }, + "companyFk": { + "type": "number" + }, + "addressToFk": { + "type": "number" + }, + "addressFromFk": { + "type": "number" + }, + "supplierFk": { + "type": "number" + }, + "packagesList": { + "type": "string" + }, + "merchandiseDetail": { + "type": "string" + }, + "landed": { + "type": "date" + }, + "ead": { + "type": "date" + } + } +} diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 06dc5b7fb..2bd52aaa8 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -20,7 +20,7 @@ module.exports = Self => { Self.saveCmr = async(ctx, tickets, options) => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; - let tx, dms; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); @@ -32,42 +32,43 @@ module.exports = Self => { try { for (const ticketId of tickets) { - const cmrFk = await models.Ticket.findOne({ - where: {id: ticketId}, - fields: ['cmrFk'] - }, myOptions); + const ticket = await models.Ticket.findById(ticketId, myOptions); - if (cmrFk) { - const dmsTypeCmr = await models.DmsType.findOne({ - where: {code: 'ticket'}, + if (ticket.cmrFk) { + const dmsType = await models.DmsType.findOne({ + where: {code: 'cmr'}, fields: ['id'] }, myOptions); const hasDmsCmr = await models.TicketDms.findOne({ where: { ticketFk: ticketId }, - fields: ['dmsFk'], include: { relation: 'dms', + fields: ['dmsFk'], scope: { - where: { dmsTypeFk: dmsTypeCmr } + where: { dmsTypeFk: dmsType.id } } } }, myOptions); - if (!hasDmsCmr) { - const zip = await models.Route.downloadCmrsZip(ctx, cmr, myOptions); - const ticket = await models.Ticket.findById(ticketId, null, myOptions); - const ctxUploadFile = Object.assign({}, zip); + if (!hasDmsCmr.dms()) { + const zip = await models.Route.downloadCmrsZip(ctx, ticket.cmrFk.toString(), myOptions); + let ctxUploadFile; + ctx.req.file = Object.assign({}, zip); + ctxUploadFile = Object.assign({}, ctx); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk, - dmsTypeId: dmsTypeCmr.id, + dmsTypeId: dmsType.id, reference: '', - description: `Documento comprimido - CMR ${cmrFk}`, + description: `Documento comprimido - CMR ${ticket.cmrFk}`, hasFile: false }; - dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); + const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + await models.TicketDms.create({ + ticketFk: ticketId, + dmsFk: dms[0].id + }, myOptions); } } } diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index b5f2b5ed9..4a5205d3d 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -139,6 +139,11 @@ "type": "belongsTo", "model": "Zone", "foreignKey": "zoneFk" + }, + "cmrFk": { + "type": "belongsTo", + "model": "Cmr", + "foreignKey": "cmrFk" } } } From 0771548ef1c5ce9cbff10f2fd427f836aa696458 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 9 Nov 2023 14:14:09 +0100 Subject: [PATCH 005/116] refs #6184 Requested changes --- modules/ticket/back/methods/ticket/saveCmr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 2bd52aaa8..c322dd27c 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -61,7 +61,7 @@ module.exports = Self => { companyId: ticket.companyFk, dmsTypeId: dmsType.id, reference: '', - description: `Documento comprimido - CMR ${ticket.cmrFk}`, + description: `${ticket.cmrFk} - ${ticket.id}`, hasFile: false }; const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); From 2792efa9cd4030d9d6fbf27f48e5c4cf2e6654bf Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 13 Nov 2023 08:36:05 +0100 Subject: [PATCH 006/116] perf: refs #6184 Requested changes --- modules/ticket/back/methods/ticket/saveCmr.js | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index c322dd27c..680e7a1f0 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -31,38 +31,39 @@ module.exports = Self => { } try { + const dmsTypeCmr = await models.DmsType.findOne({ + where: {code: 'cmr'}, + fields: ['id'] + }, myOptions); + for (const ticketId of tickets) { const ticket = await models.Ticket.findById(ticketId, myOptions); if (ticket.cmrFk) { - const dmsType = await models.DmsType.findOne({ - where: {code: 'cmr'}, - fields: ['id'] - }, myOptions); - const hasDmsCmr = await models.TicketDms.findOne({ where: { ticketFk: ticketId }, include: { relation: 'dms', fields: ['dmsFk'], scope: { - where: { dmsTypeFk: dmsType.id } + where: { dmsTypeFk: dmsTypeCmr.id } } } }, myOptions); if (!hasDmsCmr.dms()) { const zip = await models.Route.downloadCmrsZip(ctx, ticket.cmrFk.toString(), myOptions); - let ctxUploadFile; ctx.req.file = Object.assign({}, zip); - ctxUploadFile = Object.assign({}, ctx); - ctxUploadFile.args = { - warehouseId: ticket.warehouseFk, - companyId: ticket.companyFk, - dmsTypeId: dmsType.id, - reference: '', - description: `${ticket.cmrFk} - ${ticket.id}`, - hasFile: false + const ctxUploadFile = { + ...ctx, + args: { + warehouseId: ticket.warehouseFk, + companyId: ticket.companyFk, + dmsTypeId: dmsTypeCmr.id, + reference: ticket.id, + description: `${ticket.cmrFk} - ${ticket.id}`, + hasFile: false + } }; const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); await models.TicketDms.create({ From 64ca72b1f44568151e86e065f6986162ca9b47de Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 13 Nov 2023 09:57:25 +0100 Subject: [PATCH 007/116] refactor refs #6184 Changed downloadCmrsZip --- .../route/back/methods/route/downloadCmrsZip.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index c3379ab82..23fae5ddc 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -37,7 +37,6 @@ module.exports = Self => { Self.downloadCmrsZip = async function(ctx, ids, options) { const models = Self.app.models; const myOptions = {}; - const token = ctx.req.accessToken; const zip = new JSZip(); if (typeof options == 'object') @@ -47,18 +46,20 @@ module.exports = Self => { let totalSize = 0; ids = ids.split(','); try { - for (let id of ids) { + const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); + + for (const id of ids) { if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); - const baseUrl = (ctx.req.headers.origin) - ? `${ctx.req.headers.origin}/api` - : `${ctx.req.headers.referer}api` const response = await axios.get( - `${baseUrl}/Routes/${id}/cmr?access_token=${token.id}`, { + `${baseUrl}Routes/${id}/cmr`, { ...myOptions, + headers: { + Authorization: ctx.req.accessToken.id + }, responseType: 'arraybuffer', }); - + if (response.headers['content-type'] !== 'application/pdf') throw new UserError(`The response is not a PDF`); From 45fd96cee6d59d14852529aaf0bdf9e1af7d1795 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 17 Jan 2024 13:07:26 +0100 Subject: [PATCH 008/116] feat: #6184 Modified uploadFile --- back/methods/dms/uploadFile.js | 46 +++++-------------- back/models/dms.js | 30 ++++++++++++ .../back/methods/route/downloadCmrsZip.js | 33 ++++++------- modules/ticket/back/methods/ticket/saveCmr.js | 28 +++++------ 4 files changed, 71 insertions(+), 66 deletions(-) diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js index a4212b804..728ae229f 100644 --- a/back/methods/dms/uploadFile.js +++ b/back/methods/dms/uploadFile.js @@ -49,7 +49,6 @@ module.exports = Self => { Self.uploadFile = async(ctx, options) => { const models = Self.app.models; const TempContainer = models.TempContainer; - const DmsContainer = models.DmsContainer; const fileOptions = {}; const args = ctx.args; @@ -79,19 +78,21 @@ module.exports = Self => { const addedDms = []; for (const uploadedFile of files) { - const newDms = await createDms(ctx, uploadedFile, myOptions); - const pathHash = DmsContainer.getHash(newDms.id); - const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name); srcFile = path.join(file.client.root, file.container, file.name); - const dmsContainer = await DmsContainer.container(pathHash); - const dstFile = path.join(dmsContainer.client.root, pathHash, newDms.file); - - await fs.move(srcFile, dstFile, { - overwrite: true - }); - + const data = { + workerFk: ctx.req.accessToken.userId, + dmsTypeFk: args.dmsTypeId, + companyFk: args.companyId, + warehouseFk: args.warehouseId, + reference: args.reference, + description: args.description, + contentType: file.type, + hasFile: args.hasFile + }; + const extension = await models.DmsContainer.getFileExtension(uploadedFile.name); + const newDms = await Self.createFromFile(data, extension, srcFile, myOptions); addedDms.push(newDms); } @@ -107,27 +108,4 @@ module.exports = Self => { throw e; } }; - - async function createDms(ctx, file, myOptions) { - const models = Self.app.models; - const myUserId = ctx.req.accessToken.userId; - const args = ctx.args; - - const newDms = await Self.create({ - workerFk: myUserId, - dmsTypeFk: args.dmsTypeId, - companyFk: args.companyId, - warehouseFk: args.warehouseId, - reference: args.reference, - description: args.description, - contentType: file.type, - hasFile: args.hasFile - }, myOptions); - - let fileName = file.name; - const extension = models.DmsContainer.getFileExtension(fileName); - fileName = `${newDms.id}.${extension}`; - - return newDms.updateAttribute('file', fileName, myOptions); - } }; diff --git a/back/models/dms.js b/back/models/dms.js index 24c072f56..e5b925e82 100644 --- a/back/models/dms.js +++ b/back/models/dms.js @@ -1,4 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); +const fs = require('fs-extra'); +const path = require('path'); module.exports = Self => { require('../methods/dms/downloadFile')(Self); @@ -35,4 +37,32 @@ module.exports = Self => { return [stream, dms.contentType, `filename="${dms.file}"`]; }; + + Self.getPath = async function(dms) { + const models = Self.app.models; + const pathHash = await models.DmsContainer.getHash(dms.id); + const dmsContainer = await models.DmsContainer.container(pathHash); + const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file); + return dstFile; + }; + + Self.createWithExtension = async function(data, extension, options) { + const newDms = await Self.create(data, options); + return newDms.updateAttribute('file', `${newDms.id}.${extension}`, options); + }; + + Self.createFromFile = async function(data, extension, srcFile, options) { + const dms = await Self.createWithExtension(data, extension, options); + const dstFile = await Self.getPath(dms); + await fs.move(srcFile, dstFile, {overwrite: true}); + return dms; + }; + + Self.createFromStream = async function(data, extension, stream, options) { + const dms = await Self.createWithExtension(data, extension, options); + const dstFile = await Self.getPath(dms); + const writeStream = await fs.createWriteStream(dstFile); + await readStream.pipe(writeStream); + return dms; + }; }; diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 23fae5ddc..fbf439d24 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -45,32 +45,29 @@ module.exports = Self => { const zipConfig = await models.ZipConfig.findOne(null, myOptions); let totalSize = 0; ids = ids.split(','); - try { - const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); - for (const id of ids) { - if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); + const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); - const response = await axios.get( - `${baseUrl}Routes/${id}/cmr`, { + for (const id of ids) { + if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); + + const response = await axios.get( + `${baseUrl}Routes/${id}/cmr`, { ...myOptions, headers: { Authorization: ctx.req.accessToken.id }, responseType: 'arraybuffer', }); - - if (response.headers['content-type'] !== 'application/pdf') - throw new UserError(`The response is not a PDF`); - - zip.file(`${id}.pdf`, response.data, { binary: true }); - } - - const zipStream = zip.generateNodeStream({ streamFiles: true }); - - return [zipStream, 'application/zip', `filename="cmrs.zip"`]; - } catch (e) { - throw e; + + if (response.headers['content-type'] !== 'application/pdf') + throw new UserError(`The response is not a PDF`); + + zip.file(`${id}.pdf`, response.data, {binary: true}); } + + const zipStream = zip.generateNodeStream({streamFiles: true}); + + return [zipStream, 'application/zip', `filename="cmrs.zip"`]; }; }; diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 680e7a1f0..01c45e104 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -41,31 +41,31 @@ module.exports = Self => { if (ticket.cmrFk) { const hasDmsCmr = await models.TicketDms.findOne({ - where: { ticketFk: ticketId }, + where: {ticketFk: ticketId}, include: { relation: 'dms', fields: ['dmsFk'], scope: { - where: { dmsTypeFk: dmsTypeCmr.id } + where: {dmsTypeFk: dmsTypeCmr.id} } } }, myOptions); if (!hasDmsCmr.dms()) { const zip = await models.Route.downloadCmrsZip(ctx, ticket.cmrFk.toString(), myOptions); - ctx.req.file = Object.assign({}, zip); - const ctxUploadFile = { - ...ctx, - args: { - warehouseId: ticket.warehouseFk, - companyId: ticket.companyFk, - dmsTypeId: dmsTypeCmr.id, - reference: ticket.id, - description: `${ticket.cmrFk} - ${ticket.id}`, - hasFile: false - } + const stream = Object.assign({}, zip); + const data = { + workerFk: ctx.req.accessToken.userId, + dmsTypeFk: dmsTypeCmr.id, + companyFk: ticket.companyFk, + warehouseFk: ticket.warehouseFk, + reference: ticket.id, + description: `${ticket.cmrFk} - ${ticket.id}`, + contentType: '?', + hasFile: false }; - const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + + const dms = await models.Dms.createFromStream(data, 'zip', stream, myOptions); await models.TicketDms.create({ ticketFk: ticketId, dmsFk: dms[0].id From 1a52e58eaaf2fc13e8e619eceeda11fe55d01e8e Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 17 Jan 2024 14:18:31 +0100 Subject: [PATCH 009/116] feat: #6184 Created generateCmrPdf --- back/models/dms.js | 2 +- .../back/methods/route/downloadCmrsZip.js | 23 +------ .../back/methods/route/generateCmrPdf.js | 64 +++++++++++++++++++ modules/route/back/models/route.js | 1 + modules/ticket/back/methods/ticket/saveCmr.js | 16 +++-- 5 files changed, 77 insertions(+), 29 deletions(-) create mode 100644 modules/route/back/methods/route/generateCmrPdf.js diff --git a/back/models/dms.js b/back/models/dms.js index e5b925e82..d6eab4fe4 100644 --- a/back/models/dms.js +++ b/back/models/dms.js @@ -62,7 +62,7 @@ module.exports = Self => { const dms = await Self.createWithExtension(data, extension, options); const dstFile = await Self.getPath(dms); const writeStream = await fs.createWriteStream(dstFile); - await readStream.pipe(writeStream); + await stream.pipe(writeStream); return dms; }; }; diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index fbf439d24..9fe9c3735 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -1,6 +1,4 @@ const JSZip = require('jszip'); -const axios = require('axios'); -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('downloadCmrsZip', { @@ -42,28 +40,11 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const zipConfig = await models.ZipConfig.findOne(null, myOptions); - let totalSize = 0; ids = ids.split(','); - const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); - for (const id of ids) { - if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); - - const response = await axios.get( - `${baseUrl}Routes/${id}/cmr`, { - ...myOptions, - headers: { - Authorization: ctx.req.accessToken.id - }, - responseType: 'arraybuffer', - }); - - if (response.headers['content-type'] !== 'application/pdf') - throw new UserError(`The response is not a PDF`); - - zip.file(`${id}.pdf`, response.data, {binary: true}); + const data = models.Route.generateCmrPdf(id); + zip.file(`${id}.pdf`, data, {binary: true}); } const zipStream = zip.generateNodeStream({streamFiles: true}); diff --git a/modules/route/back/methods/route/generateCmrPdf.js b/modules/route/back/methods/route/generateCmrPdf.js new file mode 100644 index 000000000..236c11508 --- /dev/null +++ b/modules/route/back/methods/route/generateCmrPdf.js @@ -0,0 +1,64 @@ +const axios = require('axios'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('generateCmrPdf', { + description: 'Generate a pdf of a cmr', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'string', + description: 'The cmr', + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'string', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'string', + http: {target: 'header'} + } + ], + http: { + path: '/generateCmrPdf', + verb: 'GET' + } + }); + + Self.generateCmrPdf = async function(ctx, id, options) { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const zipConfig = await models.ZipConfig.findOne(null, myOptions); + let totalSize = 0; + + const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); + + if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); + + const response = await axios.get( + `${baseUrl}Routes/${id}/cmr`, { + ...myOptions, + headers: { + Authorization: ctx.req.accessToken.id + }, + responseType: 'arraybuffer', + }); + + if (response.headers['content-type'] !== 'application/pdf') + throw new UserError(`The response is not a PDF`); + + return response.data; + }; +}; diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 9b5f3564f..9777aa8d8 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -17,6 +17,7 @@ module.exports = Self => { require('../methods/route/cmr')(Self); require('../methods/route/getExternalCmrs')(Self); require('../methods/route/downloadCmrsZip')(Self); + require('../methods/route/generateCmrPdf')(Self); require('../methods/route/getExpeditionSummary')(Self); require('../methods/route/getByWorker')(Self); diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 01c45e104..15f9b3fad 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -1,3 +1,5 @@ +const {Readable} = require('stream'); + module.exports = Self => { Self.remoteMethodCtx('saveCmr', { description: 'Save cmr', @@ -51,9 +53,9 @@ module.exports = Self => { } }, myOptions); - if (!hasDmsCmr.dms()) { - const zip = await models.Route.downloadCmrsZip(ctx, ticket.cmrFk.toString(), myOptions); - const stream = Object.assign({}, zip); + if (!hasDmsCmr?.dms()) { + const response = await models.Route.generateCmrPdf(ctx, ticket.cmrFk.toString(), myOptions); + const pdfStream = Readable.from(Buffer.from(response)); const data = { workerFk: ctx.req.accessToken.userId, dmsTypeFk: dmsTypeCmr.id, @@ -61,14 +63,14 @@ module.exports = Self => { warehouseFk: ticket.warehouseFk, reference: ticket.id, description: `${ticket.cmrFk} - ${ticket.id}`, - contentType: '?', - hasFile: false + contentType: 'application/pdf', + hasFile: true }; - const dms = await models.Dms.createFromStream(data, 'zip', stream, myOptions); + const dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); await models.TicketDms.create({ ticketFk: ticketId, - dmsFk: dms[0].id + dmsFk: dms.id }, myOptions); } } From 85a0f8b3230d428c2fa3950349bda6d984122209 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 17 Jan 2024 14:30:58 +0100 Subject: [PATCH 010/116] feat: #6184 Minor change --- modules/route/back/methods/route/downloadCmrsZip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 9fe9c3735..21d10d6e9 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -43,7 +43,7 @@ module.exports = Self => { ids = ids.split(','); for (const id of ids) { - const data = models.Route.generateCmrPdf(id); + const data = await models.Route.generateCmrPdf(ctx, id, options); zip.file(`${id}.pdf`, data, {binary: true}); } From a486b7f2d4be3fa695a0ebf437767c6ec00757a8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 17 Jan 2024 14:42:38 +0100 Subject: [PATCH 011/116] feat: #6184 Minor change --- modules/ticket/back/methods/ticket/saveSign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 85404cfac..9df1cdecc 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -142,7 +142,7 @@ module.exports = Self => { stateFk: deliveryState.id }, myOptions); - await models.Ticket.saveCmr(ticketId, myOptions); + await models.Ticket.saveCmr([ticketId], myOptions); } if (tx) await tx.commit(); From ce5a2ada622dbdef083246fac7759a22e98825a9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 18 Jan 2024 07:46:58 +0100 Subject: [PATCH 012/116] feat: #6184 Requested changes --- modules/route/back/methods/route/generateCmrPdf.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/route/back/methods/route/generateCmrPdf.js b/modules/route/back/methods/route/generateCmrPdf.js index 236c11508..56b8f0f2f 100644 --- a/modules/route/back/methods/route/generateCmrPdf.js +++ b/modules/route/back/methods/route/generateCmrPdf.js @@ -34,19 +34,13 @@ module.exports = Self => { }); Self.generateCmrPdf = async function(ctx, id, options) { - const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - const zipConfig = await models.ZipConfig.findOne(null, myOptions); - let totalSize = 0; - const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); - if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); - const response = await axios.get( `${baseUrl}Routes/${id}/cmr`, { ...myOptions, From 12bfb8ca7743f753fd455abf68bff4406988e08b Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 23 Jan 2024 11:05:39 +0100 Subject: [PATCH 013/116] feat: #6184 Added tests and process.env.IS_SPEC_RUNNING --- back/tests.js | 3 +- db/dump/fixtures.sql | 11 +++- .../back/methods/route/downloadCmrsZip.js | 6 +- .../back/methods/route/generateCmrPdf.js | 58 ------------------- .../route/specs/downloadCmrsZip.spec.js | 18 ++++++ .../back/methods/route/specs/saveCmr.spec.js | 24 ++++++++ modules/route/back/models/route.js | 1 - modules/ticket/back/methods/ticket/saveCmr.js | 3 +- print/core/cluster.js | 2 +- 9 files changed, 61 insertions(+), 65 deletions(-) delete mode 100644 modules/route/back/methods/route/generateCmrPdf.js create mode 100644 modules/route/back/methods/route/specs/downloadCmrsZip.spec.js create mode 100644 modules/route/back/methods/route/specs/saveCmr.spec.js diff --git a/back/tests.js b/back/tests.js index 2678f6744..19738acfb 100644 --- a/back/tests.js +++ b/back/tests.js @@ -74,10 +74,11 @@ async function test() { spec_files: backSpecs, helpers: [], }); - + process.env.IS_SPEC_RUNNING = true; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); + // eslint-disable-next-line no-console console.log('App disconnected & container removed'); } diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index b243692bb..ba5e0d887 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2384,7 +2384,7 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `c (14, 'Ticket', 'tickets', 1, 1, 'ticket'), (15, 'Presupuestos', 'Presupuestos', NULL, NULL, 'budgets'), (16, 'Logistica', 'logistica', NULL, NULL, 'logistics'), - (17, 'cmr', 'cmr', NULL, NULL, 'cmr'), + (17, 'cmr', 'cmr', 1, 1, 'cmr'), (18, 'dua', 'dua', NULL, NULL, 'dua'), (19, 'inmovilizado', 'inmovilizado', NULL, NULL, 'fixedAssets'), (20, 'Reclamación', 'reclamacion', 1, 1, 'claim'); @@ -3043,3 +3043,12 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`) (4, 1103, 4, 32), (13, 1101, 1, NULL), (14, 1101, 4, 27); + +INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state) + VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), + (2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), + (3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'); + +UPDATE `vn`.`ticket` SET `cmrFk`= 1 WHERE `id`= 1; +UPDATE `vn`.`ticket` SET `cmrFk`= 2 WHERE `id`= 2; +UPDATE `vn`.`ticket` SET `cmrFk`= 3 WHERE `id`= 3; diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 21d10d6e9..ccbb57d87 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -43,8 +43,10 @@ module.exports = Self => { ids = ids.split(','); for (const id of ids) { - const data = await models.Route.generateCmrPdf(ctx, id, options); - zip.file(`${id}.pdf`, data, {binary: true}); + ctx.args = ctx.args || {}; + ctx.args.id = Number(id); + const data = await models.Route.cmr(ctx, myOptions); + zip.file(`${id}.pdf`, data[0], {binary: true}); } const zipStream = zip.generateNodeStream({streamFiles: true}); diff --git a/modules/route/back/methods/route/generateCmrPdf.js b/modules/route/back/methods/route/generateCmrPdf.js deleted file mode 100644 index 56b8f0f2f..000000000 --- a/modules/route/back/methods/route/generateCmrPdf.js +++ /dev/null @@ -1,58 +0,0 @@ -const axios = require('axios'); -const UserError = require('vn-loopback/util/user-error'); - -module.exports = Self => { - Self.remoteMethodCtx('generateCmrPdf', { - description: 'Generate a pdf of a cmr', - accessType: 'READ', - accepts: [ - { - arg: 'id', - type: 'string', - description: 'The cmr', - } - ], - returns: [ - { - arg: 'body', - type: 'file', - root: true - }, { - arg: 'Content-Type', - type: 'string', - http: {target: 'header'} - }, { - arg: 'Content-Disposition', - type: 'string', - http: {target: 'header'} - } - ], - http: { - path: '/generateCmrPdf', - verb: 'GET' - } - }); - - Self.generateCmrPdf = async function(ctx, id, options) { - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const baseUrl = (await Self.app.models.Url.getUrl()).replace('#!', 'api'); - - const response = await axios.get( - `${baseUrl}Routes/${id}/cmr`, { - ...myOptions, - headers: { - Authorization: ctx.req.accessToken.id - }, - responseType: 'arraybuffer', - }); - - if (response.headers['content-type'] !== 'application/pdf') - throw new UserError(`The response is not a PDF`); - - return response.data; - }; -}; diff --git a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js new file mode 100644 index 000000000..ba5da9bde --- /dev/null +++ b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js @@ -0,0 +1,18 @@ +const models = require('vn-loopback/server/server').models; + +describe('route downloadCmrsZip()', () => { + it('should create a zip file with the given cmr ids', async() => { + const ctx = { + req: { + getLocale: () => { + return 'en'; + }, + accessToken: {userId: 9} + } + }; + let cmrs = '1,2'; + let result = await models.Route.downloadCmrsZip(ctx, cmrs); + + expect(result.length).toBeGreaterThanOrEqual(1); + }); +}); diff --git a/modules/route/back/methods/route/specs/saveCmr.spec.js b/modules/route/back/methods/route/specs/saveCmr.spec.js new file mode 100644 index 000000000..2f99723fe --- /dev/null +++ b/modules/route/back/methods/route/specs/saveCmr.spec.js @@ -0,0 +1,24 @@ +const models = require('vn-loopback/server/server').models; + +fdescribe('Ticket saveCmr()', () => { + let ctx = {req: { + accessToken: {userId: 9} + }}; + + it(`should throw error if the cmr can't save`, async() => { + const tx = await models.Route.beginTransaction({}); + let error; + try { + const options = {transaction: tx}; + const ticket = [1]; + await models.Route.saveCmr(ctx, ticket, options); + + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } + + expect(error).toBeDefined(); + }); +}); diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 9777aa8d8..9b5f3564f 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -17,7 +17,6 @@ module.exports = Self => { require('../methods/route/cmr')(Self); require('../methods/route/getExternalCmrs')(Self); require('../methods/route/downloadCmrsZip')(Self); - require('../methods/route/generateCmrPdf')(Self); require('../methods/route/getExpeditionSummary')(Self); require('../methods/route/getByWorker')(Self); diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 15f9b3fad..9de84a1fa 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -54,7 +54,8 @@ module.exports = Self => { }, myOptions); if (!hasDmsCmr?.dms()) { - const response = await models.Route.generateCmrPdf(ctx, ticket.cmrFk.toString(), myOptions); + ctx.args.id = ticket.cmrFk; + const response = await models.Route.cmr(ctx, myOptions); const pdfStream = Readable.from(Buffer.from(response)); const data = { workerFk: ctx.req.accessToken.userId, diff --git a/print/core/cluster.js b/print/core/cluster.js index a75c4cf24..869907a7d 100644 --- a/print/core/cluster.js +++ b/print/core/cluster.js @@ -35,7 +35,7 @@ module.exports = { logger.error(`[Print] => ${err.message}`); }); - cluster.on('queue', () => logger.info('Printing task initialized by pool')); + cluster.on('queue', () => !process.env.IS_SPEC_RUNNING && logger.info('Printing task initialized by pool')); }); } }; From a676607e295de698bae842fe719be6c499ffaa77 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 23 Jan 2024 14:13:40 +0100 Subject: [PATCH 014/116] feat: #6184 Added email cmr --- modules/route/back/methods/route/cmrEmail.js | 98 +++++++++++++++++++ modules/route/back/models/route.js | 1 + .../ticket/back/methods/ticket/saveSign.js | 3 +- .../templates/email/cmr/assets/css/import.js | 11 +++ print/templates/email/cmr/attachments.json | 6 ++ print/templates/email/cmr/cmr.html | 12 +++ print/templates/email/cmr/cmr.js | 22 +++++ print/templates/email/cmr/locale/en.yml | 9 ++ print/templates/email/cmr/locale/es.yml | 9 ++ print/templates/email/cmr/locale/fr.yml | 9 ++ print/templates/email/cmr/locale/pt.yml | 9 ++ print/templates/email/cmr/sql/cmr.sql | 5 + 12 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 modules/route/back/methods/route/cmrEmail.js create mode 100644 print/templates/email/cmr/assets/css/import.js create mode 100644 print/templates/email/cmr/attachments.json create mode 100644 print/templates/email/cmr/cmr.html create mode 100755 print/templates/email/cmr/cmr.js create mode 100644 print/templates/email/cmr/locale/en.yml create mode 100644 print/templates/email/cmr/locale/es.yml create mode 100644 print/templates/email/cmr/locale/fr.yml create mode 100644 print/templates/email/cmr/locale/pt.yml create mode 100644 print/templates/email/cmr/sql/cmr.sql diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js new file mode 100644 index 000000000..e24d8a58f --- /dev/null +++ b/modules/route/back/methods/route/cmrEmail.js @@ -0,0 +1,98 @@ +const {Email} = require('vn-print'); + +module.exports = Self => { + Self.remoteMethodCtx('cmrEmail', { + description: 'Sends the email with an cmr attached PDF', + accessType: 'WRITE', + accepts: [ + { + arg: 'ticketId', + type: 'number', + required: true, + description: 'The ticket id', + }, + { + arg: 'recipientId', + type: 'number', + description: 'The client id', + required: true + }, + { + arg: 'recipient', + type: 'string', + description: 'The recipient email', + required: false, + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'string', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'string', + http: {target: 'header'} + } + ], + http: { + path: '/cmrEmail', + verb: 'POST' + } + }); + + Self.cmrEmail = async function(ctx, ticketId, recipientId, recipient, options) { + const models = Self.app.models; + const myOptions = {}; + const args = Object.assign({}, ctx.args); + const params = { + recipient: args.recipient, + lang: ctx.req.getLocale() + }; + + delete args.ctx; + for (const param in args) + params[param] = args[param]; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!recipient) + params.recipient = (await models.Client.findById(recipientId, {fields: ['email']}, myOptions)).email; + + const cmr = (await models.Ticket.findById(ticketId, {fields: ['cmrFk']}, myOptions)).cmrFk; + + const dms = await models.TicketDms.findOne({ + where: { + ticketFk: ticketId + }, + include: [ + { + relation: 'dms', + fields: ['id'], + scope: { + relation: 'dmsType', + where: { + code: 'cmr' + } + } + } + ] + }, myOptions); + + const response = await models.Dms.downloadFile(ctx, dms.id); + const email = new Email('cmr', params); + + return email.send({ + overrideAttachments: true, + attachments: [{ + filename: `${cmr}.pdf`, + content: response[0] + }] + }); + }; +}; diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 9b5f3564f..a25e8769b 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -17,6 +17,7 @@ module.exports = Self => { require('../methods/route/cmr')(Self); require('../methods/route/getExternalCmrs')(Self); require('../methods/route/downloadCmrsZip')(Self); + require('../methods/route/cmrEmail')(Self); require('../methods/route/getExpeditionSummary')(Self); require('../methods/route/getByWorker')(Self); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 9df1cdecc..26ca2e1c5 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -142,7 +142,8 @@ module.exports = Self => { stateFk: deliveryState.id }, myOptions); - await models.Ticket.saveCmr([ticketId], myOptions); + await models.Ticket.saveCmr(ctx, [ticketId], myOptions); + await models.Route.cmrEmail(ctx, [ticketId], myOptions); } if (tx) await tx.commit(); diff --git a/print/templates/email/cmr/assets/css/import.js b/print/templates/email/cmr/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/cmr/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/cmr/attachments.json b/print/templates/email/cmr/attachments.json new file mode 100644 index 000000000..40845566d --- /dev/null +++ b/print/templates/email/cmr/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "cmr.pdf", + "component": "cmr" + } +] \ No newline at end of file diff --git a/print/templates/email/cmr/cmr.html b/print/templates/email/cmr/cmr.html new file mode 100644 index 000000000..2f6d9e346 --- /dev/null +++ b/print/templates/email/cmr/cmr.html @@ -0,0 +1,12 @@ + +
+
+

{{ $t('title') }}

+

{{$t('dear')}},

+

+

+

+

+
+
+
\ No newline at end of file diff --git a/print/templates/email/cmr/cmr.js b/print/templates/email/cmr/cmr.js new file mode 100755 index 000000000..104e4d2fe --- /dev/null +++ b/print/templates/email/cmr/cmr.js @@ -0,0 +1,22 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); +module.exports = { + name: 'cmr', + async serverPrefetch() { + this.cmr = await this.fetchCmr(this.ticketId); + }, + methods: { + fetchCmr(ticketId) { + return this.findOneFromDef('cmr', [ticketId]); + }, + }, + components: { + 'email-body': emailBody.build(), + }, + props: { + ticketId: { + type: Number, + required: true + } + } +}; diff --git a/print/templates/email/cmr/locale/en.yml b/print/templates/email/cmr/locale/en.yml new file mode 100644 index 000000000..fbfca9aaa --- /dev/null +++ b/print/templates/email/cmr/locale/en.yml @@ -0,0 +1,9 @@ +subject: Your CMR +title: Your CMR +dear: Dear Customer +description: The CMR {0} corresponding to order {1} is now available.
+ You can download it by clicking on the attachment in this email. +poll: If you wish, you can respond to our satisfaction survey to + help us provide better service. Your opinion is very important to us! +help: If you have any doubts, do not hesitate to ask, we are here to serve you! +conclusion: Thank you for your attention! \ No newline at end of file diff --git a/print/templates/email/cmr/locale/es.yml b/print/templates/email/cmr/locale/es.yml new file mode 100644 index 000000000..4c384edf5 --- /dev/null +++ b/print/templates/email/cmr/locale/es.yml @@ -0,0 +1,9 @@ +subject: Tu CMR +title: Tu CMR +dear: Estimado cliente +description: Ya está disponible el CMR {0} correspondiente al pedido {1}.
+ Puedes descargarla haciendo clic en el adjunto de este correo. +poll: Si lo deseas, puedes responder a nuestra encuesta de satisfacción para + ayudarnos a prestar un mejor servicio. ¡Tu opinión es muy importante para nosotros! +help: Cualquier duda que te surja, no dudes en consultarla, ¡estamos para atenderte! +conclusion: ¡Gracias por tu atención! \ No newline at end of file diff --git a/print/templates/email/cmr/locale/fr.yml b/print/templates/email/cmr/locale/fr.yml new file mode 100644 index 000000000..c715f4433 --- /dev/null +++ b/print/templates/email/cmr/locale/fr.yml @@ -0,0 +1,9 @@ +subject: Votre CMR +title: Votre CMR +dear: Cher client +description: Le CMR {0} correspondant à la commande {1} est maintenant disponible.
+ Vous pouvez le télécharger en cliquant sur la pièce jointe de cet e-mail. +poll: Si vous le souhaitez, vous pouvez répondre à notre enquête de satisfaction pour + nous aider à améliorer notre service. Votre avis est très important pour nous ! +help: Si vous avez des doutes, n'hésitez pas à nous consulter, nous sommes là pour vous servir ! +conclusion: Merci de votre attention ! \ No newline at end of file diff --git a/print/templates/email/cmr/locale/pt.yml b/print/templates/email/cmr/locale/pt.yml new file mode 100644 index 000000000..74b2b2e7a --- /dev/null +++ b/print/templates/email/cmr/locale/pt.yml @@ -0,0 +1,9 @@ +subject: Seu CMR +title: Seu CMR +dear: Caro cliente +description: O CMR {0} correspondente ao pedido {1} já está disponível.
+ Você pode baixá-lo clicando no anexo deste e-mail. +poll: Se desejar, pode responder à nossa pesquisa de satisfação para + nos ajudar a oferecer um serviço melhor. Sua opinião é muito importante para nós! +help: Se tiver alguma dúvida, não hesite em nos consultar, estamos aqui para atendê-lo! +conclusion: Obrigado pela sua atenção! \ No newline at end of file diff --git a/print/templates/email/cmr/sql/cmr.sql b/print/templates/email/cmr/sql/cmr.sql new file mode 100644 index 000000000..f1c0904d8 --- /dev/null +++ b/print/templates/email/cmr/sql/cmr.sql @@ -0,0 +1,5 @@ +SELECT t.id ticketFk, + c.id + FROM ticket t + JOIN cmr c ON c.id = t.cmrFk + WHERE t.id = ? From 9005975f1c851a42dcf6581076adbe023c74390d Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 25 Jan 2024 13:56:47 +0100 Subject: [PATCH 015/116] feat: #6184 Modified email cmr --- modules/route/back/methods/route/cmrEmail.js | 115 ++++++++++-------- .../back/methods/route/specs/saveCmr.spec.js | 2 +- modules/ticket/back/methods/ticket/saveCmr.js | 9 +- .../ticket/back/methods/ticket/saveSign.js | 31 ++++- .../methods/ticket/specs/saveSign.spec.js | 15 +-- 5 files changed, 100 insertions(+), 72 deletions(-) diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index e24d8a58f..dd8452e71 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -1,4 +1,5 @@ const {Email} = require('vn-print'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('cmrEmail', { @@ -6,22 +7,10 @@ module.exports = Self => { accessType: 'WRITE', accepts: [ { - arg: 'ticketId', - type: 'number', + arg: 'tickets', + type: ['number'], required: true, description: 'The ticket id', - }, - { - arg: 'recipientId', - type: 'number', - description: 'The client id', - required: true - }, - { - arg: 'recipient', - type: 'string', - description: 'The recipient email', - required: false, } ], returns: [ @@ -45,54 +34,76 @@ module.exports = Self => { } }); - Self.cmrEmail = async function(ctx, ticketId, recipientId, recipient, options) { + Self.cmrEmail = async function(ctx, tickets, options) { const models = Self.app.models; const myOptions = {}; - const args = Object.assign({}, ctx.args); - const params = { - recipient: args.recipient, - lang: ctx.req.getLocale() - }; - - delete args.ctx; - for (const param in args) - params[param] = args[param]; if (typeof options == 'object') Object.assign(myOptions, options); - if (!recipient) - params.recipient = (await models.Client.findById(recipientId, {fields: ['email']}, myOptions)).email; + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } - const cmr = (await models.Ticket.findById(ticketId, {fields: ['cmrFk']}, myOptions)).cmrFk; + try { + for (const ticketId of tickets) { + const ticket = await models.Ticket.findOne({ + where: { + id: ticketId + }, + include: [{ + relation: 'client', + fields: ['email'] + }] + }, myOptions); - const dms = await models.TicketDms.findOne({ - where: { - ticketFk: ticketId - }, - include: [ - { - relation: 'dms', - fields: ['id'], - scope: { - relation: 'dmsType', - where: { - code: 'cmr' + const recipient = ticket.client().email; + if (!recipient) + throw new UserError('Client does not have an email'); + + const params = { + ticketId, + lang: ctx.req.getLocale(), + recipient + }; + + const dms = await models.TicketDms.findOne({ + where: { + ticketFk: ticketId + }, + include: [ + { + relation: 'dms', + fields: ['id'], + scope: { + relation: 'dmsType', + where: { + code: 'cmr' + } + } } - } - } - ] - }, myOptions); + ] + }, myOptions); - const response = await models.Dms.downloadFile(ctx, dms.id); - const email = new Email('cmr', params); + if (!dms) throw new UserError('Cmr file does not exist'); - return email.send({ - overrideAttachments: true, - attachments: [{ - filename: `${cmr}.pdf`, - content: response[0] - }] - }); + const response = await models.Dms.downloadFile(ctx, dms.id); + const email = new Email('cmr', params); + + return email.send({ + overrideAttachments: true, + attachments: [{ + filename: `${ticket.cmrFk}.pdf`, + content: response[0] + }] + }); + } + if (tx) await tx.commit(); + return; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } }; }; diff --git a/modules/route/back/methods/route/specs/saveCmr.spec.js b/modules/route/back/methods/route/specs/saveCmr.spec.js index 2f99723fe..9de29540f 100644 --- a/modules/route/back/methods/route/specs/saveCmr.spec.js +++ b/modules/route/back/methods/route/specs/saveCmr.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -fdescribe('Ticket saveCmr()', () => { +describe('Ticket saveCmr()', () => { let ctx = {req: { accessToken: {userId: 9} }}; diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 9de84a1fa..67c7484fe 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -4,8 +4,7 @@ module.exports = Self => { Self.remoteMethodCtx('saveCmr', { description: 'Save cmr', accessType: 'WRITE', - accepts: - [ + accepts: [ { arg: 'tickets', type: ['number'], @@ -23,6 +22,7 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; + let dms; if (typeof options == 'object') Object.assign(myOptions, options); @@ -56,7 +56,7 @@ module.exports = Self => { if (!hasDmsCmr?.dms()) { ctx.args.id = ticket.cmrFk; const response = await models.Route.cmr(ctx, myOptions); - const pdfStream = Readable.from(Buffer.from(response)); + const pdfStream = Readable.from(Buffer.from(response[0])); const data = { workerFk: ctx.req.accessToken.userId, dmsTypeFk: dmsTypeCmr.id, @@ -68,7 +68,7 @@ module.exports = Self => { hasFile: true }; - const dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); + dms = await models.Dms.createFromStream(data, 'pdf', pdfStream); await models.TicketDms.create({ ticketFk: ticketId, dmsFk: dms.id @@ -80,6 +80,7 @@ module.exports = Self => { return; } catch (e) { if (tx) await tx.rollback(); + if (dms) await models.Dms.destroyAll({where: {id: dms.id}}); throw e; } }; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 26ca2e1c5..6e74a0f3d 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -128,22 +128,41 @@ module.exports = Self => { if (location) setLocation(ticketId); if (!gestDocCreated) await createGestDoc(ticketId); await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); - const ticket = await models.Ticket.findById(ticketId, null, myOptions); + const ticket = await models.Ticket.findOne({ + where: {ticketFk: ticketId}, + include: [{ + relation: 'address', + scope: { + include: { + relation: 'province', + scope: { + include: { + relation: 'country', + scope: { + fields: ['code'] + } + } + } + } + } + }] + }, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); - const deliveryState = await models.State.find({ + const deliveryState = await models.State.findOne({ where: { code: 'DELIVERED' } - }, options); - + }, myOptions); await models.Ticket.state(ctx, { ticketFk: ticketId, stateFk: deliveryState.id }, myOptions); - await models.Ticket.saveCmr(ctx, [ticketId], myOptions); - await models.Route.cmrEmail(ctx, [ticketId], myOptions); + if (ticket.address().province().country().code != 'ES') { + await models.Ticket.saveCmr(ctx, [ticketId], myOptions); + await models.Route.cmrEmail(ctx, [ticketId], myOptions); + } } if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/ticket/specs/saveSign.spec.js b/modules/ticket/back/methods/ticket/specs/saveSign.spec.js index 6b532a5d1..792e9e824 100644 --- a/modules/ticket/back/methods/ticket/specs/saveSign.spec.js +++ b/modules/ticket/back/methods/ticket/specs/saveSign.spec.js @@ -1,14 +1,11 @@ const models = require('vn-loopback/server/server').models; describe('Ticket saveSign()', () => { - const FormData = require('form-data'); - const data = new FormData(); let ctx = {req: { - accessToken: {userId: 9}, - headers: { - ...data.getHeaders() - } - + getLocale: () => { + return 'en'; + }, + accessToken: {userId: 9} }}; it(`should throw error if the ticket's alert level is lower than 2`, async() => { @@ -17,9 +14,9 @@ describe('Ticket saveSign()', () => { let error; try { const options = {transaction: tx}; - ctx.args = {tickets: [ticketWithOkState]}; + const tickets = [ticketWithOkState]; - await models.Ticket.saveSign(ctx, options); + await models.Ticket.saveSign(ctx, tickets, options); await tx.rollback(); } catch (e) { From e43210af9cf814ccdefb4dd7ce00bbf6da390484 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 26 Jan 2024 09:23:43 +0100 Subject: [PATCH 016/116] fix(driver-route): refs #6684 manage word overflow with wordBreak --- modules/item/front/basic-data/index.html | 7 +++++++ print/templates/reports/driver-route/driver-route.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index af76d5966..38c314208 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -49,6 +49,13 @@ vn-name="relevancy" rule> + +
-

{{ticket.description}}

+

{{ticket.description}}

From 5828fa965763ed4709ebcbf5dcdadc3ca6ce46ef Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jan 2024 10:05:24 +0100 Subject: [PATCH 017/116] feat: #6184 Refactor saveSign --- back/tests.js | 1 - modules/account/front/role/card/index.spec.js | 2 +- .../front/role/descriptor/index.spec.js | 2 +- modules/route/back/methods/route/cmrEmail.js | 1 + .../route/specs/downloadCmrsZip.spec.js | 4 + modules/ticket/back/methods/ticket/saveCmr.js | 4 +- .../ticket/back/methods/ticket/saveSign.js | 118 ++++++++---------- print/core/cluster.js | 2 +- 8 files changed, 61 insertions(+), 73 deletions(-) diff --git a/back/tests.js b/back/tests.js index 19738acfb..de8a7e927 100644 --- a/back/tests.js +++ b/back/tests.js @@ -74,7 +74,6 @@ async function test() { spec_files: backSpecs, helpers: [], }); - process.env.IS_SPEC_RUNNING = true; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); diff --git a/modules/account/front/role/card/index.spec.js b/modules/account/front/role/card/index.spec.js index f02c08f28..569fe487d 100644 --- a/modules/account/front/role/card/index.spec.js +++ b/modules/account/front/role/card/index.spec.js @@ -1,6 +1,6 @@ import './index'; -fdescribe('component vnRoleCard', () => { +describe('component vnRoleCard', () => { let controller; let $httpBackend; diff --git a/modules/account/front/role/descriptor/index.spec.js b/modules/account/front/role/descriptor/index.spec.js index eafb96727..f3b2e4763 100644 --- a/modules/account/front/role/descriptor/index.spec.js +++ b/modules/account/front/role/descriptor/index.spec.js @@ -1,6 +1,6 @@ import './index'; -fdescribe('component vnRoleDescriptor', () => { +describe('component vnRoleDescriptor', () => { let controller; let $httpBackend; diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index dd8452e71..40665a49a 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -37,6 +37,7 @@ module.exports = Self => { Self.cmrEmail = async function(ctx, tickets, options) { const models = Self.app.models; const myOptions = {}; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js index ba5da9bde..1e8ed29e7 100644 --- a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js +++ b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js @@ -1,6 +1,10 @@ const models = require('vn-loopback/server/server').models; describe('route downloadCmrsZip()', () => { + beforeEach(() => { + spyOn(models.Route, 'downloadCmrsZip').and.returnValue([true]); + }); + it('should create a zip file with the given cmr ids', async() => { const ctx = { req: { diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 67c7484fe..a74ee9bb9 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -63,12 +63,11 @@ module.exports = Self => { companyFk: ticket.companyFk, warehouseFk: ticket.warehouseFk, reference: ticket.id, - description: `${ticket.cmrFk} - ${ticket.id}`, contentType: 'application/pdf', hasFile: true }; - dms = await models.Dms.createFromStream(data, 'pdf', pdfStream); + dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); await models.TicketDms.create({ ticketFk: ticketId, dmsFk: dms.id @@ -80,7 +79,6 @@ module.exports = Self => { return; } catch (e) { if (tx) await tx.rollback(); - if (dms) await models.Dms.destroyAll({where: {id: dms.id}}); throw e; } }; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 6e74a0f3d..cdcd37255 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -33,8 +33,7 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; - let dms; - let gestDocCreated = false; + let ticket; if (typeof options == 'object') Object.assign(myOptions, options); @@ -44,6 +43,11 @@ module.exports = Self => { myOptions.transaction = tx; } + const dmsTypeTicket = await models.DmsType.findOne({ + where: {code: 'ticket'}, + fields: ['id'] + }, myOptions); + async function setLocation(ticketId) { await models.Delivery.create({ ticketFk: ticketId, @@ -53,83 +57,38 @@ module.exports = Self => { }, myOptions); } - async function gestDocExists(ticketId) { + async function hasSignDms(ticketId) { const ticketDms = await models.TicketDms.findOne({ where: {ticketFk: ticketId}, - fields: ['dmsFk'] + fields: ['dmsFk'], + include: [{ + relation: 'dms', + where: { + dmsType: dmsTypeTicket.id + } + }] }, myOptions); - - if (!ticketDms) return false; - - const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions); - if (ticket.isSigned == true) - return true; - else - await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions); - - return false; + if (ticketDms) return true; } async function createGestDoc(id) { - const ticket = await models.Ticket.findById(id, - {include: [ - { - relation: 'warehouse', - scope: { - fields: ['id'] - } - }, { - relation: 'client', - scope: { - fields: ['name'] - } - }, { - relation: 'route', - scope: { - fields: ['id'] - } - } - ] - }, myOptions); - const dmsType = await models.DmsType.findOne({where: {code: 'ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); - if (ticket.route() === null) - throw new UserError('Ticket without route'); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk, - dmsTypeId: dmsType.id, - reference: '', + dmsTypeId: dmsTypeTicket.id, + reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, - hasFile: false + hasFile: true }; - dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - gestDocCreated = true; + const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + await models.TicketDms.create({ticketFk: id, dmsFk: dms[0].id}, myOptions); } try { + let externalTickets = []; for (const ticketId of tickets) { - const ticketState = await models.TicketState.findOne( - {where: {ticketFk: ticketId}, - fields: ['alertLevel'] - }, myOptions); - - const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'}, - fields: ['id'] - }, myOptions); - - if (!ticketState) - throw new UserError('Ticket does not exist'); - if (ticketState.alertLevel < packedAlertLevel.id) - throw new UserError('This ticket cannot be signed because it has not been boxed'); - if (await gestDocExists(ticketId)) - throw new UserError('Ticket is already signed'); - - if (location) setLocation(ticketId); - if (!gestDocCreated) await createGestDoc(ticketId); - await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); - const ticket = await models.Ticket.findOne({ - where: {ticketFk: ticketId}, + ticket = await models.Ticket.findById(ticketId, { include: [{ relation: 'address', scope: { @@ -145,8 +104,34 @@ module.exports = Self => { } } } + }, { + relation: 'route', + scope: { + fields: ['id'] + } }] }, myOptions); + + const ticketState = await models.TicketState.findOne( + {where: {ticketFk: ticketId}, + fields: ['alertLevel'] + }, myOptions); + + const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'}, + fields: ['id'] + }, myOptions); + + if (!ticketState) + throw new UserError('Ticket does not exist'); + if (!ticket.route()) + throw new UserError('Ticket without route'); + if (ticketState.alertLevel < packedAlertLevel.id) + throw new UserError('This ticket cannot be signed because it has not been boxed'); + if (await ticket.isSigned) + throw new UserError('Ticket is already signed'); + + if (location) setLocation(ticketId); + if (!await hasSignDms(ticketId)) createGestDoc(ticketId); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ @@ -154,18 +139,19 @@ module.exports = Self => { code: 'DELIVERED' } }, myOptions); + await models.Ticket.state(ctx, { ticketFk: ticketId, stateFk: deliveryState.id }, myOptions); - if (ticket.address().province().country().code != 'ES') { + if (ticket?.address()?.province()?.country()?.code != 'ES') { await models.Ticket.saveCmr(ctx, [ticketId], myOptions); - await models.Route.cmrEmail(ctx, [ticketId], myOptions); + externalTickets.push(ticketId); } } - if (tx) await tx.commit(); + await models.Route.cmrEmail(ctx, externalTickets); return; } catch (e) { if (tx) await tx.rollback(); diff --git a/print/core/cluster.js b/print/core/cluster.js index 869907a7d..a75c4cf24 100644 --- a/print/core/cluster.js +++ b/print/core/cluster.js @@ -35,7 +35,7 @@ module.exports = { logger.error(`[Print] => ${err.message}`); }); - cluster.on('queue', () => !process.env.IS_SPEC_RUNNING && logger.info('Printing task initialized by pool')); + cluster.on('queue', () => logger.info('Printing task initialized by pool')); }); } }; From dec795d90278af0c1bd5f1641abffd6116a2c338 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jan 2024 10:14:47 +0100 Subject: [PATCH 018/116] feat: #6184 Minor changes --- modules/ticket/back/methods/ticket/saveSign.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index cdcd37255..621e9b456 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -112,12 +112,13 @@ module.exports = Self => { }] }, myOptions); - const ticketState = await models.TicketState.findOne( - {where: {ticketFk: ticketId}, - fields: ['alertLevel'] - }, myOptions); + const ticketState = await models.TicketState.findOne({ + where: {ticketFk: ticketId}, + fields: ['alertLevel'] + }, myOptions); - const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'}, + const packedAlertLevel = await models.AlertLevel.findOne({ + where: {code: 'PACKED'}, fields: ['id'] }, myOptions); @@ -135,9 +136,7 @@ module.exports = Self => { await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ - where: { - code: 'DELIVERED' - } + where: {code: 'DELIVERED'} }, myOptions); await models.Ticket.state(ctx, { From d5a145ba1bf6ce4c820695458fe11e5ed5c034ae Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jan 2024 10:44:04 +0100 Subject: [PATCH 019/116] feat: #6184 Minor changes --- modules/ticket/back/methods/ticket/saveSign.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 621e9b456..9ce32f39c 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -59,16 +59,18 @@ module.exports = Self => { async function hasSignDms(ticketId) { const ticketDms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, + where: { + ticketFk: ticketId + }, fields: ['dmsFk'], include: [{ relation: 'dms', - where: { - dmsType: dmsTypeTicket.id + scope: { + where: {dmsType: dmsTypeTicket.id} } }] }, myOptions); - if (ticketDms) return true; + if (ticketDms.dms().id) return true; } async function createGestDoc(id) { @@ -132,7 +134,8 @@ module.exports = Self => { throw new UserError('Ticket is already signed'); if (location) setLocation(ticketId); - if (!await hasSignDms(ticketId)) createGestDoc(ticketId); + if (!await hasSignDms(ticketId)) + createGestDoc(ticketId); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ From 25fa154f607767cec5f6e840481bf20e16ed9f55 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jan 2024 12:25:02 +0100 Subject: [PATCH 020/116] feat: #6184 Minor changes --- modules/route/back/methods/route/cmrEmail.js | 20 +++++++--------- .../ticket/back/methods/ticket/saveSign.js | 24 +++++++++---------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index 40665a49a..7d1b23bab 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -70,21 +70,17 @@ module.exports = Self => { }; const dms = await models.TicketDms.findOne({ - where: { - ticketFk: ticketId - }, - include: [ - { - relation: 'dms', - fields: ['id'], + where: {ticketFk: ticketId}, + include: [{ + relation: 'dms', + fields: ['id'], + scope: { + relation: 'dmsType', scope: { - relation: 'dmsType', - where: { - code: 'cmr' - } + where: {code: 'cmr'} } } - ] + }] }, myOptions); if (!dms) throw new UserError('Cmr file does not exist'); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 9ce32f39c..625b04d6e 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -59,18 +59,18 @@ module.exports = Self => { async function hasSignDms(ticketId) { const ticketDms = await models.TicketDms.findOne({ - where: { - ticketFk: ticketId - }, - fields: ['dmsFk'], - include: [{ - relation: 'dms', - scope: { - where: {dmsType: dmsTypeTicket.id} + where: {ticketFk: ticketId}, + include: [ + { + relation: 'dms', + fields: ['id'], + scope: { + where: {dmsTypeFk: dmsTypeTicket.id} + } } - }] + ] }, myOptions); - if (ticketDms.dms().id) return true; + if (ticketDms.dms()?.id) return true; } async function createGestDoc(id) { @@ -133,9 +133,9 @@ module.exports = Self => { if (await ticket.isSigned) throw new UserError('Ticket is already signed'); - if (location) setLocation(ticketId); + if (location) await setLocation(ticketId); if (!await hasSignDms(ticketId)) - createGestDoc(ticketId); + await createGestDoc(ticketId); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ From 567e480e3bb47a7023019d45c0cd91ba435ce8de Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jan 2024 12:40:42 +0100 Subject: [PATCH 021/116] feat: #6184 Minor changes --- loopback/locale/es.json | 8 +-- modules/ticket/back/methods/ticket/saveCmr.js | 51 +++++++++---------- .../ticket/back/methods/ticket/saveSign.js | 2 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 5555ef8b0..63613dec8 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -72,7 +72,7 @@ "The secret can't be blank": "La contraseña no puede estar en blanco", "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", "This ticket can not be modified": "Este ticket no puede ser modificado", @@ -336,5 +336,7 @@ "Incorrect pin": "Pin incorrecto.", "You already have the mailAlias": "Ya tienes este alias de correo", "The alias cant be modified": "Este alias de correo no puede ser modificado", - "No tickets to invoice": "No hay tickets para facturar" -} + "No tickets to invoice": "No hay tickets para facturar", + "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", + "Client does not have an email": "El cliente no tiene correo" +} \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index a74ee9bb9..30b327dee 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -1,4 +1,5 @@ const {Readable} = require('stream'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('saveCmr', { @@ -22,7 +23,6 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; - let dms; if (typeof options == 'object') Object.assign(myOptions, options); @@ -33,11 +33,6 @@ module.exports = Self => { } try { - const dmsTypeCmr = await models.DmsType.findOne({ - where: {code: 'cmr'}, - fields: ['id'] - }, myOptions); - for (const ticketId of tickets) { const ticket = await models.Ticket.findById(ticketId, myOptions); @@ -48,31 +43,35 @@ module.exports = Self => { relation: 'dms', fields: ['dmsFk'], scope: { - where: {dmsTypeFk: dmsTypeCmr.id} + relation: 'dmsType', + scope: { + where: {code: 'cmr'} + } } } }, myOptions); - if (!hasDmsCmr?.dms()) { - ctx.args.id = ticket.cmrFk; - const response = await models.Route.cmr(ctx, myOptions); - const pdfStream = Readable.from(Buffer.from(response[0])); - const data = { - workerFk: ctx.req.accessToken.userId, - dmsTypeFk: dmsTypeCmr.id, - companyFk: ticket.companyFk, - warehouseFk: ticket.warehouseFk, - reference: ticket.id, - contentType: 'application/pdf', - hasFile: true - }; + if (hasDmsCmr?.dms()) + throw new UserError('This ticket already has a cmr saved'); - dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); - await models.TicketDms.create({ - ticketFk: ticketId, - dmsFk: dms.id - }, myOptions); - } + ctx.args.id = ticket.cmrFk; + const response = await models.Route.cmr(ctx, myOptions); + const pdfStream = Readable.from(Buffer.from(response[0])); + const data = { + workerFk: ctx.req.accessToken.userId, + dmsTypeFk: dmsTypeCmr.id, + companyFk: ticket.companyFk, + warehouseFk: ticket.warehouseFk, + reference: ticket.id, + contentType: 'application/pdf', + hasFile: true + }; + + const dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); + await models.TicketDms.create({ + ticketFk: ticketId, + dmsFk: dms.id + }, myOptions); } } if (tx) await tx.commit(); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 625b04d6e..e3461ad3a 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -70,7 +70,7 @@ module.exports = Self => { } ] }, myOptions); - if (ticketDms.dms()?.id) return true; + if (ticketDms?.dms()?.id) return true; } async function createGestDoc(id) { From 4fc71b9798edf7a225b5272acd765a0437b4e58a Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 29 Jan 2024 08:04:52 +0100 Subject: [PATCH 022/116] fix(driverRoute): refs #6684 driverRouteHotFix --- print/templates/reports/driver-route/assets/css/style.css | 3 +++ print/templates/reports/driver-route/driver-route.html | 2 +- print/templates/reports/driver-route/driver-route.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/print/templates/reports/driver-route/assets/css/style.css b/print/templates/reports/driver-route/assets/css/style.css index 6b76748eb..903d15186 100644 --- a/print/templates/reports/driver-route/assets/css/style.css +++ b/print/templates/reports/driver-route/assets/css/style.css @@ -47,6 +47,9 @@ section.text-area { padding-right: 1em; background-color: #e5e5e5; } +.text-area > p { + word-break: break-all; +} .route-block { margin-bottom: 100px; diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index cf414c4d3..1475b8e77 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -129,7 +129,7 @@
-

{{ticket.description}}

+

{{ticket.description}}

diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index c166e3809..a970da18c 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -5,12 +5,12 @@ module.exports = { mixins: [vnReport], async serverPrefetch() { let ids = this.id; - + console.log(typeof ids); const hasMultipleRoutes = String(this.id).includes(','); if (hasMultipleRoutes) ids = this.id.split(','); - const routes = await this.rawSqlFromDef('routes', [ids]); + const routes = await this.rawSqlFromDef('routes', +[ids]); const tickets = await this.rawSqlFromDef('tickets', [ids, ids]); const map = new Map(); From 7c80a7bdda38cba71d5bdcc4bb76ab832fdcd71a Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 29 Jan 2024 08:14:33 +0100 Subject: [PATCH 023/116] fix: #6184 Minor changes --- modules/route/back/methods/route/cmrEmail.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index 7d1b23bab..248245259 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -13,21 +13,6 @@ module.exports = Self => { description: 'The ticket id', } ], - returns: [ - { - arg: 'body', - type: 'file', - root: true - }, { - arg: 'Content-Type', - type: 'string', - http: {target: 'header'} - }, { - arg: 'Content-Disposition', - type: 'string', - http: {target: 'header'} - } - ], http: { path: '/cmrEmail', verb: 'POST' @@ -88,7 +73,7 @@ module.exports = Self => { const response = await models.Dms.downloadFile(ctx, dms.id); const email = new Email('cmr', params); - return email.send({ + await email.send({ overrideAttachments: true, attachments: [{ filename: `${ticket.cmrFk}.pdf`, @@ -97,7 +82,6 @@ module.exports = Self => { }); } if (tx) await tx.commit(); - return; } catch (e) { if (tx) await tx.rollback(); throw e; From 65756f98ad579ce2908062c398836d16d3b6777e Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 29 Jan 2024 08:25:00 +0100 Subject: [PATCH 024/116] fix: #6184 Minor changes --- modules/ticket/back/methods/ticket/saveCmr.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 30b327dee..17760bacc 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -33,6 +33,11 @@ module.exports = Self => { } try { + const dmsTypeCmr = await models.DmsType.findOne({ + where: {code: 'cmr'}, + fields: ['id'] + }, myOptions); + for (const ticketId of tickets) { const ticket = await models.Ticket.findById(ticketId, myOptions); @@ -43,10 +48,7 @@ module.exports = Self => { relation: 'dms', fields: ['dmsFk'], scope: { - relation: 'dmsType', - scope: { - where: {code: 'cmr'} - } + where: {dmsTypeFk: dmsTypeCmr.id} } } }, myOptions); From 194262a93e2fdcd86d14fb0f0bed89d3872d539e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 29 Jan 2024 13:48:02 +0100 Subject: [PATCH 025/116] fix: refs #6085 ACL canEditAlias checked, migrated to remote hooks --- back/models/specs/mailAliasAccount.spec.js | 17 ------ .../240404/00-revokeMailAliasAccount.sql | 5 ++ gulpfile.js | 4 +- loopback/locale/en.json | 6 ++- loopback/locale/es.json | 2 +- .../account/back/models/mail-alias-account.js | 52 +++++++++---------- 6 files changed, 38 insertions(+), 48 deletions(-) create mode 100644 db/changes/240404/00-revokeMailAliasAccount.sql diff --git a/back/models/specs/mailAliasAccount.spec.js b/back/models/specs/mailAliasAccount.spec.js index c13cc7ae8..8f0278a50 100644 --- a/back/models/specs/mailAliasAccount.spec.js +++ b/back/models/specs/mailAliasAccount.spec.js @@ -1,23 +1,6 @@ const models = require('vn-loopback/server/server').models; describe('loopback model MailAliasAccount', () => { - it('should fail to add a mail Alias if the worker doesnt have ACLs', async() => { - const tx = await models.MailAliasAccount.beginTransaction({}); - let error; - - try { - const options = {transaction: tx, accessToken: {userId: 57}}; - await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - error = e; - } - - expect(error.message).toEqual('The alias cant be modified'); - }); - it('should add a mail Alias', async() => { const tx = await models.MailAliasAccount.beginTransaction({}); let error; diff --git a/db/changes/240404/00-revokeMailAliasAccount.sql b/db/changes/240404/00-revokeMailAliasAccount.sql new file mode 100644 index 000000000..a86de1f3c --- /dev/null +++ b/db/changes/240404/00-revokeMailAliasAccount.sql @@ -0,0 +1,5 @@ +DELETE FROM salix.ACL + WHERE model = 'MailAliasAccount' + AND property = 'canEditAlias' + AND principalType = 'ROLE' + AND principalId = 'marketingBoss'; diff --git a/gulpfile.js b/gulpfile.js index d7e7d8e86..8614ed1b4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -234,13 +234,13 @@ async function dockerStart() { const container = new Docker('salix-db'); await container.start(); } -dockerStart.description = `Starts the salix-db container`; +dockerStart.description = `Starts the DB container`; async function docker() { const container = new Docker('salix-db'); await container.run(); } -docker.description = `Runs the salix-db container`; +docker.description = `Builds and starts the DB container`; module.exports = { default: defaultTask, diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 568916bef..fb287d185 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -203,5 +203,7 @@ "Cannot past travels with entries": "Cannot past travels with entries", "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", "Incorrect pin": "Incorrect pin.", - "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified" -} \ No newline at end of file + "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", + "You are not allowed to modify the alias": "You are not allowed to modify the alias", + "You already have the mailAlias": "You already have the mailAlias" +} diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 5555ef8b0..9163c494f 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -335,6 +335,6 @@ "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", "Incorrect pin": "Pin incorrecto.", "You already have the mailAlias": "Ya tienes este alias de correo", - "The alias cant be modified": "Este alias de correo no puede ser modificado", + "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", "No tickets to invoice": "No hay tickets para facturar" } diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js index 5eb561408..61ca344e9 100644 --- a/modules/account/back/models/mail-alias-account.js +++ b/modules/account/back/models/mail-alias-account.js @@ -1,5 +1,5 @@ -const UserError = require('vn-loopback/util/user-error'); +const ForbiddenError = require('vn-loopback/util/forbiddenError'); module.exports = Self => { Self.rewriteDbError(function(err) { @@ -8,38 +8,38 @@ module.exports = Self => { return err; }); - Self.observe('before save', async ctx => { - const changes = ctx.currentInstance || ctx.instance; - - await checkModifyPermission(ctx, changes.mailAlias); + Self.beforeRemote('create', async function(ctx) { + const mailAlias = ctx.args.data?.mailAlias; + if (!mailAlias) return; + await checkModifyPermission(ctx, mailAlias); }); - - Self.observe('before delete', async ctx => { - const mailAliasAccount = await Self.findById(ctx.where.id); - - await checkModifyPermission(ctx, mailAliasAccount.mailAlias); + Self.beforeRemote('deleteById', async function(ctx) { + const instance = await Self.findById(ctx.args.id, + {fields: ['mailAlias']} + ); + await checkModifyPermission(ctx, instance.mailAlias); }); async function checkModifyPermission(ctx, mailAliasFk) { - const userId = ctx.options.accessToken.userId; const models = Self.app.models; + const userId = ctx.req.accessToken.userId; - const roles = await models.RoleMapping.find({ - fields: ['roleId'], - where: {principalId: userId} + const canEditAlias = await models.ACL.checkAccessAcl(ctx, + 'MailAliasAccount', 'canEditAlias', 'WRITE'); + if (canEditAlias) return; + + const allowedRoles = await models.MailAliasAcl.find({ + fields: ['roleFk'], + where: {mailAliasFk} }); + const nRoles = allowedRoles.length && + await models.RoleMapping.count({ + principalId: userId, + principalType: 'USER', + roleId: {inq: allowedRoles.map(x => x.roleFk)} + }); - const availableMailAlias = await models.MailAliasAcl.findOne({ - fields: ['mailAliasFk'], - include: {relation: 'mailAlias'}, - where: { - roleFk: { - inq: roles.map(role => role.roleId), - }, - mailAliasFk - } - }); - - if (!availableMailAlias) throw new UserError('The alias cant be modified'); + if (!nRoles) + throw new ForbiddenError('You are not allowed to modify the alias'); } }; From 65268487b9ae6d53a0db185ba1914794b36c09f6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 30 Jan 2024 07:32:26 +0100 Subject: [PATCH 026/116] fix: #6184 Now creates only one dms in saveSign --- modules/ticket/back/methods/ticket/saveSign.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index e3461ad3a..7f168bfc0 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -34,6 +34,8 @@ module.exports = Self => { const myOptions = {userId: ctx.req.accessToken.userId}; let tx; let ticket; + let dms; + let gestDocCreated; if (typeof options == 'object') Object.assign(myOptions, options); @@ -83,8 +85,8 @@ module.exports = Self => { description: `Firma del cliente - Ruta ${ticket.route().id}`, hasFile: true }; - const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - await models.TicketDms.create({ticketFk: id, dmsFk: dms[0].id}, myOptions); + dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + gestDocCreated = true; } try { @@ -134,8 +136,9 @@ module.exports = Self => { throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); - if (!await hasSignDms(ticketId)) + if (!await hasSignDms(ticketId) && !gestDocCreated) await createGestDoc(ticketId); + await models.TicketDms.create({ticketFk: id, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ From 1fe6818a0f0c9ba12e3f8136906f98f6b52ce18a Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 30 Jan 2024 07:42:58 +0100 Subject: [PATCH 027/116] fix: #6184 Minor changes --- modules/ticket/back/methods/ticket/saveSign.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 7f168bfc0..91c6930d8 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -75,7 +75,7 @@ module.exports = Self => { if (ticketDms?.dms()?.id) return true; } - async function createGestDoc(id) { + async function createGestDoc() { const ctxUploadFile = Object.assign({}, ctx); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, @@ -138,7 +138,7 @@ module.exports = Self => { if (location) await setLocation(ticketId); if (!await hasSignDms(ticketId) && !gestDocCreated) await createGestDoc(ticketId); - await models.TicketDms.create({ticketFk: id, dmsFk: dms[0].id}, myOptions); + await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ From 0f3ffcfa61a84f3c529e0399b60415bd6814ff74 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 30 Jan 2024 08:11:33 +0100 Subject: [PATCH 028/116] fix: refs #6184 Upload sign --- back/methods/dms/uploadFile.js | 2 +- modules/ticket/back/methods/ticket/saveSign.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js index 728ae229f..8456cf2d3 100644 --- a/back/methods/dms/uploadFile.js +++ b/back/methods/dms/uploadFile.js @@ -88,7 +88,7 @@ module.exports = Self => { warehouseFk: args.warehouseId, reference: args.reference, description: args.description, - contentType: file.type, + contentType: args.contentType, hasFile: args.hasFile }; const extension = await models.DmsContainer.getFileExtension(uploadedFile.name); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 91c6930d8..0fcd41102 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -83,6 +83,7 @@ module.exports = Self => { dmsTypeId: dmsTypeTicket.id, reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, + contentType: 'image/png', hasFile: true }; dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); From 1e56e741e2f7ba5a9082644ecd5d9f170b40ca0c Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 30 Jan 2024 09:44:10 +0100 Subject: [PATCH 029/116] fix: #6184 Requested changes --- db/dump/fixtures.after.sql | 3 - db/dump/fixtures.before.sql | 70 +++++++++---------- loopback/locale/es.json | 3 +- modules/route/back/methods/route/cmrEmail.js | 15 ++-- .../back/methods/route/downloadCmrsZip.js | 6 +- 5 files changed, 43 insertions(+), 54 deletions(-) diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index 57ccb8626..db4d05dfd 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -66,9 +66,6 @@ UPDATE vn.supplier SET isTrucker = 1 WHERE id = 2; -INSERT INTO vn.cmr (id, truckPlate, observations, senderInstruccions, paymentInstruccions, specialAgreements, created, companyFk, addressToFk, addressFromFk, supplierFk, packagesList, merchandiseDetail, state, landed, ead) - VALUES (2, NULL, NULL, NULL, 'Carriage paid', NULL, '2022-06-27 13:31:11.000', 442, 3, 2, 2, NULL, NULL, NULL, NULL, NULL); - -- XXX: tpv UPDATE `vn`.`claimRatio` SET `claimAmount` = '10' WHERE (`clientFk` = '1101'); diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 7ea8c0120..6ff95a404 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -729,40 +729,40 @@ 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`) +INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`) 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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), 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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (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), - (24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), 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), - (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), - (27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), 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), - (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), - (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), - (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), - (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); + (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); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES @@ -3071,7 +3071,3 @@ INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentIns VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), (2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'), (3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'); - -UPDATE `vn`.`ticket` SET `cmrFk`= 1 WHERE `id`= 1; -UPDATE `vn`.`ticket` SET `cmrFk`= 2 WHERE `id`= 2; -UPDATE `vn`.`ticket` SET `cmrFk`= 3 WHERE `id`= 3; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 63613dec8..7b51527d4 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -337,6 +337,5 @@ "You already have the mailAlias": "Ya tienes este alias de correo", "The alias cant be modified": "Este alias de correo no puede ser modificado", "No tickets to invoice": "No hay tickets para facturar", - "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", - "Client does not have an email": "El cliente no tiene correo" + "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado" } \ No newline at end of file diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index 248245259..11c4d3dc8 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -46,13 +46,7 @@ module.exports = Self => { const recipient = ticket.client().email; if (!recipient) - throw new UserError('Client does not have an email'); - - const params = { - ticketId, - lang: ctx.req.getLocale(), - recipient - }; + throw new UserError('There is no assigned email for this client'); const dms = await models.TicketDms.findOne({ where: {ticketFk: ticketId}, @@ -71,7 +65,12 @@ module.exports = Self => { if (!dms) throw new UserError('Cmr file does not exist'); const response = await models.Dms.downloadFile(ctx, dms.id); - const email = new Email('cmr', params); + + const email = new Email('cmr', { + ticketId, + lang: ctx.req.getLocale(), + recipient + }); await email.send({ overrideAttachments: true, diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index ccbb57d87..58445f6f1 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -45,12 +45,10 @@ module.exports = Self => { for (const id of ids) { ctx.args = ctx.args || {}; ctx.args.id = Number(id); - const data = await models.Route.cmr(ctx, myOptions); - zip.file(`${id}.pdf`, data[0], {binary: true}); + const [data] = await models.Route.cmr(ctx, myOptions); + zip.file(`${id}.pdf`, data, {binary: true}); } - const zipStream = zip.generateNodeStream({streamFiles: true}); - return [zipStream, 'application/zip', `filename="cmrs.zip"`]; }; }; From d39d54a514aa85c493175b39cc10486964cc6d56 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 30 Jan 2024 09:50:53 +0100 Subject: [PATCH 030/116] fix: #6184 Requested changes --- .../back/methods/route/specs/downloadCmrsZip.spec.js | 11 +++++++++-- .../route/back/methods/route/specs/saveCmr.spec.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js index 1e8ed29e7..c6b498a77 100644 --- a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js +++ b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js @@ -6,6 +6,7 @@ describe('route downloadCmrsZip()', () => { }); it('should create a zip file with the given cmr ids', async() => { + const tx = await models.Route.beginTransaction({}); const ctx = { req: { getLocale: () => { @@ -15,8 +16,14 @@ describe('route downloadCmrsZip()', () => { } }; let cmrs = '1,2'; - let result = await models.Route.downloadCmrsZip(ctx, cmrs); + try { + await models.Route.downloadCmrsZip(ctx, cmrs); + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } - expect(result.length).toBeGreaterThanOrEqual(1); + expect(error).toBeDefined(); }); }); diff --git a/modules/route/back/methods/route/specs/saveCmr.spec.js b/modules/route/back/methods/route/specs/saveCmr.spec.js index 9de29540f..d9ad12ad1 100644 --- a/modules/route/back/methods/route/specs/saveCmr.spec.js +++ b/modules/route/back/methods/route/specs/saveCmr.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -describe('Ticket saveCmr()', () => { +describe('ticket saveCmr()', () => { let ctx = {req: { accessToken: {userId: 9} }}; From 7d4b6132ec1392fa0154302bcd67658b27999fb4 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 31 Jan 2024 12:30:57 +0100 Subject: [PATCH 031/116] fix(css): refs #6684 driverRouteReport --- modules/item/front/basic-data/index.html | 7 ------- print/templates/reports/driver-route/assets/css/style.css | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 38c314208..af76d5966 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -49,13 +49,6 @@ vn-name="relevancy" rule>
- -
p { - word-break: break-all; + & > p { + word-break: break-all; + } } .route-block { From 4ba76291c141a6d9d142d870de1a40d4557641b7 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 31 Jan 2024 12:33:52 +0100 Subject: [PATCH 032/116] remove(console.log): refs #6684 driverRouteFix --- print/templates/reports/driver-route/driver-route.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index a970da18c..ad8ad62ee 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -5,12 +5,11 @@ module.exports = { mixins: [vnReport], async serverPrefetch() { let ids = this.id; - console.log(typeof ids); const hasMultipleRoutes = String(this.id).includes(','); if (hasMultipleRoutes) ids = this.id.split(','); - const routes = await this.rawSqlFromDef('routes', +[ids]); + const routes = await this.rawSqlFromDef('routes', [ids]); const tickets = await this.rawSqlFromDef('tickets', [ids, ids]); const map = new Map(); From 550e3991cd2b303338f3049a0c33e2cfaebc6f6f Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 31 Jan 2024 12:50:32 +0100 Subject: [PATCH 033/116] fix(warning): refs #6684 fix vue warning --- print/templates/reports/driver-route/driver-route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index ad8ad62ee..bfe04f337 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -29,7 +29,7 @@ module.exports = { }, props: { id: { - type: Number, + type: String, required: true, description: 'The route id' } From eec36300ad9a3681aa71c1e6671a02ae870f2440 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 2 Feb 2024 12:25:48 +0100 Subject: [PATCH 034/116] refactor: refs #6184 Minor changes --- modules/ticket/back/methods/ticket/saveSign.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 3a4a5ac28..0fcd41102 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -137,23 +137,13 @@ module.exports = Self => { throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); -<<<<<<< HEAD if (!await hasSignDms(ticketId) && !gestDocCreated) await createGestDoc(ticketId); -======= - if (!gestDocCreated) await createGestDoc(ticketId); ->>>>>>> dev await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ -<<<<<<< HEAD where: {code: 'DELIVERED'} -======= - where: { - code: 'DELIVERED' - } ->>>>>>> dev }, myOptions); await models.Ticket.state(ctx, { From 9448b4053392a52df4040cf1ccb89c5122516ed5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 2 Feb 2024 14:53:48 +0100 Subject: [PATCH 035/116] refs #6386 feat: add extension when return file --- back/methods/image/download.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/image/download.js b/back/methods/image/download.js index c4037b809..2b1a4b546 100644 --- a/back/methods/image/download.js +++ b/back/methods/image/download.js @@ -87,6 +87,6 @@ module.exports = Self => { await fs.access(file.path); const stream = fs.createReadStream(file.path); - return [stream, file.contentType, `filename="${file.name}"`]; + return [stream, file.contentType, `filename="${fileName}"`]; }; }; From d28cacfbad39a874c3ac070b2d1965cf519620f7 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 5 Feb 2024 09:02:31 +0100 Subject: [PATCH 036/116] refactor: refs #6778 Migrated views of vn2008 to vn --- .../bi/procedures/Greuge_Evolution_Add.sql | 14 ++++---- .../bi/procedures/claim_ratio_routine.sql | 26 +++++++-------- db/routines/bi/procedures/defaulting.sql | 4 +-- .../bi/procedures/greuge_dif_porte_add.sql | 12 +++---- .../bs/procedures/comercialesCompleto.sql | 10 +++--- .../bs/procedures/manaCustomerUpdate.sql | 10 +++--- .../bs/procedures/ventas_contables_add.sql | 6 ++-- .../ventas_contables_por_cliente.sql | 6 ++-- db/routines/bs/procedures/vivosMuertos.sql | 22 ++++++------- .../vn/functions/isPalletHomogeneus.sql | 4 +-- .../vn/procedures/getDayExpeditions.sql | 10 +++--- .../vn/procedures/itemFuentesBalance.sql | 33 +++++++++---------- .../vn/procedures/itemShelvingRadar.sql | 10 +++--- .../vn/procedures/shelving_getSpam.sql | 30 ++++++++--------- .../vn2008/functions/intrastat_neto.sql | 12 +++---- .../vn2008/procedures/CalculoRemesas.sql | 10 +++--- .../procedures/ListaTicketsEncajados.sql | 6 ++-- .../vn2008/procedures/availableTraslate.sql | 22 ++++++------- .../vn2008/procedures/balance_create.sql | 6 ++-- .../procedures/customerDebtEvolution.sql | 8 ++--- db/routines/vn2008/views/Facturas.sql | 20 ----------- db/routines/vn2008/views/Gastos.sql | 7 ---- db/routines/vn2008/views/Greuges.sql | 12 ------- db/routines/vn2008/views/Greuges_type.sql | 6 ---- db/routines/vn2008/views/Intrastat.sql | 8 ----- db/routines/vn2008/views/expeditions.sql | 16 --------- db/routines/vn2008/views/gestdoc.sql | 16 --------- db/routines/vn2008/views/gesttip.sql | 9 ----- db/routines/vn2008/views/intrastat_data.sql | 13 -------- .../vn2008/views/invoiceCorrection.sql | 9 ----- db/routines/vn2008/views/itemTag.sql | 9 ----- db/routines/vn2008/views/item_entry_in.sql | 20 ----------- db/routines/vn2008/views/item_entry_out.sql | 27 --------------- db/routines/vn2008/views/item_out.sql | 17 ---------- .../10868-grayChico/00-firstScript.sql | 15 +++++++++ 35 files changed, 145 insertions(+), 320 deletions(-) delete mode 100644 db/routines/vn2008/views/Facturas.sql delete mode 100644 db/routines/vn2008/views/Gastos.sql delete mode 100644 db/routines/vn2008/views/Greuges.sql delete mode 100644 db/routines/vn2008/views/Greuges_type.sql delete mode 100644 db/routines/vn2008/views/Intrastat.sql delete mode 100644 db/routines/vn2008/views/expeditions.sql delete mode 100644 db/routines/vn2008/views/gestdoc.sql delete mode 100644 db/routines/vn2008/views/gesttip.sql delete mode 100644 db/routines/vn2008/views/intrastat_data.sql delete mode 100644 db/routines/vn2008/views/invoiceCorrection.sql delete mode 100644 db/routines/vn2008/views/itemTag.sql delete mode 100644 db/routines/vn2008/views/item_entry_in.sql delete mode 100644 db/routines/vn2008/views/item_entry_out.sql delete mode 100644 db/routines/vn2008/views/item_out.sql create mode 100644 db/versions/10868-grayChico/00-firstScript.sql diff --git a/db/routines/bi/procedures/Greuge_Evolution_Add.sql b/db/routines/bi/procedures/Greuge_Evolution_Add.sql index 83033cbf8..b29be6b49 100644 --- a/db/routines/bi/procedures/Greuge_Evolution_Add.sql +++ b/db/routines/bi/procedures/Greuge_Evolution_Add.sql @@ -42,9 +42,9 @@ BEGIN CREATE TEMPORARY TABLE maxInvoice (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY - SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha - FROM vn2008.Facturas - GROUP BY Id_Cliente + SELECT DISTINCT clientFk Id_Cliente, max(issued) as maxFecha + FROM vn.invoiceOut + GROUP BY clientFk HAVING maxFecha < timestampadd(month,-2,datFEC); WHILE datFEC < util.VN_CURDATE() DO @@ -53,10 +53,10 @@ BEGIN SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 FROM ( - SELECT Id_Cliente, sum(Importe) as Greuge - FROM vn2008.Greuges - where Fecha <= datFEC - group by Id_Cliente + SELECT clientFk Id_Cliente, sum(amount) as Greuge + FROM vn2.greuge + where shipped <= datFEC + group by clientFk ) sub RIGHT JOIN diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index 4616bcb9e..ded154242 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -11,8 +11,8 @@ BEGIN -- Reclamaciones demasiado sensibles - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe, Greuges_type_id,Id_Ticket) + INSERT INTO vn.greuge(shipped, clientFk, description, + amount, greugeTypeFk, ticketFk) SELECT cm.Fecha , cm.Id_Cliente , concat('Claim ',cm.id,' : ', m.Concepte) @@ -29,8 +29,8 @@ BEGIN -- Reclamaciones que pasan a Maná - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe , Greuges_type_id,Id_Ticket) + INSERT INTO vn.greuge(shipped, clientFk, description, + amount, greugeTypeFk, ticketFk) SELECT cm.Fecha , cm.Id_Cliente , concat('Claim_mana ',cm.id,' : ', m.Concepte) @@ -73,12 +73,12 @@ BEGIN AND s.alert_level >= 3; DELETE g.* - FROM vn2008.Greuges g - JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket - WHERE Greuges_type_id = 2; + FROM vn.greuge g + JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket + WHERE t.greugeTypeFk = 2; - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, - Greuges_type_id, Id_Ticket) + INSERT INTO vn.greuge(clientFk, description, amount,shipped, + greugeTypeFk, ticketFk) SELECT Id_Cliente ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) AS dif @@ -130,10 +130,10 @@ BEGIN -- Calculamos el porcentaje del recobro para añadirlo al precio de venta UPDATE bi.claims_ratio cr JOIN ( - SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge - FROM vn2008.Greuges - WHERE Fecha <= util.VN_CURDATE() - GROUP BY Id_Cliente + SELECT clientFk Id_Cliente, nz(SUM(amount)) 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(nz(Greuge) / (nz(Consumo) * vMonthToRefund / 12 ) ,3)); diff --git a/db/routines/bi/procedures/defaulting.sql b/db/routines/bi/procedures/defaulting.sql index 50600e554..e8ba5e682 100644 --- a/db/routines/bi/procedures/defaulting.sql +++ b/db/routines/bi/procedures/defaulting.sql @@ -14,8 +14,8 @@ BEGIN WHERE hasChanged AND date = vDate; DECLARE invoices CURSOR FOR - SELECT Vencimiento, importe FROM vn2008.Facturas f - WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + SELECT dued Vencimiento, amount importe FROM vn.invoiceOut + WHERE issued >= '2016-01-01' AND clientFk = vClient ORDER BY issued DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; diff --git a/db/routines/bi/procedures/greuge_dif_porte_add.sql b/db/routines/bi/procedures/greuge_dif_porte_add.sql index c81e41661..02bd9eae4 100644 --- a/db/routines/bi/procedures/greuge_dif_porte_add.sql +++ b/db/routines/bi/procedures/greuge_dif_porte_add.sql @@ -19,8 +19,8 @@ BEGIN FROM vn.ticket t JOIN vn2008.Clientes cli ON cli.Id_cliente = t.clientFk - LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.id - JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.EsBulto + LEFT JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk JOIN vn.zone z ON t.zoneFk = z.id WHERE t.shipped between datSTART AND datEND @@ -64,17 +64,17 @@ BEGIN CREATE TEMPORARY TABLE tmp.dp_aux (PRIMARY KEY (ticketFk)) ENGINE = MEMORY - SELECT dp.ticketFk, sum(Importe) Importe + SELECT dp.ticketFk, sum(g.amount) Importe FROM tmp.dp - JOIN vn2008.Greuges g ON g.Id_Ticket = dp.ticketFk - WHERE Greuges_type_id = 1 -- dif_porte + JOIN vn.greuge g ON g.ticketFk = dp.ticketFk + WHERE g.greugeTypeFk = 1 -- dif_porte GROUP BY dp.ticketFk; UPDATE tmp.dp JOIN tmp.dp_aux USING(ticketFk) SET greuge = IFNULL(Importe,0); - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) + INSERT INTO vn.greuge (clientFk,description,amount,shipped,greugeTypeFk,ticketFk) SELECT dp.clientFk , concat('dif_porte ', dp.ticketFk) , round(IFNULL(dp.teorico,0) - IFNULL(dp.practico,0) - IFNULL(dp.greuge,0),2) as Importe diff --git a/db/routines/bs/procedures/comercialesCompleto.sql b/db/routines/bs/procedures/comercialesCompleto.sql index 323d5cd00..b84467cf1 100644 --- a/db/routines/bs/procedures/comercialesCompleto.sql +++ b/db/routines/bs/procedures/comercialesCompleto.sql @@ -37,9 +37,9 @@ BEGIN FROM vn2008.Clientes c LEFT JOIN - (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge - FROM vn2008.Greuges g - JOIN vn.`client` c ON c.id = g.Id_Cliente + (SELECT g.clientFk Id_Cliente, CAST( SUM(g.amount) as DECIMAL(12,2)) AS Greuge + FROM vn.greuge g + JOIN vn.`client` c ON c.id = g.clientFk LEFT JOIN vn.worker w ON c.salesPersonFk = w.id WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker) GROUP BY Id_Cliente @@ -99,8 +99,8 @@ BEGIN LEFT JOIN (SELECT c.Id_Cliente, IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto - FROM vn2008.Facturas f - JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente + FROM vn.invoiceOut f + JOIN vn2008.Clientes c ON c.Id_cliente = f.clientFk LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente diff --git a/db/routines/bs/procedures/manaCustomerUpdate.sql b/db/routines/bs/procedures/manaCustomerUpdate.sql index 1e9cb8429..2cb25d135 100644 --- a/db/routines/bs/procedures/manaCustomerUpdate.sql +++ b/db/routines/bs/procedures/manaCustomerUpdate.sql @@ -82,11 +82,11 @@ BEGIN AND Fechacobro > vFromDated AND Fechacobro <= vToDated UNION ALL - SELECT g.Id_Cliente, g.Importe - FROM vn2008.Greuges g - WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated - AND Fecha <= vToDated + SELECT clientFk, amount + FROM vn.greuge + WHERE greugeTypeFk = vManaGreugeTypeId + AND shipped > vFromDated + AND shipped <= vToDated UNION ALL SELECT clientFk, mana FROM vn.clientManaCache diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index d8e963e3e..6cca2ff7f 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -23,9 +23,9 @@ BEGIN ENGINE = MEMORY SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + JOIN vn.invoiceOut f ON f.id = t.Factura + WHERE year(f.issued) = vYear + AND month(f.issued) = vMonth; INSERT INTO bs.ventas_contables(year , month diff --git a/db/routines/bs/procedures/ventas_contables_por_cliente.sql b/db/routines/bs/procedures/ventas_contables_por_cliente.sql index 9f1399025..b5b7a39d5 100644 --- a/db/routines/bs/procedures/ventas_contables_por_cliente.sql +++ b/db/routines/bs/procedures/ventas_contables_por_cliente.sql @@ -13,9 +13,9 @@ BEGIN (PRIMARY KEY (Id_Ticket)) SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + JOIN vn.invoiceOut f ON f.id = t.Factura + WHERE year(f.issued) = vYear + AND month(f.issued) = vMonth; SELECT vYear Año, vMonth Mes, diff --git a/db/routines/bs/procedures/vivosMuertos.sql b/db/routines/bs/procedures/vivosMuertos.sql index 1743eda64..9cd0e3605 100644 --- a/db/routines/bs/procedures/vivosMuertos.sql +++ b/db/routines/bs/procedures/vivosMuertos.sql @@ -24,20 +24,20 @@ BEGIN WHERE date BETWEEN @datSTART AND @datEND ) tm LEFT JOIN - (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha + (SELECT DISTINCT tm.yearMonth, f.clientFk Id_Cliente , 1 as Compra + FROM vn.invoiceOut f + JOIN vn2008.time tm ON tm.date = f.issued WHERE Fecha BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; UPDATE tmp.VivosMuertos vm JOIN - (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha + (SELECT MIN(tm.yearMonth) firstMonth, f.clientFk Id_Cliente + FROM vn.invoiceOut f + JOIN vn2008.time tm ON tm.date = f.issued WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth + GROUP BY f.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Nuevo = 1; @@ -46,11 +46,11 @@ BEGIN UPDATE tmp.VivosMuertos vm JOIN ( - SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha + SELECT MAX(tm.yearMonth) firstMonth, f.clientFk Id_Cliente + FROM vn.invoiceOut f + JOIN vn2008.time tm ON tm.date = f.issued WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth + GROUP BY f.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Muerto = 1 diff --git a/db/routines/vn/functions/isPalletHomogeneus.sql b/db/routines/vn/functions/isPalletHomogeneus.sql index 39c6461ae..d308e8ed3 100644 --- a/db/routines/vn/functions/isPalletHomogeneus.sql +++ b/db/routines/vn/functions/isPalletHomogeneus.sql @@ -16,8 +16,8 @@ BEGIN FROM ( SELECT DISTINCT t.Id_Ruta FROM vn2008.scan_line sl - JOIN vn2008.expeditions e ON e.expeditions_id = sl.code - JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id + JOIN expeditions e ON e.id = sl.code + JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk WHERE sl.scan_id = vScanId AND t.Id_Ruta ) t1; diff --git a/db/routines/vn/procedures/getDayExpeditions.sql b/db/routines/vn/procedures/getDayExpeditions.sql index 949cf4e5b..535dfde4a 100644 --- a/db/routines/vn/procedures/getDayExpeditions.sql +++ b/db/routines/vn/procedures/getDayExpeditions.sql @@ -3,12 +3,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getDayExpeditions`( BEGIN SELECT - e.expeditions_id as expeditionFk, - date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, - e.ticket_id as ticketFk, + e.id as expeditionFk, + date_format(e.created,'%Y-%m-%d') as expeditionDate, + e.ticketFk, t.routeFk as routeFk - FROM vn2008.expeditions e - INNER JOIN vn.ticket t ON t.id = e.ticket_id + FROM expeditions e + INNER JOIN vn.ticket t ON t.id = e.ticketFk WHERE DATE(odbc_date) = util.VN_CURDATE(); END$$ diff --git a/db/routines/vn/procedures/itemFuentesBalance.sql b/db/routines/vn/procedures/itemFuentesBalance.sql index d793841ee..e60273340 100644 --- a/db/routines/vn/procedures/itemFuentesBalance.sql +++ b/db/routines/vn/procedures/itemFuentesBalance.sql @@ -50,31 +50,30 @@ BEGIN ) alb ON alb.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta + FROM itemTicketOut + WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseFk = vWarehouseFk + GROUP BY itemFk ) sale ON sale.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra + FROM itemEntryIn + WHERE landed BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseInFk = vWarehouseFk AND isVirtualStock = FALSE - GROUP BY item_id + GROUP BY itemFk ) buy ON buy.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado + FROM itemEntryOut + WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseOutFk = vWarehouseFk + GROUP BY itemFk ) mov ON mov.item_id = i.id WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) AND i.itemPackingTypeFk = 'H' - AND ic.shortLife - ; + AND ic.shortLife; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql index 778bd9910..a1e89e89a 100644 --- a/db/routines/vn/procedures/itemShelvingRadar.sql +++ b/db/routines/vn/procedures/itemShelvingRadar.sql @@ -141,8 +141,8 @@ proc:BEGIN amount, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes - FROM vn2008.item_out io - JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id + FROM itemTicketOut io + JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk JOIN vn.ticket t on t.id= io.ticketFk JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk JOIN vn.state s ON s.id = ts.stateFk @@ -154,10 +154,10 @@ proc:BEGIN ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk WHERE t.warehouseFk = vWarehouseFk AND s.isPicked = 0 - AND NOT io.Reservado + AND NOT io.reserved AND stPrevious.saleFk IS NULL - AND io.dat >= util.VN_CURDATE() - AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY + AND io.shipped >= util.VN_CURDATE() + AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY ) sub GROUP BY itemFk, hours, minutes; diff --git a/db/routines/vn/procedures/shelving_getSpam.sql b/db/routines/vn/procedures/shelving_getSpam.sql index eccbfb9a4..2895470ad 100644 --- a/db/routines/vn/procedures/shelving_getSpam.sql +++ b/db/routines/vn/procedures/shelving_getSpam.sql @@ -34,26 +34,26 @@ BEGIN ) fue ON fue.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta + FROM itemTicketOut + WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseFk = vWarehouseFk + GROUP BY itemFk ) sale ON sale.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra + FROM itemEntryIn + WHERE landed BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseInFk = vWarehouseFk AND isVirtualStock = FALSE - GROUP BY item_id + GROUP BY itemFk ) buy ON buy.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado + FROM itemEntryOut + WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseOutFk = vWarehouseFk + GROUP BY itemFk ) mov ON mov.item_id = i.id WHERE v.amount; diff --git a/db/routines/vn2008/functions/intrastat_neto.sql b/db/routines/vn2008/functions/intrastat_neto.sql index 34e01de8c..0f38ccd0e 100644 --- a/db/routines/vn2008/functions/intrastat_neto.sql +++ b/db/routines/vn2008/functions/intrastat_neto.sql @@ -6,12 +6,12 @@ BEGIN DECLARE n DOUBLE; - SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM - (SELECT *, unidades / neto MEDIA - FROM intrastat_data - WHERE intrastat_id = intINSTRASTAT AND neto - AND unidades > 0 - ORDER BY odbc_date DESC + SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(MEDIA)), 2) INTO n FROM + (SELECT *, stems / net MEDIA + FROM vn.invoiceInIntrastat + WHERE intrastatFk = intINSTRASTAT AND net + AND stems > 0 + ORDER BY dated DESC LIMIT 20) t; -- JGF 01/06 per a evitar Kg en negatiu RETURN n/2; diff --git a/db/routines/vn2008/procedures/CalculoRemesas.sql b/db/routines/vn2008/procedures/CalculoRemesas.sql index 17a2e7fdd..e7d1ae22c 100644 --- a/db/routines/vn2008/procedures/CalculoRemesas.sql +++ b/db/routines/vn2008/procedures/CalculoRemesas.sql @@ -47,13 +47,13 @@ BEGIN UNION ALL - SELECT empresa_id, Id_Cliente, - Importe - FROM Facturas f - JOIN Clientes c using(Id_Cliente) + SELECT d.companyFk, f.clientFk Id_Cliente, - f.amount + FROM vn.invoiceOut f + JOIN Clientes c ON c.Id_Cliente = f.clientFk JOIN pay_met pm on pm.id = pay_met_id - WHERE f.Vencimiento > vFechaRemesa + WHERE f.dued > vFechaRemesa AND pay_met_id = 4 AND pm.deudaviva - AND Importe > 0 + AND f.amount > 0 ) risk ON c.Id_Cliente = risk.clientFk GROUP BY risk.companyFk, Id_Cliente diff --git a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql index 3d3318c63..e0b48bc5e 100644 --- a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql +++ b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql @@ -13,9 +13,9 @@ SELECT Agencia, FROM Tickets ti INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia - LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS nbultos FROM expeditions WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS notros FROM expeditions WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.Ticket_Id + LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.ticketFk INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk WHERE ti.Fecha=util.VN_CURDATE() AND ts.userFk=intId_Trabajador diff --git a/db/routines/vn2008/procedures/availableTraslate.sql b/db/routines/vn2008/procedures/availableTraslate.sql index 6328560c8..4ac5e3209 100644 --- a/db/routines/vn2008/procedures/availableTraslate.sql +++ b/db/routines/vn2008/procedures/availableTraslate.sql @@ -67,12 +67,12 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.itemCalc (INDEX (itemFk,warehouseFk)) ENGINE = MEMORY - SELECT i.item_id itemFk, vWarehouseLanding warehouseFk, i.dat dated, i.amount quantity - FROM item_out i + SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity + FROM vn.itemTicketOut i JOIN itemRangeLive ir ON ir.itemFK = i.item_id - WHERE i.dat >= vDatedFrom - AND (ir.dated IS NULL OR i.dat <= ir.dated) - AND i.warehouse_id = vWarehouseLanding + WHERE i.shipped >= vDatedFrom + AND (ir.dated IS NULL OR i.shipped <= ir.dated) + AND i.warehouseFk = vWarehouseLanding UNION ALL SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity FROM vn.buy b @@ -86,12 +86,12 @@ proc: BEGIN AND t.landed >= vDatedFrom AND (ir.dated IS NULL OR t.landed <= ir.dated) UNION ALL - SELECT i.item_id, vWarehouseLanding, i.dat, i.amount - FROM item_entry_out i - JOIN itemRangeLive ir ON ir.itemFk = i.item_id - WHERE i.dat >= vDatedFrom - AND (ir.dated IS NULL OR i.dat <= ir.dated) - AND i.warehouse_id = vWarehouseLanding + SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity + FROM vn.itemEntryOut i + JOIN itemRangeLive ir ON ir.itemFk = i.itemFk + WHERE i.shipped >= vDatedFrom + AND (ir.dated IS NULL OR i.shipped <= ir.dated) + AND i.warehouseOutFk = vWarehouseLanding UNION ALL SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount FROM hedera.order_row r diff --git a/db/routines/vn2008/procedures/balance_create.sql b/db/routines/vn2008/procedures/balance_create.sql index 978dae720..2acd26834 100644 --- a/db/routines/vn2008/procedures/balance_create.sql +++ b/db/routines/vn2008/procedures/balance_create.sql @@ -122,9 +122,9 @@ BEGIN -- Añadimos los gastos, para facilitar el formulario UPDATE tmp.balance b JOIN vn2008.balance_nest_tree bnt on bnt.id = b.id - JOIN (SELECT Id_Gasto, Gasto - FROM vn2008.Gastos - GROUP BY Id_Gasto) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci + JOIN (SELECT id Id_Gasto, name Gasto + FROM vn.expense + GROUP BY id) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci SET b.Id_Gasto = g.Id_Gasto COLLATE utf8_general_ci , b.Gasto = g.Gasto COLLATE utf8_general_ci ; diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql index e5d23f0ef..20ed75d8f 100644 --- a/db/routines/vn2008/procedures/customerDebtEvolution.sql +++ b/db/routines/vn2008/procedures/customerDebtEvolution.sql @@ -18,10 +18,10 @@ SELECT * FROM WHERE Id_Cliente = vCustomer AND Fechacobro >= '2017-01-01' UNION ALL - SELECT vn.getDueDate(f.Fecha,c.Vencimiento), - Importe - FROM Facturas f - JOIN Clientes c ON f.Id_Cliente = c.Id_Cliente - WHERE f.Id_Cliente = vCustomer + SELECT vn.getDueDate(f.issued,c.Vencimiento), - Importe + FROM vn.invoiceOut f + JOIN Clientes c ON f.clientFk = c.Id_Cliente + WHERE f.clientFk = vCustomer AND Fecha >= '2017-01-01' UNION ALL SELECT '2016-12-31', Debt diff --git a/db/routines/vn2008/views/Facturas.sql b/db/routines/vn2008/views/Facturas.sql deleted file mode 100644 index bc99c02d8..000000000 --- a/db/routines/vn2008/views/Facturas.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Facturas` -AS SELECT `io`.`id` AS `factura_id`, - `io`.`ref` AS `Id_Factura`, - `io`.`serial` AS `Serie`, - `io`.`issued` AS `Fecha`, - `io`.`amount` AS `Importe`, - `io`.`clientFk` AS `Id_Cliente`, - `io`.`created` AS `odbc_date`, - `io`.`companyFk` AS `empresa_id`, - `io`.`dued` AS `Vencimiento`, - `io`.`booked` AS `booked`, - `io`.`bankFk` AS `Id_Banco`, - `io`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`, - `io`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`, - `io`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`, - `io`.`siiTrascendencyInvoiceOutFk` AS `siiTrascendencyInvoiceOutFk`, - `io`.`hasPdf` AS `pdf` -FROM `vn`.`invoiceOut` `io` diff --git a/db/routines/vn2008/views/Gastos.sql b/db/routines/vn2008/views/Gastos.sql deleted file mode 100644 index 2eee445d8..000000000 --- a/db/routines/vn2008/views/Gastos.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Gastos` -AS SELECT `e`.`id` AS `Id_Gasto`, - `e`.`name` AS `Gasto`, - `e`.`isWithheld` AS `isWithheld` -FROM `vn`.`expense` `e` diff --git a/db/routines/vn2008/views/Greuges.sql b/db/routines/vn2008/views/Greuges.sql deleted file mode 100644 index 8958ec455..000000000 --- a/db/routines/vn2008/views/Greuges.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Greuges` -AS SELECT `g`.`Id` AS `Id`, - `g`.`clientFk` AS `Id_Cliente`, - `g`.`description` AS `Comentario`, - `g`.`amount` AS `Importe`, - `g`.`shipped` AS `Fecha`, - `g`.`created` AS `odbc_date`, - `g`.`greugeTypeFk` AS `Greuges_type_id`, - `g`.`ticketFk` AS `Id_Ticket` -FROM `vn`.`greuge` `g` diff --git a/db/routines/vn2008/views/Greuges_type.sql b/db/routines/vn2008/views/Greuges_type.sql deleted file mode 100644 index 500a1cc03..000000000 --- a/db/routines/vn2008/views/Greuges_type.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Greuges_type` -AS SELECT `gt`.`id` AS `Greuges_type_id`, - `gt`.`name` AS `name` -FROM `vn`.`greugeType` `gt` diff --git a/db/routines/vn2008/views/Intrastat.sql b/db/routines/vn2008/views/Intrastat.sql deleted file mode 100644 index 9ed3ef283..000000000 --- a/db/routines/vn2008/views/Intrastat.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Intrastat` -AS SELECT `i`.`id` AS `Codintrastat`, - `i`.`description` AS `Definicion`, - `i`.`taxClassFk` AS `iva_group_id`, - `i`.`taxCodeFk` AS `iva_codigo_id` -FROM `vn`.`intrastat` `i` diff --git a/db/routines/vn2008/views/expeditions.sql b/db/routines/vn2008/views/expeditions.sql deleted file mode 100644 index d93e2a1c6..000000000 --- a/db/routines/vn2008/views/expeditions.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`expeditions` -AS SELECT `e`.`id` AS `expeditions_id`, - `e`.`agencyModeFk` AS `agency_id`, - `e`.`ticketFk` AS `ticket_id`, - `e`.`freightItemFk` AS `EsBulto`, - `e`.`created` AS `odbc_date`, - `e`.`counter` AS `counter`, - `e`.`workerFk` AS `workerFk`, - `e`.`externalId` AS `externalId`, - `p`.`itemFk` AS `Id_article` -FROM ( - `vn`.`expedition` `e` - LEFT JOIN `vn`.`packaging` `p` ON(`p`.`id` = `e`.`packagingFk`) - ) diff --git a/db/routines/vn2008/views/gestdoc.sql b/db/routines/vn2008/views/gestdoc.sql deleted file mode 100644 index f9fef2895..000000000 --- a/db/routines/vn2008/views/gestdoc.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`gestdoc` -AS SELECT `d`.`id` AS `id`, - `d`.`dmsTypeFk` AS `gesttip_id`, - `d`.`file` AS `file`, - `d`.`contentType` AS `contentType`, - `d`.`workerFk` AS `trabajador_id`, - `d`.`warehouseFk` AS `warehouse_id`, - `d`.`companyFk` AS `emp_id`, - `d`.`hardCopyNumber` AS `orden`, - `d`.`hasFile` AS `original`, - `d`.`reference` AS `sref`, - `d`.`description` AS `brief`, - `d`.`created` AS `odbc_date` -FROM `vn`.`dms` `d` diff --git a/db/routines/vn2008/views/gesttip.sql b/db/routines/vn2008/views/gesttip.sql deleted file mode 100644 index 663e70617..000000000 --- a/db/routines/vn2008/views/gesttip.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`gesttip` -AS SELECT `g`.`id` AS `id`, - `g`.`name` AS `tipo`, - `g`.`readRoleFk` AS `readRoleFk`, - `g`.`writeRoleFk` AS `writeRoleFk`, - `g`.`code` AS `code` -FROM `vn`.`dmsType` `g` diff --git a/db/routines/vn2008/views/intrastat_data.sql b/db/routines/vn2008/views/intrastat_data.sql deleted file mode 100644 index 54853b69c..000000000 --- a/db/routines/vn2008/views/intrastat_data.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`intrastat_data` -AS SELECT `ii`.`id` AS `id`, - `ii`.`invoiceInFk` AS `recibida_id`, - `ii`.`net` AS `neto`, - `ii`.`intrastatFk` AS `intrastat_id`, - `ii`.`amount` AS `importe`, - `ii`.`stems` AS `unidades`, - `ii`.`countryFk` AS `Paises_Id`, - `ii`.`dated` AS `odbc_date`, - `ii`.`statisticalValue` AS `valorestadistico` -FROM `vn`.`invoiceInIntrastat` `ii` diff --git a/db/routines/vn2008/views/invoiceCorrection.sql b/db/routines/vn2008/views/invoiceCorrection.sql deleted file mode 100644 index 5ed1d5844..000000000 --- a/db/routines/vn2008/views/invoiceCorrection.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`invoiceCorrection` -AS SELECT `ic`.`correctingFk` AS `correctingFk`, - `ic`.`correctedFk` AS `correctedFk`, - `ic`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`, - `ic`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`, - `ic`.`invoiceCorrectionTypeFk` AS `invoiceCorrectionTypeFk` -FROM `vn`.`invoiceCorrection` `ic` diff --git a/db/routines/vn2008/views/itemTag.sql b/db/routines/vn2008/views/itemTag.sql deleted file mode 100644 index ff247089f..000000000 --- a/db/routines/vn2008/views/itemTag.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`itemTag` -AS SELECT `i`.`id` AS `id`, - `i`.`itemFk` AS `itemFk`, - `i`.`tagFk` AS `tagFk`, - `i`.`value` AS `value`, - `i`.`priority` AS `priority` -FROM `vn`.`itemTag` `i` diff --git a/db/routines/vn2008/views/item_entry_in.sql b/db/routines/vn2008/views/item_entry_in.sql deleted file mode 100644 index 1cc7d21b1..000000000 --- a/db/routines/vn2008/views/item_entry_in.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`item_entry_in` -AS SELECT `t`.`warehouse_id` AS `warehouse_id`, - `t`.`warehouse_id_out` AS `warehouse_id_out`, - `t`.`landing` AS `dat`, - `m`.`Id_Article` AS `item_id`, - `m`.`Cantidad` AS `amount`, - `t`.`received` AS `received`, - `e`.`Redada` AS `isVirtualStock`, - `e`.`Id_Entrada` AS `entryFk` -FROM ( - ( - `vn2008`.`Compres` `m` - JOIN `vn2008`.`Entradas` `e` ON(`m`.`Id_Entrada` = `e`.`Id_Entrada`) - ) - JOIN `vn2008`.`travel` `t` ON(`e`.`travel_id` = `t`.`id`) - ) -WHERE `e`.`Inventario` = 0 - AND `m`.`Cantidad` <> 0 diff --git a/db/routines/vn2008/views/item_entry_out.sql b/db/routines/vn2008/views/item_entry_out.sql deleted file mode 100644 index d99672df8..000000000 --- a/db/routines/vn2008/views/item_entry_out.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`item_entry_out` -AS SELECT `t`.`warehouse_id_out` AS `warehouse_id`, - `t`.`shipment` AS `dat`, - `m`.`Id_Article` AS `item_id`, - - `m`.`Cantidad` AS `amount`, - `t`.`delivered` <> 0 - OR IFNULL(`co`.`valor`, 0) AS `delivered`, - `e`.`Id_Entrada` AS `entryFk` -FROM ( - ( - ( - `vn2008`.`Compres` `m` - JOIN `vn2008`.`Entradas` `e` ON(`m`.`Id_Entrada` = `e`.`Id_Entrada`) - ) - JOIN `vn2008`.`travel` `t` ON(`e`.`travel_id` = `t`.`id`) - ) - LEFT JOIN `vn2008`.`Compres_ok` `co` ON( - `co`.`Id_Compra` = `m`.`Id_Compra` - AND `co`.`Id_Accion` = 3 - AND `co`.`valor` <> 0 - ) - ) -WHERE `e`.`Inventario` = 0 - AND `e`.`Redada` = 0 - AND `m`.`Cantidad` <> 0 diff --git a/db/routines/vn2008/views/item_out.sql b/db/routines/vn2008/views/item_out.sql deleted file mode 100644 index 57353a6d6..000000000 --- a/db/routines/vn2008/views/item_out.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`item_out` -AS SELECT `t`.`warehouse_id` AS `warehouse_id`, - `t`.`Fecha` AS `dat`, - `m`.`Id_Article` AS `item_id`, - - `m`.`Cantidad` AS `amount`, - `m`.`OK` AS `ok`, - `m`.`Reservado` AS `Reservado`, - `t`.`Factura` AS `invoice`, - `m`.`Id_Movimiento` AS `saleFk`, - `m`.`Id_Ticket` AS `ticketFk` -FROM ( - `vn2008`.`Movimientos` `m` - JOIN `vn2008`.`Tickets` `t` ON(`m`.`Id_Ticket` = `t`.`Id_Ticket`) - ) -WHERE `m`.`Cantidad` <> 0 diff --git a/db/versions/10868-grayChico/00-firstScript.sql b/db/versions/10868-grayChico/00-firstScript.sql new file mode 100644 index 000000000..d0b98362c --- /dev/null +++ b/db/versions/10868-grayChico/00-firstScript.sql @@ -0,0 +1,15 @@ +REVOKE SELECT ON TABLE vn2008.expeditions FROM employee; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.Gastos FROM administrative; +REVOKE SELECT ON TABLE vn2008.Facturas FROM salesPerson; +REVOKE SELECT ON TABLE vn2008.Facturas FROM logistic; +REVOKE SELECT ON TABLE vn2008.Facturas FROM palletizer; +REVOKE SELECT ON TABLE vn2008.Facturas FROM hr; +REVOKE SELECT ON TABLE vn2008.gestdoc FROM employee; +REVOKE INSERT, UPDATE ON TABLE vn2008.gestdoc FROM administrative; +REVOKE DELETE ON TABLE vn2008.gestdoc FROM hr; +REVOKE SELECT ON TABLE vn2008.gesttip FROM employee; +REVOKE SELECT ON TABLE vn2008.Greuges FROM employee; +REVOKE SELECT ON TABLE vn2008.Greuges_type FROM financial; +REVOKE SELECT ON TABLE vn2008.intrastat_data FROM buyer; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.intrastat_data FROM administrative; +REVOKE SELECT, INSERT ON TABLE vn2008.invoiceCorrection FROM administrative; From ff225400761f87ff27bd310e655c63ce0030d0bb Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 5 Feb 2024 12:48:43 +0100 Subject: [PATCH 037/116] fix: hotfix puppeteer updated --- package-lock.json | 1155 +++++++++++++++++++++++++++------------------ package.json | 2 +- 2 files changed, 706 insertions(+), 451 deletions(-) diff --git a/package-lock.json b/package-lock.json index 36e11dc8f..96d3bbc09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "node-ssh": "^11.0.0", "object-diff": "0.0.4", "object.pick": "^1.3.0", - "puppeteer": "^20.3.0", + "puppeteer": "^20.9.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "smbhash": "0.0.1", @@ -2907,17 +2907,15 @@ } }, "node_modules/@puppeteer/browsers": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.3.0.tgz", - "integrity": "sha512-an3QdbNPkuU6qpxpbssxAbjRLJcF+eP4L8UqIY3+6n0sbaVxw5pz7PiCLy9g32XEZuoamUlV5ZQPnA6FxvkIHA==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", + "integrity": "sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==", "dependencies": { "debug": "4.3.4", "extract-zip": "2.0.1", - "http-proxy-agent": "5.0.0", - "https-proxy-agent": "5.0.1", "progress": "2.0.3", - "proxy-from-env": "1.1.0", - "tar-fs": "2.1.1", + "proxy-agent": "6.3.0", + "tar-fs": "3.0.4", "unbzip2-stream": "1.4.3", "yargs": "17.7.1" }, @@ -2925,7 +2923,7 @@ "browsers": "lib/cjs/main-cli.js" }, "engines": { - "node": ">=16.0.0" + "node": ">=16.3.0" }, "peerDependencies": { "typescript": ">= 4.7.4" @@ -2936,25 +2934,6 @@ } } }, - "node_modules/@puppeteer/browsers/node_modules/@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "engines": { - "node": ">= 10" - } - }, - "node_modules/@puppeteer/browsers/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/@puppeteer/browsers/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -2979,31 +2958,6 @@ } } }, - "node_modules/@puppeteer/browsers/node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@puppeteer/browsers/node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/@puppeteer/browsers/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -3093,6 +3047,11 @@ "node": ">= 6" } }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==" + }, "node_modules/@types/babel__core": { "version": "7.1.19", "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", @@ -3359,9 +3318,9 @@ "dev": true }, "node_modules/@types/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "optional": true, "dependencies": { "@types/node": "*" @@ -4300,6 +4259,11 @@ "proxy-from-env": "^1.1.0" } }, + "node_modules/b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, "node_modules/babel-jest": { "version": "26.6.3", "integrity": "sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA==", @@ -4606,6 +4570,14 @@ "node": ">=6.0.0" } }, + "node_modules/basic-ftp": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.4.tgz", + "integrity": "sha512-8PzkB0arJFV4jJWSGOYR+OEic6aeKMu/osRhBULN6RY0ykby6LKhbmuQ5ublvaas5BOwboah5D87nrHyuh8PPA==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/batch": { "version": "0.6.1", "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", @@ -5568,10 +5540,6 @@ "node": ">=0.10.0" } }, - "node_modules/chownr": { - "version": "1.1.4", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, "node_modules/chrome-trace-event": { "version": "1.0.3", "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", @@ -5580,9 +5548,9 @@ } }, "node_modules/chromium-bidi": { - "version": "0.4.9", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.9.tgz", - "integrity": "sha512-u3DC6XwgLCA9QJ5ak1voPslCmacQdulZNCPsI3qNXxSnEcZS7DFIbww+5RM2bznMEje7cc0oydavRLRvOIZtHw==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.16.tgz", + "integrity": "sha512-7ZbXdWERxRxSwo3txsBjjmc/NLxqb1Bk30mRb0BMS4YIaiV6zvKZqL/UAH+DdqcDYayDWk2n/y8klkBDODrPvA==", "dependencies": { "mitt": "3.0.0" }, @@ -6202,9 +6170,9 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/cosmiconfig": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.1.3.tgz", - "integrity": "sha512-/UkO2JKI18b5jVMJUp0lvKFMpa/Gye+ZgZjKD+DGEN9y7NRcf/nK1A0sp67ONmKtnDCNMS44E6jrk0Yc3bDuUw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", "dependencies": { "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -6487,6 +6455,14 @@ "version": "2.0.0", "integrity": "sha512-APql/TZ6FdLEpf2z7/X2a2zyqK8juYtqaSVqxw9mYoQ64CXkfU15AeLh8pUszT8+fnYjgm6t0aIYpWKJbnLkuA==" }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", + "integrity": "sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==", + "engines": { + "node": ">= 14" + } + }, "node_modules/data-urls": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", @@ -6645,7 +6621,8 @@ }, "node_modules/deep-is": { "version": "0.1.4", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true }, "node_modules/deepmerge": { "version": "4.2.2", @@ -6871,6 +6848,30 @@ "node": ">=0.10.0" } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/degenerator/node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/del": { "version": "2.2.2", "integrity": "sha512-Z4fzpbIRjOu7lO5jCETSWoqUDVe0IPOlfugBsF6suen2LKDlVb4QZpKEM9P+buNJ4KI1eN7I083w/pbKUpsrWQ==", @@ -6973,9 +6974,9 @@ "dev": true }, "node_modules/devtools-protocol": { - "version": "0.0.1120988", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1120988.tgz", - "integrity": "sha512-39fCpE3Z78IaIPChJsP6Lhmkbf4dWXOmzLk/KFTdRkNk/0JymRIfUynDVRndV9HoDz8PyalK1UH21ST/ivwW5Q==" + "version": "0.0.1147663", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", + "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" }, "node_modules/diff": { "version": "1.4.0", @@ -7480,14 +7481,13 @@ } }, "node_modules/escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" + "esutils": "^2.0.2" }, "bin": { "escodegen": "bin/escodegen.js", @@ -7508,42 +7508,6 @@ "node": ">=4.0" } }, - "node_modules/escodegen/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/escodegen/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -7553,17 +7517,6 @@ "node": ">=0.10.0" } }, - "node_modules/escodegen/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/eslint": { "version": "7.32.0", "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", @@ -8359,6 +8312,11 @@ "version": "3.1.3", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, "node_modules/fast-json-patch": { "version": "2.2.1", "integrity": "sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig==", @@ -8379,7 +8337,8 @@ }, "node_modules/fast-levenshtein": { "version": "2.0.6", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true }, "node_modules/fast-safe-stringify": { "version": "2.1.1", @@ -8989,11 +8948,6 @@ "node": ">= 0.6" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, "node_modules/fs-extra": { "version": "5.0.0", "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", @@ -9321,6 +9275,54 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-uri": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.2.tgz", + "integrity": "sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.0", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/get-uri/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/get-uri/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/get-uri/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/get-value": { "version": "2.0.6", "integrity": "sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==", @@ -11940,8 +11942,9 @@ } }, "node_modules/ip": { - "version": "1.1.5", - "integrity": "sha512-rBtCAQAJm8A110nbwn6YdveUnuZH3WrC36IwkRXxDnq53JvXA2NVQvB7IHyKomxK1MJ4VDNw3UtFDdXQ+AvLYA==" + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" }, "node_modules/ip-regex": { "version": "2.1.0", @@ -17453,6 +17456,14 @@ "version": "2.6.2", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/next-tick": { "version": "1.1.0", "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", @@ -17499,9 +17510,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -18695,6 +18706,106 @@ "node": ">=6" } }, + "node_modules/pac-proxy-agent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz", + "integrity": "sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "pac-resolver": "^7.0.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/pac-proxy-agent/node_modules/http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/pac-proxy-agent/node_modules/socks-proxy-agent": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", + "integrity": "sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz", + "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==", + "dependencies": { + "degenerator": "^5.0.0", + "ip": "^1.1.8", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/package-json": { "version": "6.5.0", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", @@ -19499,6 +19610,101 @@ "node": ">= 0.10" } }, + "node_modules/proxy-agent": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", + "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/proxy-agent/node_modules/http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/proxy-agent/node_modules/socks-proxy-agent": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", + "integrity": "sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -19567,14 +19773,18 @@ } }, "node_modules/puppeteer": { - "version": "20.3.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.3.0.tgz", - "integrity": "sha512-OJIsxC3PcU6fAWfp1BX0oKj62FFxhxwpakGAcGVbyfqfDrNmkFjpzb0XrMsgnQxCJmoLpTZKHRXDFxEDnLqkow==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.9.0.tgz", + "integrity": "sha512-kAglT4VZ9fWEGg3oLc4/de+JcONuEJhlh3J6f5R1TLkrY/EHHIHxWXDOzXvaxQCtedmyVXBwg8M+P8YCO/wZjw==", + "deprecated": "< 21.5.0 is no longer supported", "hasInstallScript": true, "dependencies": { - "@puppeteer/browsers": "1.3.0", - "cosmiconfig": "8.1.3", - "puppeteer-core": "20.3.0" + "@puppeteer/browsers": "1.4.6", + "cosmiconfig": "8.2.0", + "puppeteer-core": "20.9.0" + }, + "engines": { + "node": ">=16.3.0" } }, "node_modules/puppeteer-cluster": { @@ -19607,19 +19817,19 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/puppeteer-core": { - "version": "20.3.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.3.0.tgz", - "integrity": "sha512-264pBrIui5bO6NJeOcbJrLa0OCwmA4+WK00JMrLIKTfRiqe2gx8KWTzLsjyw/bizErp3TKS7vt/I0i5fTC+mAw==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.9.0.tgz", + "integrity": "sha512-H9fYZQzMTRrkboEfPmf7m3CLDN6JvbxXA3qTtS+dFt27tR+CsFHzPsT6pzp6lYL6bJbAPaR0HaPO6uSi+F94Pg==", "dependencies": { - "@puppeteer/browsers": "1.3.0", - "chromium-bidi": "0.4.9", - "cross-fetch": "3.1.6", + "@puppeteer/browsers": "1.4.6", + "chromium-bidi": "0.4.16", + "cross-fetch": "4.0.0", "debug": "4.3.4", - "devtools-protocol": "0.0.1120988", + "devtools-protocol": "0.0.1147663", "ws": "8.13.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=16.3.0" }, "peerDependencies": { "typescript": ">= 4.7.4" @@ -19630,6 +19840,14 @@ } } }, + "node_modules/puppeteer-core/node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/puppeteer-core/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -19673,6 +19891,11 @@ "version": "2.2.0", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, "node_modules/quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", @@ -21466,7 +21689,6 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -21668,7 +21890,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", - "dev": true, "dependencies": { "ip": "^2.0.0", "smart-buffer": "^4.2.0" @@ -21730,8 +21951,7 @@ "node_modules/socks/node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", - "dev": true + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" }, "node_modules/source-map": { "version": "0.5.6", @@ -22196,6 +22416,15 @@ "node": ">=0.8.0" } }, + "node_modules/streamx": { + "version": "2.15.7", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.7.tgz", + "integrity": "sha512-NPEKS5+yjyo597eafGbKW5ujh7Sm6lDLHZQd/lRSz6S0VarpADBJItqfB4PnwpS+472oob1GX5cCY9vzfJpHUA==", + "dependencies": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "node_modules/string_decoder": { "version": "0.10.31", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" @@ -23110,121 +23339,23 @@ } }, "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", "dependencies": { - "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", - "tar-stream": "^2.1.4" + "tar-stream": "^3.1.5" } }, "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tar-stream/node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/tar-stream/node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/tar-stream/node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/tar-stream/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/tar-stream/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" } }, "node_modules/tar/node_modules/chownr": { @@ -23747,8 +23878,7 @@ "node_modules/tslib": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz", - "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==", - "dev": true + "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==" }, "node_modules/tunnel-agent": { "version": "0.6.0", @@ -25530,6 +25660,7 @@ "node_modules/word-wrap": { "version": "1.2.3", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -29429,34 +29560,19 @@ "optional": true }, "@puppeteer/browsers": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.3.0.tgz", - "integrity": "sha512-an3QdbNPkuU6qpxpbssxAbjRLJcF+eP4L8UqIY3+6n0sbaVxw5pz7PiCLy9g32XEZuoamUlV5ZQPnA6FxvkIHA==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", + "integrity": "sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==", "requires": { "debug": "4.3.4", "extract-zip": "2.0.1", - "http-proxy-agent": "5.0.0", - "https-proxy-agent": "5.0.1", "progress": "2.0.3", - "proxy-from-env": "1.1.0", - "tar-fs": "2.1.1", + "proxy-agent": "6.3.0", + "tar-fs": "3.0.4", "unbzip2-stream": "1.4.3", "yargs": "17.7.1" }, "dependencies": { - "@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==" - }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "requires": { - "debug": "4" - } - }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -29470,25 +29586,6 @@ "ms": "2.1.2" } }, - "http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "requires": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - } - }, - "https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "requires": { - "agent-base": "6", - "debug": "4" - } - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -29553,6 +29650,11 @@ "version": "1.1.2", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" }, + "@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==" + }, "@types/babel__core": { "version": "7.1.19", "integrity": "sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw==", @@ -29818,9 +29920,9 @@ "dev": true }, "@types/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "optional": true, "requires": { "@types/node": "*" @@ -30541,6 +30643,11 @@ "proxy-from-env": "^1.1.0" } }, + "b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, "babel-jest": { "version": "26.6.3", "integrity": "sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA==", @@ -30771,6 +30878,11 @@ "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" }, + "basic-ftp": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.4.tgz", + "integrity": "sha512-8PzkB0arJFV4jJWSGOYR+OEic6aeKMu/osRhBULN6RY0ykby6LKhbmuQ5ublvaas5BOwboah5D87nrHyuh8PPA==" + }, "batch": { "version": "0.6.1", "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", @@ -31516,18 +31628,14 @@ } } }, - "chownr": { - "version": "1.1.4", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, "chrome-trace-event": { "version": "1.0.3", "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==" }, "chromium-bidi": { - "version": "0.4.9", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.9.tgz", - "integrity": "sha512-u3DC6XwgLCA9QJ5ak1voPslCmacQdulZNCPsI3qNXxSnEcZS7DFIbww+5RM2bznMEje7cc0oydavRLRvOIZtHw==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.16.tgz", + "integrity": "sha512-7ZbXdWERxRxSwo3txsBjjmc/NLxqb1Bk30mRb0BMS4YIaiV6zvKZqL/UAH+DdqcDYayDWk2n/y8klkBDODrPvA==", "requires": { "mitt": "3.0.0" } @@ -31999,9 +32107,9 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "cosmiconfig": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.1.3.tgz", - "integrity": "sha512-/UkO2JKI18b5jVMJUp0lvKFMpa/Gye+ZgZjKD+DGEN9y7NRcf/nK1A0sp67ONmKtnDCNMS44E6jrk0Yc3bDuUw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", + "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", "requires": { "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -32204,6 +32312,11 @@ "version": "2.0.0", "integrity": "sha512-APql/TZ6FdLEpf2z7/X2a2zyqK8juYtqaSVqxw9mYoQ64CXkfU15AeLh8pUszT8+fnYjgm6t0aIYpWKJbnLkuA==" }, + "data-uri-to-buffer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", + "integrity": "sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==" + }, "data-urls": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", @@ -32324,7 +32437,8 @@ }, "deep-is": { "version": "0.1.4", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true }, "deepmerge": { "version": "4.2.2", @@ -32490,6 +32604,26 @@ } } }, + "degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "requires": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "dependencies": { + "ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "requires": { + "tslib": "^2.0.1" + } + } + } + }, "del": { "version": "2.2.2", "integrity": "sha512-Z4fzpbIRjOu7lO5jCETSWoqUDVe0IPOlfugBsF6suen2LKDlVb4QZpKEM9P+buNJ4KI1eN7I083w/pbKUpsrWQ==", @@ -32567,9 +32701,9 @@ "dev": true }, "devtools-protocol": { - "version": "0.0.1120988", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1120988.tgz", - "integrity": "sha512-39fCpE3Z78IaIPChJsP6Lhmkbf4dWXOmzLk/KFTdRkNk/0JymRIfUynDVRndV9HoDz8PyalK1UH21ST/ivwW5Q==" + "version": "0.0.1147663", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", + "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" }, "diff": { "version": "1.4.0", @@ -33009,14 +33143,13 @@ "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" }, "escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "requires": { "esprima": "^4.0.1", "estraverse": "^5.2.0", "esutils": "^2.0.2", - "optionator": "^0.8.1", "source-map": "~0.6.1" }, "dependencies": { @@ -33025,46 +33158,11 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==" - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "optional": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "requires": { - "prelude-ls": "~1.1.2" - } } } }, @@ -33658,6 +33756,11 @@ "version": "3.1.3", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, "fast-json-patch": { "version": "2.2.1", "integrity": "sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig==", @@ -33677,7 +33780,8 @@ }, "fast-levenshtein": { "version": "2.0.6", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true }, "fast-safe-stringify": { "version": "2.1.1", @@ -34144,11 +34248,6 @@ "version": "0.5.2", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, "fs-extra": { "version": "5.0.0", "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", @@ -34405,6 +34504,42 @@ "pump": "^3.0.0" } }, + "get-uri": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.2.tgz", + "integrity": "sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==", + "requires": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.0", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "get-value": { "version": "2.0.6", "integrity": "sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==", @@ -36535,8 +36670,9 @@ "integrity": "sha512-CYdFeFexxhv/Bcny+Q0BfOV+ltRlJcd4BBZBYFX/O0u4npJrgZtIcjokegtiSMAvlMTJ+Koq0GBCc//3bueQxw==" }, "ip": { - "version": "1.1.5", - "integrity": "sha512-rBtCAQAJm8A110nbwn6YdveUnuZH3WrC36IwkRXxDnq53JvXA2NVQvB7IHyKomxK1MJ4VDNw3UtFDdXQ+AvLYA==" + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", + "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" }, "ip-regex": { "version": "2.1.0", @@ -40946,6 +41082,11 @@ "version": "2.6.2", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==" + }, "next-tick": { "version": "1.1.0", "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", @@ -40976,9 +41117,9 @@ "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" }, "node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "requires": { "whatwg-url": "^5.0.0" } @@ -41851,6 +41992,82 @@ "version": "2.2.0", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, + "pac-proxy-agent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.1.tgz", + "integrity": "sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==", + "requires": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", + "pac-resolver": "^7.0.0", + "socks-proxy-agent": "^8.0.2" + }, + "dependencies": { + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "requires": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + } + }, + "https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "requires": { + "agent-base": "^7.0.2", + "debug": "4" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "socks-proxy-agent": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", + "integrity": "sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==", + "requires": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + } + } + } + }, + "pac-resolver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz", + "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==", + "requires": { + "degenerator": "^5.0.0", + "ip": "^1.1.8", + "netmask": "^2.0.2" + } + }, "package-json": { "version": "6.5.0", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", @@ -42444,6 +42661,77 @@ "ipaddr.js": "1.9.1" } }, + "proxy-agent": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", + "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", + "requires": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.1" + }, + "dependencies": { + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "http-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", + "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "requires": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + } + }, + "https-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", + "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "requires": { + "agent-base": "^7.0.2", + "debug": "4" + } + }, + "lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "socks-proxy-agent": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.2.tgz", + "integrity": "sha512-8zuqoLv1aP/66PHF5TqwJ7Czm3Yv32urJQHrVyhD7mmA6d61Zv8cIXQYPTWwmg6qlupnPvs/QKDmfa4P/qct2g==", + "requires": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "socks": "^2.7.1" + } + } + } + }, "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -42508,13 +42796,13 @@ } }, "puppeteer": { - "version": "20.3.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.3.0.tgz", - "integrity": "sha512-OJIsxC3PcU6fAWfp1BX0oKj62FFxhxwpakGAcGVbyfqfDrNmkFjpzb0XrMsgnQxCJmoLpTZKHRXDFxEDnLqkow==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.9.0.tgz", + "integrity": "sha512-kAglT4VZ9fWEGg3oLc4/de+JcONuEJhlh3J6f5R1TLkrY/EHHIHxWXDOzXvaxQCtedmyVXBwg8M+P8YCO/wZjw==", "requires": { - "@puppeteer/browsers": "1.3.0", - "cosmiconfig": "8.1.3", - "puppeteer-core": "20.3.0" + "@puppeteer/browsers": "1.4.6", + "cosmiconfig": "8.2.0", + "puppeteer-core": "20.9.0" } }, "puppeteer-cluster": { @@ -42538,18 +42826,26 @@ } }, "puppeteer-core": { - "version": "20.3.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.3.0.tgz", - "integrity": "sha512-264pBrIui5bO6NJeOcbJrLa0OCwmA4+WK00JMrLIKTfRiqe2gx8KWTzLsjyw/bizErp3TKS7vt/I0i5fTC+mAw==", + "version": "20.9.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.9.0.tgz", + "integrity": "sha512-H9fYZQzMTRrkboEfPmf7m3CLDN6JvbxXA3qTtS+dFt27tR+CsFHzPsT6pzp6lYL6bJbAPaR0HaPO6uSi+F94Pg==", "requires": { - "@puppeteer/browsers": "1.3.0", - "chromium-bidi": "0.4.9", - "cross-fetch": "3.1.6", + "@puppeteer/browsers": "1.4.6", + "chromium-bidi": "0.4.16", + "cross-fetch": "4.0.0", "debug": "4.3.4", - "devtools-protocol": "0.0.1120988", + "devtools-protocol": "0.0.1147663", "ws": "8.13.0" }, "dependencies": { + "cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "requires": { + "node-fetch": "^2.6.12" + } + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -42577,6 +42873,11 @@ "version": "2.2.0", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, + "queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, "quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", @@ -43964,8 +44265,7 @@ "smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" }, "smbhash": { "version": "0.0.1", @@ -44131,7 +44431,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", - "dev": true, "requires": { "ip": "^2.0.0", "smart-buffer": "^4.2.0" @@ -44140,8 +44439,7 @@ "ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", - "dev": true + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" } } }, @@ -44548,6 +44846,15 @@ "version": "0.1.2", "integrity": "sha512-jos8u++JKm0ARcSUTAZXOVC0mSox7Bhn6sBgty73P1f3JGf7yG2clTbBNHUdde/kdvP2FESam+vM6l8jBrNxHA==" }, + "streamx": { + "version": "2.15.7", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.7.tgz", + "integrity": "sha512-NPEKS5+yjyo597eafGbKW5ujh7Sm6lDLHZQd/lRSz6S0VarpADBJItqfB4PnwpS+472oob1GX5cCY9vzfJpHUA==", + "requires": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "string_decoder": { "version": "0.10.31", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" @@ -45267,75 +45574,23 @@ } }, "tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", "requires": { - "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", - "tar-stream": "^2.1.4" + "tar-stream": "^3.1.5" } }, "tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - } + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" } }, "teeny-request": { @@ -45714,8 +45969,7 @@ "tslib": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz", - "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==", - "dev": true + "integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA==" }, "tunnel-agent": { "version": "0.6.0", @@ -48060,7 +48314,8 @@ }, "word-wrap": { "version": "1.2.3", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true }, "wrap-ansi": { "version": "7.0.0", diff --git a/package.json b/package.json index f13c44162..f700bd07d 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "node-ssh": "^11.0.0", "object-diff": "0.0.4", "object.pick": "^1.3.0", - "puppeteer": "^20.3.0", + "puppeteer": "^20.9.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "smbhash": "0.0.1", From c9785e76da4d341a06bf946252f1e5c5fc3166a6 Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 5 Feb 2024 12:56:23 +0100 Subject: [PATCH 038/116] fix: hotfix puppeteer updated to 21.11.0 --- db/remotes/dev.ini | 6 + db/remotes/production.ini | 6 + package-lock.json | 365 ++++++++++++-------------------------- package.json | 2 +- 4 files changed, 129 insertions(+), 250 deletions(-) create mode 100644 db/remotes/dev.ini create mode 100644 db/remotes/production.ini diff --git a/db/remotes/dev.ini b/db/remotes/dev.ini new file mode 100644 index 000000000..a613510ea --- /dev/null +++ b/db/remotes/dev.ini @@ -0,0 +1,6 @@ +[client] +host = dev-db.verdnatura.es +port = 3307 +user = jgallego +password = 9b7620x. +default-character-set=utf8 diff --git a/db/remotes/production.ini b/db/remotes/production.ini new file mode 100644 index 000000000..0896a9b7a --- /dev/null +++ b/db/remotes/production.ini @@ -0,0 +1,6 @@ +[client] +host = db.verdnatura.es +port = 3308 +user = jgallego +password = 9b7620x. +default-character-set=utf8 diff --git a/package-lock.json b/package-lock.json index 96d3bbc09..a29413292 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "node-ssh": "^11.0.0", "object-diff": "0.0.4", "object.pick": "^1.3.0", - "puppeteer": "^20.9.0", + "puppeteer": "^21.11.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "smbhash": "0.0.1", @@ -2907,39 +2907,23 @@ } }, "node_modules/@puppeteer/browsers": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", - "integrity": "sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.9.1.tgz", + "integrity": "sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==", "dependencies": { "debug": "4.3.4", "extract-zip": "2.0.1", "progress": "2.0.3", - "proxy-agent": "6.3.0", + "proxy-agent": "6.3.1", "tar-fs": "3.0.4", "unbzip2-stream": "1.4.3", - "yargs": "17.7.1" + "yargs": "17.7.2" }, "bin": { "browsers": "lib/cjs/main-cli.js" }, "engines": { "node": ">=16.3.0" - }, - "peerDependencies": { - "typescript": ">= 4.7.4" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@puppeteer/browsers/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" } }, "node_modules/@puppeteer/browsers/node_modules/debug": { @@ -2958,68 +2942,11 @@ } } }, - "node_modules/@puppeteer/browsers/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, "node_modules/@puppeteer/browsers/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/@puppeteer/browsers/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@puppeteer/browsers/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@puppeteer/browsers/node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "engines": { - "node": ">=10" - } - }, - "node_modules/@puppeteer/browsers/node_modules/yargs": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", - "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/@sindresorhus/is": { "version": "2.1.1", "integrity": "sha512-/aPsuoj/1Dw/kzhkgz+ES6TxG0zfTMGLwuK2ZG00k/iJzYHTLCE8mVU8EPqEOp/lmxPoq1C1C9RYToRKb2KEfg==", @@ -5548,11 +5475,12 @@ } }, "node_modules/chromium-bidi": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.16.tgz", - "integrity": "sha512-7ZbXdWERxRxSwo3txsBjjmc/NLxqb1Bk30mRb0BMS4YIaiV6zvKZqL/UAH+DdqcDYayDWk2n/y8klkBDODrPvA==", + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.5.8.tgz", + "integrity": "sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==", "dependencies": { - "mitt": "3.0.0" + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0" }, "peerDependencies": { "devtools-protocol": "*" @@ -6170,20 +6098,28 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/cosmiconfig": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", - "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dependencies": { - "import-fresh": "^3.2.1", + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0" + "parse-json": "^5.2.0" }, "engines": { "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/cosmiconfig/node_modules/parse-json": { @@ -6203,14 +6139,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cosmiconfig/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, "node_modules/cross-fetch": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.6.tgz", @@ -6974,9 +6902,9 @@ "dev": true }, "node_modules/devtools-protocol": { - "version": "0.0.1147663", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", - "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" + "version": "0.0.1232444", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1232444.tgz", + "integrity": "sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==" }, "node_modules/diff": { "version": "1.4.0", @@ -7333,7 +7261,6 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "dev": true, "engines": { "node": ">=6" } @@ -17014,9 +16941,9 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/mitt": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.0.tgz", - "integrity": "sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, "node_modules/mixin-deep": { "version": "1.3.2", @@ -19611,18 +19538,18 @@ } }, "node_modules/proxy-agent": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", - "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", + "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", "dependencies": { "agent-base": "^7.0.2", "debug": "^4.3.4", "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", "lru-cache": "^7.14.1", - "pac-proxy-agent": "^7.0.0", + "pac-proxy-agent": "^7.0.1", "proxy-from-env": "^1.1.0", - "socks-proxy-agent": "^8.0.1" + "socks-proxy-agent": "^8.0.2" }, "engines": { "node": ">= 14" @@ -19773,18 +19700,20 @@ } }, "node_modules/puppeteer": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.9.0.tgz", - "integrity": "sha512-kAglT4VZ9fWEGg3oLc4/de+JcONuEJhlh3J6f5R1TLkrY/EHHIHxWXDOzXvaxQCtedmyVXBwg8M+P8YCO/wZjw==", - "deprecated": "< 21.5.0 is no longer supported", + "version": "21.11.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.11.0.tgz", + "integrity": "sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==", "hasInstallScript": true, "dependencies": { - "@puppeteer/browsers": "1.4.6", - "cosmiconfig": "8.2.0", - "puppeteer-core": "20.9.0" + "@puppeteer/browsers": "1.9.1", + "cosmiconfig": "9.0.0", + "puppeteer-core": "21.11.0" + }, + "bin": { + "puppeteer": "lib/esm/puppeteer/node/cli.js" }, "engines": { - "node": ">=16.3.0" + "node": ">=16.13.2" } }, "node_modules/puppeteer-cluster": { @@ -19817,27 +19746,19 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/puppeteer-core": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.9.0.tgz", - "integrity": "sha512-H9fYZQzMTRrkboEfPmf7m3CLDN6JvbxXA3qTtS+dFt27tR+CsFHzPsT6pzp6lYL6bJbAPaR0HaPO6uSi+F94Pg==", + "version": "21.11.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.11.0.tgz", + "integrity": "sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==", "dependencies": { - "@puppeteer/browsers": "1.4.6", - "chromium-bidi": "0.4.16", + "@puppeteer/browsers": "1.9.1", + "chromium-bidi": "0.5.8", "cross-fetch": "4.0.0", "debug": "4.3.4", - "devtools-protocol": "0.0.1147663", - "ws": "8.13.0" + "devtools-protocol": "0.0.1232444", + "ws": "8.16.0" }, "engines": { - "node": ">=16.3.0" - }, - "peerDependencies": { - "typescript": ">= 4.7.4" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "node": ">=16.13.2" } }, "node_modules/puppeteer-core/node_modules/cross-fetch": { @@ -24505,6 +24426,11 @@ "version": "1.3.2", "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" }, + "node_modules/urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==" + }, "node_modules/use": { "version": "3.1.1", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", @@ -25797,9 +25723,9 @@ } }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", "engines": { "node": ">=10.0.0" }, @@ -25922,7 +25848,6 @@ "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -25948,7 +25873,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "engines": { "node": ">=8" } @@ -25957,7 +25881,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "engines": { "node": ">=8" } @@ -25966,7 +25889,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -25980,7 +25902,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -25992,7 +25913,6 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, "engines": { "node": ">=10" } @@ -29560,24 +29480,19 @@ "optional": true }, "@puppeteer/browsers": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", - "integrity": "sha512-x4BEjr2SjOPowNeiguzjozQbsc6h437ovD/wu+JpaenxVLm3jkgzHY2xOslMTp50HoTvQreMjiexiGQw1sqZlQ==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.9.1.tgz", + "integrity": "sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==", "requires": { "debug": "4.3.4", "extract-zip": "2.0.1", "progress": "2.0.3", - "proxy-agent": "6.3.0", + "proxy-agent": "6.3.1", "tar-fs": "3.0.4", "unbzip2-stream": "1.4.3", - "yargs": "17.7.1" + "yargs": "17.7.2" }, "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -29586,52 +29501,10 @@ "ms": "2.1.2" } }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" - }, - "yargs": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", - "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", - "requires": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - } } } }, @@ -31633,11 +31506,12 @@ "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==" }, "chromium-bidi": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.4.16.tgz", - "integrity": "sha512-7ZbXdWERxRxSwo3txsBjjmc/NLxqb1Bk30mRb0BMS4YIaiV6zvKZqL/UAH+DdqcDYayDWk2n/y8klkBDODrPvA==", + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.5.8.tgz", + "integrity": "sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==", "requires": { - "mitt": "3.0.0" + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0" } }, "ci-info": { @@ -32107,14 +31981,14 @@ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "cosmiconfig": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.2.0.tgz", - "integrity": "sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "requires": { - "import-fresh": "^3.2.1", + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0" + "parse-json": "^5.2.0" }, "dependencies": { "parse-json": { @@ -32127,11 +32001,6 @@ "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" } } }, @@ -32701,9 +32570,9 @@ "dev": true }, "devtools-protocol": { - "version": "0.0.1147663", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1147663.tgz", - "integrity": "sha512-hyWmRrexdhbZ1tcJUGpO95ivbRhWXz++F4Ko+n21AY5PNln2ovoJw+8ZMNDTtip+CNFQfrtLVh/w4009dXO/eQ==" + "version": "0.0.1232444", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1232444.tgz", + "integrity": "sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==" }, "diff": { "version": "1.4.0", @@ -33020,8 +32889,7 @@ "env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "dev": true + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==" }, "envinfo": { "version": "7.8.1", @@ -40698,9 +40566,9 @@ } }, "mitt": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.0.tgz", - "integrity": "sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, "mixin-deep": { "version": "1.3.2", @@ -42662,18 +42530,18 @@ } }, "proxy-agent": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.0.tgz", - "integrity": "sha512-0LdR757eTj/JfuU7TL2YCuAZnxWXu3tkJbg4Oq3geW/qFNT/32T0sp2HnZ9O0lMR4q3vwAt0+xCA8SR0WAD0og==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", + "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", "requires": { "agent-base": "^7.0.2", "debug": "^4.3.4", "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", "lru-cache": "^7.14.1", - "pac-proxy-agent": "^7.0.0", + "pac-proxy-agent": "^7.0.1", "proxy-from-env": "^1.1.0", - "socks-proxy-agent": "^8.0.1" + "socks-proxy-agent": "^8.0.2" }, "dependencies": { "agent-base": { @@ -42796,13 +42664,13 @@ } }, "puppeteer": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-20.9.0.tgz", - "integrity": "sha512-kAglT4VZ9fWEGg3oLc4/de+JcONuEJhlh3J6f5R1TLkrY/EHHIHxWXDOzXvaxQCtedmyVXBwg8M+P8YCO/wZjw==", + "version": "21.11.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-21.11.0.tgz", + "integrity": "sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==", "requires": { - "@puppeteer/browsers": "1.4.6", - "cosmiconfig": "8.2.0", - "puppeteer-core": "20.9.0" + "@puppeteer/browsers": "1.9.1", + "cosmiconfig": "9.0.0", + "puppeteer-core": "21.11.0" } }, "puppeteer-cluster": { @@ -42826,16 +42694,16 @@ } }, "puppeteer-core": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-20.9.0.tgz", - "integrity": "sha512-H9fYZQzMTRrkboEfPmf7m3CLDN6JvbxXA3qTtS+dFt27tR+CsFHzPsT6pzp6lYL6bJbAPaR0HaPO6uSi+F94Pg==", + "version": "21.11.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-21.11.0.tgz", + "integrity": "sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==", "requires": { - "@puppeteer/browsers": "1.4.6", - "chromium-bidi": "0.4.16", + "@puppeteer/browsers": "1.9.1", + "chromium-bidi": "0.5.8", "cross-fetch": "4.0.0", "debug": "4.3.4", - "devtools-protocol": "0.0.1147663", - "ws": "8.13.0" + "devtools-protocol": "0.0.1232444", + "ws": "8.16.0" }, "dependencies": { "cross-fetch": { @@ -46438,6 +46306,11 @@ "prepend-http": "^2.0.0" } }, + "urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==" + }, "use": { "version": "3.1.1", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", @@ -48416,9 +48289,9 @@ } }, "ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", "requires": {} }, "x-xss-protection": { @@ -48504,7 +48377,6 @@ "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, "requires": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -48518,20 +48390,17 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -48542,7 +48411,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "requires": { "ansi-regex": "^5.0.1" } @@ -48550,8 +48418,7 @@ "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" } } }, diff --git a/package.json b/package.json index f700bd07d..5d5435b85 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "node-ssh": "^11.0.0", "object-diff": "0.0.4", "object.pick": "^1.3.0", - "puppeteer": "^20.9.0", + "puppeteer": "^21.11.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "smbhash": "0.0.1", From 759ff45a271214ca822fc45d8ff3b14dbe8df9bb Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 5 Feb 2024 13:13:00 +0100 Subject: [PATCH 039/116] fix: hotfix DEBUG enabled --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f09a626a2..200ba4123 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { steps { script { // Uncomment to enable debugging - //env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method' + env.DEBUG = 'strong-remoting:shared-method,puppeteer-cluster:*' switch (env.BRANCH_NAME) { case 'master': From 693a39d34a5f9290c87074311cea061192f8403e Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 5 Feb 2024 13:19:44 +0100 Subject: [PATCH 040/116] fix: hotfix puppeteer CONCURRENCY_PAGE --- print/core/cluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/core/cluster.js b/print/core/cluster.js index a75c4cf24..f24b383a9 100644 --- a/print/core/cluster.js +++ b/print/core/cluster.js @@ -6,7 +6,7 @@ module.exports = { init() { if (this.pool) return; Cluster.launch({ - concurrency: Cluster.CONCURRENCY_CONTEXT, + concurrency: Cluster.CONCURRENCY_PAGE, maxConcurrency: cpus().length, puppeteerOptions: { headless: 'new', From 15ac5472801b6774e969a862d0f4b086ca30664a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 5 Feb 2024 14:38:22 +0100 Subject: [PATCH 041/116] fix: hotfix disable DEBUG --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 200ba4123..596de40ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { steps { script { // Uncomment to enable debugging - env.DEBUG = 'strong-remoting:shared-method,puppeteer-cluster:*' + // env.DEBUG = 'strong-remoting:shared-method,puppeteer-cluster:*' switch (env.BRANCH_NAME) { case 'master': From f2946e41688f2f232ebeb8d02882530e3dd93f42 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 6 Feb 2024 08:04:19 +0100 Subject: [PATCH 042/116] fix: refs #6184 Requested changes --- .../route/specs/downloadCmrsZip.spec.js | 10 ++--- .../back/methods/route/specs/saveCmr.spec.js | 24 ---------- .../back/methods/ticket/specs/saveCmr.spec.js | 45 +++++++++++++++++++ 3 files changed, 50 insertions(+), 29 deletions(-) delete mode 100644 modules/route/back/methods/route/specs/saveCmr.spec.js create mode 100644 modules/ticket/back/methods/ticket/specs/saveCmr.spec.js diff --git a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js index c6b498a77..2930fe703 100644 --- a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js +++ b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js @@ -2,7 +2,7 @@ const models = require('vn-loopback/server/server').models; describe('route downloadCmrsZip()', () => { beforeEach(() => { - spyOn(models.Route, 'downloadCmrsZip').and.returnValue([true]); + spyOn(models.Route, 'downloadCmrsZip').and.returnValue(true); }); it('should create a zip file with the given cmr ids', async() => { @@ -17,13 +17,13 @@ describe('route downloadCmrsZip()', () => { }; let cmrs = '1,2'; try { - await models.Route.downloadCmrsZip(ctx, cmrs); + const stream = await models.Route.downloadCmrsZip(ctx, cmrs); + + expect(stream).toBeTrue(); await tx.rollback(); } catch (e) { - error = e; await tx.rollback(); + throw e; } - - expect(error).toBeDefined(); }); }); diff --git a/modules/route/back/methods/route/specs/saveCmr.spec.js b/modules/route/back/methods/route/specs/saveCmr.spec.js deleted file mode 100644 index d9ad12ad1..000000000 --- a/modules/route/back/methods/route/specs/saveCmr.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('ticket saveCmr()', () => { - let ctx = {req: { - accessToken: {userId: 9} - }}; - - it(`should throw error if the cmr can't save`, async() => { - const tx = await models.Route.beginTransaction({}); - let error; - try { - const options = {transaction: tx}; - const ticket = [1]; - await models.Route.saveCmr(ctx, ticket, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error).toBeDefined(); - }); -}); diff --git a/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js b/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js new file mode 100644 index 000000000..b8e1b5083 --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js @@ -0,0 +1,45 @@ +const models = require('vn-loopback/server/server').models; + +describe('ticket saveCmr()', () => { + beforeEach(() => { + spyOn(models.Ticket, 'saveCmr').and.returnValue(true); + }); + + it(`should throw error if the cmr can't save`, async() => { + const tx = await models.Ticket.beginTransaction({}); + const ctx = { + req: { + getLocale: () => { + return 'en'; + }, + accessToken: {userId: 9} + }, + args: {} + }; + try { + const options = {transaction: tx}; + const ticket = [1]; + await models.Ticket.saveCmr(ctx, ticket); + + const hasDmsCmr = await models.TicketDms.findOne({ + where: {ticketFk: ticket[1]}, + include: [{ + relation: 'dms', + fields: ['id'], + scope: { + relation: 'dmsType', + scope: { + where: {code: 'cmr'} + } + } + }] + }, options); + + expect(hasDmsCmr?.dms()?.dmsType()).toEqual(1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); From 2cab007f57388b861c29a03f5fb58344d615ca47 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 6 Feb 2024 12:12:45 +0100 Subject: [PATCH 043/116] fix: refs #6184 Requested changes --- back/tests.js | 1 + .../back/methods/route/specs/downloadCmrsZip.spec.js | 6 +----- .../ticket/back/methods/ticket/specs/saveCmr.spec.js | 12 ++++-------- print/core/cluster.js | 3 ++- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/back/tests.js b/back/tests.js index 0fb4c76ea..c48c64b77 100644 --- a/back/tests.js +++ b/back/tests.js @@ -96,6 +96,7 @@ async function test() { // runner.loadConfigFile('back/jasmine.json'); runner.loadConfig(config); + process.env.SPEC_IS_RUNNING = true; await runner.execute(); } diff --git a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js index 2930fe703..7312a5d44 100644 --- a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js +++ b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js @@ -1,10 +1,6 @@ const models = require('vn-loopback/server/server').models; describe('route downloadCmrsZip()', () => { - beforeEach(() => { - spyOn(models.Route, 'downloadCmrsZip').and.returnValue(true); - }); - it('should create a zip file with the given cmr ids', async() => { const tx = await models.Route.beginTransaction({}); const ctx = { @@ -19,7 +15,7 @@ describe('route downloadCmrsZip()', () => { try { const stream = await models.Route.downloadCmrsZip(ctx, cmrs); - expect(stream).toBeTrue(); + expect(stream[0]).toBeDefined(); await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js b/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js index b8e1b5083..441aae68b 100644 --- a/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js +++ b/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js @@ -1,10 +1,6 @@ const models = require('vn-loopback/server/server').models; describe('ticket saveCmr()', () => { - beforeEach(() => { - spyOn(models.Ticket, 'saveCmr').and.returnValue(true); - }); - it(`should throw error if the cmr can't save`, async() => { const tx = await models.Ticket.beginTransaction({}); const ctx = { @@ -18,11 +14,11 @@ describe('ticket saveCmr()', () => { }; try { const options = {transaction: tx}; - const ticket = [1]; - await models.Ticket.saveCmr(ctx, ticket); + const ticket = [2]; + await models.Ticket.saveCmr(ctx, ticket, options); const hasDmsCmr = await models.TicketDms.findOne({ - where: {ticketFk: ticket[1]}, + where: {ticketFk: ticket[0]}, include: [{ relation: 'dms', fields: ['id'], @@ -35,7 +31,7 @@ describe('ticket saveCmr()', () => { }] }, options); - expect(hasDmsCmr?.dms()?.dmsType()).toEqual(1); + expect(hasDmsCmr?.dms()?.id).toBeGreaterThanOrEqual(1); await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/print/core/cluster.js b/print/core/cluster.js index a75c4cf24..f2b2c3f21 100644 --- a/print/core/cluster.js +++ b/print/core/cluster.js @@ -35,7 +35,8 @@ module.exports = { logger.error(`[Print] => ${err.message}`); }); - cluster.on('queue', () => logger.info('Printing task initialized by pool')); + cluster.on('queue', () => + process.env.SPEC_IS_RUNNING === 'false' && logger.info('Printing task initialized by pool')); }); } }; From aff8ee28ea0dd67a862407b2e1abae6af71383c7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 7 Feb 2024 10:16:47 +0100 Subject: [PATCH 044/116] fix: refs #6272 back & create test --- .../00-aclUpdateFiscalData.sql | 3 + loopback/locale/en.json | 5 +- loopback/locale/es.json | 7 +- .../supplier/specs/updateFiscalData.spec.js | 202 +++++++++++------- .../back/methods/supplier/updateFiscalData.js | 91 ++++---- 5 files changed, 186 insertions(+), 122 deletions(-) create mode 100644 db/versions/10872-pinkLilium/00-aclUpdateFiscalData.sql diff --git a/db/versions/10872-pinkLilium/00-aclUpdateFiscalData.sql b/db/versions/10872-pinkLilium/00-aclUpdateFiscalData.sql new file mode 100644 index 000000000..24f5346a8 --- /dev/null +++ b/db/versions/10872-pinkLilium/00-aclUpdateFiscalData.sql @@ -0,0 +1,3 @@ +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES ('Supplier', 'updateAllFiscalData', 'WRITE', 'ALLOW', 'ROLE', 'administrative'), + ('Supplier', 'updateFiscalData', 'WRITE', 'ALLOW', 'ROLE', 'buyer'); \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 7e010e1b5..419775d1b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -206,6 +206,5 @@ "Incorrect pin": "Incorrect pin.", "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", "Name should be uppercase": "Name should be uppercase", - "Fecha fuera de rango": "Fecha fuera de rango", - "There is no zone for these parameters 34": "There is no zone for these parameters 34" -} + "You cannot update these fields": "You cannot update these fields" +} \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 1dd70b633..dac839085 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -338,6 +338,7 @@ "The alias cant be modified": "Este alias de correo no puede ser modificado", "No tickets to invoice": "No hay tickets para facturar", "Name should be uppercase": "El nombre debe ir en mayúscula", - "Bank entity must be specified": "La entidad bancaria es obligatoria", - "An email is necessary": "Es necesario un email" -} + "Bank entity must be specified": "La entidad bancaria es obligatoria", + "An email is necessary": "Es necesario un email", + "You cannot update these fields": "No puedes actualizar estos campos" +} \ No newline at end of file diff --git a/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js b/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js index 56030a894..7cb95f840 100644 --- a/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js +++ b/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js @@ -1,92 +1,142 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -describe('Supplier updateFiscalData', () => { +describe('Supplier updateFiscalData()', () => { const supplierId = 1; const administrativeId = 5; - const employeeId = 1; - const defaultData = { - name: 'PLANTS SL', - nif: '06089160W', - account: '4100000001', - sageTaxTypeFk: 4, - sageWithholdingFk: 1, - sageTransactionTypeFk: 1, - postCode: '15214', - city: 'PONTEVEDRA', - provinceFk: 1, - countryFk: 1, - }; + const buyerId = 35; - it('should return an error if the user is not administrative', async() => { - const ctx = {req: {accessToken: {userId: employeeId}}}; - ctx.args = {}; + const name = 'NEW PLANTS'; + const city = 'PONTEVEDRA'; + const nif = 'A68446004'; + const account = '4000000005'; + const sageTaxTypeFk = 5; + const sageWithholdingFk = 2; + const sageTransactionTypeFk = 2; + const postCode = '46460'; + const phone = 456129367; + const street = ' Fake address 12 3 flat'; + const provinceFk = 2; + const countryFk = 1; + const supplierActivityFk = 'animals'; + const healthRegister = '400664487H'; - let error; - await app.models.Supplier.updateFiscalData(ctx, supplierId) - .catch(e => { - error = e; - }); + let ctx; + let options; + let tx; - expect(error.message).toBeDefined(); - }); - - it('should check that the supplier fiscal data is untainted', async() => { - const supplier = await app.models.Supplier.findById(supplierId); - - expect(supplier.name).toEqual(defaultData.name); - expect(supplier.nif).toEqual(defaultData.nif); - expect(supplier.account).toEqual(defaultData.account); - expect(supplier.sageTaxTypeFk).toEqual(defaultData.sageTaxTypeFk); - expect(supplier.sageWithholdingFk).toEqual(defaultData.sageWithholdingFk); - expect(supplier.sageTransactionTypeFk).toEqual(defaultData.sageTransactionTypeFk); - expect(supplier.postCode).toEqual(defaultData.postCode); - expect(supplier.city).toEqual(defaultData.city); - expect(supplier.provinceFk).toEqual(defaultData.provinceFk); - expect(supplier.countryFk).toEqual(defaultData.countryFk); - }); - - it('should update the supplier fiscal data and return the count if changes made', async() => { - const activeCtx = { - accessToken: {userId: administrativeId}, + beforeEach(async() => { + ctx = { + req: { + accessToken: {userId: buyerId}, + headers: {origin: 'http://localhost'}, + __: value => value + }, + args: {} }; - const ctx = {req: activeCtx}; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx + active: ctx.req }); - ctx.args = { - name: 'WEAPON DEALER', - nif: 'A68446004', - account: '4000000005', - sageTaxTypeFk: 5, - sageWithholdingFk: 2, - sageTransactionTypeFk: 2, - postCode: '46460', - city: 'VALENCIA', - provinceFk: 2, - countryFk: 1, - supplierActivityFk: 'animals', - healthRegister: '400664487H' - }; + options = {transaction: tx}; + tx = await models.Sale.beginTransaction({}); + options.transaction = tx; + }); - const result = await app.models.Supplier.updateFiscalData(ctx, supplierId); + afterEach(async() => { + await tx.rollback(); + }); - expect(result.name).toEqual('WEAPON DEALER'); - expect(result.nif).toEqual('A68446004'); - expect(result.account).toEqual('4000000005'); - expect(result.sageTaxTypeFk).toEqual(5); - expect(result.sageWithholdingFk).toEqual(2); - expect(result.sageTransactionTypeFk).toEqual(2); - expect(result.postCode).toEqual('46460'); - expect(result.city).toEqual('VALENCIA'); - expect(result.provinceFk).toEqual(2); - expect(result.countryFk).toEqual(1); - expect(result.supplierActivityFk).toEqual('animals'); - expect(result.healthRegister).toEqual('400664487H'); + it('should throw an error if it is a buyer and tries to update forbidden fiscal data', async() => { + try { + await models.Supplier.updateFiscalData(ctx, + supplierId, + name, + nif, + account, + undefined, + sageTaxTypeFk, + undefined, + sageTransactionTypeFk, + undefined, + undefined, + undefined, + provinceFk, + countryFk, + supplierActivityFk, + healthRegister, + undefined, + undefined, + options); + } catch (e) { + expect(e.message).toEqual('You cannot update these fields'); + } + }); - // Restores - ctx.args = defaultData; - await app.models.Supplier.updateFiscalData(ctx, supplierId); + it('should update the granted fiscal data if it is a buyer', async() => { + const supplier = await models.Supplier.updateFiscalData(ctx, + supplierId, + undefined, + undefined, + account, + phone, + undefined, + undefined, + undefined, + postCode, + street, + city, + provinceFk, + undefined, + undefined, + undefined, + undefined, + undefined, + options); + + expect(supplier.account).toEqual(account); + expect(supplier.phone).toEqual(phone); + expect(supplier.postCode).toEqual(postCode); + expect(supplier.account).toEqual(account); + expect(supplier.city).toEqual(city); + expect(supplier.provinceFk).toEqual(provinceFk); + }); + + it('should update all fiscalData if it is an administative', async() => { + const supplier = await models.Supplier.updateFiscalData(ctx, + supplierId, + name, + nif, + account, + phone, + sageTaxTypeFk, + sageWithholdingFk, + sageTransactionTypeFk, + postCode, + street, + city, + provinceFk, + countryFk, + supplierActivityFk, + healthRegister, + undefined, + undefined, + options); + + expect(supplier.name).toEqual(name); + expect(supplier.nif).toEqual(nif); + expect(supplier.account).toEqual(account); + expect(supplier.phone).toEqual(phone); + expect(supplier.sageTaxTypeFk).toEqual(sageTaxTypeFk); + expect(supplier.sageWithholdingFk).toEqual(sageWithholdingFk); + expect(supplier.sageTransactionTypeFk).toEqual(sageTransactionTypeFk); + expect(supplier.postCode).toEqual(postCode); + expect(supplier.street).toEqual(street); + expect(supplier.city).toEqual(city); + expect(supplier.provinceFk).toEqual(provinceFk); + expect(supplier.countryFk).toEqual(countryFk); + expect(supplier.supplierActivityFk).toEqual(supplierActivityFk); + expect(supplier.healthRegister).toEqual(healthRegister); }); }); diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index 271ed8769..c0b860983 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -1,75 +1,59 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethod('updateFiscalData', { + Self.remoteMethodCtx('updateFiscalData', { description: 'Updates fiscal data of a supplier', accessType: 'WRITE', accepts: [{ - arg: 'ctx', - type: 'Object', - http: {source: 'context'} - }, - { arg: 'id', type: 'Number', description: 'The supplier id', http: {source: 'path'} - }, - { + }, { arg: 'name', type: 'string' - }, - { + }, { arg: 'nif', type: 'string' - }, - { + }, { arg: 'account', type: 'any' - }, - { + }, { + arg: 'phone', + type: 'string' + }, { arg: 'sageTaxTypeFk', type: 'any' - }, - { + }, { arg: 'sageWithholdingFk', type: 'any' - }, - { + }, { arg: 'sageTransactionTypeFk', type: 'any' - }, - { + }, { arg: 'postCode', type: 'any' - }, - { + }, { arg: 'street', type: 'any' - }, - { + }, { arg: 'city', type: 'string' - }, - { + }, { arg: 'provinceFk', type: 'any' - }, - { + }, { arg: 'countryFk', type: 'any' - }, - { + }, { arg: 'supplierActivityFk', type: 'string' - }, - { + }, { arg: 'healthRegister', type: 'string' - }, - { + }, { arg: 'isVies', type: 'boolean' - }, - { + }, { arg: 'isTrucker', type: 'boolean' }], @@ -84,15 +68,42 @@ module.exports = Self => { } }); - Self.updateFiscalData = async(ctx, supplierId) => { + Self.updateFiscalData = async(ctx, supplierId, name, nif, account, phone, sageTaxTypeFk, sageWithholdingFk, sageTransactionTypeFk, postCode, street, city, provinceFk, countryFk, supplierActivityFk, healthRegister, isVies, isTrucker, options) => { const models = Self.app.models; - const args = ctx.args; + const {args} = ctx; + const myOptions = {}; const supplier = await models.Supplier.findById(supplierId); - // Remove unwanted properties + if (typeof options == 'object') Object.assign(myOptions, options); + delete args.ctx; delete args.id; - return supplier.updateAttributes(args); + const updateAllFiscalData = await models.ACL.checkAccessAcl(ctx, 'Supplier', 'updateAllFiscalData', 'WRITE'); + if (!updateAllFiscalData) { + for (const arg in args) { + if (args[arg] && !['street', 'postCode', 'city', 'provinceFk', 'phone'].includes(arg)) + throw new UserError('You cannot update these fields'); + } + } + + return supplier.updateAttributes({ + name, + nif, + account, + phone, + sageTaxTypeFk, + sageWithholdingFk, + sageTransactionTypeFk, + postCode, + street, + city, + provinceFk, + countryFk, + supplierActivityFk, + healthRegister, + isVies, + isTrucker + }, myOptions); }; }; From ffa9212861e494a7676b1c7a01ddeafde0c2e4ec Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 7 Feb 2024 10:29:42 +0100 Subject: [PATCH 045/116] fix: refs #6184 Requested changes --- modules/ticket/back/methods/ticket/specs/saveCmr.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js b/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js index 441aae68b..e7d1e5ad2 100644 --- a/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js +++ b/modules/ticket/back/methods/ticket/specs/saveCmr.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('ticket saveCmr()', () => { - it(`should throw error if the cmr can't save`, async() => { + it(`should save cmr`, async() => { const tx = await models.Ticket.beginTransaction({}); const ctx = { req: { From 9ee0669903ecff05ea8fa48c091cbc10da0c1cda Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 7 Feb 2024 11:27:18 +0100 Subject: [PATCH 046/116] hotfix kmMax --- loopback/locale/es.json | 2 +- modules/route/back/models/route.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9163c494f..81bd564aa 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -139,7 +139,7 @@ "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*", "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", - "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", + "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000", "This ticket is deleted": "Este ticket está eliminado", "Unable to clone this travel": "No ha sido posible clonar este travel", "This thermograph id already exists": "La id del termógrafo ya existe", diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 9b5f3564f..48ed0a50c 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -21,16 +21,16 @@ module.exports = Self => { require('../methods/route/getByWorker')(Self); Self.validate('kmStart', validateDistance, { - message: 'Distance must be lesser than 1000' + message: 'Distance must be lesser than 4000' }); Self.validate('kmEnd', validateDistance, { - message: 'Distance must be lesser than 1000' + message: 'Distance must be lesser than 4000' }); function validateDistance(err) { const routeTotalKm = this.kmEnd - this.kmStart; - const routeMaxKm = 1000; + const routeMaxKm = 4000; if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) err(); } From 7e18bd0a1212f4df21952288ef487532261a9045 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 7 Feb 2024 13:03:24 +0100 Subject: [PATCH 047/116] refs #6281 vehicles remove where --- modules/route/front/create/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/route/front/create/index.html b/modules/route/front/create/index.html index b76878f2e..de341220e 100644 --- a/modules/route/front/create/index.html +++ b/modules/route/front/create/index.html @@ -22,7 +22,6 @@ label="Vehicle" ng-model="$ctrl.route.vehicleFk" url="Vehicles" - where="{warehouseFk: $ctrl.vnConfig.warehouseFk}" show-field="numberPlate"> Date: Thu, 8 Feb 2024 10:50:56 +0100 Subject: [PATCH 048/116] refs #6443 migrate vn2008.cc_to_iban to util.accountNumberToIban --- .../util/functions/accountNumberToIban.sql | 58 +++++++++++++++++++ db/routines/vn2008/functions/cc_to_iban.sql | 49 ---------------- .../10873-greenPaniculata/00-firstScript.sql | 1 + 3 files changed, 59 insertions(+), 49 deletions(-) create mode 100644 db/routines/util/functions/accountNumberToIban.sql delete mode 100644 db/routines/vn2008/functions/cc_to_iban.sql create mode 100644 db/versions/10873-greenPaniculata/00-firstScript.sql diff --git a/db/routines/util/functions/accountNumberToIban.sql b/db/routines/util/functions/accountNumberToIban.sql new file mode 100644 index 000000000..2b38efe72 --- /dev/null +++ b/db/routines/util/functions/accountNumberToIban.sql @@ -0,0 +1,58 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`accountNumberToIban`( + vAccount VARCHAR(20) +) + RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci + DETERMINISTIC +BEGIN +/** +* Calcula y genera el código IBAN correspondiente +* a un número de cuenta bancaria español. +* +* @param vAccount Número de cuenta bancaria +* @return vIban Código IBAN de 4 caracteres. +*/ + DECLARE vIban VARCHAR(4); + + SELECT + CONCAT('ES', + RIGHT( + CONCAT(0, + 98-MOD( + CONCAT( + MOD( + CONCAT( + MOD( + CONCAT( + MOD( + SUBSTRING(vAccount, 1, 8), + 97 + ), + SUBSTRING(vAccount,9,8) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 17, + 8 + ) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 25, + 2 + ) + ), + 97 + ) + ), + 2 + ) + ) INTO vIban; + + RETURN vIban; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn2008/functions/cc_to_iban.sql b/db/routines/vn2008/functions/cc_to_iban.sql deleted file mode 100644 index c4515a9cc..000000000 --- a/db/routines/vn2008/functions/cc_to_iban.sql +++ /dev/null @@ -1,49 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`cc_to_iban`(cc VARCHAR(20)) - RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci - DETERMINISTIC -BEGIN - DECLARE iban VARCHAR(4); - select - CONCAT('ES', - RIGHT( - concat(0, - 98- - mod( - concat( - mod( - concat( - mod( - concat( - mod( - substring(cc,1,8), - 97), - substring(cc,9,8) - ), - 97), - substring( - concat( - cc, - 142800 - ), - 17, - 8 - ) - ), - 97), - substring( - concat( - cc, - 142800 - ), - 25, - 2 - ) - ), - 97) - ) - ,2) - )into iban; -RETURN iban; -END$$ -DELIMITER ; diff --git a/db/versions/10873-greenPaniculata/00-firstScript.sql b/db/versions/10873-greenPaniculata/00-firstScript.sql new file mode 100644 index 000000000..59ab23944 --- /dev/null +++ b/db/versions/10873-greenPaniculata/00-firstScript.sql @@ -0,0 +1 @@ +REVOKE EXECUTE ON FUNCTION vn2008.cc_to_iban FROM hr, financial; From 2e009b6f25884b7d3337c03e663b2f5174d4314e Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 8 Feb 2024 12:04:34 +0100 Subject: [PATCH 049/116] refactor: refs #6609 sectorType description to code --- db/dump/fixtures.before.sql | 4 ++-- db/routines/vn/procedures/collectionPlacement_get.sql | 4 ++-- db/routines/vn/procedures/productionControl.sql | 2 +- db/routines/vn/procedures/productionSectorList.sql | 2 +- db/routines/vn/views/itemShelvingStock.sql | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index ae7612b46..be9fe05ff 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -184,8 +184,8 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory (13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0), (60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0); -INSERT INTO `vn`.`sectorType` (id,description) - VALUES (1,'First type'); +INSERT INTO `vn`.`sectorType` (`id`, `code`) + VALUES (1,'normal'); INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`, `typeFk`) VALUES diff --git a/db/routines/vn/procedures/collectionPlacement_get.sql b/db/routines/vn/procedures/collectionPlacement_get.sql index db452ec2a..3641ba705 100644 --- a/db/routines/vn/procedures/collectionPlacement_get.sql +++ b/db/routines/vn/procedures/collectionPlacement_get.sql @@ -70,9 +70,9 @@ BEGIN ish.created, ish.visible, IFNULL( - IF(st.description = 'previousByPacking', ish.packing, g.`grouping`), + IF(st.code = 'previousByPacking', ish.packing, g.`grouping`), 1) `grouping`, - st.description = 'previousPrepared' isPreviousPrepared, + st.code = 'previousPrepared' isPreviousPrepared, iss.id itemShelvingSaleFk, ts.ticketFk, iss.id, diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql index 3f3663865..b42645d1e 100644 --- a/db/routines/vn/procedures/productionControl.sql +++ b/db/routines/vn/procedures/productionControl.sql @@ -207,7 +207,7 @@ proc: BEGIN ENGINE = MEMORY SELECT ish.itemFk, p.sectorFk, - st.description = 'previousPrepared' isPreviousPrepared, + st.code = 'previousPrepared' isPreviousPrepared, sc.itemPackingTypeFk FROM itemShelving ish JOIN shelving sh ON sh.code = ish.shelvingFk diff --git a/db/routines/vn/procedures/productionSectorList.sql b/db/routines/vn/procedures/productionSectorList.sql index ea047b376..5447f10d0 100644 --- a/db/routines/vn/procedures/productionSectorList.sql +++ b/db/routines/vn/procedures/productionSectorList.sql @@ -85,7 +85,7 @@ BEGIN JOIN client c ON c.id = t.clientFk JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id JOIN packagingConfig pc - WHERE IF(st.description = 'previousByPacking', + WHERE IF(st.code = 'previousByPacking', i.`size` > pc.previousPreparationMinimumSize AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), TRUE) diff --git a/db/routines/vn/views/itemShelvingStock.sql b/db/routines/vn/views/itemShelvingStock.sql index 15afe72a2..e0825eae5 100644 --- a/db/routines/vn/views/itemShelvingStock.sql +++ b/db/routines/vn/views/itemShelvingStock.sql @@ -15,7 +15,7 @@ AS SELECT `ish`.`itemFk` AS `itemFk`, `sh`.`parkingFk` AS `parkingFk`, `ish`.`id` AS `itemShelvingFk`, `ish`.`created` AS `created`, - `st`.`description` = 'previousPrepared' AS `isPreviousPrepared` + `st`.`code` = 'previousPrepared' AS `isPreviousPrepared` FROM ( ( ( From 3f400f92e5e1cb3427a95da7b96baeb098115d6c Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 8 Feb 2024 12:08:19 +0100 Subject: [PATCH 050/116] refactor: refs #6609 sectorType description to code --- db/versions/10874-yellowRose/00-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/10874-yellowRose/00-firstScript.sql diff --git a/db/versions/10874-yellowRose/00-firstScript.sql b/db/versions/10874-yellowRose/00-firstScript.sql new file mode 100644 index 000000000..835ff8515 --- /dev/null +++ b/db/versions/10874-yellowRose/00-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.sectorType CHANGE description code varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL; From 6a94a48a9d357b6a358d74f5498d0d03f8b9a2fc Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 8 Feb 2024 12:18:37 +0100 Subject: [PATCH 051/116] refactor: refs #6609 sectorType description to code --- .../10874-yellowRose/00-firstScript.sql | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/db/versions/10874-yellowRose/00-firstScript.sql b/db/versions/10874-yellowRose/00-firstScript.sql index 835ff8515..6d5b1ee86 100644 --- a/db/versions/10874-yellowRose/00-firstScript.sql +++ b/db/versions/10874-yellowRose/00-firstScript.sql @@ -1 +1,38 @@ ALTER TABLE vn.sectorType CHANGE description code varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL; + +-- Si no pongo lo de bajo da error en la view vn.itemShelvingAvailable +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn`.`itemShelvingStock` +AS SELECT `ish`.`itemFk` AS `itemFk`, + sum(`ish`.`visible`) AS `visible`, + min(`ish`.`packing`) AS `packing`, + min(`ish`.`grouping`) AS `grouping`, + `s`.`description` AS `sector`, + sum(`ish`.`visible`) AS `visibleOriginal`, + 0 AS `removed`, + `p`.`sectorFk` AS `sectorFk`, + `s`.`warehouseFk` AS `warehouseFk`, + `ish`.`shelvingFk` AS `shelvingFk`, + `p`.`code` AS `parkingCode`, + `sh`.`parkingFk` AS `parkingFk`, + `ish`.`id` AS `itemShelvingFk`, + `ish`.`created` AS `created`, + `st`.`code` = 'previousPrepared' AS `isPreviousPrepared` +FROM ( + ( + ( + ( + `vn`.`itemShelving` `ish` + LEFT JOIN `vn`.`shelving` `sh` ON(`sh`.`code` = `ish`.`shelvingFk`) + ) + LEFT JOIN `vn`.`parking` `p` ON(`p`.`id` = `sh`.`parkingFk`) + ) + LEFT JOIN `vn`.`sector` `s` ON(`s`.`id` = `p`.`sectorFk`) + ) + LEFT JOIN `vn`.`sectorType` `st` ON(`st`.`id` = `s`.`typeFk`) + ) +WHERE `ish`.`visible` <> 0 + AND `p`.`sectorFk` <> 0 +GROUP BY `ish`.`itemFk`, + `p`.`sectorFk`; \ No newline at end of file From 53a367f4b3064747a6160e7008af40ace0de55e8 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 8 Feb 2024 13:04:06 +0100 Subject: [PATCH 052/116] feat: refs #6371 cleanTablesFix --- db/routines/vn/views/agencyWarehouse.sql | 7 ------- db/routines/vn/views/clientDefaultCompany.sql | 9 -------- db/routines/vn/views/coolerPath.sql | 6 ------ db/routines/vn/views/grantGroup.sql | 7 ------- db/routines/vn2008/procedures/clean.sql | 8 ------- .../10876-goldenRoebelini/00-firstScript.sql | 21 +++++++++++++++++++ 6 files changed, 21 insertions(+), 37 deletions(-) delete mode 100644 db/routines/vn/views/agencyWarehouse.sql delete mode 100644 db/routines/vn/views/clientDefaultCompany.sql delete mode 100644 db/routines/vn/views/coolerPath.sql delete mode 100644 db/routines/vn/views/grantGroup.sql create mode 100644 db/versions/10876-goldenRoebelini/00-firstScript.sql diff --git a/db/routines/vn/views/agencyWarehouse.sql b/db/routines/vn/views/agencyWarehouse.sql deleted file mode 100644 index 6cb174544..000000000 --- a/db/routines/vn/views/agencyWarehouse.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`agencyWarehouse` -AS SELECT `a`.`agency_id` AS `agencyFk`, - `a`.`warehouse_id` AS `warehouseFk`, - `a`.`Vista` AS `agencyType` -FROM `vn2008`.`agency_warehouse` `a` diff --git a/db/routines/vn/views/clientDefaultCompany.sql b/db/routines/vn/views/clientDefaultCompany.sql deleted file mode 100644 index 6af418a1a..000000000 --- a/db/routines/vn/views/clientDefaultCompany.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`clientDefaultCompany` -AS SELECT `t`.`Id_Clientes_empresa` AS `id`, - `t`.`Id_Cliente` AS `clientFk`, - `t`.`empresa_id` AS `companyFk`, - `t`.`fecha_ini` AS `started`, - `t`.`fecha_fin` AS `finished` -FROM `vn2008`.`Clientes_empresa` `t` diff --git a/db/routines/vn/views/coolerPath.sql b/db/routines/vn/views/coolerPath.sql deleted file mode 100644 index 6be11e557..000000000 --- a/db/routines/vn/views/coolerPath.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`coolerPath` -AS SELECT `c`.`cooler_path_id` AS `id`, - `c`.`description` AS `description` -FROM `vn2008`.`cooler_path` `c` diff --git a/db/routines/vn/views/grantGroup.sql b/db/routines/vn/views/grantGroup.sql deleted file mode 100644 index 267c3154e..000000000 --- a/db/routines/vn/views/grantGroup.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`grantGroup` -AS SELECT `vn2008`.`Grupos`.`id` AS `id`, - `vn2008`.`Grupos`.`Grupo` AS `description`, - `vn2008`.`Grupos`.`observation_type_id` AS `observationTypeFk` -FROM `vn2008`.`Grupos` diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index bd8a324c6..8c36cced8 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -21,18 +21,10 @@ proc: BEGIN SET vRangeDeleteTicket = 60; DELETE FROM cdr WHERE calldate < vDate18; - DELETE FROM Monitoring WHERE ODBC_TIME < vDate; - DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM mail WHERE DATE_ODBC < vDate; - DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE ts - FROM Tickets_stack ts - JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; - DELETE tobs FROM ticket_observation tobs JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket diff --git a/db/versions/10876-goldenRoebelini/00-firstScript.sql b/db/versions/10876-goldenRoebelini/00-firstScript.sql new file mode 100644 index 000000000..361f3c7c8 --- /dev/null +++ b/db/versions/10876-goldenRoebelini/00-firstScript.sql @@ -0,0 +1,21 @@ +ALTER TABLE IF EXISTS vn2008.Compres_ok__ RENAME vn2008.Compres_ok; +ALTER TABLE IF EXISTS vn2008.Compres_ok COMMENT=''; + + +-- Para la tabla Monitoring +ALTER TABLE IF EXISTS vn2008.Monitoring RENAME vn2008.Monitoring__; +ALTER TABLE IF EXISTS vn2008.Monitoring__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Movimientos_avisar +ALTER TABLE IF EXISTS vn2008.Movimientos_avisar RENAME vn2008.Movimientos_avisar__; +ALTER TABLE IF EXISTS vn2008.Movimientos_avisar__ COMMENT='refs #6371 deprecated 2024-01-11'; + + +-- Para la tabla Movimientos_revisar +ALTER TABLE IF EXISTS vn2008.Movimientos_revisar RENAME vn2008.Movimientos_revisar__; +ALTER TABLE IF EXISTS vn2008.Movimientos_revisar__ COMMENT='refs #6371 deprecated 2024-01-11'; + + +-- Para la tabla Proveedores_escritos +ALTER TABLE IF EXISTS vn2008.Proveedores_escritos RENAME vn2008.Proveedores_escritos__; +ALTER TABLE IF EXISTS vn2008.Proveedores_escritos__ COMMENT='refs #6371 deprecated 2024-01-11'; \ No newline at end of file From 30069ded15802c0ea505736e3fba4ff73bfbf706 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 8 Feb 2024 16:01:34 +0100 Subject: [PATCH 053/116] fix: refs #6806 fix date filter --- modules/item/front/last-entries/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js index 31616f8a7..a5f1f4d9d 100644 --- a/modules/item/front/last-entries/index.js +++ b/modules/item/front/last-entries/index.js @@ -16,7 +16,7 @@ class Controller extends Section { this.filter = { where: { itemFk: this.$params.id, - shipped: { + landed: { between: [from, to] } } @@ -36,7 +36,7 @@ class Controller extends Section { const to = new Date(this._dateTo); to.setHours(23, 59, 59, 59); - this.filter.where.shipped = { + this.filter.where.landed = { between: [from, to] }; this.$.model.refresh(); @@ -53,7 +53,7 @@ class Controller extends Section { const to = new Date(value); to.setHours(23, 59, 59, 59); - this.filter.where.shipped = { + this.filter.where.landed = { between: [from, to] }; this.$.model.refresh(); From 08728d3162dec76398ebcb7b5a029c30aa030cf3 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 9 Feb 2024 07:51:51 +0100 Subject: [PATCH 054/116] refs #6651 feat:add urlImage --- db/routines/vn/procedures/itemShelving_get.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/itemShelving_get.sql b/db/routines/vn/procedures/itemShelving_get.sql index 98f865994..c6968e093 100644 --- a/db/routines/vn/procedures/itemShelving_get.sql +++ b/db/routines/vn/procedures/itemShelving_get.sql @@ -15,11 +15,13 @@ BEGIN p.code, ish.id, s.priority, - ish.isChecked + ish.isChecked, + CONCAT('http:', ic.url, '/catalog/200x200/', i.image) urlImage FROM itemShelving ish JOIN item i ON i.id = ish.itemFk JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci LEFT JOIN parking p ON s.parkingFk = p.id + JOIN hedera.imageConfig ic WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf; END$$ DELIMITER ; From 02bf78d00a2bab69a1e2fd5b42315d1a36fd7ca5 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 9 Feb 2024 09:22:24 +0100 Subject: [PATCH 055/116] feat: refs #6830 item_getLack origin --- db/routines/vn/procedures/item_getLack.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/item_getLack.sql b/db/routines/vn/procedures/item_getLack.sql index b2e3e425c..e0531e2ac 100644 --- a/db/routines/vn/procedures/item_getLack.sql +++ b/db/routines/vn/procedures/item_getLack.sql @@ -23,7 +23,8 @@ BEGIN SUM(IFNULL(sub.amount,0)) lack, i.inkFk, IFNULL(im.timed, util.midnight()) timed, - IFNULL(izc.timed, util.midnight()) minTimed + IFNULL(izc.timed, util.midnight()) minTimed, + o.name originFk FROM (SELECT item_id, warehouse_id, amount @@ -42,6 +43,7 @@ BEGIN JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id + JOIN origin o ON o.id = i.originFk WHERE w.isForTicket AND ic.display AND it.code != 'GEN' From f18191d6e9222bb147331a687b5e613fa685d859 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 9 Feb 2024 09:23:00 +0100 Subject: [PATCH 056/116] refactor: refs#6706 root dir clean, minimist dep removed --- Dockerfile => back/Dockerfile | 0 docker-compose.yml | 3 ++- e2e/helpers/tests.js | 14 +++++++++----- fileMock.js => front/jest-mock.js | 0 jest-front.js => front/jest-setup.js | 28 ++++++++++++++-------------- gulpfile.js | 4 ---- jest.front.config.js | 4 ++-- package.json | 1 - pnpm-lock.yaml | 3 --- 9 files changed, 27 insertions(+), 30 deletions(-) rename Dockerfile => back/Dockerfile (100%) rename fileMock.js => front/jest-mock.js (100%) rename jest-front.js => front/jest-setup.js (59%) diff --git a/Dockerfile b/back/Dockerfile similarity index 100% rename from Dockerfile rename to back/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 8391a5e23..43a528a8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,10 +19,11 @@ services: back: image: registry.verdnatura.es/salix-back:${VERSION:?} build: . + dockerfile: back/Dockerfile environment: + - TZ - NODE_ENV - DEBUG - - TZ ports: - 3000 configs: diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js index a4a059622..7dd299e0b 100644 --- a/e2e/helpers/tests.js +++ b/e2e/helpers/tests.js @@ -1,7 +1,9 @@ +/* eslint-disable no-console */ require('@babel/register')({presets: ['@babel/env']}); require('core-js/stable'); require('regenerator-runtime/runtime'); require('vn-loopback/server/boot/date')(); +const getopts = require('getopts'); const path = require('path'); const Myt = require('@verdnatura/myt/myt'); @@ -18,12 +20,16 @@ process.on('warning', warning => { }); async function test() { - if (process.argv[2] === 'show') - process.env.E2E_SHOW = true; + const opts = getopts(process.argv.slice(2), { + boolean: ['show'] + }); + process.env.E2E_SHOW = opts.show; + console.log('Building and running DB container.'); const myt = new Myt(); await myt.init({workspace: path.join(__dirname, '../..')}); await myt.run(Run); + await myt.deinit(); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); @@ -70,12 +76,10 @@ async function test() { jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; await jasmine.execute(); - - await myt.deinit(); } async function backendStatus() { - log('Awaiting backend connection...'); + log('Awaiting backend connection.'); const milliseconds = 1000; const maxAttempts = 10; diff --git a/fileMock.js b/front/jest-mock.js similarity index 100% rename from fileMock.js rename to front/jest-mock.js diff --git a/jest-front.js b/front/jest-setup.js similarity index 59% rename from jest-front.js rename to front/jest-setup.js index eabda9110..eebd99bbd 100644 --- a/jest-front.js +++ b/front/jest-setup.js @@ -1,19 +1,19 @@ import 'angular'; import 'angular-mocks'; -import core from './front/core/module.js'; -import './front/salix/components/app/app.js'; -import './modules/zone/front/module.js'; -import './modules/claim/front/module.js'; -import './modules/client/front/module.js'; -import './modules/invoiceOut/front/module.js'; -import './modules/invoiceIn/front/module.js'; -import './modules/item/front/module.js'; -import './modules/order/front/module.js'; -import './modules/route/front/module.js'; -import './modules/ticket/front/module.js'; -import './modules/travel/front/module.js'; -import './modules/worker/front/module.js'; -import './modules/shelving/front/module.js'; +import core from './core/module.js'; +import './salix/components/app/app.js'; +import '../modules/zone/front/module.js'; +import '../modules/claim/front/module.js'; +import '../modules/client/front/module.js'; +import '../modules/invoiceOut/front/module.js'; +import '../modules/invoiceIn/front/module.js'; +import '../modules/item/front/module.js'; +import '../modules/order/front/module.js'; +import '../modules/route/front/module.js'; +import '../modules/ticket/front/module.js'; +import '../modules/travel/front/module.js'; +import '../modules/worker/front/module.js'; +import '../modules/shelving/front/module.js'; import 'vn-loopback/server/boot/date'; // Set NODE_ENV diff --git a/gulpfile.js b/gulpfile.js index 255b1ee05..054a65c1c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,6 @@ require('require-yaml'); const gulp = require('gulp'); const PluginError = require('plugin-error'); -const argv = require('minimist')(process.argv.slice(2)); const log = require('fancy-log'); const Myt = require('@verdnatura/myt/myt'); const Run = require('@verdnatura/myt/myt-run'); @@ -12,9 +11,6 @@ const Start = require('@verdnatura/myt/myt-start'); let isWindows = /^win/.test(process.platform); -if (argv.NODE_ENV) - process.env.NODE_ENV = argv.NODE_ENV; - let langs = ['es', 'en']; let srcDir = './front'; let modulesDir = './modules'; diff --git a/jest.front.config.js b/jest.front.config.js index 3289df8bb..a843832ea 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -10,7 +10,7 @@ module.exports = { }, testEnvironment: 'jsdom', setupFilesAfterEnv: [ - './jest-front.js' + './front/jest-setup.js' ], testMatch: [ '**/front/**/*.spec.js', @@ -37,7 +37,7 @@ module.exports = { ], moduleNameMapper: { '\\.(css|scss)$': 'identity-obj-proxy', - '\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/fileMock.js', + '\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/front/jest-mock.js', }, testURL: 'http://localhost', verbose: false, diff --git a/package.json b/package.json index 197c1094d..9ae8b276b 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "js-yaml": "^4.1.0", "json-loader": "^0.5.7", "merge-stream": "^1.0.1", - "minimist": "^1.2.5", "node-sass": "^9.0.0", "nodemon": "^2.0.16", "plugin-error": "^1.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19f57caf9..221008dd9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -232,9 +232,6 @@ devDependencies: merge-stream: specifier: ^1.0.1 version: 1.0.1 - minimist: - specifier: ^1.2.5 - version: 1.2.8 node-sass: specifier: ^9.0.0 version: 9.0.0 From 26d4dbbe347f4ea5218c5f26d64326e876d21289 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 9 Feb 2024 09:26:46 +0100 Subject: [PATCH 057/116] fix: refs#6706 docker-compose.yml fixes --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 43a528a8b..5bb168093 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,8 +18,9 @@ services: memory: 1G back: image: registry.verdnatura.es/salix-back:${VERSION:?} - build: . - dockerfile: back/Dockerfile + build: + context: . + dockerfile: back/Dockerfile environment: - TZ - NODE_ENV From dcefc9d3822b6cb2f088614f91e1c184c6c5f775 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 9 Feb 2024 11:14:30 +0100 Subject: [PATCH 058/116] refs #6651 feat:add urlImage --- db/routines/vn/procedures/itemShelving_get.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/itemShelving_get.sql b/db/routines/vn/procedures/itemShelving_get.sql index c6968e093..1be762f09 100644 --- a/db/routines/vn/procedures/itemShelving_get.sql +++ b/db/routines/vn/procedures/itemShelving_get.sql @@ -16,7 +16,7 @@ BEGIN ish.id, s.priority, ish.isChecked, - CONCAT('http:', ic.url, '/catalog/200x200/', i.image) urlImage + ic.url FROM itemShelving ish JOIN item i ON i.id = ish.itemFk JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci From cc863a65f65038f1e5f6c225983bef0598c999c2 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 9 Feb 2024 11:40:20 +0100 Subject: [PATCH 059/116] refactor: refs #6501 Migrated procs from vn2008 to vn --- .../vn/procedures/XDiario_reconciliation.sql | 41 ++++ .../vn/procedures/entry_getTransfer.sql | 203 ++++++++++++++++++ .../vn/procedures/supplier_statement.sql | 139 ++++++++++++ db/routines/vn/procedures/travel_detail.sql | 103 +++++++++ .../vn2008/procedures/XDiario_Quadrator.sql | 34 --- .../vn2008/procedures/supplierStatement.sql | 117 ---------- db/routines/vn2008/procedures/traslado.sql | 182 ---------------- .../vn2008/procedures/travelDetail.sql | 119 ---------- .../10878-blueSalal/00-firstScript.sql | 4 + 9 files changed, 490 insertions(+), 452 deletions(-) create mode 100644 db/routines/vn/procedures/XDiario_reconciliation.sql create mode 100644 db/routines/vn/procedures/entry_getTransfer.sql create mode 100644 db/routines/vn/procedures/supplier_statement.sql create mode 100644 db/routines/vn/procedures/travel_detail.sql delete mode 100644 db/routines/vn2008/procedures/XDiario_Quadrator.sql delete mode 100644 db/routines/vn2008/procedures/supplierStatement.sql delete mode 100644 db/routines/vn2008/procedures/traslado.sql delete mode 100644 db/routines/vn2008/procedures/travelDetail.sql create mode 100644 db/versions/10878-blueSalal/00-firstScript.sql diff --git a/db/routines/vn/procedures/XDiario_reconciliation.sql b/db/routines/vn/procedures/XDiario_reconciliation.sql new file mode 100644 index 000000000..c4724849d --- /dev/null +++ b/db/routines/vn/procedures/XDiario_reconciliation.sql @@ -0,0 +1,41 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_reconciliation`() +BEGIN +/** + * Realiza la conciliación diaria de los asientos contables, + * identificando y notificando los asientos descuadrados + * y ajustando los saldos en caso necesario. + */ + INSERT INTO mail (receiver, subject, body) + SELECT 'cau@verdnatura.es', + 'Asientos descuadrados', + GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n') + FROM ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01 + ) sub + HAVING COUNT(*); + + UPDATE XDiario xd + JOIN ( + SELECT xd.id, SUBCTA, recon + FROM XDiario xd + JOIN ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING recon + ) sub ON sub.ASIEN = xd.ASIEN + WHERE xd.SUBCTA > '5999999999' + GROUP BY xd.ASIEN + ) sub ON sub.id = xd.id + SET xd.Eurohaber = IF(IFNULL(xd.Eurohaber, 0) = 0, xd.Eurohaber, xd.Eurohaber + sub.recon), + xd.Eurodebe = IF(IFNULL(xd.Eurodebe, 0) = 0, xd.Eurodebe, xd.Eurodebe - sub.recon); +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql new file mode 100644 index 000000000..2c9fe8577 --- /dev/null +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -0,0 +1,203 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`( + vSelf INT +) +BEGIN +/** + * Gestiona el traslado de productos a partir de una entrada específica. + * + * @param vSelf Id de entrada + */ + DECLARE vDateShipped DATE; + DECLARE vDateLanded DATE; + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vCalcVisible INT; + DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate(); + + SELECT shipped, landed, warehouseInFk, warehouseOutFk + INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id + WHERE e.id = vSelf; + + CALL vn.rate_getPrices(vDateShipped, vWarehouseIn); + + -- Traslado en almacen origen + CREATE OR REPLACE TEMPORARY TABLE tBuy + (PRIMARY KEY (itemFk), INDEX(buyFk)) + ENGINE = MEMORY + SELECT * + FROM ( + SELECT b.itemFk, b.id buyFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vInventoryDate AND vDateShipped + AND NOT b.isIgnored + AND b.price2 >= 0 + ORDER BY (vWarehouseOut = t.warehouseInFk) DESC, t.landed DESC + LIMIT 10000000000000000000 + ) sub + GROUP BY itemFk; + + IF vDateShipped >= util.VN_CURDATE() THEN + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseOut); + + CREATE OR REPLACE TEMPORARY TABLE tItem ( + `itemFk` int(10) unsigned NOT NULL, + `visible` int(11) NOT NULL DEFAULT 0, + `available` int(11) NOT NULL DEFAULT 0, + `visibleLanding` int(11) NOT NULL DEFAULT 0, + `availableLanding` int(11) NOT NULL DEFAULT 0, + UNIQUE INDEX i USING HASH (itemFk) + ) ENGINE = MEMORY; + + INSERT INTO tItem(itemFk, visible) + SELECT item_id itemFk, visible + FROM `cache`.visible + WHERE calc_id = vCalcVisible + AND visible; + + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseIn); + + INSERT INTO tItem(itemFk, visibleLanding) + SELECT item_id, `visible` + FROM `cache`.`visible` v + WHERE v.calc_id = vCalcVisible + AND v.`visible` + ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; + + CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL); + + INSERT INTO tItem(itemFk, available) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE available = a.available; + + CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut); + + INSERT INTO tItem(itemFk, availableLanding) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE availableLanding = a.available; + ELSE + CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL); + + CREATE OR REPLACE TEMPORARY TABLE tItem + (UNIQUE INDEX i USING HASH (itemFk)) + ENGINE = MEMORY + SELECT itemFk, + `visible`, + available, + 0 visibleLanding, + 0 availableLanding + FROM tmp.itemList; + END IF; + + CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); + + CREATE OR REPLACE TEMPORARY TABLE tTransfer + ENGINE = MEMORY + SELECT it.categoryFk, + i.typeFk, + i.id itemFk, + i.name item, + i.`size`, + i.category, + i.inkFk, + o.code originCode, + b2.quantity, + i.stems, + CAST(ti.visible AS DECIMAL(10,0)) vis1, + CAST(ti.available AS DECIMAL(10,0)) ava1, + CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2, + CAST(ti.availableLanding AS DECIMAL(10,0)) ava, + COALESCE(b2.`grouping`, b.`grouping`) `grouping`, + COALESCE(b2.packing, b.packing) packing, + COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, + IFNULL(p.name, s.nickname) productor, + b.packagingFk, + b2.id buyFk, + b2.stickers, + b.ektFk, + it.workerFk, + pa.volume, + IFNULL(pa.width, 0) width, + IFNULL(pa.`depth`, 0) `depth`, + IFNULL(pa.height, 0) height, + IFNULL(b.buyingValue, 0) buyingValue, + IFNULL(b.comissionValue, 0) comissionValue, + IFNULL(b.freightValue, 0) freightValue, + am.m3, + e.commission, + pa.isPackageReturnable, + IFNULL(pa2.value, pa.value) `value`, + r.rate3, + r.rate2, + it.promo, + b.`grouping` groupingOrigin, + b.packing packingOrigin, + b.id buyFkOrigin, + pa.returnCost, + b.weight + FROM vn.item i + JOIN tItem ti ON ti.itemFk = i.id + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN tBuy lb ON lb.itemFk = i.id + LEFT JOIN vn.buy b ON b.id = lb.buyFk + LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk + LEFT JOIN vn.entry e2 ON e2.id = b.entryFk + LEFT JOIN vn.supplier s ON s.id = e2.supplierFk + LEFT JOIN vn.entry e ON e.id = vSelf + LEFT JOIN vn.travel tr ON tr.id = e.travelFk + LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk + LEFT JOIN vn.buy b2 ON b2.itemFk = i.id + AND b2.entryFk = vSelf + LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk + LEFT JOIN tmp.rate r ON TRUE + LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id + LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk + WHERE ic.display + AND NOT e.isRaid + AND (ti.visible != 0 OR ti.available != 0) + ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; + + CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); + + SET @carriage := 0; + SET @comission := 0; + SET @packaging := 0; + SET @rate3 := 0; + SET @cost := 0; + SELECT *, + quantity - MOD(quantity , `grouping`) subQuantity, + MOD(quantity, `grouping`) soll, + ROUND((IF(volume > 0,volume, width * `depth` * IF(height = 0, `size` + 10, height))) / packing, 0) cm3, + buyingValue + comissionValue + freightValue Cost, + @carriage := ROUND((IF(volume > 0, volume, width * `depth` * IF(height = 0, `size` + 10, height))) * m3 / 1000000 / Packing, 3) carriage, + @comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, + ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) / packing, 3) packaging, + @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + + IFNULL(@packaging, 0) + + IFNULL(@carriage, 0) + + IFNULL(@comission, 0) cost, + @rate3 := ROUND(@cost / ( (100 - rate3 - promo) / 100), 2) rate3, + ROUND(@rate3 * (1 + ((rate2 - rate3)/100)), 2) rate2, + FALSE selected + FROM tTransfer; + + DROP TEMPORARY TABLE IF EXISTS + tTransfer, + tItem, + tBuy, + tmp.buyUltimateFromInterval, + tmp.rate, + tmp.itemList; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/supplier_statement.sql b/db/routines/vn/procedures/supplier_statement.sql new file mode 100644 index 000000000..406286e9d --- /dev/null +++ b/db/routines/vn/procedures/supplier_statement.sql @@ -0,0 +1,139 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_statement`( + vSupplierFk INT, + vCurrencyFk INT, + vCompanyFk INT, + vOrderBy VARCHAR(15), + vIsConciliated BOOL +) +BEGIN +/** + * Crea un estado de cuenta de proveedores calculando + * los saldos en euros y en la moneda especificada. + * + * @param vSupplierFk Id del proveedor + * @param vCurrencyFk Id de la moneda + * @param vCompanyFk Id de la empresa + * @param vOrderBy Criterio de ordenación + * @param vIsConciliated Indica si está conciliado o no + * @return tmp.supplierStatement + */ + SET @euroBalance:= 0; + SET @currencyBalance:= 0; + + CREATE OR REPLACE TEMPORARY TABLE tmp.supplierStatement + ENGINE = MEMORY + SELECT *, + @euroBalance:= ROUND( + @euroBalance + IFNULL(paymentEuros, 0) - + IFNULL(invoiceEuros, 0), 2 + ) euroBalance, + @currencyBalance:= ROUND( + @currencyBalance + IFNULL(paymentCurrency, 0) - + IFNULL(invoiceCurrency, 0), 2 + ) currencyBalance + FROM ( + SELECT * FROM + ( + SELECT NULL bankFk, + ii.companyFk, + ii.serial, + ii.id, + CASE + WHEN vOrderBy = 'issued' THEN ii.issued + WHEN vOrderBy = 'bookEntried' THEN ii.bookEntried + WHEN vOrderBy = 'booked' THEN ii.booked + WHEN vOrderBy = 'dueDate' THEN iid.dueDated + END dated, + CONCAT('S/Fra ', ii.supplierRef) sref, + IF(ii.currencyFk > 1, + ROUND(SUM(iid.foreignValue) / SUM(iid.amount), 3), + NULL + ) changeValue, + CAST(SUM(iid.amount) AS DECIMAL(10,2)) invoiceEuros, + CAST(SUM(iid.foreignValue) AS DECIMAL(10,2)) invoiceCurrency, + NULL paymentEuros, + NULL paymentCurrency, + ii.currencyFk, + ii.isBooked, + c.code, + 'invoiceIn' statementType + FROM invoiceIn ii + JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id + JOIN currency c ON c.id = ii.currencyFk + WHERE ii.issued > '2014-12-31' + AND ii.supplierFk = vSupplierFk + AND vCurrencyFk IN (ii.currencyFk, 0) + AND vCompanyFk IN (ii.companyFk, 0) + AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated) + GROUP BY iid.id + UNION ALL + SELECT p.bankFk, + p.companyFk, + NULL, + p.id, + CASE + WHEN vOrderBy = 'issued' THEN p.received + WHEN vOrderBy = 'bookEntried' THEN p.received + WHEN vOrderBy = 'booked' THEN p.received + WHEN vOrderBy = 'dueDate' THEN p.dueDated + END, + CONCAT(IFNULL(pm.name, ''), + IF(pn.concept <> '', + CONCAT(' : ', pn.concept), + '') + ), + IF(p.currencyFk > 1, p.divisa / p.amount, NULL), + NULL, + NULL, + p.amount, + p.divisa, + p.currencyFk, + p.isConciliated, + c.code, + 'payment' + FROM payment p + LEFT JOIN currency c ON c.id = p.currencyFk + LEFT JOIN bank b ON b.id = p.bankFk + LEFT JOIN payMethod pm ON pm.id = p.payMethodFk + LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id + WHERE p.received > '2014-12-31' + AND p.supplierFk = vSupplierFk + AND vCurrencyFk IN (p.currencyFk, 0) + AND vCompanyFk IN (p.companyFk, 0) + AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated) + UNION ALL + SELECT NULL, + companyFk, + NULL, + se.id, + CASE + WHEN vOrderBy = 'issued' THEN se.dated + WHEN vOrderBy = 'bookEntried' THEN se.dated + WHEN vOrderBy = 'booked' THEN se.dated + WHEN vOrderBy = 'dueDate' THEN se.dueDated + END, + se.description, + 1, + amount, + NULL, + NULL, + NULL, + currencyFk, + isConciliated, + c.`code`, + 'expense' + FROM supplierExpense se + JOIN currency c ON c.id = se.currencyFk + WHERE se.supplierFk = vSupplierFk + AND vCurrencyFk IN (se.currencyFk,0) + AND vCompanyFk IN (se.companyFk,0) + AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated) + ) sub + ORDER BY (dated IS NULL AND NOT isBooked), + dated, + IF(vOrderBy = 'dueDate', id, NULL) + LIMIT 10000000000000000000 + ) t; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/travel_detail.sql b/db/routines/vn/procedures/travel_detail.sql new file mode 100644 index 000000000..d805f0ca9 --- /dev/null +++ b/db/routines/vn/procedures/travel_detail.sql @@ -0,0 +1,103 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detail`() +BEGIN +/** + * Devuelve los detalles de los vuelos que tienen + * un almacén de salida en Ecuador o Colombia. + */ + DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; + SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, + sub.* + FROM ( + SELECT tr.id travelFk, + NULL entryFk, + TRUE isTravel, + am.name agency, + tr.ref, + tr.shipped, + wOut.name originBoxes, + tr.landed, + wIn.name destination, + SUM(b.stickers) stickers, + NULL evaNotes, + tr.kg, + CAST(SUM(b.weight * b.stickers) AS INT) loadedkg, + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ) volumeKg, + NULL loadPriority, + NULL invoiceAmount, + s.nickname freighter, + NULL reference + FROM travel tr + LEFT JOIN supplier s ON s.id = tr.cargoSupplierFk + LEFT JOIN entry e ON e.travelFk = tr.id + LEFT JOIN buy b ON b.entryFk = e.id + LEFT JOIN packaging p ON p.id = b.packagingFk + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN agencyMode am ON am.id = tr.agencyModeFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND (wOut.code = "col" OR wOut.code = "ecu") + GROUP BY tr.id + UNION ALL + SELECT e.travelFk, + e.id, + FALSE, + s.name, + e.invoiceNumber, + tr.shipped, + wOut.name, + tr.landed, + wIn.name, + SUM(b.stickers), + e.evaNotes, + NULL, + CAST(SUM(b.weight * b.stickers) AS INT), + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ), + loadPriority, + e.invoiceAmount, + s2.nickname, + e.reference + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN packaging p ON p.id = b.packagingFk + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN supplier s ON s.id = e.supplierFk + JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND (wOut.code = "col" OR wOut.code = "ecu") + GROUP BY e.id + ) sub + ORDER BY landed ASC, + shipped ASC, + travelFk, + isTravel DESC, + (loadPriority > 0) DESC, + loadPriority, + agency, + evaNotes; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn2008/procedures/XDiario_Quadrator.sql b/db/routines/vn2008/procedures/XDiario_Quadrator.sql deleted file mode 100644 index 93ddc231d..000000000 --- a/db/routines/vn2008/procedures/XDiario_Quadrator.sql +++ /dev/null @@ -1,34 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`XDiario_Quadrator`() -BEGIN - INSERT INTO vn.mail (receiver, subject, body) - SELECT 'cau@verdnatura.es', - 'asientos descuadrados', - group_concat(CONCAT(' Asiento: ', ASIEN, '- importe:', quadre) SEPARATOR ' \r\n ') - FROM ( - SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) quadre - FROM vn.XDiario - WHERE enlazado = FALSE - GROUP BY ASIEN - HAVING ABS(SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0))) > 0.01 - ) t - HAVING count(*) > 0; - - UPDATE vn.XDiario XD - INNER JOIN( - SELECT XD.id, SUBCTA, Quadre FROM vn.XDiario XD - INNER JOIN ( - SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) as Quadre - FROM vn.XDiario - WHERE enlazado = FALSE - GROUP BY ASIEN - HAVING Quadre != 0 - ) sub USING(ASIEN) - WHERE SUBCTA > '5999999999' - GROUP BY ASIEN - ) sub2 USING(id) - SET Eurohaber = IF(IFNULL(Eurohaber,0) = 0, Eurohaber, Eurohaber + Quadre), - Eurodebe = IF(IFNULL(Eurodebe,0) = 0, Eurodebe, Eurodebe - Quadre); - -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/supplierStatement.sql b/db/routines/vn2008/procedures/supplierStatement.sql deleted file mode 100644 index 4701e3e21..000000000 --- a/db/routines/vn2008/procedures/supplierStatement.sql +++ /dev/null @@ -1,117 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`supplierStatement`(vSupplierFk INT, vCurrencyFk INT, vCompanyFk INT, vOrderBy VARCHAR(15), vOnlyConciliated BIT) -BEGIN - SET @saldo_eur:= 0; - SET @saldo_div:= 0; -select vOnlyConciliated; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierStatement; - - CREATE TEMPORARY TABLE tmp.supplierStatement ENGINE = MEMORY - SELECT - *, - @saldo_eur:= round(@saldo_eur + IFNULL(Pago_Euros, 0) - IFNULL(Fac_Euros, 0) ,2 ) AS saldo_eur, - @saldo_div:= round(@saldo_div + IFNULL(Pago_Divisas, 0) - IFNULL(Fac_Divisas, 0) ,2 ) AS saldo_div - FROM - (SELECT * FROM - (SELECT - NULL as banco_id, - r.empresa_id, - r.serie, - r.id, - CASE - WHEN vOrderBy = 'issued' THEN r.fecha - WHEN vOrderBy = 'bookEntried' THEN r.bookEntried - WHEN vOrderBy = 'booked' THEN r.dateBooking - WHEN vOrderBy = 'dueDate' THEN rv.fecha - END AS fecha, - CONCAT('S/Fra ', r.sref) sref, - if(r.moneda_id > 1,round(sum(divisa) / sum(cantidad),3),NULL) val_cambio, - CAST(sum(cantidad) as DECIMAL(10,2)) as Fac_Euros, - CAST(sum(divisa) as DECIMAL(10,2)) as Fac_Divisas, - NULL AS Pago_Euros, - NULL AS Pago_Divisas, - r.moneda_id, - r.contabilizada, - Moneda, - NULL as pago_sdc_id, - 'invoiceIn' statementType - FROM - recibida r - JOIN recibida_vencimiento rv on rv.recibida_id = r.id - JOIN Monedas m on m.Id_Moneda = r.moneda_id - WHERE - r.fecha > '2014-12-31' - AND r.proveedor_id = vSupplierFk - AND vCurrencyFk IN (r.moneda_id, 0) - AND vCompanyFk IN (r.empresa_id,0) - AND (vOnlyConciliated = r.contabilizada OR NOT vOnlyConciliated) - GROUP BY rv.id - - UNION ALL - SELECT - p.id_banco, - p.empresa_id, - NULL, - p.id, - CASE - WHEN vOrderBy = 'issued' THEN p.Fecha - WHEN vOrderBy = 'bookEntried' THEN p.Fecha - WHEN vOrderBy = 'booked' THEN p.Fecha - WHEN vOrderBy = 'dueDate' THEN p.dueDated - END AS fecha, - CONCAT(IFNULL(name, ''), IF(pre.concepto <> '', CONCAT(' : ', pre.concepto), '')), - if(p.id_moneda > 1, p.divisa / importe, NULL) tip_cambio, - NULL, - NULL, - p.importe, - p.divisa, - p.id_moneda, - p.conciliado, - Moneda, - NULL as pago_sdc_id, - 'payment' statementType - FROM - pago p - LEFT JOIN Monedas ON Monedas.Id_Moneda = p.id_moneda - LEFT JOIN Bancos ON p.id_banco = Bancos.Id_banco - LEFT JOIN pay_met pm ON p.pay_met_id = pm.id - LEFT JOIN Pagares pre ON pre.pago_id = p.id - WHERE - Fecha > '2014-12-31' - AND p.Id_Proveedor = vSupplierFk - AND vCurrencyFk IN (p.id_moneda,0) - AND vCompanyFk IN (p.empresa_id,0) - AND (vOnlyConciliated = p.conciliado OR NOT vOnlyConciliated) - UNION ALL - SELECT - NULL, - companyFk, - NULL, - se.id, - CASE - WHEN vOrderBy = 'issued' THEN se.dated - WHEN vOrderBy = 'bookEntried' THEN se.dated - WHEN vOrderBy = 'booked' THEN se.dated - WHEN vOrderBy = 'dueDate' THEN se.dueDated - END AS fecha, - se.description, - 1 tip_cambio, - amount, - NULL, - NULL, - NULL, - currencyFk, - isConciliated, - c.`code`, - NULL, - 'expense' statementType - FROM vn.supplierExpense se - JOIN vn.currency c on c.id= se.currencyFk - WHERE se.supplierFk = vSupplierFk - AND vCurrencyFk IN (se.currencyFk,0) - AND vCompanyFk IN (se.companyFk,0) - AND (vOnlyConciliated = se.isConciliated OR NOT vOnlyConciliated) - ) AS SUB - ORDER BY (fecha is null and NOT contabilizada),fecha, IF(vOrderBy = 'dueDate', id, NULL) LIMIT 10000000000000000000) t; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/traslado.sql b/db/routines/vn2008/procedures/traslado.sql deleted file mode 100644 index 9c1e5efe7..000000000 --- a/db/routines/vn2008/procedures/traslado.sql +++ /dev/null @@ -1,182 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`traslado`(IN i_entrada INTEGER) -BEGIN - DECLARE dateShipment DATE; - DECLARE dateLanding DATE; - DECLARE warehouseShipment INTEGER; - DECLARE warehouseLanding INTEGER; - DECLARE v_calc_visible INTEGER; - DECLARE vInventoryDate DATE; - - SET vInventoryDate := vn.getInventoryDate(); - SELECT shipment, landing, warehouse_id_out, warehouse_id - INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding - FROM travel t JOIN Entradas e ON t.id = e.travel_id - WHERE Id_Entrada = i_entrada; - - CALL vn.rate_getPrices(dateShipment, warehouseLanding); - - -- Traslado en almacen origen - - DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; - CREATE TEMPORARY TABLE buy_edi_temp - (KEY (Id_Article), INDEX(Id_Compra)) ENGINE = MEMORY - SELECT * - FROM (SELECT c.Id_Article, c.Id_Compra - FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) - INNER JOIN travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN vInventoryDate AND dateShipment - AND c.Novincular = FALSE - AND c.Tarifa2 >= 0 - ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC - LIMIT 10000000000000000000) t - GROUP BY Id_Article; - - IF dateShipment >= util.VN_CURDATE() THEN - CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseShipment); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item ( - `itemFk` int(10) unsigned NOT NULL, - `visible` int(11) NOT NULL DEFAULT 0, - `available` int(11) NOT NULL DEFAULT 0, - `visibleLanding` int(11) NOT NULL DEFAULT 0, - `availableLanding` int(11) NOT NULL DEFAULT 0, - UNIQUE INDEX i USING HASH (itemFk) - ) ENGINE = MEMORY; - - INSERT INTO tmp.item(itemFk, visible) - SELECT item_id itemFk, visible - FROM `cache`.visible - WHERE calc_id = v_calc_visible - AND visible; - - CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseLanding); - - INSERT INTO tmp.item(itemFk, visibleLanding) - SELECT item_id, `visible` - FROM `cache`.`visible` v - WHERE v.calc_id = v_calc_visible - AND v.`visible` - ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; - - CALL availableTraslate(warehouseShipment, dateShipment, NULL); - - INSERT INTO tmp.item(itemFk, available) - SELECT a.item_id, a.available - FROM availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE available = a.available; - - CALL availableTraslate(warehouseLanding, dateLanding, warehouseShipment); - - INSERT INTO tmp.item(itemFk, availableLanding) - SELECT a.item_id, a.available - FROM availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE availableLanding = a.available; - ELSE - CALL vn.item_getStock(warehouseShipment, dateShipment, NULL); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item (UNIQUE INDEX i USING HASH (itemFk)) ENGINE = MEMORY - SELECT itemFk, `visible`, available , 0 visibleLanding, 0 availableLanding - FROM tmp.itemList; - - DROP TEMPORARY TABLE tmp.itemList; - END IF; - - CALL vn.buyUltimateFromInterval(warehouseLanding,vInventoryDate, dateLanding); - - DROP TEMPORARY TABLE IF EXISTS Traslados; - CREATE TEMPORARY TABLE Traslados ENGINE = MEMORY - SELECT tp.Id_Tipo AS Tipo, - tp.reino_id, - ar.tipo_id, - ar.Id_Article AS article_id, - ar.Article, - ar.Medida, - ar.Categoria, - ar.Color, - Origen.abreviatura as Origen, - CE.Cantidad, - ar.Tallos, - CAST(AIM.visible AS DECIMAL(10,0)) as vis1, - CAST(AIM.available AS DECIMAL(10,0)) as dis1, - CAST(AIM.visibleLanding AS DECIMAL(10,0)) as vis2, - CAST(AIM.availableLanding AS DECIMAL(10,0)) as dis2, - COALESCE(CE.`grouping`, C.`grouping`) as `grouping`, - COALESCE(CE.Packing, C.Packing) as Packing, - COALESCE(cl.caja, CE.caja, C.caja) as caja, - IFNULL(p.name, P2.Alias) AS Productor, - C.Id_Cubo, - 1 Tinta, - CE.Id_Compra, - CE.Etiquetas, - C.buy_edi_id, - tp.Id_Trabajador, - CB.Volumen, - IFNULL(CB.x,0) x, - IFNULL(CB.y,0) y, - IFNULL(CB.z,0) z, - IFNULL(C.Costefijo,0) Costefijo, - IFNULL(C.Comisionfija,0) Comisionfija, - IFNULL(C.Portefijo,0) Portefijo, - A.m3, - E.comision, - CB.Retornable, - IFNULL(CEB.Valor,CB.Valor) Valor, - r.rate3 t3, r.rate2 t2, tp.promo, - C.`grouping` groupingOrigin, - C.Packing PackingOrigin, - C.Id_Compra CompraOrigin, - CB.costeRetorno, - C.weight - FROM Articles ar - JOIN tmp.item AIM ON AIM.itemFk = ar.Id_Article - LEFT JOIN producer p ON p.producer_id = ar.producer_id - LEFT JOIN Tipos tp ON tp.tipo_id = ar.tipo_id - JOIN vn.itemCategory ic ON ic.id = tp.reino_id - LEFT JOIN Origen ON Origen.id = ar.id_origen - LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article - LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra - LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo - LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada - LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor - LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada - LEFT JOIN travel TR ON TR.id = E.travel_id - LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id - LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada - LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo - LEFT JOIN tmp.rate r ON TRUE - LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = ar.Id_Article - LEFT JOIN Compres cl ON cl.Id_Compra = bufi.buyFk - WHERE ic.display - AND E.Redada = FALSE - AND (AIM.visible != 0 OR AIM.available != 0) - ORDER BY tipo_id, Article, article_id, Medida, Categoria, Origen; - - CREATE INDEX tindex USING HASH ON Traslados (article_id); - - SELECT t.*, - Cantidad - MOD(Cantidad , `grouping`) as Subcantidad, - MOD(Cantidad , `grouping`) as Soll, - ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing,0) as cm3, - Costefijo + Comisionfija + Portefijo AS Cost, - @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte, - @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, - ROUND(@embalaje := (costeRetorno + IF(Retornable != 0, 0, Valor)) / packing ,3) AS Embalaje, - @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste, - @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3, - ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2, - 0 selected - FROM Traslados t; - - DROP TEMPORARY TABLE Traslados; - DROP TEMPORARY TABLE tmp.item; - DROP TEMPORARY TABLE buy_edi_temp; - DROP TEMPORARY TABLE tmp.buyUltimateFromInterval; - DROP TEMPORARY TABLE tmp.rate; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/travelDetail.sql b/db/routines/vn2008/procedures/travelDetail.sql deleted file mode 100644 index 39ed4f7b8..000000000 --- a/db/routines/vn2008/procedures/travelDetail.sql +++ /dev/null @@ -1,119 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`travelDetail`() -BEGIN -/** - * Returns the details of the travels that have a departure warehouse in Ecuador or Colombia. - */ - DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; - SELECT IFNULL(CONCAT(" ",Entrada),travel) travelAndEntry, - travel, - Entrada, - IsTravel, - Agencia, - ref, - shipment, - OrigenCajas, - landing, - Destino, - Etiquetas, - Notas_Eva, - kg, - loadedKg, - volumeKg, - loadPriority, - invoiceAmount, - Carguera, - reference - FROM - (SELECT TRUE IsTravel, - tr.id travel, - NULL Entrada, - ag.Agencia, - tr.ref, - tr.shipment, - wo.name OrigenCajas, - tr.landing, - w.name Destino, - SUM(c.Etiquetas) Etiquetas, - NULL Notas_Eva, - tr.kg, - CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - c.Etiquetas * - IF(cb.Volumen, - cb.Volumen, - cb.X * cb.Y * cb.Z - ) / 1000000 - ) AS INT - ) volumeKg, - NULL loadPriority, - NULL invoiceAmount, - pc.Alias Carguera, - NULL reference - FROM travel tr - LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk - LEFT JOIN Entradas e ON e.travel_id = tr.id - LEFT JOIN Compres c ON c.Id_Entrada = e.Id_Entrada - LEFT JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo - LEFT JOIN Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN warehouse w ON w.id = tr.warehouse_id - JOIN warehouse wo ON wo.id = tr.warehouse_id_out - JOIN Agencias ag ON ag.Id_Agencia = tr.agency_id - JOIN vn.volumeConfig vc - WHERE tr.landing >= vDateFrom - AND (wo.name="Colombia" OR wo.name="Ecuador") - GROUP BY tr.id - UNION ALL - SELECT 0 IsTravel, - e.travel_id travel, - e.Id_Entrada, - p.Proveedor, - e.Referencia, - tr.shipment, - wo.name OrigenCajas, - tr.landing, - w.name Destino, - SUM(Etiquetas) Etiquetas, - e.Notas_Eva, - NULL kg, - CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - c.Etiquetas * - IF(cb.Volumen, - cb.Volumen, - cb.X * cb.Y * cb.Z - ) / 1000000 - ) AS INT - ) volumeKg, - loadPriority, - e.invoiceAmount, - pc.Alias carguera, - e.reference - FROM Entradas e - JOIN Compres c ON c.Id_Entrada = e.Id_Entrada - JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor - JOIN travel tr ON tr.id = e.travel_id - LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk - JOIN warehouse w ON w.id = tr.warehouse_id - JOIN warehouse wo ON wo.id = tr.warehouse_id_out - JOIN vn.volumeConfig vc - WHERE tr.landing >= vDateFrom - AND (wo.name="Colombia" OR wo.name="Ecuador") - GROUP BY e.Id_Entrada - ) sub - ORDER BY landing ASC, - shipment ASC, - travel, - IsTravel DESC, - (loadPriority > 0) DESC, - loadPriority, - Agencia, - Notas_Eva; -END$$ -DELIMITER ; diff --git a/db/versions/10878-blueSalal/00-firstScript.sql b/db/versions/10878-blueSalal/00-firstScript.sql new file mode 100644 index 000000000..49511166b --- /dev/null +++ b/db/versions/10878-blueSalal/00-firstScript.sql @@ -0,0 +1,4 @@ +GRANT EXECUTE ON PROCEDURE vn.supplier_statement TO administrative, buyer, hrBoss; +GRANT EXECUTE ON PROCEDURE vn.XDiario_reconciliation TO adminBoss; +GRANT EXECUTE ON PROCEDURE vn.travel_detail TO buyer; +GRANT EXECUTE ON PROCEDURE vn.entry_transfer TO claimManager, buyer; From 22e6f547faad8a0a2e2918d42c659902100c7c18 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 9 Feb 2024 11:41:23 +0100 Subject: [PATCH 060/116] refactor: refs #6501 Migrated procs from vn2008 to vn --- db/versions/10878-blueSalal/00-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/10878-blueSalal/00-firstScript.sql b/db/versions/10878-blueSalal/00-firstScript.sql index 49511166b..1c1894c0e 100644 --- a/db/versions/10878-blueSalal/00-firstScript.sql +++ b/db/versions/10878-blueSalal/00-firstScript.sql @@ -1,4 +1,4 @@ GRANT EXECUTE ON PROCEDURE vn.supplier_statement TO administrative, buyer, hrBoss; GRANT EXECUTE ON PROCEDURE vn.XDiario_reconciliation TO adminBoss; GRANT EXECUTE ON PROCEDURE vn.travel_detail TO buyer; -GRANT EXECUTE ON PROCEDURE vn.entry_transfer TO claimManager, buyer; +GRANT EXECUTE ON PROCEDURE vn.entry_getTransfer TO claimManager, buyer; From dbe63ad11b675ed22794fd32a0f1e298de5a7209 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 9 Feb 2024 11:45:31 +0100 Subject: [PATCH 061/116] refactor: refs #6501 Fix grant errors --- .../10878-blueSalal/00-firstScript.sql | 495 +++++++++++++++++- 1 file changed, 494 insertions(+), 1 deletion(-) diff --git a/db/versions/10878-blueSalal/00-firstScript.sql b/db/versions/10878-blueSalal/00-firstScript.sql index 1c1894c0e..7ef168c6b 100644 --- a/db/versions/10878-blueSalal/00-firstScript.sql +++ b/db/versions/10878-blueSalal/00-firstScript.sql @@ -1,4 +1,497 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_statement`( + vSupplierFk INT, + vCurrencyFk INT, + vCompanyFk INT, + vOrderBy VARCHAR(15), + vIsConciliated BOOL +) +BEGIN +/** + * Crea un estado de cuenta de proveedores calculando + * los saldos en euros y en la moneda especificada. + * + * @param vSupplierFk Id del proveedor + * @param vCurrencyFk Id de la moneda + * @param vCompanyFk Id de la empresa + * @param vOrderBy Criterio de ordenación + * @param vIsConciliated Indica si está conciliado o no + * @return tmp.supplierStatement + */ + SET @euroBalance:= 0; + SET @currencyBalance:= 0; + + CREATE OR REPLACE TEMPORARY TABLE tmp.supplierStatement + ENGINE = MEMORY + SELECT *, + @euroBalance:= ROUND( + @euroBalance + IFNULL(paymentEuros, 0) - + IFNULL(invoiceEuros, 0), 2 + ) euroBalance, + @currencyBalance:= ROUND( + @currencyBalance + IFNULL(paymentCurrency, 0) - + IFNULL(invoiceCurrency, 0), 2 + ) currencyBalance + FROM ( + SELECT * FROM + ( + SELECT NULL bankFk, + ii.companyFk, + ii.serial, + ii.id, + CASE + WHEN vOrderBy = 'issued' THEN ii.issued + WHEN vOrderBy = 'bookEntried' THEN ii.bookEntried + WHEN vOrderBy = 'booked' THEN ii.booked + WHEN vOrderBy = 'dueDate' THEN iid.dueDated + END dated, + CONCAT('S/Fra ', ii.supplierRef) sref, + IF(ii.currencyFk > 1, + ROUND(SUM(iid.foreignValue) / SUM(iid.amount), 3), + NULL + ) changeValue, + CAST(SUM(iid.amount) AS DECIMAL(10,2)) invoiceEuros, + CAST(SUM(iid.foreignValue) AS DECIMAL(10,2)) invoiceCurrency, + NULL paymentEuros, + NULL paymentCurrency, + ii.currencyFk, + ii.isBooked, + c.code, + 'invoiceIn' statementType + FROM invoiceIn ii + JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id + JOIN currency c ON c.id = ii.currencyFk + WHERE ii.issued > '2014-12-31' + AND ii.supplierFk = vSupplierFk + AND vCurrencyFk IN (ii.currencyFk, 0) + AND vCompanyFk IN (ii.companyFk, 0) + AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated) + GROUP BY iid.id + UNION ALL + SELECT p.bankFk, + p.companyFk, + NULL, + p.id, + CASE + WHEN vOrderBy = 'issued' THEN p.received + WHEN vOrderBy = 'bookEntried' THEN p.received + WHEN vOrderBy = 'booked' THEN p.received + WHEN vOrderBy = 'dueDate' THEN p.dueDated + END, + CONCAT(IFNULL(pm.name, ''), + IF(pn.concept <> '', + CONCAT(' : ', pn.concept), + '') + ), + IF(p.currencyFk > 1, p.divisa / p.amount, NULL), + NULL, + NULL, + p.amount, + p.divisa, + p.currencyFk, + p.isConciliated, + c.code, + 'payment' + FROM payment p + LEFT JOIN currency c ON c.id = p.currencyFk + LEFT JOIN bank b ON b.id = p.bankFk + LEFT JOIN payMethod pm ON pm.id = p.payMethodFk + LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id + WHERE p.received > '2014-12-31' + AND p.supplierFk = vSupplierFk + AND vCurrencyFk IN (p.currencyFk, 0) + AND vCompanyFk IN (p.companyFk, 0) + AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated) + UNION ALL + SELECT NULL, + companyFk, + NULL, + se.id, + CASE + WHEN vOrderBy = 'issued' THEN se.dated + WHEN vOrderBy = 'bookEntried' THEN se.dated + WHEN vOrderBy = 'booked' THEN se.dated + WHEN vOrderBy = 'dueDate' THEN se.dueDated + END, + se.description, + 1, + amount, + NULL, + NULL, + NULL, + currencyFk, + isConciliated, + c.`code`, + 'expense' + FROM supplierExpense se + JOIN currency c ON c.id = se.currencyFk + WHERE se.supplierFk = vSupplierFk + AND vCurrencyFk IN (se.currencyFk,0) + AND vCompanyFk IN (se.companyFk,0) + AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated) + ) sub + ORDER BY (dated IS NULL AND NOT isBooked), + dated, + IF(vOrderBy = 'dueDate', id, NULL) + LIMIT 10000000000000000000 + ) t; +END$$ +DELIMITER ; + GRANT EXECUTE ON PROCEDURE vn.supplier_statement TO administrative, buyer, hrBoss; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_reconciliation`() +BEGIN +/** + * Realiza la conciliación diaria de los asientos contables, + * identificando y notificando los asientos descuadrados + * y ajustando los saldos en caso necesario. + */ + INSERT INTO mail (receiver, subject, body) + SELECT 'cau@verdnatura.es', + 'Asientos descuadrados', + GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n') + FROM ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01 + ) sub + HAVING COUNT(*); + + UPDATE XDiario xd + JOIN ( + SELECT xd.id, SUBCTA, recon + FROM XDiario xd + JOIN ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING recon + ) sub ON sub.ASIEN = xd.ASIEN + WHERE xd.SUBCTA > '5999999999' + GROUP BY xd.ASIEN + ) sub ON sub.id = xd.id + SET xd.Eurohaber = IF(IFNULL(xd.Eurohaber, 0) = 0, xd.Eurohaber, xd.Eurohaber + sub.recon), + xd.Eurodebe = IF(IFNULL(xd.Eurodebe, 0) = 0, xd.Eurodebe, xd.Eurodebe - sub.recon); +END$$ +DELIMITER ; + GRANT EXECUTE ON PROCEDURE vn.XDiario_reconciliation TO adminBoss; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detail`() +BEGIN +/** + * Devuelve los detalles de los vuelos que tienen + * un almacén de salida en Ecuador o Colombia. + */ + DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; + SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, + sub.* + FROM ( + SELECT tr.id travelFk, + NULL entryFk, + TRUE isTravel, + am.name agency, + tr.ref, + tr.shipped, + wOut.name originBoxes, + tr.landed, + wIn.name destination, + SUM(b.stickers) stickers, + NULL evaNotes, + tr.kg, + CAST(SUM(b.weight * b.stickers) AS INT) loadedkg, + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ) volumeKg, + NULL loadPriority, + NULL invoiceAmount, + s.nickname freighter, + NULL reference + FROM travel tr + LEFT JOIN supplier s ON s.id = tr.cargoSupplierFk + LEFT JOIN entry e ON e.travelFk = tr.id + LEFT JOIN buy b ON b.entryFk = e.id + LEFT JOIN packaging p ON p.id = b.packagingFk + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN agencyMode am ON am.id = tr.agencyModeFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND (wOut.code = "col" OR wOut.code = "ecu") + GROUP BY tr.id + UNION ALL + SELECT e.travelFk, + e.id, + FALSE, + s.name, + e.invoiceNumber, + tr.shipped, + wOut.name, + tr.landed, + wIn.name, + SUM(b.stickers), + e.evaNotes, + NULL, + CAST(SUM(b.weight * b.stickers) AS INT), + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ), + loadPriority, + e.invoiceAmount, + s2.nickname, + e.reference + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN packaging p ON p.id = b.packagingFk + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN supplier s ON s.id = e.supplierFk + JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND (wOut.code = "col" OR wOut.code = "ecu") + GROUP BY e.id + ) sub + ORDER BY landed ASC, + shipped ASC, + travelFk, + isTravel DESC, + (loadPriority > 0) DESC, + loadPriority, + agency, + evaNotes; +END$$ +DELIMITER ; + GRANT EXECUTE ON PROCEDURE vn.travel_detail TO buyer; -GRANT EXECUTE ON PROCEDURE vn.entry_getTransfer TO claimManager, buyer; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`( + vSelf INT +) +BEGIN +/** + * Gestiona el traslado de productos a partir de una entrada específica. + * + * @param vSelf Id de entrada + */ + DECLARE vDateShipped DATE; + DECLARE vDateLanded DATE; + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vCalcVisible INT; + DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate(); + + SELECT shipped, landed, warehouseInFk, warehouseOutFk + INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id + WHERE e.id = vSelf; + + CALL vn.rate_getPrices(vDateShipped, vWarehouseIn); + + -- Traslado en almacen origen + CREATE OR REPLACE TEMPORARY TABLE tBuy + (PRIMARY KEY (itemFk), INDEX(buyFk)) + ENGINE = MEMORY + SELECT * + FROM ( + SELECT b.itemFk, b.id buyFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vInventoryDate AND vDateShipped + AND NOT b.isIgnored + AND b.price2 >= 0 + ORDER BY (vWarehouseOut = t.warehouseInFk) DESC, t.landed DESC + LIMIT 10000000000000000000 + ) sub + GROUP BY itemFk; + + IF vDateShipped >= util.VN_CURDATE() THEN + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseOut); + + CREATE OR REPLACE TEMPORARY TABLE tItem ( + `itemFk` int(10) unsigned NOT NULL, + `visible` int(11) NOT NULL DEFAULT 0, + `available` int(11) NOT NULL DEFAULT 0, + `visibleLanding` int(11) NOT NULL DEFAULT 0, + `availableLanding` int(11) NOT NULL DEFAULT 0, + UNIQUE INDEX i USING HASH (itemFk) + ) ENGINE = MEMORY; + + INSERT INTO tItem(itemFk, visible) + SELECT item_id itemFk, visible + FROM `cache`.visible + WHERE calc_id = vCalcVisible + AND visible; + + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseIn); + + INSERT INTO tItem(itemFk, visibleLanding) + SELECT item_id, `visible` + FROM `cache`.`visible` v + WHERE v.calc_id = vCalcVisible + AND v.`visible` + ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; + + CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL); + + INSERT INTO tItem(itemFk, available) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE available = a.available; + + CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut); + + INSERT INTO tItem(itemFk, availableLanding) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE availableLanding = a.available; + ELSE + CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL); + + CREATE OR REPLACE TEMPORARY TABLE tItem + (UNIQUE INDEX i USING HASH (itemFk)) + ENGINE = MEMORY + SELECT itemFk, + `visible`, + available, + 0 visibleLanding, + 0 availableLanding + FROM tmp.itemList; + END IF; + + CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); + + CREATE OR REPLACE TEMPORARY TABLE tTransfer + ENGINE = MEMORY + SELECT it.categoryFk, + i.typeFk, + i.id itemFk, + i.name item, + i.`size`, + i.category, + i.inkFk, + o.code originCode, + b2.quantity, + i.stems, + CAST(ti.visible AS DECIMAL(10,0)) vis1, + CAST(ti.available AS DECIMAL(10,0)) ava1, + CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2, + CAST(ti.availableLanding AS DECIMAL(10,0)) ava, + COALESCE(b2.`grouping`, b.`grouping`) `grouping`, + COALESCE(b2.packing, b.packing) packing, + COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, + IFNULL(p.name, s.nickname) productor, + b.packagingFk, + b2.id buyFk, + b2.stickers, + b.ektFk, + it.workerFk, + pa.volume, + IFNULL(pa.width, 0) width, + IFNULL(pa.`depth`, 0) `depth`, + IFNULL(pa.height, 0) height, + IFNULL(b.buyingValue, 0) buyingValue, + IFNULL(b.comissionValue, 0) comissionValue, + IFNULL(b.freightValue, 0) freightValue, + am.m3, + e.commission, + pa.isPackageReturnable, + IFNULL(pa2.value, pa.value) `value`, + r.rate3, + r.rate2, + it.promo, + b.`grouping` groupingOrigin, + b.packing packingOrigin, + b.id buyFkOrigin, + pa.returnCost, + b.weight + FROM vn.item i + JOIN tItem ti ON ti.itemFk = i.id + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN tBuy lb ON lb.itemFk = i.id + LEFT JOIN vn.buy b ON b.id = lb.buyFk + LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk + LEFT JOIN vn.entry e2 ON e2.id = b.entryFk + LEFT JOIN vn.supplier s ON s.id = e2.supplierFk + LEFT JOIN vn.entry e ON e.id = vSelf + LEFT JOIN vn.travel tr ON tr.id = e.travelFk + LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk + LEFT JOIN vn.buy b2 ON b2.itemFk = i.id + AND b2.entryFk = vSelf + LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk + LEFT JOIN tmp.rate r ON TRUE + LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id + LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk + WHERE ic.display + AND NOT e.isRaid + AND (ti.visible != 0 OR ti.available != 0) + ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; + + CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); + + SET @carriage := 0; + SET @comission := 0; + SET @packaging := 0; + SET @rate3 := 0; + SET @cost := 0; + SELECT *, + quantity - MOD(quantity , `grouping`) subQuantity, + MOD(quantity, `grouping`) soll, + ROUND((IF(volume > 0,volume, width * `depth` * IF(height = 0, `size` + 10, height))) / packing, 0) cm3, + buyingValue + comissionValue + freightValue Cost, + @carriage := ROUND((IF(volume > 0, volume, width * `depth` * IF(height = 0, `size` + 10, height))) * m3 / 1000000 / Packing, 3) carriage, + @comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, + ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) / packing, 3) packaging, + @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + + IFNULL(@packaging, 0) + + IFNULL(@carriage, 0) + + IFNULL(@comission, 0) cost, + @rate3 := ROUND(@cost / ( (100 - rate3 - promo) / 100), 2) rate3, + ROUND(@rate3 * (1 + ((rate2 - rate3)/100)), 2) rate2, + FALSE selected + FROM tTransfer; + + DROP TEMPORARY TABLE IF EXISTS + tTransfer, + tItem, + tBuy, + tmp.buyUltimateFromInterval, + tmp.rate, + tmp.itemList; +END$$ +DELIMITER ; + +GRANT EXECUTE ON PROCEDURE vn.entry_getTransfer TO claimManager, buyer; \ No newline at end of file From 3e57bf2b341527d7cb047dfa0f7301009e209a5c Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 9 Feb 2024 11:49:29 +0100 Subject: [PATCH 062/116] refs #6791 remake negativeBases --- modules/invoiceOut/back/methods/invoiceOut/negativeBases.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js index 96c789316..46ec1cfa6 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js +++ b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js @@ -66,6 +66,7 @@ module.exports = Self => { cou.country, c.id clientId, c.socialName clientSocialName, + u.nickname workerSocialName, SUM(s.quantity * s.price * ( 100 - s.discount ) / 100) amount, negativeBase.taxableBase, negativeBase.ticketFk, @@ -78,8 +79,10 @@ module.exports = Self => { JOIN vn.company co ON co.id = t.companyFk JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.client c ON c.id = t.clientFk + JOIN vn.country cou ON cou.id = c.countryFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk + JOIN account.user u ON u.id = w.id LEFT JOIN ( SELECT ticketFk, taxableBase FROM tmp.ticketAmount From 4075375d6edd6542399d9ac98db9aad0b85f659b Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 9 Feb 2024 12:12:10 +0100 Subject: [PATCH 063/116] fix: refs #6379 get mail --- .../back/methods/route/driverRouteEmail.js | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/modules/route/back/methods/route/driverRouteEmail.js b/modules/route/back/methods/route/driverRouteEmail.js index 82b005e44..e4fd17b5f 100644 --- a/modules/route/back/methods/route/driverRouteEmail.js +++ b/modules/route/back/methods/route/driverRouteEmail.js @@ -9,24 +9,14 @@ module.exports = Self => { required: true, description: 'The client id', http: {source: 'path'} - }, - { - arg: 'recipient', - type: 'string', - description: 'The recipient email', - required: true, - }, - { + }, { arg: 'replyTo', type: 'string', description: 'The sender email to reply to', - required: false - }, - { + }, { arg: 'recipientId', type: 'number', description: 'The recipient id to send to the recipient preferred language', - required: false } ], returns: { @@ -39,5 +29,28 @@ module.exports = Self => { } }); - Self.driverRouteEmail = ctx => Self.sendTemplate(ctx, 'driver-route'); + Self.driverRouteEmail = async(ctx, id) => { + const models = Self.app.models; + const {workerFk, agencyMode} = await Self.findById(id, { + fields: ['workerFk', 'agencyModeFk'], + include: {relation: 'agencyMode'} + }); + const {reportMail} = agencyMode(); + let user; + let account; + + if (workerFk) { + user = await models.VnUser.findById(workerFk, { + fields: ['active', 'id'], + include: {relation: 'emailUser'} + }); + account = await models.Account.findById(workerFk); + } + + if (user?.active && !account) ctx.args.recipient = reportMail; + else if (user?.active && account) ctx.args.recipient = user.emailUser().email; + else // throws an error? + + Self.sendTemplate(ctx, 'driver-route'); + }; }; From 1597f17230ac995cb83c71661ef6575c028b3ecd Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 9 Feb 2024 12:47:17 +0100 Subject: [PATCH 064/116] refs #6791 remove intro --- modules/invoiceOut/back/methods/invoiceOut/negativeBases.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js index 46ec1cfa6..dc9496b4a 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js +++ b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js @@ -79,7 +79,6 @@ module.exports = Self => { JOIN vn.company co ON co.id = t.companyFk JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.client c ON c.id = t.clientFk - JOIN vn.country cou ON cou.id = c.countryFk LEFT JOIN vn.worker w ON w.id = c.salesPersonFk JOIN account.user u ON u.id = w.id From e0de498f659733ec747b5cc0ac7cd865b55aac1d Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 9 Feb 2024 13:04:27 +0100 Subject: [PATCH 065/116] fix: refs #6379 add Error & locale --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- modules/route/back/methods/route/driverRouteEmail.js | 9 +++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 419775d1b..33db02516 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -206,5 +206,6 @@ "Incorrect pin": "Incorrect pin.", "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", "Name should be uppercase": "Name should be uppercase", - "You cannot update these fields": "You cannot update these fields" + "You cannot update these fields": "You cannot update these fields", + "CountryFK cannot be empty": "CountryFK cannot be empty" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index dac839085..42215edd6 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -340,5 +340,6 @@ "Name should be uppercase": "El nombre debe ir en mayúscula", "Bank entity must be specified": "La entidad bancaria es obligatoria", "An email is necessary": "Es necesario un email", - "You cannot update these fields": "No puedes actualizar estos campos" + "You cannot update these fields": "No puedes actualizar estos campos", + "CountryFK cannot be empty": "CountryFK cannot be empty" } \ No newline at end of file diff --git a/modules/route/back/methods/route/driverRouteEmail.js b/modules/route/back/methods/route/driverRouteEmail.js index e4fd17b5f..35814de3c 100644 --- a/modules/route/back/methods/route/driverRouteEmail.js +++ b/modules/route/back/methods/route/driverRouteEmail.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('driverRouteEmail', { description: 'Sends the driver route email with an attached PDF', @@ -47,10 +48,10 @@ module.exports = Self => { account = await models.Account.findById(workerFk); } - if (user?.active && !account) ctx.args.recipient = reportMail; - else if (user?.active && account) ctx.args.recipient = user.emailUser().email; - else // throws an error? + if (user?.active && account) ctx.args.recipient = user.emailUser().email; + else ctx.args.recipient = reportMail; - Self.sendTemplate(ctx, 'driver-route'); + if (!ctx.args.recipient) throw new UserError('An email is necessary'); + Self.sendTemplate(ctx, 'driver-route'); }; }; From 362d825202e5ad3dc4a7ef9f4dd72246166c37dd Mon Sep 17 00:00:00 2001 From: ivanm Date: Fri, 9 Feb 2024 13:38:09 +0100 Subject: [PATCH 066/116] fix: refs #6443 #6444 #6445 ChangeRevokeToGrant --- .../util/functions/accountNumberToIban.sql | 42 ++++++------- .../10866-whiteRaphis/00-firstScript.sql | 1 - .../10873-greenPaniculata/00-firstScript.sql | 61 ++++++++++++++++++- .../10879-maroonCymbidium/00-firstScript.sql | 34 +++++++++++ 4 files changed, 115 insertions(+), 23 deletions(-) delete mode 100644 db/versions/10866-whiteRaphis/00-firstScript.sql create mode 100644 db/versions/10879-maroonCymbidium/00-firstScript.sql diff --git a/db/routines/util/functions/accountNumberToIban.sql b/db/routines/util/functions/accountNumberToIban.sql index 2b38efe72..49d3c917e 100644 --- a/db/routines/util/functions/accountNumberToIban.sql +++ b/db/routines/util/functions/accountNumberToIban.sql @@ -1,6 +1,6 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`accountNumberToIban`( - vAccount VARCHAR(20) + vAccount VARCHAR(20) ) RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci DETERMINISTIC @@ -18,41 +18,41 @@ BEGIN CONCAT('ES', RIGHT( CONCAT(0, - 98-MOD( - CONCAT( - MOD( - CONCAT( - MOD( - CONCAT( - MOD( - SUBSTRING(vAccount, 1, 8), - 97 - ), - SUBSTRING(vAccount,9,8) + 98-MOD( + CONCAT( + MOD( + CONCAT( + MOD( + CONCAT( + MOD( + SUBSTRING(vAccount, 1, 8), + 97 + ), + SUBSTRING(vAccount,9,8) ), - 97 - ), + 97 + ), SUBSTRING( CONCAT(vAccount, 142800), 17, 8 ) ), - 97 - ), + 97 + ), SUBSTRING( CONCAT(vAccount, 142800), 25, 2 ) ), - 97 - ) + 97 + ) ), - 2 - ) + 2 + ) ) INTO vIban; - RETURN vIban; + RETURN vIban; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/versions/10866-whiteRaphis/00-firstScript.sql b/db/versions/10866-whiteRaphis/00-firstScript.sql deleted file mode 100644 index bfbcb5dc9..000000000 --- a/db/versions/10866-whiteRaphis/00-firstScript.sql +++ /dev/null @@ -1 +0,0 @@ -REVOKE EXECUTE ON FUNCTION vn2008.red FROM hrBoss, salesPerson; diff --git a/db/versions/10873-greenPaniculata/00-firstScript.sql b/db/versions/10873-greenPaniculata/00-firstScript.sql index 59ab23944..3125eb7aa 100644 --- a/db/versions/10873-greenPaniculata/00-firstScript.sql +++ b/db/versions/10873-greenPaniculata/00-firstScript.sql @@ -1 +1,60 @@ -REVOKE EXECUTE ON FUNCTION vn2008.cc_to_iban FROM hr, financial; +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`accountNumberToIban`( + vAccount VARCHAR(20) +) + RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci + DETERMINISTIC +BEGIN +/** +* Calcula y genera el código IBAN correspondiente +* a un número de cuenta bancaria español. +* +* @param vAccount Número de cuenta bancaria +* @return vIban Código IBAN de 4 caracteres. +*/ + DECLARE vIban VARCHAR(4); + + SELECT + CONCAT('ES', + RIGHT( + CONCAT(0, + 98-MOD( + CONCAT( + MOD( + CONCAT( + MOD( + CONCAT( + MOD( + SUBSTRING(vAccount, 1, 8), + 97 + ), + SUBSTRING(vAccount,9,8) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 17, + 8 + ) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 25, + 2 + ) + ), + 97 + ) + ), + 2 + ) + ) INTO vIban; + + RETURN vIban; +END$$ +DELIMITER ; + +GRANT EXECUTE ON FUNCTION util.accountNumberToIban TO hr, financial; diff --git a/db/versions/10879-maroonCymbidium/00-firstScript.sql b/db/versions/10879-maroonCymbidium/00-firstScript.sql new file mode 100644 index 000000000..7efc4d6ab --- /dev/null +++ b/db/versions/10879-maroonCymbidium/00-firstScript.sql @@ -0,0 +1,34 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`( + vSelf INT, + vStems INT +) + RETURNS double + DETERMINISTIC +BEGIN +/** +* Calcula un valor neto estimado en función de +* datos históricos de facturas intrastat. +* +* @param vSelf Id de intrastat +* @param vStems Número de unidades +* @return vNet +*/ + DECLARE vNet DOUBLE; + + SELECT ROUND(vStems / (SUM(average) / COUNT(average)), 2) INTO vNet + FROM ( + SELECT *, stems / net average + FROM invoiceInIntrastat + WHERE intrastatFk = vSelf + AND net + AND stems > 0 + ORDER BY dated DESC + LIMIT 20 + ) sub; + + RETURN vNet/2; +END$$ +DELIMITER ; + +GRANT EXECUTE ON FUNCTION vn.intrastat_estimateNet TO administrative; \ No newline at end of file From b06f80e0913a0cc1545dfa34a673d0df557e8de5 Mon Sep 17 00:00:00 2001 From: ivanm Date: Mon, 12 Feb 2024 08:11:49 +0100 Subject: [PATCH 067/116] refs #6446 Delete function nz from db --- db/routines/bi/functions/nz.sql | 16 ---------------- .../bi/procedures/claim_ratio_routine.sql | 6 +++--- db/routines/vn/functions/nz.sql | 14 -------------- .../vn/procedures/client_checkBalance.sql | 2 +- .../vn/procedures/supplier_checkBalance.sql | 2 +- .../vn/triggers/expedition_beforeInsert.sql | 12 ++++++------ db/routines/vn2008/functions/nz.sql | 14 -------------- 7 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 db/routines/bi/functions/nz.sql delete mode 100644 db/routines/vn/functions/nz.sql delete mode 100644 db/routines/vn2008/functions/nz.sql diff --git a/db/routines/bi/functions/nz.sql b/db/routines/bi/functions/nz.sql deleted file mode 100644 index 0d047703a..000000000 --- a/db/routines/bi/functions/nz.sql +++ /dev/null @@ -1,16 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `bi`.`nz`(vData DOUBLE) - RETURNS double - DETERMINISTIC -BEGIN -/** - * Devuelve 0, si el parámetro es NULL: - */ - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vData,0); - - RETURN vResult; - -END$$ -DELIMITER ; diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index 4616bcb9e..e5a5310b4 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -130,13 +130,13 @@ BEGIN -- Calculamos el porcentaje del recobro para añadirlo al precio de venta UPDATE bi.claims_ratio cr JOIN ( - SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge + SELECT Id_Cliente, IFNULL(SUM(Importe), 0) AS Greuge FROM vn2008.Greuges WHERE Fecha <= util.VN_CURDATE() GROUP BY Id_Cliente ) g ON g.Id_Cliente = cr.Id_Cliente - SET recobro = GREATEST(0,round(nz(Greuge) / - (nz(Consumo) * vMonthToRefund / 12 ) ,3)); + SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) / + (IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3)); -- Protección neonatos UPDATE bi.claims_ratio cr diff --git a/db/routines/vn/functions/nz.sql b/db/routines/vn/functions/nz.sql deleted file mode 100644 index 71c017b78..000000000 --- a/db/routines/vn/functions/nz.sql +++ /dev/null @@ -1,14 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`nz`(vQuantity DOUBLE) - RETURNS double - DETERMINISTIC -BEGIN - - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vQuantity,0); - - RETURN vResult; - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/client_checkBalance.sql b/db/routines/vn/procedures/client_checkBalance.sql index ca8792ba4..210fcc00f 100644 --- a/db/routines/vn/procedures/client_checkBalance.sql +++ b/db/routines/vn/procedures/client_checkBalance.sql @@ -48,7 +48,7 @@ BEGIN SELECT lc.companyFk, c.id, 0, - - (NZ(lc.credit) - NZ(lc.debit)) + - (IFNULL(lc.credit, 0) - IFNULL(lc.debit, 0)) FROM tmp.ledgerComparative lc JOIN client c ON c.accountingAccount = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo diff --git a/db/routines/vn/procedures/supplier_checkBalance.sql b/db/routines/vn/procedures/supplier_checkBalance.sql index 5248b4cec..04c513927 100644 --- a/db/routines/vn/procedures/supplier_checkBalance.sql +++ b/db/routines/vn/procedures/supplier_checkBalance.sql @@ -60,7 +60,7 @@ BEGIN SELECT lc.companyFk, s.id, 0, - - (NZ(lc.debit) - NZ(lc.credit)) + - (IFNULL(lc.debit, 0) - IFNULL(lc.credit, 0)) FROM tmp.ledgerComparative lc JOIN supplier s ON s.account = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo diff --git a/db/routines/vn/triggers/expedition_beforeInsert.sql b/db/routines/vn/triggers/expedition_beforeInsert.sql index a7fa029b4..685de72cb 100644 --- a/db/routines/vn/triggers/expedition_beforeInsert.sql +++ b/db/routines/vn/triggers/expedition_beforeInsert.sql @@ -4,22 +4,22 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInse FOR EACH ROW BEGIN DECLARE intcounter INT; - DECLARE vShipFk INT; + DECLARE vShipFk INT; SET NEW.editorFk = account.myUser_getId(); IF NEW.freightItemFk IS NOT NULL THEN - UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk; + UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk; SELECT IFNULL(MAX(counter),0) +1 INTO intcounter - FROM expedition e + FROM expedition e INNER JOIN ticket t1 ON e.ticketFk = t1.id - LEFT JOIN ticketState ts ON ts.ticketFk = t1.id + LEFT JOIN ticketState ts ON ts.ticketFk = t1.id INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) - AND t1.warehouseFk = t2.warehouseFk + AND t1.warehouseFk = t2.warehouseFk WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk - AND t1.agencyModeFk = t2.agencyModeFk; + AND t1.agencyModeFk = t2.agencyModeFk; SET NEW.`counter` = intcounter; END IF; diff --git a/db/routines/vn2008/functions/nz.sql b/db/routines/vn2008/functions/nz.sql deleted file mode 100644 index 3ca911052..000000000 --- a/db/routines/vn2008/functions/nz.sql +++ /dev/null @@ -1,14 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`nz`(dblCANTIDAD DOUBLE) - RETURNS double - DETERMINISTIC -BEGIN - - DECLARE dblRESULT DOUBLE; - - SET dblRESULT = IFNULL(dblCANTIDAD,0); - - RETURN dblRESULT; - -END$$ -DELIMITER ; From d60a95feaad736fb29fb0164c415c1c75e6a0359 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 12 Feb 2024 08:34:25 +0100 Subject: [PATCH 068/116] fix: refs #6379 await & locale --- loopback/locale/en.json | 2 +- loopback/locale/es.json | 2 +- modules/route/back/methods/route/driverRouteEmail.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 33db02516..39756a615 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -207,5 +207,5 @@ "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", "Name should be uppercase": "Name should be uppercase", "You cannot update these fields": "You cannot update these fields", - "CountryFK cannot be empty": "CountryFK cannot be empty" + "CountryFK cannot be empty": "Country cannot be empty" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 42215edd6..4f9a84b44 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -341,5 +341,5 @@ "Bank entity must be specified": "La entidad bancaria es obligatoria", "An email is necessary": "Es necesario un email", "You cannot update these fields": "No puedes actualizar estos campos", - "CountryFK cannot be empty": "CountryFK cannot be empty" + "CountryFK cannot be empty": "El país no puede estar vacío" } \ No newline at end of file diff --git a/modules/route/back/methods/route/driverRouteEmail.js b/modules/route/back/methods/route/driverRouteEmail.js index 35814de3c..bbac2b0e8 100644 --- a/modules/route/back/methods/route/driverRouteEmail.js +++ b/modules/route/back/methods/route/driverRouteEmail.js @@ -52,6 +52,6 @@ module.exports = Self => { else ctx.args.recipient = reportMail; if (!ctx.args.recipient) throw new UserError('An email is necessary'); - Self.sendTemplate(ctx, 'driver-route'); + return Self.sendTemplate(ctx, 'driver-route'); }; }; From 380e0ef651dca7102a880af39c8f389bf94cb9b8 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 12 Feb 2024 08:44:54 +0100 Subject: [PATCH 069/116] refs #2687 fix: clone Travel as user action --- .../01-update_procedure_TravelCloneWithEntries.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql b/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql index b0c177b9a..59041a5b3 100644 --- a/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql +++ b/db/versions/10832-purpleAralia/01-update_procedure_TravelCloneWithEntries.sql @@ -27,7 +27,7 @@ BEGIN DECLARE vEvaNotes VARCHAR(255); DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; - DECLARE vTx BOOLEAN DEFAULT !@@in_transaction; + DECLARE vTx BOOLEAN DEFAULT @@in_transaction; DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e @@ -41,8 +41,8 @@ BEGIN CALL util.tx_rollback(vTx); RESIGNAL; END; - - CALL util.tx_start(vTx); + + CALL util.tx_start(vTx); INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom) SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk From e79bdb4456d27a2f11805f863bd7521850086a17 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 12 Feb 2024 08:45:07 +0100 Subject: [PATCH 070/116] refs #2687 test: fix --- .../back/methods/travel/specs/cloneWithEntries.spec.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js index 74ec10155..950da7bb1 100644 --- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js @@ -27,7 +27,10 @@ describe('Travel cloneWithEntries()', () => { expect(newTravel.warehouseOutFk).toEqual(warehouseThree); expect(newTravel.agencyModeFk).toEqual(agencyModeOne); expect(travelEntries.length).toBeGreaterThan(0); - + await models.Entry.destroyAll({ + travelFk: newTravelId + }, options); + await models.Travel.destroyById(newTravelId, options); await tx.rollback(); const travelRemoved = await models.Travel.findById(newTravelId, options); From 212bf5893277ef45012cc60034dbf9c5e05a5c82 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 10:08:56 +0100 Subject: [PATCH 071/116] refactor: refs #6501 Minor change --- db/routines/vn/procedures/entry_getTransfer.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 2c9fe8577..414f62429 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -179,14 +179,14 @@ BEGIN quantity - MOD(quantity , `grouping`) subQuantity, MOD(quantity, `grouping`) soll, ROUND((IF(volume > 0,volume, width * `depth` * IF(height = 0, `size` + 10, height))) / packing, 0) cm3, - buyingValue + comissionValue + freightValue Cost, + buyingValue + comissionValue + freightValue cost, @carriage := ROUND((IF(volume > 0, volume, width * `depth` * IF(height = 0, `size` + 10, height))) * m3 / 1000000 / Packing, 3) carriage, @comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) / packing, 3) packaging, @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + IFNULL(@packaging, 0) + IFNULL(@carriage, 0) + - IFNULL(@comission, 0) cost, + IFNULL(@comission, 0) expense, @rate3 := ROUND(@cost / ( (100 - rate3 - promo) / 100), 2) rate3, ROUND(@rate3 * (1 + ((rate2 - rate3)/100)), 2) rate2, FALSE selected From 4d7bc482ec75733ed880c2c6853e46f4cffd1b22 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 12 Feb 2024 10:10:30 +0100 Subject: [PATCH 072/116] refs #6742 fix(invoice_pdf): incotermsFk --- .../reports/invoice-incoterms/sql/incoterms.sql | 2 +- .../templates/reports/invoice/sql/hasIncoterms.sql | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/print/templates/reports/invoice-incoterms/sql/incoterms.sql b/print/templates/reports/invoice-incoterms/sql/incoterms.sql index b36f50084..81c0ec189 100644 --- a/print/templates/reports/invoice-incoterms/sql/incoterms.sql +++ b/print/templates/reports/invoice-incoterms/sql/incoterms.sql @@ -15,7 +15,7 @@ SELECT pack.packages, LEFT JOIN vn.province p ON p.id = c.provinceFk JOIN vn.ticket t ON t.refFk = io.ref JOIN vn.address a ON a.id = t.addressFk - LEFT JOIN vn.incoterms ic ON ic.code = a.incotermsFk + JOIN vn.incoterms ic ON ic.code = a.incotermsFk LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk JOIN vn.sale s ON s.ticketFk = t.id JOIN ( diff --git a/print/templates/reports/invoice/sql/hasIncoterms.sql b/print/templates/reports/invoice/sql/hasIncoterms.sql index 40a6db384..176fb30a6 100644 --- a/print/templates/reports/invoice/sql/hasIncoterms.sql +++ b/print/templates/reports/invoice/sql/hasIncoterms.sql @@ -1,8 +1,5 @@ -SELECT IF(incotermsFk IS NULL, FALSE, TRUE) AS hasIncoterms - FROM ticket t - JOIN invoiceOut io ON io.ref = t.refFk - JOIN client c ON c.id = t.clientFk - JOIN address a ON a.id = t.addressFk - WHERE t.refFk = ? - AND IF(c.hasToinvoiceByAddress = FALSE, c.defaultAddressFk, TRUE) - LIMIT 1 \ No newline at end of file +SELECT COUNT(*) AS hasIncoterms + FROM invoiceOut io + JOIN vn.invoiceOutSerial ios ON ios.code = io.serial + AND ios.taxAreaFk = 'WORLD' + WHERE io.ref = ? From f89ae0aad9f9fe670abea57e9383ea20454a010e Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 10:18:31 +0100 Subject: [PATCH 073/116] refactor: refs #6501 Minor change --- db/routines/vn/procedures/entry_getTransfer.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 414f62429..58e22c031 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -114,7 +114,7 @@ BEGIN CAST(ti.visible AS DECIMAL(10,0)) vis1, CAST(ti.available AS DECIMAL(10,0)) ava1, CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2, - CAST(ti.availableLanding AS DECIMAL(10,0)) ava, + CAST(ti.availableLanding AS DECIMAL(10,0)) ava2, COALESCE(b2.`grouping`, b.`grouping`) `grouping`, COALESCE(b2.packing, b.packing) packing, COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, From 23bf9b2750d8b4cb1f5e4ffbe6f7662e112ffe4e Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 10:28:25 +0100 Subject: [PATCH 074/116] refactor: refs #6501 Minor change --- db/routines/vn/procedures/entry_getTransfer.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 58e22c031..426619463 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -101,7 +101,8 @@ BEGIN CREATE OR REPLACE TEMPORARY TABLE tTransfer ENGINE = MEMORY - SELECT it.categoryFk, + SELECT it.code `type`, + it.categoryFk, i.typeFk, i.id itemFk, i.name item, From 4b5802202ddb0b20a2dc93f4b3bfc8769a864849 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 10:36:09 +0100 Subject: [PATCH 075/116] refactor: refs #6501 Minor change --- .../vn/procedures/entry_getTransfer.sql | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 426619463..10f14c681 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -120,6 +120,7 @@ BEGIN COALESCE(b2.packing, b.packing) packing, COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, IFNULL(p.name, s.nickname) productor, + TRUE tinta, b.packagingFk, b2.id buyFk, b2.stickers, @@ -136,8 +137,8 @@ BEGIN e.commission, pa.isPackageReturnable, IFNULL(pa2.value, pa.value) `value`, - r.rate3, - r.rate2, + r.r3, + r.r2, it.promo, b.`grouping` groupingOrigin, b.packing packingOrigin, @@ -179,11 +180,17 @@ BEGIN SELECT *, quantity - MOD(quantity , `grouping`) subQuantity, MOD(quantity, `grouping`) soll, - ROUND((IF(volume > 0,volume, width * `depth` * IF(height = 0, `size` + 10, height))) / packing, 0) cm3, + ROUND((IF(volume > 0,volume, width * `depth` * + IF(height = 0, `size` + 10, height))) / + packing, 0) cm3, buyingValue + comissionValue + freightValue cost, - @carriage := ROUND((IF(volume > 0, volume, width * `depth` * IF(height = 0, `size` + 10, height))) * m3 / 1000000 / Packing, 3) carriage, - @comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, - ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) / packing, 3) packaging, + @carriage := ROUND((IF(volume > 0, volume, width * `depth` * + IF(height = 0, `size` + 10, height))) * + m3 / 1000000 / Packing, 3) carriage, + @comission := ROUND((buyingValue + comissionValue + freightValue) * + commission / 100, 3) commission, + ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) + / packing, 3) packaging, @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + IFNULL(@packaging, 0) + IFNULL(@carriage, 0) + From fb763816245eb281f6025004242e2baf3150d9ef Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 11:02:24 +0100 Subject: [PATCH 076/116] refactor: refs #6501 Minor change --- db/routines/vn/procedures/entry_getTransfer.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 10f14c681..986612a26 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -137,8 +137,8 @@ BEGIN e.commission, pa.isPackageReturnable, IFNULL(pa2.value, pa.value) `value`, - r.r3, - r.r2, + r.rate3 r3, + r.rate2 r2, it.promo, b.`grouping` groupingOrigin, b.packing packingOrigin, From 8a7441be57a1acef083159f6bbe7dc5491117db8 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 12 Feb 2024 11:14:17 +0100 Subject: [PATCH 077/116] feat: refs #6371 --- db/routines/vn2008/procedures/clean.sql | 7 ------- db/versions/10876-goldenRoebelini/00-firstScript.sql | 4 ---- 2 files changed, 11 deletions(-) diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index 8c36cced8..0ff185c46 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -56,13 +56,6 @@ proc: BEGIN JOIN travel t ON t.id = e.travel_id WHERE t.landing <= vDate; - DELETE co - FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE t.landing <= vDate; - DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1; - IF v_full THEN CREATE OR REPLACE TEMPORARY TABLE tTicketDelete SELECT DISTINCT tl.originFk ticketFk diff --git a/db/versions/10876-goldenRoebelini/00-firstScript.sql b/db/versions/10876-goldenRoebelini/00-firstScript.sql index 361f3c7c8..c089f8950 100644 --- a/db/versions/10876-goldenRoebelini/00-firstScript.sql +++ b/db/versions/10876-goldenRoebelini/00-firstScript.sql @@ -1,7 +1,3 @@ -ALTER TABLE IF EXISTS vn2008.Compres_ok__ RENAME vn2008.Compres_ok; -ALTER TABLE IF EXISTS vn2008.Compres_ok COMMENT=''; - - -- Para la tabla Monitoring ALTER TABLE IF EXISTS vn2008.Monitoring RENAME vn2008.Monitoring__; ALTER TABLE IF EXISTS vn2008.Monitoring__ COMMENT='refs #6371 deprecated 2024-01-11'; From 534b5bb05a021488fac049abc411590caebc6976 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 12 Feb 2024 11:26:00 +0100 Subject: [PATCH 078/116] fix: refs #6106 where filter --- modules/route/back/methods/route/getTickets.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index d1ebf9ee7..59ba389ed 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -1,5 +1,5 @@ -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const {ParameterizedSQL} = require('loopback-connector'); module.exports = Self => { Self.remoteMethod('getTickets', { @@ -83,13 +83,15 @@ module.exports = Self => { const where = filter.where; where['r.id'] = filter.id; + where.and = [{or: [ + {'t.packages': {gt: 0}}, + {and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]} + ]}]; stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeGroupBy('t.id')); stmt.merge(conn.makeOrderBy(filter.order)); - const tickets = await conn.executeStmt(stmt, myOptions); - - return tickets; + return conn.executeStmt(stmt, myOptions); }; }; From ee67a02bf0cad8944b0fb82c2a1ae3f3948b3f77 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 11:28:54 +0100 Subject: [PATCH 079/116] refactor: refs #6501 Minor change --- db/routines/vn/procedures/entry_getTransfer.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 986612a26..2939fbf9e 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -195,8 +195,8 @@ BEGIN IFNULL(@packaging, 0) + IFNULL(@carriage, 0) + IFNULL(@comission, 0) expense, - @rate3 := ROUND(@cost / ( (100 - rate3 - promo) / 100), 2) rate3, - ROUND(@rate3 * (1 + ((rate2 - rate3)/100)), 2) rate2, + @rate3 := ROUND(@cost / ( (100 - r3 - promo) / 100), 2) rate3, + ROUND(@rate3 * (1 + ((rate2 - r3)/100)), 2) rate2, FALSE selected FROM tTransfer; From 96d6637a3f689d59f460a22a14cfb9f525d0f8a8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Feb 2024 11:32:07 +0100 Subject: [PATCH 080/116] refactor: refs #6501 Minor change --- db/routines/vn/procedures/entry_getTransfer.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 2939fbf9e..f2cec654e 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -196,7 +196,7 @@ BEGIN IFNULL(@carriage, 0) + IFNULL(@comission, 0) expense, @rate3 := ROUND(@cost / ( (100 - r3 - promo) / 100), 2) rate3, - ROUND(@rate3 * (1 + ((rate2 - r3)/100)), 2) rate2, + ROUND(@rate3 * (1 + ((r2 - r3)/100)), 2) rate2, FALSE selected FROM tTransfer; From fb84fe4b973be62faf9cb6079c17e825d9ca1bb1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 07:16:32 +0100 Subject: [PATCH 081/116] refactor: refs #6501 Requested changes --- .../{XDiario_reconciliation.sql => XDiario_verify.sql} | 4 ++-- db/routines/vn/procedures/entry_getTransfer.sql | 6 +++--- .../{travel_detail.sql => travel_detailAmerica.sql} | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename db/routines/vn/procedures/{XDiario_reconciliation.sql => XDiario_verify.sql} (93%) rename db/routines/vn/procedures/{travel_detail.sql => travel_detailAmerica.sql} (98%) diff --git a/db/routines/vn/procedures/XDiario_reconciliation.sql b/db/routines/vn/procedures/XDiario_verify.sql similarity index 93% rename from db/routines/vn/procedures/XDiario_reconciliation.sql rename to db/routines/vn/procedures/XDiario_verify.sql index c4724849d..0f898638a 100644 --- a/db/routines/vn/procedures/XDiario_reconciliation.sql +++ b/db/routines/vn/procedures/XDiario_verify.sql @@ -1,8 +1,8 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_reconciliation`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_verify`() BEGIN /** - * Realiza la conciliación diaria de los asientos contables, + * Realiza la verificación diaria de los asientos contables, * identificando y notificando los asientos descuadrados * y ajustando los saldos en caso necesario. */ diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index f2cec654e..151bebd4d 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`( ) BEGIN /** - * Gestiona el traslado de productos a partir de una entrada específica. + * Retorna los artículos trasladables a partir de una entrada. * * @param vSelf Id de entrada */ @@ -167,7 +167,7 @@ BEGIN LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk WHERE ic.display AND NOT e.isRaid - AND (ti.visible != 0 OR ti.available != 0) + AND (ti.visible OR ti.available) ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); @@ -189,7 +189,7 @@ BEGIN m3 / 1000000 / Packing, 3) carriage, @comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, - ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) + ROUND(@packaging := (returnCost + IF(isPackageReturnable, 0, value)) / packing, 3) packaging, @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + IFNULL(@packaging, 0) + diff --git a/db/routines/vn/procedures/travel_detail.sql b/db/routines/vn/procedures/travel_detailAmerica.sql similarity index 98% rename from db/routines/vn/procedures/travel_detail.sql rename to db/routines/vn/procedures/travel_detailAmerica.sql index d805f0ca9..ecd24cd5c 100644 --- a/db/routines/vn/procedures/travel_detail.sql +++ b/db/routines/vn/procedures/travel_detailAmerica.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detail`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detailAmerica`() BEGIN /** * Devuelve los detalles de los vuelos que tienen From a897a05e8b6a931b0288a67bf61964738cc170ca Mon Sep 17 00:00:00 2001 From: josepd Date: Tue, 13 Feb 2024 07:52:09 +0100 Subject: [PATCH 082/116] feat: refs#6685RestoreViewCredit --- db/routines/vn2008/views/credit.sql | 9 +++++++++ db/versions/10883-azureRuscus/00-firstScript.sql | 1 + 2 files changed, 10 insertions(+) create mode 100644 db/routines/vn2008/views/credit.sql create mode 100644 db/versions/10883-azureRuscus/00-firstScript.sql diff --git a/db/routines/vn2008/views/credit.sql b/db/routines/vn2008/views/credit.sql new file mode 100644 index 000000000..4bd3cef39 --- /dev/null +++ b/db/routines/vn2008/views/credit.sql @@ -0,0 +1,9 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`credit` +AS SELECT `c`.`id` AS `id`, + `c`.`clientFk` AS `Id_Cliente`, + `c`.`workerFk` AS `Id_Trabajador`, + `c`.`amount` AS `amount`, + `c`.`created` AS `odbc_date` +FROM `vn`.`clientCredit` `c` \ No newline at end of file diff --git a/db/versions/10883-azureRuscus/00-firstScript.sql b/db/versions/10883-azureRuscus/00-firstScript.sql new file mode 100644 index 000000000..8e046d95b --- /dev/null +++ b/db/versions/10883-azureRuscus/00-firstScript.sql @@ -0,0 +1 @@ +GRANT SELECT ON TABLE vn2008.credit TO financialBoss; \ No newline at end of file From 118fbcb94fa48ae299fa086c8d4d6ed111a5d509 Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 13 Feb 2024 07:55:40 +0100 Subject: [PATCH 083/116] feat: #5720 vehicle nuevos campos --- db/versions/10882-blueRuscus/00-vehicle.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 db/versions/10882-blueRuscus/00-vehicle.sql diff --git a/db/versions/10882-blueRuscus/00-vehicle.sql b/db/versions/10882-blueRuscus/00-vehicle.sql new file mode 100644 index 000000000..337778cef --- /dev/null +++ b/db/versions/10882-blueRuscus/00-vehicle.sql @@ -0,0 +1,13 @@ +ALTER TABLE vn.vehicle ADD supplierFk int(10) unsigned NULL COMMENT 'supplier from whom the vehicle was purchased'; +ALTER TABLE vn.vehicle ADD CONSTRAINT vehicle_supplierFk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id); + +ALTER TABLE vn.vehicle ADD import decimal(10,2) NULL; + +ALTER TABLE vn.vehicle ADD supplierCoolerFk int(10) unsigned NULL; +ALTER TABLE vn.vehicle ADD CONSTRAINT vehicle_supplierCoolerFk FOREIGN KEY (supplierCoolerFk) REFERENCES vn.supplier(id) ON DELETE RESTRICT ON UPDATE CASCADE; + +ALTER TABLE vn.vehicle ADD vin varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL; + +ALTER TABLE vn.vehicle ADD bankPolicyFk int(11) NULL; +ALTER TABLE vn.vehicle ADD CONSTRAINT vehicle_bankPolicyFk FOREIGN KEY (bankPolicyFk) REFERENCES vn.bankPolicy(id) ON DELETE RESTRICT ON UPDATE CASCADE; + From 3b35e4dae89622a01a9fbd27426ae0f4f3389f02 Mon Sep 17 00:00:00 2001 From: josepd Date: Tue, 13 Feb 2024 08:57:49 +0100 Subject: [PATCH 084/116] refs#6685 RestoreViewCredit --- db/versions/10883-azureRuscus/00-firstScript.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/versions/10883-azureRuscus/00-firstScript.sql b/db/versions/10883-azureRuscus/00-firstScript.sql index 8e046d95b..89fdbf781 100644 --- a/db/versions/10883-azureRuscus/00-firstScript.sql +++ b/db/versions/10883-azureRuscus/00-firstScript.sql @@ -1 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`credit`AS +SELECT 1; + GRANT SELECT ON TABLE vn2008.credit TO financialBoss; \ No newline at end of file From e08fb3d229485a9d0453a7e4e35cbe0a66ab44c4 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 08:59:58 +0100 Subject: [PATCH 085/116] fix: refs #6184 Minor change --- loopback/locale/es.json | 5 +++-- modules/ticket/back/methods/ticket/saveSign.js | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index b48772f0d..b0eb59cd5 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -339,8 +339,9 @@ "No tickets to invoice": "No hay tickets para facturar", "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", "Name should be uppercase": "El nombre debe ir en mayúscula", - "Bank entity must be specified": "La entidad bancaria es obligatoria", + "Bank entity must be specified": "La entidad bancaria es obligatoria", "An email is necessary": "Es necesario un email", "You cannot update these fields": "No puedes actualizar estos campos", - "CountryFK cannot be empty": "El país no puede estar vacío" + "CountryFK cannot be empty": "El país no puede estar vacío", + "Cmr file does not exist": "El archivo del cmr no existe" } \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 0fcd41102..3718dfcda 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -34,8 +34,6 @@ module.exports = Self => { const myOptions = {userId: ctx.req.accessToken.userId}; let tx; let ticket; - let dms; - let gestDocCreated; if (typeof options == 'object') Object.assign(myOptions, options); @@ -86,8 +84,8 @@ module.exports = Self => { contentType: 'image/png', hasFile: true }; - dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - gestDocCreated = true; + const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); } try { @@ -137,9 +135,8 @@ module.exports = Self => { throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); - if (!await hasSignDms(ticketId) && !gestDocCreated) + if (!await hasSignDms(ticketId)) await createGestDoc(ticketId); - await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ @@ -160,7 +157,7 @@ module.exports = Self => { await models.Route.cmrEmail(ctx, externalTickets); return; } catch (e) { - if (tx) await tx.rollback(); + if (tx && tx.isActive()) await tx.rollback(); throw e; } }; From 41db1c924f3c3875c27f08f3993c66ff4c79235d Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 09:20:21 +0100 Subject: [PATCH 086/116] refactor: refs #6781 Deleted timeControlDevice --- db/versions/10884-maroonGerbera/00-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/10884-maroonGerbera/00-firstScript.sql diff --git a/db/versions/10884-maroonGerbera/00-firstScript.sql b/db/versions/10884-maroonGerbera/00-firstScript.sql new file mode 100644 index 000000000..704342a7c --- /dev/null +++ b/db/versions/10884-maroonGerbera/00-firstScript.sql @@ -0,0 +1 @@ +DROP TABLE vn.timeControlDevice; From 6116ada156dd68e2b5e1e94fef8c8811c8fc9e7b Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 13 Feb 2024 09:35:39 +0100 Subject: [PATCH 087/116] fix: refs #6813 remove inserts --- db/routines/vn2008/procedures/recobro_credito.sql | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index ca5304b6c..0db9d6e70 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -8,16 +8,10 @@ BEGIN END; START TRANSACTION; - INSERT INTO vn.clientCredit(clientFk, amount) - SELECT c.id, 0 - FROM vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk - WHERE c.credit <> 0 AND pm.`code` = 'card'; - UPDATE vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk + JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.`code` = 'card'; + WHERE pm.`code` = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit @@ -44,10 +38,6 @@ BEGIN UPDATE Clientes JOIN clientes_credit USING(Id_Cliente) SET Clientes.Credito = newCredit; - - INSERT INTO credit(Id_Cliente, amount, Id_Trabajador) - SELECT Id_Cliente, newCredit, NULL - FROM clientes_credit; DROP TEMPORARY TABLE clientes_credit; COMMIT; From 744171dd4c33af9e2bfd94e5d9cf06628471b99e Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 09:41:26 +0100 Subject: [PATCH 088/116] fix: refs #6184 Requested changes --- modules/ticket/back/methods/ticket/saveSign.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 3718dfcda..9c6e8181a 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -34,6 +34,7 @@ module.exports = Self => { const myOptions = {userId: ctx.req.accessToken.userId}; let tx; let ticket; + let externalTickets = []; if (typeof options == 'object') Object.assign(myOptions, options); @@ -89,7 +90,6 @@ module.exports = Self => { } try { - let externalTickets = []; for (const ticketId of tickets) { ticket = await models.Ticket.findById(ticketId, { include: [{ @@ -154,11 +154,10 @@ module.exports = Self => { } } if (tx) await tx.commit(); - await models.Route.cmrEmail(ctx, externalTickets); - return; } catch (e) { - if (tx && tx.isActive()) await tx.rollback(); + if (tx) await tx.rollback(); throw e; } + await models.Route.cmrEmail(ctx, externalTickets); }; }; From 4f9b46346f38ee77b8328333fc4f84a5867df44e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 13 Feb 2024 09:49:33 +0100 Subject: [PATCH 089/116] fix: refs#6706 back tests spec timeout reduced --- back/tests.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/back/tests.js b/back/tests.js index 6c1b366e2..50698eb92 100644 --- a/back/tests.js +++ b/back/tests.js @@ -17,7 +17,8 @@ const opts = getopts(process.argv.slice(2), { let server; const PARALLEL = false; -const TIMEOUT = 900000; +const SETUP_TIMEOUT = 15 * 60 * 1000; +const SPEC_TIMEOUT = 30 * 1000; process.on('exit', teardown); process.on('uncaughtException', onError); @@ -74,9 +75,9 @@ async function test() { let runner; const config = { globalSetup: setup, - globalSetupTimeout: TIMEOUT, + globalSetupTimeout: SETUP_TIMEOUT, globalTeardown: teardown, - globalTeardownTimeout: TIMEOUT, + globalTeardownTimeout: SETUP_TIMEOUT, spec_dir: '.', spec_files: [ 'back/**/*[sS]pec.js', @@ -111,7 +112,7 @@ async function test() { runner.addReporter(new JunitReporter.JUnitXmlReporter()); } if (opts.ci) - runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT; + runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT; // runner.loadConfigFile('back/jasmine.json'); runner.loadConfig(config); From 185cc4f17fdf3209ded8586c954b110dc2b87fab Mon Sep 17 00:00:00 2001 From: Jbreso Date: Tue, 13 Feb 2024 09:50:07 +0100 Subject: [PATCH 090/116] feat: refs #6693 revisar triggers --- ...udgetNotes_BeforeInsert.sql => budgetNotes_beforeInsert.sql} | 2 +- ...lientCredit_AfterInsert.sql => clientCredit_afterInsert.sql} | 0 .../triggers/{client_AfterInsert.sql => client_afterInsert.sql} | 0 ...ionState_AfterInsert.sql => expeditionState_afterInsert.sql} | 0 ...nState_BeforeInsert.sql => expeditionState_beforeInsert.sql} | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename db/routines/vn/triggers/{budgetNotes_BeforeInsert.sql => budgetNotes_beforeInsert.sql} (91%) rename db/routines/vn/triggers/{clientCredit_AfterInsert.sql => clientCredit_afterInsert.sql} (100%) rename db/routines/vn/triggers/{client_AfterInsert.sql => client_afterInsert.sql} (100%) rename db/routines/vn/triggers/{expeditionState_AfterInsert.sql => expeditionState_afterInsert.sql} (100%) rename db/routines/vn/triggers/{expeditionState_BeforeInsert.sql => expeditionState_beforeInsert.sql} (100%) diff --git a/db/routines/vn/triggers/budgetNotes_BeforeInsert.sql b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql similarity index 91% rename from db/routines/vn/triggers/budgetNotes_BeforeInsert.sql rename to db/routines/vn/triggers/budgetNotes_beforeInsert.sql index f75b7a01e..6ea5ad5eb 100644 --- a/db/routines/vn/triggers/budgetNotes_BeforeInsert.sql +++ b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_BeforeInsert` +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_beforeInsert` BEFORE INSERT ON `budgetNotes` FOR EACH ROW BEGIN diff --git a/db/routines/vn/triggers/clientCredit_AfterInsert.sql b/db/routines/vn/triggers/clientCredit_afterInsert.sql similarity index 100% rename from db/routines/vn/triggers/clientCredit_AfterInsert.sql rename to db/routines/vn/triggers/clientCredit_afterInsert.sql diff --git a/db/routines/vn/triggers/client_AfterInsert.sql b/db/routines/vn/triggers/client_afterInsert.sql similarity index 100% rename from db/routines/vn/triggers/client_AfterInsert.sql rename to db/routines/vn/triggers/client_afterInsert.sql diff --git a/db/routines/vn/triggers/expeditionState_AfterInsert.sql b/db/routines/vn/triggers/expeditionState_afterInsert.sql similarity index 100% rename from db/routines/vn/triggers/expeditionState_AfterInsert.sql rename to db/routines/vn/triggers/expeditionState_afterInsert.sql diff --git a/db/routines/vn/triggers/expeditionState_BeforeInsert.sql b/db/routines/vn/triggers/expeditionState_beforeInsert.sql similarity index 100% rename from db/routines/vn/triggers/expeditionState_BeforeInsert.sql rename to db/routines/vn/triggers/expeditionState_beforeInsert.sql From b1fa83462666edfad64efc1e41c67da5474c3437 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 10:12:08 +0100 Subject: [PATCH 091/116] refactor: refs #6775 Deleted proc itemProposal_Add --- .../vn/procedures/itemProposal_Add.sql | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 db/routines/vn/procedures/itemProposal_Add.sql diff --git a/db/routines/vn/procedures/itemProposal_Add.sql b/db/routines/vn/procedures/itemProposal_Add.sql deleted file mode 100644 index 5a01cb67a..000000000 --- a/db/routines/vn/procedures/itemProposal_Add.sql +++ /dev/null @@ -1,70 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal_Add`(vSaleFk INT, vMateFk INT, vQuantity INT) -BEGIN -/** - * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. - * - * @param vSaleFk id de la tabla sale - * @param vMateFk articulo sustituto - * @ param vQuantity cantidad que se va a sustituir - */ - DECLARE vTicketFk INT; - DECLARE vItemFk INT; - DECLARE vWarehouseFk SMALLINT; - DECLARE vDate DATE; - DECLARE vGrouping INT; - DECLARE vBox INT; - DECLARE vPacking INT; - DECLARE vRoundQuantity INT DEFAULT 1; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk - INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE s.id = vSaleFk; - - CALL buyUltimate(vWarehouseFk, vDate); - - SELECT `grouping`, groupingMode, packing INTO vGrouping, vBox, vPacking - FROM buy b - JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk - WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk; - - IF vBox = 2 AND vPacking > 0 THEN - SET vRoundQuantity = vPacking; - END IF; - IF vBox = 1 AND vGrouping > 0 THEN - SET vRoundQuantity = vGrouping; - END IF; - - START TRANSACTION; - - UPDATE sale - SET quantity = quantity - vQuantity - WHERE id = vSaleFk; - - INSERT INTO sale(ticketFk, itemFk, quantity, concept) - SELECT vTicketFk, - vMateFk, - CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, - CONCAT('+ ',i.longName) - FROM item i - WHERE id = vMateFk; - - SELECT LAST_INSERT_ID() INTO vSaleFk; - - CALL sale_calculateComponent(vSaleFk, NULL); - - INSERT INTO itemProposal(itemFk, mateFk, counter) - VALUES(vItemFk, vMateFk, 1) - ON DUPLICATE KEY UPDATE counter = counter + 1; - - COMMIT; -END$$ -DELIMITER ; \ No newline at end of file From db2919b48208cd634ab8cea4d7d9f567fca32354 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 13 Feb 2024 11:05:21 +0100 Subject: [PATCH 092/116] fix: refs #6813 procedure --- db/routines/vn2008/procedures/recobro_credito.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index 0db9d6e70..3c8b6fbfe 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -8,10 +8,10 @@ BEGIN END; START TRANSACTION; - UPDATE vn.`client` c + UPDATE vn.client c JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.`code` = 'card'; + WHERE pm.code = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit From ed67b1168f71f457c0210a5c13b5fa8a5b3267a6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 11:14:35 +0100 Subject: [PATCH 093/116] refactor: refs #6501 Requested changes --- ...ilAmerica.sql => continent_getTravelDetail.sql} | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) rename db/routines/vn/procedures/{travel_detailAmerica.sql => continent_getTravelDetail.sql} (87%) diff --git a/db/routines/vn/procedures/travel_detailAmerica.sql b/db/routines/vn/procedures/continent_getTravelDetail.sql similarity index 87% rename from db/routines/vn/procedures/travel_detailAmerica.sql rename to db/routines/vn/procedures/continent_getTravelDetail.sql index ecd24cd5c..8049f9e65 100644 --- a/db/routines/vn/procedures/travel_detailAmerica.sql +++ b/db/routines/vn/procedures/continent_getTravelDetail.sql @@ -1,9 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detailAmerica`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`continent_getTravelDetail`( + vSelf INT +) BEGIN /** * Devuelve los detalles de los vuelos que tienen - * un almacén de salida en Ecuador o Colombia. + * un almacén de salida de un continente. + * + * @param vSelf Id de continente */ DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, @@ -44,10 +48,11 @@ BEGIN LEFT JOIN itemType it ON it.id = i.typeFk JOIN warehouse wIn ON wIn.id = tr.warehouseInFk JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN country co ON co.id = wOut.countryFk JOIN agencyMode am ON am.id = tr.agencyModeFk JOIN volumeConfig vc WHERE tr.landed >= vDateFrom - AND (wOut.code = "col" OR wOut.code = "ecu") + AND co.continentFk = vSelf GROUP BY tr.id UNION ALL SELECT e.travelFk, @@ -86,9 +91,10 @@ BEGIN LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk JOIN warehouse wIn ON wIn.id = tr.warehouseInFk JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN country co ON co.id = wOut.countryFk JOIN volumeConfig vc WHERE tr.landed >= vDateFrom - AND (wOut.code = "col" OR wOut.code = "ecu") + AND co.continentFk = vSelf GROUP BY e.id ) sub ORDER BY landed ASC, From 579f2abe5bd48bd05f5d25b7a9b66daf45038278 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 13 Feb 2024 11:16:00 +0100 Subject: [PATCH 094/116] fix: refs #6813 remove quotation marks --- db/routines/vn2008/procedures/recobro_credito.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index 3c8b6fbfe..0db9d6e70 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -8,10 +8,10 @@ BEGIN END; START TRANSACTION; - UPDATE vn.client c + UPDATE vn.`client` c JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.code = 'card'; + WHERE pm.`code` = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit From 999d9a0f9c3599436039772f64ca747b9bcadbb2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 13 Feb 2024 16:21:01 +0100 Subject: [PATCH 095/116] fix: refs#6706 E2E show parameter fix --- e2e/{helpers => }/tests.js | 7 ++++--- package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) rename e2e/{helpers => }/tests.js (94%) diff --git a/e2e/helpers/tests.js b/e2e/tests.js similarity index 94% rename from e2e/helpers/tests.js rename to e2e/tests.js index 7dd299e0b..829056f4c 100644 --- a/e2e/helpers/tests.js +++ b/e2e/tests.js @@ -10,7 +10,7 @@ const Myt = require('@verdnatura/myt/myt'); const Run = require('@verdnatura/myt/myt-run'); const axios = require('axios'); -const e2eConfig = require('./config.js'); +const e2eConfig = require('./helpers/config.js'); const log = require('fancy-log'); process.on('warning', warning => { @@ -23,11 +23,12 @@ async function test() { const opts = getopts(process.argv.slice(2), { boolean: ['show'] }); - process.env.E2E_SHOW = opts.show; + if (opts.show) + process.env.E2E_SHOW = true; console.log('Building and running DB container.'); const myt = new Myt(); - await myt.init({workspace: path.join(__dirname, '../..')}); + await myt.init({workspace: path.join(__dirname, '..')}); await myt.run(Run); await myt.deinit(); diff --git a/package.json b/package.json index 9ae8b276b..a9a355cf6 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "dbtest": "nodemon -q db/tests.js -w db/tests", "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json", "test:back:ci": "node back/tests.js --ci --junit --network jenkins", - "test:e2e": "node e2e/helpers/tests.js", + "test:e2e": "node e2e/tests.js", "test:front": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", From 27d7a114e6e9596232d84ab8774e4d30e3033ba8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 13 Feb 2024 17:16:10 +0100 Subject: [PATCH 096/116] fix: refs#6706 package.json dbtest script removed --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a9a355cf6..dc2e25166 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,6 @@ "yaml-loader": "^0.5.0" }, "scripts": { - "dbtest": "nodemon -q db/tests.js -w db/tests", "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json", "test:back:ci": "node back/tests.js --ci --junit --network jenkins", "test:e2e": "node e2e/tests.js", From 19bbb4a4bf06db9c52dcae984719dd1707be86c4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 13 Feb 2024 17:20:04 +0100 Subject: [PATCH 097/116] fix: refs#6706 package.json deprecated scripts removed --- Jenkinsfile | 2 +- package.json | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c04bcf16..d508da8bf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -103,7 +103,7 @@ pipeline { NODE_ENV = '' } steps { - sh 'npm run test:back:ci' + sh 'node back/tests.js --ci --junit --network jenkins' } post { always { diff --git a/package.json b/package.json index dc2e25166..5970e68fb 100644 --- a/package.json +++ b/package.json @@ -106,12 +106,10 @@ }, "scripts": { "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json", - "test:back:ci": "node back/tests.js --ci --junit --network jenkins", "test:e2e": "node e2e/tests.js", "test:front": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", - "lint": "eslint ./ --cache --ignore-pattern .gitignore", - "docker": "docker build --progress=plain -t salix-db ./db" + "lint": "eslint ./ --cache --ignore-pattern .gitignore" }, "jest": { "projects": [ From c2dadc09a22de4c648806f890f65ed5a875bb4e6 Mon Sep 17 00:00:00 2001 From: Jbreso Date: Wed, 14 Feb 2024 07:36:38 +0100 Subject: [PATCH 098/116] feat: refs #6693 comprobar triggers --- ...rojectNotes_BeforeInsert.sql => projectNotes_beforeInsert.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/routines/vn/triggers/{projectNotes_BeforeInsert.sql => projectNotes_beforeInsert.sql} (100%) diff --git a/db/routines/vn/triggers/projectNotes_BeforeInsert.sql b/db/routines/vn/triggers/projectNotes_beforeInsert.sql similarity index 100% rename from db/routines/vn/triggers/projectNotes_BeforeInsert.sql rename to db/routines/vn/triggers/projectNotes_beforeInsert.sql From 8542f1fae50aff6d3f95564ed5e6dd9da0ebeb9e Mon Sep 17 00:00:00 2001 From: Jbreso Date: Wed, 14 Feb 2024 08:34:02 +0100 Subject: [PATCH 099/116] feat: refs #6728 revision triggers test --- ...udgetNotes_BeforeInsert.sql => budgetNotes_beforeInsert.sql} | 2 +- ...lientCredit_AfterInsert.sql => clientCredit_afterInsert.sql} | 0 .../triggers/{client_AfterInsert.sql => client_afterInsert.sql} | 0 ...ionState_AfterInsert.sql => expeditionState_afterInsert.sql} | 0 ...nState_BeforeInsert.sql => expeditionState_beforeInsert.sql} | 0 ...jectNotes_BeforeInsert.sql => projectNotes_beforeInsert.sql} | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename db/routines/vn/triggers/{budgetNotes_BeforeInsert.sql => budgetNotes_beforeInsert.sql} (91%) rename db/routines/vn/triggers/{clientCredit_AfterInsert.sql => clientCredit_afterInsert.sql} (100%) rename db/routines/vn/triggers/{client_AfterInsert.sql => client_afterInsert.sql} (100%) rename db/routines/vn/triggers/{expeditionState_AfterInsert.sql => expeditionState_afterInsert.sql} (100%) rename db/routines/vn/triggers/{expeditionState_BeforeInsert.sql => expeditionState_beforeInsert.sql} (100%) rename db/routines/vn/triggers/{projectNotes_BeforeInsert.sql => projectNotes_beforeInsert.sql} (100%) diff --git a/db/routines/vn/triggers/budgetNotes_BeforeInsert.sql b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql similarity index 91% rename from db/routines/vn/triggers/budgetNotes_BeforeInsert.sql rename to db/routines/vn/triggers/budgetNotes_beforeInsert.sql index f75b7a01e..6ea5ad5eb 100644 --- a/db/routines/vn/triggers/budgetNotes_BeforeInsert.sql +++ b/db/routines/vn/triggers/budgetNotes_beforeInsert.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_BeforeInsert` +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_beforeInsert` BEFORE INSERT ON `budgetNotes` FOR EACH ROW BEGIN diff --git a/db/routines/vn/triggers/clientCredit_AfterInsert.sql b/db/routines/vn/triggers/clientCredit_afterInsert.sql similarity index 100% rename from db/routines/vn/triggers/clientCredit_AfterInsert.sql rename to db/routines/vn/triggers/clientCredit_afterInsert.sql diff --git a/db/routines/vn/triggers/client_AfterInsert.sql b/db/routines/vn/triggers/client_afterInsert.sql similarity index 100% rename from db/routines/vn/triggers/client_AfterInsert.sql rename to db/routines/vn/triggers/client_afterInsert.sql diff --git a/db/routines/vn/triggers/expeditionState_AfterInsert.sql b/db/routines/vn/triggers/expeditionState_afterInsert.sql similarity index 100% rename from db/routines/vn/triggers/expeditionState_AfterInsert.sql rename to db/routines/vn/triggers/expeditionState_afterInsert.sql diff --git a/db/routines/vn/triggers/expeditionState_BeforeInsert.sql b/db/routines/vn/triggers/expeditionState_beforeInsert.sql similarity index 100% rename from db/routines/vn/triggers/expeditionState_BeforeInsert.sql rename to db/routines/vn/triggers/expeditionState_beforeInsert.sql diff --git a/db/routines/vn/triggers/projectNotes_BeforeInsert.sql b/db/routines/vn/triggers/projectNotes_beforeInsert.sql similarity index 100% rename from db/routines/vn/triggers/projectNotes_BeforeInsert.sql rename to db/routines/vn/triggers/projectNotes_beforeInsert.sql From b9a624d9cd8b863d1073800767a389d6d7595c1c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 14 Feb 2024 08:45:50 +0100 Subject: [PATCH 100/116] refs #2687 feat: create util.procedures --- db/routines/util/procedures/tx_commit.sql | 15 +++++++++ db/routines/util/procedures/tx_rollback.sql | 15 +++++++++ db/routines/util/procedures/tx_start.sql | 17 ++++++++++ .../vn/procedures/travel_cloneWithEntries.sql | 32 +++++++++---------- modules/route/front/create/index.html | 1 + 5 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 db/routines/util/procedures/tx_commit.sql create mode 100644 db/routines/util/procedures/tx_rollback.sql create mode 100644 db/routines/util/procedures/tx_start.sql diff --git a/db/routines/util/procedures/tx_commit.sql b/db/routines/util/procedures/tx_commit.sql new file mode 100644 index 000000000..11be92c2e --- /dev/null +++ b/db/routines/util/procedures/tx_commit.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +$$ + +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(IN tx BOOL) +BEGIN +/** + * Procedimiento para confirmar los cambios asociados a una transacción + * + * @param tx BOOL es true si existe transacción asociada +*/ + IF tx THEN + COMMIT; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql new file mode 100644 index 000000000..b6ac2cd12 --- /dev/null +++ b/db/routines/util/procedures/tx_rollback.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +$$ + +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(tx BOOL) +BEGIN +/** + * Procedimiento para deshacer los cambios asociados a una transacción + * + * @param tx BOOL es true si existe transacción asociada +*/ + IF tx THEN + ROLLBACK; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/util/procedures/tx_start.sql b/db/routines/util/procedures/tx_start.sql new file mode 100644 index 000000000..6e513790b --- /dev/null +++ b/db/routines/util/procedures/tx_start.sql @@ -0,0 +1,17 @@ + + +DELIMITER $$ +$$ + +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(tx BOOL) +BEGIN +/** + * Procedimiento para iniciar una transacción + * + * @param tx BOOL es true si existe transacción asociada +*/ + IF tx THEN + START TRANSACTION; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/travel_cloneWithEntries.sql b/db/routines/vn/procedures/travel_cloneWithEntries.sql index 840152c44..7cf9ee5ef 100644 --- a/db/routines/vn/procedures/travel_cloneWithEntries.sql +++ b/db/routines/vn/procedures/travel_cloneWithEntries.sql @@ -1,21 +1,20 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, + IN vTravelFk INT, + IN vDateStart DATE, IN vDateEnd DATE, IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, OUT vNewTravelFk INT) BEGIN /** * Clona un travel junto con sus entradas y compras - * * @param vTravelFk travel plantilla a clonar * @param vDateStart fecha del shipment del nuevo travel * @param vDateEnd fecha del landing del nuevo travel - * @param vWarehouseOutFk fecha del salida del nuevo travel + * @param vWarehouseOutFk warehouse del salida del nuevo travel * @param vWarehouseInFk warehouse de landing del nuevo travel * @param vRef referencia del nuevo travel * @param vAgencyModeFk del nuevo travel @@ -25,34 +24,35 @@ BEGIN DECLARE vEvaNotes VARCHAR(255); DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; + DECLARE vTx BOOLEAN DEFAULT @@in_transaction; DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e JOIN travel t ON t.id = e.travelFk WHERE e.travelFk = vTravelFk; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; + BEGIN + CALL util.tx_rollback(vTx); RESIGNAL; END; - - START TRANSACTION; + + CALL util.tx_start(vTx); INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom) SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk FROM travel WHERE id = vTravelFk; - + SET vNewTravelFk = LAST_INSERT_ID(); SET vDone = FALSE; SET @isModeInventory = TRUE; OPEN vRsEntry; - + l: LOOP SET vDone = FALSE; FETCH vRsEntry INTO vAuxEntryFk; @@ -62,7 +62,7 @@ BEGIN END IF; CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); - CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); + CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); SELECT evaNotes INTO vEvaNotes FROM entry @@ -76,6 +76,6 @@ BEGIN SET @isModeInventory = FALSE; CLOSE vRsEntry; - COMMIT; + CALL util.tx_commit(vTx); END$$ DELIMITER ; diff --git a/modules/route/front/create/index.html b/modules/route/front/create/index.html index de341220e..b76878f2e 100644 --- a/modules/route/front/create/index.html +++ b/modules/route/front/create/index.html @@ -22,6 +22,7 @@ label="Vehicle" ng-model="$ctrl.route.vehicleFk" url="Vehicles" + where="{warehouseFk: $ctrl.vnConfig.warehouseFk}" show-field="numberPlate"> Date: Wed, 14 Feb 2024 09:32:44 +0100 Subject: [PATCH 101/116] refs #2687 feat: comments --- db/routines/util/procedures/tx_commit.sql | 2 -- db/routines/util/procedures/tx_rollback.sql | 2 -- db/routines/util/procedures/tx_start.sql | 2 -- 3 files changed, 6 deletions(-) diff --git a/db/routines/util/procedures/tx_commit.sql b/db/routines/util/procedures/tx_commit.sql index 11be92c2e..121c3803b 100644 --- a/db/routines/util/procedures/tx_commit.sql +++ b/db/routines/util/procedures/tx_commit.sql @@ -1,6 +1,4 @@ DELIMITER $$ -$$ - CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(IN tx BOOL) BEGIN /** diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql index b6ac2cd12..b9e7224e1 100644 --- a/db/routines/util/procedures/tx_rollback.sql +++ b/db/routines/util/procedures/tx_rollback.sql @@ -1,6 +1,4 @@ DELIMITER $$ -$$ - CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(tx BOOL) BEGIN /** diff --git a/db/routines/util/procedures/tx_start.sql b/db/routines/util/procedures/tx_start.sql index 6e513790b..3cce946fa 100644 --- a/db/routines/util/procedures/tx_start.sql +++ b/db/routines/util/procedures/tx_start.sql @@ -1,8 +1,6 @@ DELIMITER $$ -$$ - CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(tx BOOL) BEGIN /** From 874f77649806f1d79a3a883be8ec4a70d6befaf4 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Feb 2024 11:05:16 +0100 Subject: [PATCH 102/116] refactor: refs #6501 Requested changes --- .../vn/procedures/{XDiario_verify.sql => XDiario_check.sql} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename db/routines/vn/procedures/{XDiario_verify.sql => XDiario_check.sql} (94%) diff --git a/db/routines/vn/procedures/XDiario_verify.sql b/db/routines/vn/procedures/XDiario_check.sql similarity index 94% rename from db/routines/vn/procedures/XDiario_verify.sql rename to db/routines/vn/procedures/XDiario_check.sql index 0f898638a..0fb1c410d 100644 --- a/db/routines/vn/procedures/XDiario_verify.sql +++ b/db/routines/vn/procedures/XDiario_check.sql @@ -1,8 +1,8 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_verify`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_check`() BEGIN /** - * Realiza la verificación diaria de los asientos contables, + * Realiza la revisión diaria de los asientos contables, * identificando y notificando los asientos descuadrados * y ajustando los saldos en caso necesario. */ From b64637254b267cccbc624c62106232bb016947e1 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Feb 2024 11:16:52 +0100 Subject: [PATCH 103/116] refactor: refs #6501 Requested changes --- ...velDetail.sql => travel_getDetailFromContinent.sql} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename db/routines/vn/procedures/{continent_getTravelDetail.sql => travel_getDetailFromContinent.sql} (91%) diff --git a/db/routines/vn/procedures/continent_getTravelDetail.sql b/db/routines/vn/procedures/travel_getDetailFromContinent.sql similarity index 91% rename from db/routines/vn/procedures/continent_getTravelDetail.sql rename to db/routines/vn/procedures/travel_getDetailFromContinent.sql index 8049f9e65..e81e648b3 100644 --- a/db/routines/vn/procedures/continent_getTravelDetail.sql +++ b/db/routines/vn/procedures/travel_getDetailFromContinent.sql @@ -1,13 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`continent_getTravelDetail`( - vSelf INT +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_getDetailFromContinent`( + vContinentFk INT ) BEGIN /** * Devuelve los detalles de los vuelos que tienen * un almacén de salida de un continente. * - * @param vSelf Id de continente + * @param vContinentFk Id de continente */ DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, @@ -52,7 +52,7 @@ BEGIN JOIN agencyMode am ON am.id = tr.agencyModeFk JOIN volumeConfig vc WHERE tr.landed >= vDateFrom - AND co.continentFk = vSelf + AND co.continentFk = vContinentFk GROUP BY tr.id UNION ALL SELECT e.travelFk, @@ -94,7 +94,7 @@ BEGIN JOIN country co ON co.id = wOut.countryFk JOIN volumeConfig vc WHERE tr.landed >= vDateFrom - AND co.continentFk = vSelf + AND co.continentFk = vContinentFk GROUP BY e.id ) sub ORDER BY landed ASC, From b46087b75c6eeaa16870968c557312f77f70811e Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Feb 2024 11:21:22 +0100 Subject: [PATCH 104/116] refactor: refs #6501 Requested changes --- .../10878-blueSalal/00-firstScript.sql | 482 +----------------- 1 file changed, 10 insertions(+), 472 deletions(-) diff --git a/db/versions/10878-blueSalal/00-firstScript.sql b/db/versions/10878-blueSalal/00-firstScript.sql index 7ef168c6b..64506fa61 100644 --- a/db/versions/10878-blueSalal/00-firstScript.sql +++ b/db/versions/10878-blueSalal/00-firstScript.sql @@ -1,496 +1,34 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_statement`( - vSupplierFk INT, - vCurrencyFk INT, - vCompanyFk INT, - vOrderBy VARCHAR(15), - vIsConciliated BOOL -) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`supplier_statement`() BEGIN -/** - * Crea un estado de cuenta de proveedores calculando - * los saldos en euros y en la moneda especificada. - * - * @param vSupplierFk Id del proveedor - * @param vCurrencyFk Id de la moneda - * @param vCompanyFk Id de la empresa - * @param vOrderBy Criterio de ordenación - * @param vIsConciliated Indica si está conciliado o no - * @return tmp.supplierStatement - */ - SET @euroBalance:= 0; - SET @currencyBalance:= 0; - - CREATE OR REPLACE TEMPORARY TABLE tmp.supplierStatement - ENGINE = MEMORY - SELECT *, - @euroBalance:= ROUND( - @euroBalance + IFNULL(paymentEuros, 0) - - IFNULL(invoiceEuros, 0), 2 - ) euroBalance, - @currencyBalance:= ROUND( - @currencyBalance + IFNULL(paymentCurrency, 0) - - IFNULL(invoiceCurrency, 0), 2 - ) currencyBalance - FROM ( - SELECT * FROM - ( - SELECT NULL bankFk, - ii.companyFk, - ii.serial, - ii.id, - CASE - WHEN vOrderBy = 'issued' THEN ii.issued - WHEN vOrderBy = 'bookEntried' THEN ii.bookEntried - WHEN vOrderBy = 'booked' THEN ii.booked - WHEN vOrderBy = 'dueDate' THEN iid.dueDated - END dated, - CONCAT('S/Fra ', ii.supplierRef) sref, - IF(ii.currencyFk > 1, - ROUND(SUM(iid.foreignValue) / SUM(iid.amount), 3), - NULL - ) changeValue, - CAST(SUM(iid.amount) AS DECIMAL(10,2)) invoiceEuros, - CAST(SUM(iid.foreignValue) AS DECIMAL(10,2)) invoiceCurrency, - NULL paymentEuros, - NULL paymentCurrency, - ii.currencyFk, - ii.isBooked, - c.code, - 'invoiceIn' statementType - FROM invoiceIn ii - JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id - JOIN currency c ON c.id = ii.currencyFk - WHERE ii.issued > '2014-12-31' - AND ii.supplierFk = vSupplierFk - AND vCurrencyFk IN (ii.currencyFk, 0) - AND vCompanyFk IN (ii.companyFk, 0) - AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated) - GROUP BY iid.id - UNION ALL - SELECT p.bankFk, - p.companyFk, - NULL, - p.id, - CASE - WHEN vOrderBy = 'issued' THEN p.received - WHEN vOrderBy = 'bookEntried' THEN p.received - WHEN vOrderBy = 'booked' THEN p.received - WHEN vOrderBy = 'dueDate' THEN p.dueDated - END, - CONCAT(IFNULL(pm.name, ''), - IF(pn.concept <> '', - CONCAT(' : ', pn.concept), - '') - ), - IF(p.currencyFk > 1, p.divisa / p.amount, NULL), - NULL, - NULL, - p.amount, - p.divisa, - p.currencyFk, - p.isConciliated, - c.code, - 'payment' - FROM payment p - LEFT JOIN currency c ON c.id = p.currencyFk - LEFT JOIN bank b ON b.id = p.bankFk - LEFT JOIN payMethod pm ON pm.id = p.payMethodFk - LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id - WHERE p.received > '2014-12-31' - AND p.supplierFk = vSupplierFk - AND vCurrencyFk IN (p.currencyFk, 0) - AND vCompanyFk IN (p.companyFk, 0) - AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated) - UNION ALL - SELECT NULL, - companyFk, - NULL, - se.id, - CASE - WHEN vOrderBy = 'issued' THEN se.dated - WHEN vOrderBy = 'bookEntried' THEN se.dated - WHEN vOrderBy = 'booked' THEN se.dated - WHEN vOrderBy = 'dueDate' THEN se.dueDated - END, - se.description, - 1, - amount, - NULL, - NULL, - NULL, - currencyFk, - isConciliated, - c.`code`, - 'expense' - FROM supplierExpense se - JOIN currency c ON c.id = se.currencyFk - WHERE se.supplierFk = vSupplierFk - AND vCurrencyFk IN (se.currencyFk,0) - AND vCompanyFk IN (se.companyFk,0) - AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated) - ) sub - ORDER BY (dated IS NULL AND NOT isBooked), - dated, - IF(vOrderBy = 'dueDate', id, NULL) - LIMIT 10000000000000000000 - ) t; + SELECT 1; END$$ DELIMITER ; GRANT EXECUTE ON PROCEDURE vn.supplier_statement TO administrative, buyer, hrBoss; DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_reconciliation`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_check`() BEGIN -/** - * Realiza la conciliación diaria de los asientos contables, - * identificando y notificando los asientos descuadrados - * y ajustando los saldos en caso necesario. - */ - INSERT INTO mail (receiver, subject, body) - SELECT 'cau@verdnatura.es', - 'Asientos descuadrados', - GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n') - FROM ( - SELECT ASIEN, - SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon - FROM XDiario - WHERE NOT enlazado - GROUP BY ASIEN - HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01 - ) sub - HAVING COUNT(*); - - UPDATE XDiario xd - JOIN ( - SELECT xd.id, SUBCTA, recon - FROM XDiario xd - JOIN ( - SELECT ASIEN, - SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon - FROM XDiario - WHERE NOT enlazado - GROUP BY ASIEN - HAVING recon - ) sub ON sub.ASIEN = xd.ASIEN - WHERE xd.SUBCTA > '5999999999' - GROUP BY xd.ASIEN - ) sub ON sub.id = xd.id - SET xd.Eurohaber = IF(IFNULL(xd.Eurohaber, 0) = 0, xd.Eurohaber, xd.Eurohaber + sub.recon), - xd.Eurodebe = IF(IFNULL(xd.Eurodebe, 0) = 0, xd.Eurodebe, xd.Eurodebe - sub.recon); + SELECT 1; END$$ DELIMITER ; -GRANT EXECUTE ON PROCEDURE vn.XDiario_reconciliation TO adminBoss; +GRANT EXECUTE ON PROCEDURE vn.XDiario_check TO adminBoss; DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detail`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_getDetailFromContinent`() BEGIN -/** - * Devuelve los detalles de los vuelos que tienen - * un almacén de salida en Ecuador o Colombia. - */ - DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; - SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, - sub.* - FROM ( - SELECT tr.id travelFk, - NULL entryFk, - TRUE isTravel, - am.name agency, - tr.ref, - tr.shipped, - wOut.name originBoxes, - tr.landed, - wIn.name destination, - SUM(b.stickers) stickers, - NULL evaNotes, - tr.kg, - CAST(SUM(b.weight * b.stickers) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - b.stickers * - IF(p.volume, - p.volume, - p.width * p.depth * p.height - ) / 1000000 - ) AS INT - ) volumeKg, - NULL loadPriority, - NULL invoiceAmount, - s.nickname freighter, - NULL reference - FROM travel tr - LEFT JOIN supplier s ON s.id = tr.cargoSupplierFk - LEFT JOIN entry e ON e.travelFk = tr.id - LEFT JOIN buy b ON b.entryFk = e.id - LEFT JOIN packaging p ON p.id = b.packagingFk - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN itemType it ON it.id = i.typeFk - JOIN warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk - JOIN agencyMode am ON am.id = tr.agencyModeFk - JOIN volumeConfig vc - WHERE tr.landed >= vDateFrom - AND (wOut.code = "col" OR wOut.code = "ecu") - GROUP BY tr.id - UNION ALL - SELECT e.travelFk, - e.id, - FALSE, - s.name, - e.invoiceNumber, - tr.shipped, - wOut.name, - tr.landed, - wIn.name, - SUM(b.stickers), - e.evaNotes, - NULL, - CAST(SUM(b.weight * b.stickers) AS INT), - CAST( - SUM(vc.aerealVolumetricDensity * - b.stickers * - IF(p.volume, - p.volume, - p.width * p.depth * p.height - ) / 1000000 - ) AS INT - ), - loadPriority, - e.invoiceAmount, - s2.nickname, - e.reference - FROM entry e - JOIN buy b ON b.entryFk = e.id - JOIN packaging p ON p.id = b.packagingFk - JOIN item i ON i.id = b.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN supplier s ON s.id = e.supplierFk - JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk - JOIN warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk - JOIN volumeConfig vc - WHERE tr.landed >= vDateFrom - AND (wOut.code = "col" OR wOut.code = "ecu") - GROUP BY e.id - ) sub - ORDER BY landed ASC, - shipped ASC, - travelFk, - isTravel DESC, - (loadPriority > 0) DESC, - loadPriority, - agency, - evaNotes; + SELECT 1; END$$ DELIMITER ; -GRANT EXECUTE ON PROCEDURE vn.travel_detail TO buyer; +GRANT EXECUTE ON PROCEDURE vn.travel_getDetailFromContinent TO buyer; DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`( - vSelf INT -) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_getTransfer`() BEGIN -/** - * Gestiona el traslado de productos a partir de una entrada específica. - * - * @param vSelf Id de entrada - */ - DECLARE vDateShipped DATE; - DECLARE vDateLanded DATE; - DECLARE vWarehouseIn INT; - DECLARE vWarehouseOut INT; - DECLARE vCalcVisible INT; - DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate(); - - SELECT shipped, landed, warehouseInFk, warehouseOutFk - INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut - FROM vn.travel t - JOIN vn.entry e ON e.travelFk = t.id - WHERE e.id = vSelf; - - CALL vn.rate_getPrices(vDateShipped, vWarehouseIn); - - -- Traslado en almacen origen - CREATE OR REPLACE TEMPORARY TABLE tBuy - (PRIMARY KEY (itemFk), INDEX(buyFk)) - ENGINE = MEMORY - SELECT * - FROM ( - SELECT b.itemFk, b.id buyFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vInventoryDate AND vDateShipped - AND NOT b.isIgnored - AND b.price2 >= 0 - ORDER BY (vWarehouseOut = t.warehouseInFk) DESC, t.landed DESC - LIMIT 10000000000000000000 - ) sub - GROUP BY itemFk; - - IF vDateShipped >= util.VN_CURDATE() THEN - CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseOut); - - CREATE OR REPLACE TEMPORARY TABLE tItem ( - `itemFk` int(10) unsigned NOT NULL, - `visible` int(11) NOT NULL DEFAULT 0, - `available` int(11) NOT NULL DEFAULT 0, - `visibleLanding` int(11) NOT NULL DEFAULT 0, - `availableLanding` int(11) NOT NULL DEFAULT 0, - UNIQUE INDEX i USING HASH (itemFk) - ) ENGINE = MEMORY; - - INSERT INTO tItem(itemFk, visible) - SELECT item_id itemFk, visible - FROM `cache`.visible - WHERE calc_id = vCalcVisible - AND visible; - - CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseIn); - - INSERT INTO tItem(itemFk, visibleLanding) - SELECT item_id, `visible` - FROM `cache`.`visible` v - WHERE v.calc_id = vCalcVisible - AND v.`visible` - ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; - - CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL); - - INSERT INTO tItem(itemFk, available) - SELECT a.item_id, a.available - FROM vn2008.availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE available = a.available; - - CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut); - - INSERT INTO tItem(itemFk, availableLanding) - SELECT a.item_id, a.available - FROM vn2008.availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE availableLanding = a.available; - ELSE - CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL); - - CREATE OR REPLACE TEMPORARY TABLE tItem - (UNIQUE INDEX i USING HASH (itemFk)) - ENGINE = MEMORY - SELECT itemFk, - `visible`, - available, - 0 visibleLanding, - 0 availableLanding - FROM tmp.itemList; - END IF; - - CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); - - CREATE OR REPLACE TEMPORARY TABLE tTransfer - ENGINE = MEMORY - SELECT it.categoryFk, - i.typeFk, - i.id itemFk, - i.name item, - i.`size`, - i.category, - i.inkFk, - o.code originCode, - b2.quantity, - i.stems, - CAST(ti.visible AS DECIMAL(10,0)) vis1, - CAST(ti.available AS DECIMAL(10,0)) ava1, - CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2, - CAST(ti.availableLanding AS DECIMAL(10,0)) ava, - COALESCE(b2.`grouping`, b.`grouping`) `grouping`, - COALESCE(b2.packing, b.packing) packing, - COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, - IFNULL(p.name, s.nickname) productor, - b.packagingFk, - b2.id buyFk, - b2.stickers, - b.ektFk, - it.workerFk, - pa.volume, - IFNULL(pa.width, 0) width, - IFNULL(pa.`depth`, 0) `depth`, - IFNULL(pa.height, 0) height, - IFNULL(b.buyingValue, 0) buyingValue, - IFNULL(b.comissionValue, 0) comissionValue, - IFNULL(b.freightValue, 0) freightValue, - am.m3, - e.commission, - pa.isPackageReturnable, - IFNULL(pa2.value, pa.value) `value`, - r.rate3, - r.rate2, - it.promo, - b.`grouping` groupingOrigin, - b.packing packingOrigin, - b.id buyFkOrigin, - pa.returnCost, - b.weight - FROM vn.item i - JOIN tItem ti ON ti.itemFk = i.id - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN tBuy lb ON lb.itemFk = i.id - LEFT JOIN vn.buy b ON b.id = lb.buyFk - LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk - LEFT JOIN vn.entry e2 ON e2.id = b.entryFk - LEFT JOIN vn.supplier s ON s.id = e2.supplierFk - LEFT JOIN vn.entry e ON e.id = vSelf - LEFT JOIN vn.travel tr ON tr.id = e.travelFk - LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk - LEFT JOIN vn.buy b2 ON b2.itemFk = i.id - AND b2.entryFk = vSelf - LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk - LEFT JOIN tmp.rate r ON TRUE - LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id - LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk - WHERE ic.display - AND NOT e.isRaid - AND (ti.visible != 0 OR ti.available != 0) - ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; - - CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); - - SET @carriage := 0; - SET @comission := 0; - SET @packaging := 0; - SET @rate3 := 0; - SET @cost := 0; - SELECT *, - quantity - MOD(quantity , `grouping`) subQuantity, - MOD(quantity, `grouping`) soll, - ROUND((IF(volume > 0,volume, width * `depth` * IF(height = 0, `size` + 10, height))) / packing, 0) cm3, - buyingValue + comissionValue + freightValue Cost, - @carriage := ROUND((IF(volume > 0, volume, width * `depth` * IF(height = 0, `size` + 10, height))) * m3 / 1000000 / Packing, 3) carriage, - @comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, - ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) / packing, 3) packaging, - @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + - IFNULL(@packaging, 0) + - IFNULL(@carriage, 0) + - IFNULL(@comission, 0) cost, - @rate3 := ROUND(@cost / ( (100 - rate3 - promo) / 100), 2) rate3, - ROUND(@rate3 * (1 + ((rate2 - rate3)/100)), 2) rate2, - FALSE selected - FROM tTransfer; - - DROP TEMPORARY TABLE IF EXISTS - tTransfer, - tItem, - tBuy, - tmp.buyUltimateFromInterval, - tmp.rate, - tmp.itemList; + SELECT 1; END$$ DELIMITER ; From 18c10e2dd750d9314de6bcf1a11866446868f4b9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Feb 2024 11:39:15 +0100 Subject: [PATCH 105/116] refactor: refs #6778 Requested changes --- .../bi/procedures/Greuge_Evolution_Add.sql | 2 +- .../bs/procedures/comercialesCompleto.sql | 4 +-- .../bs/procedures/ventas_contables_add.sql | 6 ++-- .../ventas_contables_por_cliente.sql | 6 ++-- db/routines/bs/procedures/vivosMuertos.sql | 28 +++++++++---------- .../vn2008/procedures/CalculoRemesas.sql | 10 +++---- .../procedures/customerDebtEvolution.sql | 8 +++--- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/db/routines/bi/procedures/Greuge_Evolution_Add.sql b/db/routines/bi/procedures/Greuge_Evolution_Add.sql index b29be6b49..1d4bf4355 100644 --- a/db/routines/bi/procedures/Greuge_Evolution_Add.sql +++ b/db/routines/bi/procedures/Greuge_Evolution_Add.sql @@ -54,7 +54,7 @@ BEGIN SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 FROM ( SELECT clientFk Id_Cliente, sum(amount) as Greuge - FROM vn2.greuge + FROM vn.greuge where shipped <= datFEC group by clientFk ) sub diff --git a/db/routines/bs/procedures/comercialesCompleto.sql b/db/routines/bs/procedures/comercialesCompleto.sql index b0c33e7f0..311b5fe2a 100644 --- a/db/routines/bs/procedures/comercialesCompleto.sql +++ b/db/routines/bs/procedures/comercialesCompleto.sql @@ -99,8 +99,8 @@ BEGIN LEFT JOIN (SELECT c.Id_Cliente, IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto - FROM vn.invoiceOut f - JOIN vn2008.Clientes c ON c.Id_cliente = f.clientFk + FROM vn.invoiceOut io + JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index 6cca2ff7f..9988c8b29 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -23,9 +23,9 @@ BEGIN ENGINE = MEMORY SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn.invoiceOut f ON f.id = t.Factura - WHERE year(f.issued) = vYear - AND month(f.issued) = vMonth; + JOIN vn.invoiceOut io ON io.id = t.Factura + WHERE year(io.issued) = vYear + AND month(io.issued) = vMonth; INSERT INTO bs.ventas_contables(year , month diff --git a/db/routines/bs/procedures/ventas_contables_por_cliente.sql b/db/routines/bs/procedures/ventas_contables_por_cliente.sql index b5b7a39d5..931653e6e 100644 --- a/db/routines/bs/procedures/ventas_contables_por_cliente.sql +++ b/db/routines/bs/procedures/ventas_contables_por_cliente.sql @@ -13,9 +13,9 @@ BEGIN (PRIMARY KEY (Id_Ticket)) SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn.invoiceOut f ON f.id = t.Factura - WHERE year(f.issued) = vYear - AND month(f.issued) = vMonth; + JOIN vn.invoiceOut io ON io.id = t.Factura + WHERE year(io.issued) = vYear + AND month(io.issued) = vMonth; SELECT vYear Año, vMonth Mes, diff --git a/db/routines/bs/procedures/vivosMuertos.sql b/db/routines/bs/procedures/vivosMuertos.sql index 9cd0e3605..c07570603 100644 --- a/db/routines/bs/procedures/vivosMuertos.sql +++ b/db/routines/bs/procedures/vivosMuertos.sql @@ -24,20 +24,20 @@ BEGIN WHERE date BETWEEN @datSTART AND @datEND ) tm LEFT JOIN - (SELECT DISTINCT tm.yearMonth, f.clientFk Id_Cliente , 1 as Compra - FROM vn.invoiceOut f - JOIN vn2008.time tm ON tm.date = f.issued - WHERE Fecha BETWEEN @datSTART + (SELECT DISTINCT tm.yearMonth, io.clientFk Id_Cliente , 1 as Compra + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; UPDATE tmp.VivosMuertos vm JOIN - (SELECT MIN(tm.yearMonth) firstMonth, f.clientFk Id_Cliente - FROM vn.invoiceOut f - JOIN vn2008.time tm ON tm.date = f.issued - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.clientFk) fm ON fm.firstMonth = vm.yearMonth + (SELECT MIN(tm.yearMonth) firstMonth, io.clientFk Id_Cliente + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND + GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Nuevo = 1; @@ -46,11 +46,11 @@ BEGIN UPDATE tmp.VivosMuertos vm JOIN ( - SELECT MAX(tm.yearMonth) firstMonth, f.clientFk Id_Cliente - FROM vn.invoiceOut f - JOIN vn2008.time tm ON tm.date = f.issued - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.clientFk) fm ON fm.firstMonth = vm.yearMonth + SELECT MAX(tm.yearMonth) firstMonth, io.clientFk Id_Cliente + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND + GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Muerto = 1 diff --git a/db/routines/vn2008/procedures/CalculoRemesas.sql b/db/routines/vn2008/procedures/CalculoRemesas.sql index e7d1ae22c..3819130ee 100644 --- a/db/routines/vn2008/procedures/CalculoRemesas.sql +++ b/db/routines/vn2008/procedures/CalculoRemesas.sql @@ -47,13 +47,13 @@ BEGIN UNION ALL - SELECT d.companyFk, f.clientFk Id_Cliente, - f.amount - FROM vn.invoiceOut f - JOIN Clientes c ON c.Id_Cliente = f.clientFk + SELECT d.companyFk, io.clientFk Id_Cliente, - io.amount + FROM vn.invoiceOut io + JOIN Clientes c ON c.Id_Cliente = io.clientFk JOIN pay_met pm on pm.id = pay_met_id - WHERE f.dued > vFechaRemesa + WHERE io.dued > vFechaRemesa AND pay_met_id = 4 AND pm.deudaviva - AND f.amount > 0 + AND io.amount > 0 ) risk ON c.Id_Cliente = risk.clientFk GROUP BY risk.companyFk, Id_Cliente diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql index 20ed75d8f..df857462c 100644 --- a/db/routines/vn2008/procedures/customerDebtEvolution.sql +++ b/db/routines/vn2008/procedures/customerDebtEvolution.sql @@ -18,10 +18,10 @@ SELECT * FROM WHERE Id_Cliente = vCustomer AND Fechacobro >= '2017-01-01' UNION ALL - SELECT vn.getDueDate(f.issued,c.Vencimiento), - Importe - FROM vn.invoiceOut f - JOIN Clientes c ON f.clientFk = c.Id_Cliente - WHERE f.clientFk = vCustomer + SELECT vn.getDueDate(io.issued,c.Vencimiento), - Importe + FROM vn.invoiceOut io + JOIN Clientes c ON io.clientFk = c.Id_Cliente + WHERE io.clientFk = vCustomer AND Fecha >= '2017-01-01' UNION ALL SELECT '2016-12-31', Debt From 35fc8930ced1eafc188e745229d253c92b146bf8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Feb 2024 12:12:40 +0100 Subject: [PATCH 106/116] fix: refs #6778 Fix and tested --- db/routines/bi/procedures/claim_ratio_routine.sql | 2 +- db/routines/bs/procedures/comercialesCompleto.sql | 2 +- db/routines/vn/functions/isPalletHomogeneus.sql | 2 +- db/routines/vn/procedures/getDayExpeditions.sql | 6 +++--- db/routines/vn/procedures/itemShelvingRadar.sql | 4 ++-- db/routines/vn2008/procedures/CalculoRemesas.sql | 2 +- db/routines/vn2008/procedures/ListaTicketsEncajados.sql | 6 +++--- db/routines/vn2008/procedures/availableTraslate.sql | 2 +- db/routines/vn2008/procedures/customerDebtEvolution.sql | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index 55489b99a..10cb717cf 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -75,7 +75,7 @@ BEGIN DELETE g.* FROM vn.greuge g JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket - WHERE t.greugeTypeFk = 2; + WHERE g.greugeTypeFk = 2; INSERT INTO vn.greuge(clientFk, description, amount,shipped, greugeTypeFk, ticketFk) diff --git a/db/routines/bs/procedures/comercialesCompleto.sql b/db/routines/bs/procedures/comercialesCompleto.sql index 311b5fe2a..101173740 100644 --- a/db/routines/bs/procedures/comercialesCompleto.sql +++ b/db/routines/bs/procedures/comercialesCompleto.sql @@ -98,7 +98,7 @@ BEGIN GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente LEFT JOIN (SELECT c.Id_Cliente, - IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto + IF(MAX(io.issued) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto FROM vn.invoiceOut io JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador diff --git a/db/routines/vn/functions/isPalletHomogeneus.sql b/db/routines/vn/functions/isPalletHomogeneus.sql index d308e8ed3..b38fdcc5e 100644 --- a/db/routines/vn/functions/isPalletHomogeneus.sql +++ b/db/routines/vn/functions/isPalletHomogeneus.sql @@ -16,7 +16,7 @@ BEGIN FROM ( SELECT DISTINCT t.Id_Ruta FROM vn2008.scan_line sl - JOIN expeditions e ON e.id = sl.code + JOIN expedition e ON e.id = sl.code JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk WHERE sl.scan_id = vScanId AND t.Id_Ruta diff --git a/db/routines/vn/procedures/getDayExpeditions.sql b/db/routines/vn/procedures/getDayExpeditions.sql index 535dfde4a..b708c8b0e 100644 --- a/db/routines/vn/procedures/getDayExpeditions.sql +++ b/db/routines/vn/procedures/getDayExpeditions.sql @@ -7,9 +7,9 @@ BEGIN date_format(e.created,'%Y-%m-%d') as expeditionDate, e.ticketFk, t.routeFk as routeFk - FROM expeditions e - INNER JOIN vn.ticket t ON t.id = e.ticketFk - WHERE DATE(odbc_date) = util.VN_CURDATE(); + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + WHERE DATE(e.created) = util.VN_CURDATE(); END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql index 624451677..c89a190ae 100644 --- a/db/routines/vn/procedures/itemShelvingRadar.sql +++ b/db/routines/vn/procedures/itemShelvingRadar.sql @@ -143,8 +143,8 @@ proc:BEGIN CREATE TEMPORARY TABLE tmp.itemOutTime SELECT *,SUM(amount) quantity FROM - (SELECT item_id itemFk, - amount, + (SELECT io.itemFk, + io.quantity amount, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes FROM itemTicketOut io diff --git a/db/routines/vn2008/procedures/CalculoRemesas.sql b/db/routines/vn2008/procedures/CalculoRemesas.sql index 3819130ee..a4c191a80 100644 --- a/db/routines/vn2008/procedures/CalculoRemesas.sql +++ b/db/routines/vn2008/procedures/CalculoRemesas.sql @@ -47,7 +47,7 @@ BEGIN UNION ALL - SELECT d.companyFk, io.clientFk Id_Cliente, - io.amount + SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount FROM vn.invoiceOut io JOIN Clientes c ON c.Id_Cliente = io.clientFk JOIN pay_met pm on pm.id = pay_met_id diff --git a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql index e0b48bc5e..ce99916ee 100644 --- a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql +++ b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql @@ -13,9 +13,9 @@ SELECT Agencia, FROM Tickets ti INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia - LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.ticketFk - LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.ticketFk - LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE packagingFk=94 GROUP BY ticketFk) sub1 ON ti.Id_Ticket=sub1.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE packagingFk IS NULL GROUP BY ticketFk) sub2 ON ti.Id_Ticket=sub2.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE packagingFk >0 GROUP BY ticketFk) sub3 ON ti.Id_Ticket=sub3.ticketFk INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk WHERE ti.Fecha=util.VN_CURDATE() AND ts.userFk=intId_Trabajador diff --git a/db/routines/vn2008/procedures/availableTraslate.sql b/db/routines/vn2008/procedures/availableTraslate.sql index 4ac5e3209..a3d2c8bea 100644 --- a/db/routines/vn2008/procedures/availableTraslate.sql +++ b/db/routines/vn2008/procedures/availableTraslate.sql @@ -69,7 +69,7 @@ proc: BEGIN ENGINE = MEMORY SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity FROM vn.itemTicketOut i - JOIN itemRangeLive ir ON ir.itemFK = i.item_id + JOIN itemRangeLive ir ON ir.itemFK = i.itemFk WHERE i.shipped >= vDatedFrom AND (ir.dated IS NULL OR i.shipped <= ir.dated) AND i.warehouseFk = vWarehouseLanding diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql index df857462c..b9763b985 100644 --- a/db/routines/vn2008/procedures/customerDebtEvolution.sql +++ b/db/routines/vn2008/procedures/customerDebtEvolution.sql @@ -18,11 +18,11 @@ SELECT * FROM WHERE Id_Cliente = vCustomer AND Fechacobro >= '2017-01-01' UNION ALL - SELECT vn.getDueDate(io.issued,c.Vencimiento), - Importe + SELECT vn.getDueDate(io.issued,c.Vencimiento), - io.amount FROM vn.invoiceOut io JOIN Clientes c ON io.clientFk = c.Id_Cliente WHERE io.clientFk = vCustomer - AND Fecha >= '2017-01-01' + AND io.issued >= '2017-01-01' UNION ALL SELECT '2016-12-31', Debt FROM bi.customerDebtInventory From 88f508a424e9c7d39217f6fbe9b502e14c173a9c Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 14 Feb 2024 14:42:04 +0100 Subject: [PATCH 107/116] fix: refs #6371 balanceNestTree add constraint --- db/versions/10835-brownCarnation/28-balance_nest_tree.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/versions/10835-brownCarnation/28-balance_nest_tree.sql b/db/versions/10835-brownCarnation/28-balance_nest_tree.sql index 043bde2e4..6a3fd1edd 100644 --- a/db/versions/10835-brownCarnation/28-balance_nest_tree.sql +++ b/db/versions/10835-brownCarnation/28-balance_nest_tree.sql @@ -6,9 +6,11 @@ CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) DEFAULT NULL; ALTER TABLE vn.balanceNestTree MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL; -UPDATE vn.balanceNestTree - SET expenseFk = NULL - WHERE expenseFk =''; +UPDATE vn.balanceNestTree b + LEFT JOIN vn.expense e ON e.id = b.expenseFk COLLATE utf8mb3_general_ci + SET b.expenseFk = NULL + WHERE b.expenseFk ='' + OR (e.id IS NULL AND b.expenseFk IS NOT NULL); ALTER TABLE IF EXISTS vn.balanceNestTree ADD CONSTRAINT balanceNestTree_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; From 3ff3c812ed2cd5ee4ec02b7f98d7cf49a09cd8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Segarra=20Mart=C3=ADnez?= Date: Wed, 14 Feb 2024 20:15:34 +0100 Subject: [PATCH 108/116] refs #2687 fix: remove bad changes file --- modules/route/front/create/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/route/front/create/index.html b/modules/route/front/create/index.html index b76878f2e..de341220e 100644 --- a/modules/route/front/create/index.html +++ b/modules/route/front/create/index.html @@ -22,7 +22,6 @@ label="Vehicle" ng-model="$ctrl.route.vehicleFk" url="Vehicles" - where="{warehouseFk: $ctrl.vnConfig.warehouseFk}" show-field="numberPlate"> Date: Thu, 15 Feb 2024 07:49:57 +0100 Subject: [PATCH 109/116] refs #2687 feat: comments --- db/routines/util/procedures/tx_commit.sql | 8 ++++---- db/routines/util/procedures/tx_rollback.sql | 8 ++++---- db/routines/util/procedures/tx_start.sql | 10 ++++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/db/routines/util/procedures/tx_commit.sql b/db/routines/util/procedures/tx_commit.sql index 121c3803b..fdf2f3ddb 100644 --- a/db/routines/util/procedures/tx_commit.sql +++ b/db/routines/util/procedures/tx_commit.sql @@ -1,12 +1,12 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(IN tx BOOL) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_commit`(isTx BOOL) BEGIN /** - * Procedimiento para confirmar los cambios asociados a una transacción + * Confirma los cambios asociados a una transacción. * - * @param tx BOOL es true si existe transacción asociada + * @param isTx es true si existe transacción asociada */ - IF tx THEN + IF isTx THEN COMMIT; END IF; END$$ diff --git a/db/routines/util/procedures/tx_rollback.sql b/db/routines/util/procedures/tx_rollback.sql index b9e7224e1..96571af2c 100644 --- a/db/routines/util/procedures/tx_rollback.sql +++ b/db/routines/util/procedures/tx_rollback.sql @@ -1,12 +1,12 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(tx BOOL) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_rollback`(isTx BOOL) BEGIN /** - * Procedimiento para deshacer los cambios asociados a una transacción + * Deshace los cambios asociados a una transacción. * - * @param tx BOOL es true si existe transacción asociada + * @param isTx es true si existe transacción asociada */ - IF tx THEN + IF isTx THEN ROLLBACK; END IF; END$$ diff --git a/db/routines/util/procedures/tx_start.sql b/db/routines/util/procedures/tx_start.sql index 3cce946fa..9d9f16bb7 100644 --- a/db/routines/util/procedures/tx_start.sql +++ b/db/routines/util/procedures/tx_start.sql @@ -1,14 +1,12 @@ - - DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(tx BOOL) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`tx_start`(isTx BOOL) BEGIN /** - * Procedimiento para iniciar una transacción + * Inicia una transacción. * - * @param tx BOOL es true si existe transacción asociada + * @param isTx es true si existe transacción asociada */ - IF tx THEN + IF isTx THEN START TRANSACTION; END IF; END$$ From 2703d50cbf1fbd67d3bcafd63d242cbdb94c28d6 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Feb 2024 09:39:02 +0100 Subject: [PATCH 110/116] refs #6859 fix(account): changePassword name --- modules/account/front/descriptor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account/front/descriptor/index.js b/modules/account/front/descriptor/index.js index 18d93b924..de41d619d 100644 --- a/modules/account/front/descriptor/index.js +++ b/modules/account/front/descriptor/index.js @@ -71,7 +71,7 @@ class Controller extends Descriptor { const params = {newPassword: this.newPassword}; if (this.askOldPass) { - method = 'changePassword'; + method = 'change-password'; params.oldPassword = this.oldPassword; } else method = 'setPassword'; From 6685a201143a320920bbe04db7f8d0d1bd32d415 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Feb 2024 10:04:15 +0100 Subject: [PATCH 111/116] build: refs #6859 myt pull db --- db/.pullinfo.json | 4 + .../bi/procedures/analisis_ventas_update.sql | 8 +- .../vn/functions/hasAnyNegativeBase.sql | 31 +-- .../vn/functions/hasAnyPositiveBase.sql | 30 ++ db/routines/vn/procedures/clean.sql | 8 +- .../vn/procedures/collection_assign.sql | 8 +- .../vn/procedures/duaInvoiceInBooking.sql | 78 +++--- db/routines/vn/procedures/getTaxBases.sql | 32 +++ db/routines/vn/procedures/inventoryMake.sql | 258 +++++++++--------- .../vn/procedures/inventoryMakeLauncher.sql | 9 +- .../vn/procedures/invoiceInTaxMakeByDua.sql | 39 +-- .../vn/procedures/invoiceInTax_getFromDua.sql | 33 ++- .../invoiceInTax_getFromEntries.sql | 17 +- .../vn/procedures/itemProposal_Add.sql | 2 +- .../itemShelving_selfConsumption.sql | 11 +- db/routines/vn/procedures/test.sql | 6 - .../vn/procedures/ticket_getMovable.sql | 59 ++-- .../vn/triggers/calendar_afterDelete.sql | 12 +- .../vn/triggers/calendar_beforeInsert.sql | 2 +- .../vn/triggers/calendar_beforeUpdate.sql | 12 +- ...reInser.sql => saleGroup_beforeInsert.sql} | 0 .../workerTimeControl_afterDelete.sql | 12 +- .../workerTimeControl_beforeInsert.sql | 12 +- .../workerTimeControl_beforeUpdate.sql | 12 +- db/routines/vn/views/awbVolume.sql | 2 +- .../vn/views/expeditionPallet_Print.sql | 2 +- .../vn/views/itemShelvingAvailable.sql | 2 +- db/routines/vn/views/ticketStateToday.sql | 11 +- .../vn/views/zoneEstimatedDelivery.sql | 67 +++-- .../vn2008/procedures/recobro_credito.sql | 2 +- db/routines/vn2008/views/v_xsubcuentas.sql | 28 +- 31 files changed, 464 insertions(+), 345 deletions(-) create mode 100644 db/.pullinfo.json create mode 100644 db/routines/vn/functions/hasAnyPositiveBase.sql create mode 100644 db/routines/vn/procedures/getTaxBases.sql delete mode 100644 db/routines/vn/procedures/test.sql rename db/routines/vn/triggers/{saleGroup_beforeInser.sql => saleGroup_beforeInsert.sql} (100%) diff --git a/db/.pullinfo.json b/db/.pullinfo.json new file mode 100644 index 000000000..20a294f1f --- /dev/null +++ b/db/.pullinfo.json @@ -0,0 +1,4 @@ +{ + "lastPull": "2024-02-15T08:58:24.000Z", + "shaSums": {} +} \ No newline at end of file diff --git a/db/routines/bi/procedures/analisis_ventas_update.sql b/db/routines/bi/procedures/analisis_ventas_update.sql index 04f9b6483..383d102b5 100644 --- a/db/routines/bi/procedures/analisis_ventas_update.sql +++ b/db/routines/bi/procedures/analisis_ventas_update.sql @@ -1,5 +1,5 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`() +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`analisis_ventas_update`() BEGIN DECLARE vLastMonth DATE; @@ -49,5 +49,5 @@ BEGIN LEFT JOIN vn2008.province p ON p.province_id = cs.province_id LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id WHERE bt.fecha >= vLastMonth AND r.mercancia; -END$$ -DELIMITER ; +END$$ +DELIMITER ; diff --git a/db/routines/vn/functions/hasAnyNegativeBase.sql b/db/routines/vn/functions/hasAnyNegativeBase.sql index 3b96a3d22..97d1e7328 100644 --- a/db/routines/vn/functions/hasAnyNegativeBase.sql +++ b/db/routines/vn/functions/hasAnyNegativeBase.sql @@ -4,32 +4,25 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`( DETERMINISTIC BEGIN -/* Calcula si existe alguna base imponible negativa -* Requiere la tabla temporal tmp.ticketToInvoice(id) +/** +* Calcula si existe alguna base imponible negativa +* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases() * * returns BOOLEAN */ + DECLARE hasAnyNegativeBase BOOLEAN; - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (KEY (ticketFk)) - ENGINE = MEMORY - SELECT id ticketFk - FROM tmp.ticketToInvoice; + CALL getTaxBases(); - CALL ticket_getTax(NULL); + SELECT negative INTO hasAnyNegativeBase + FROM tmp.taxBases + LIMIT 1; - SELECT COUNT(*) INTO hasAnyNegativeBase - FROM( - SELECT SUM(taxableBase) as taxableBase - FROM tmp.ticketTax - GROUP BY pgcFk - HAVING taxableBase < 0 - ) t; - - DROP TEMPORARY TABLE tmp.ticketTax; - DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE + tmp.ticketTax, + tmp.ticket, + tmp.taxBases; RETURN hasAnyNegativeBase; diff --git a/db/routines/vn/functions/hasAnyPositiveBase.sql b/db/routines/vn/functions/hasAnyPositiveBase.sql new file mode 100644 index 000000000..7222c3b2a --- /dev/null +++ b/db/routines/vn/functions/hasAnyPositiveBase.sql @@ -0,0 +1,30 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyPositiveBase`() + RETURNS tinyint(1) + DETERMINISTIC +BEGIN + +/** +* Calcula si existe alguna base imponible positiva +* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases() +* +* returns BOOLEAN +*/ + + DECLARE hasAnyPositiveBase BOOLEAN; + + CALL getTaxBases(); + + SELECT positive INTO hasAnyPositiveBase + FROM tmp.taxBases + LIMIT 1; + + DROP TEMPORARY TABLE + tmp.ticketTax, + tmp.ticket, + tmp.taxBases; + + RETURN hasAnyPositiveBase; + +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 1734bea98..57df1b707 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -9,6 +9,7 @@ BEGIN DECLARE v26Month DATE; DECLARE v3Month DATE; DECLARE vTrashId VARCHAR(15); + DECLARE v2Years DATE; DECLARE v5Years DATE; SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH; @@ -18,6 +19,7 @@ BEGIN SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH; SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH; SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH; + SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR; SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; DELETE FROM ticketParking WHERE created < vDateShort; @@ -162,7 +164,11 @@ BEGIN FROM tmp.duaToDelete tmp JOIN vn.dua d ON d.id = tmp.id; - DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + DELETE a + FROM vn.awb a + LEFT JOIN vn.travel t ON t.awbFk = a.id + WHERE a.created < v2Years + AND t.id IS NULL; -- Borra los registros de collection y ticketcollection DELETE FROM vn.collection WHERE created < vDateShort; diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index 0918bf1da..6d31fbc8f 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -1,8 +1,8 @@ -DELIMITER $$ +DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`( vUserFk INT, OUT vCollectionFk INT -) +) proc:BEGIN /** * Comprueba si existen colecciones libres que se ajustan @@ -84,5 +84,5 @@ proc:BEGIN WHERE id = vCollectionFk; DO RELEASE_LOCK('collection_assign'); -END$$ -DELIMITER ; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql index 9e794f0ed..dd5ab8fd2 100644 --- a/db/routines/vn/procedures/duaInvoiceInBooking.sql +++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql @@ -1,70 +1,74 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`duaInvoiceInBooking`(vDuaFk INT) BEGIN - +/** + * Genera el asiento de un DUA y marca las entradas como confirmadas + * + * @param vDuaFk Id del dua a recalcular + */ DECLARE done BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; - DECLARE vASIEN BIGINT DEFAULT 0; - DECLARE vCounter INT DEFAULT 0; - + DECLARE vASIEN BIGINT DEFAULT 0; + DECLARE vCounter INT DEFAULT 0; + DECLARE rs CURSOR FOR - SELECT e.invoiceInFk + SELECT DISTINCT e.invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE de.duaFk = vDuaFk + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE de.duaFk = vDuaFk AND de.customsValue AND ii.isBooked = FALSE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id - JOIN duaEntry de ON de.entryFk = e.id - JOIN dua d ON d.id = de.duaFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk SET ii.isBooked = TRUE, ii.booked = IFNULL(ii.booked,d.booked), ii.operated = IFNULL(ii.operated,d.operated), - ii.issued = IFNULL(ii.issued,d.issued), - ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), - e.isConfirmed = TRUE + ii.issued = IFNULL(ii.issued,d.issued), + ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isConfirmed = TRUE WHERE d.id = vDuaFk; - - SELECT IFNULL(ASIEN,0) INTO vASIEN + + SELECT IFNULL(ASIEN,0) INTO vASIEN FROM dua WHERE id = vDuaFk; - + FETCH rs INTO vInvoiceFk; - + WHILE NOT done DO CALL invoiceIn_booking(vInvoiceFk); - - IF vCounter > 0 OR vASIEN > 0 THEN - + + IF vCounter > 0 OR vASIEN > 0 THEN + UPDATE vn2008.XDiario x - JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN - SET x.ASIEN = vASIEN; - - ELSE - - SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig; - + JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN + SET x.ASIEN = vASIEN; + + ELSE + + SELECT lastBookEntry INTO vASIEN FROM ledgerConfig; + END IF; - - SET vCounter = vCounter + 1; - + + SET vCounter = vCounter + 1; + FETCH rs INTO vInvoiceFk; END WHILE; - - CLOSE rs; - - UPDATE dua - SET ASIEN = vASIEN - WHERE id = vDuaFk; - + + CLOSE rs; + + UPDATE dua + SET ASIEN = vASIEN + WHERE id = vDuaFk; + END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/getTaxBases.sql b/db/routines/vn/procedures/getTaxBases.sql new file mode 100644 index 000000000..54932aa4f --- /dev/null +++ b/db/routines/vn/procedures/getTaxBases.sql @@ -0,0 +1,32 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getTaxBases`() +BEGIN +/** +* Calcula y devuelve en número de bases imponibles postivas y negativas +* Requiere la tabla temporal tmp.ticketToInvoice(id) +* +* returns tmp.taxBases +*/ + + CREATE OR REPLACE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM tmp.ticketToInvoice; + + CALL ticket_getTax(NULL); + + DROP TEMPORARY TABLE IF EXISTS tmp.taxBases; + CREATE TEMPORARY TABLE tmp.taxBases + ENGINE = MEMORY + SELECT + SUM(taxableBase > 0) as positive, + SUM(taxableBase < 0) as negative + FROM( + SELECT SUM(taxableBase) taxableBase + FROM tmp.ticketTax + GROUP BY pgcFk + ) t; + +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/inventoryMake.sql b/db/routines/vn/procedures/inventoryMake.sql index 0def763dc..ed6a7fa43 100644 --- a/db/routines/vn/procedures/inventoryMake.sql +++ b/db/routines/vn/procedures/inventoryMake.sql @@ -1,182 +1,175 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMake`(vDate DATE, vWh INT) -proc: BEGIN +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMake`(vInventoryDate DATE) +BEGIN /** -* Recalcula los inventarios de todos los almacenes, si vWh = 0 +* Recalculate the inventories * -* @param vDate Fecha de los nuevos inventarios -* @param vWh almacen al cual hacer el inventario +* @param vInventoryDate date for the new inventory */ - DECLARE vDone BOOL; DECLARE vEntryFk INT; DECLARE vTravelFk INT; DECLARE vDateLastInventory DATE; - DECLARE vDateYesterday DATETIME DEFAULT vDate - INTERVAL 1 SECOND; + DECLARE vDateYesterday DATETIME DEFAULT vInventoryDate - INTERVAL 1 SECOND; DECLARE vWarehouseOutFkInventory INT; DECLARE vInventorySupplierFk INT; DECLARE vAgencyModeFkInventory INT; + DECLARE vMaxRecentInventories INT; + DECLARE vWarehouseFk INT; DECLARE cWarehouses CURSOR FOR SELECT id FROM warehouse - WHERE isInventory - AND vWh IN (0,id); + WHERE isInventory; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + SELECT inventorySupplierFk INTO vInventorySupplierFk FROM entryConfig LIMIT 1; + SELECT inventoried INTO vDateLastInventory FROM config LIMIT 1; + SELECT maxRecentInventories, + warehouseOutFk, + agencyModeFk + INTO vMaxRecentInventories, + vWarehouseOutFkInventory, + vAgencyModeFkInventory + FROM inventoryConfig + LIMIT 1; + + IF vDateLastInventory IS NULL + OR vInventorySupplierFk IS NULL + OR vMaxRecentInventories IS NULL + OR vInventoryDate IS NULL + OR vWarehouseOutFkInventory IS NULL + OR vAgencyModeFkInventory IS NULL THEN + CALL util.throw('Some config parameters are not set'); + END IF; + + START TRANSACTION; + OPEN cWarehouses; + -- Environment variable to disable the triggers of the affected tables SET @isModeInventory := TRUE; l: LOOP - SET vDone = FALSE; - FETCH cWarehouses INTO vWh; + SET vEntryFk = NULL; + SET vTravelFk = NULL; + + FETCH cWarehouses INTO vWarehouseFk; IF vDone THEN LEAVE l; END IF; - SELECT w.id INTO vWarehouseOutFkInventory - FROM warehouse w - WHERE w.code = 'inv'; - - SELECT inventorySupplierFk INTO vInventorySupplierFk - FROM entryConfig; - - SELECT am.id INTO vAgencyModeFkInventory - FROM agencyMode am - where code = 'inv'; - - SELECT MAX(landed) INTO vDateLastInventory - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - JOIN buy b ON b.entryFk = e.id - WHERE warehouseOutFk = vWarehouseOutFkInventory - AND landed < vDate - AND e.supplierFk = vInventorySupplierFk - AND warehouseInFk = vWh - AND NOT isRaid; - - IF vDateLastInventory IS NULL THEN - SELECT inventoried INTO vDateLastInventory FROM config; - END IF; - - -- Generamos travel, si no existe. - SET vTravelFK = 0; - + -- Generate travel, if it does not exist SELECT id INTO vTravelFk FROM travel WHERE warehouseOutFk = vWarehouseOutFkInventory - AND warehouseInFk = vWh - AND landed = vDate + AND warehouseInFk = vWarehouseFk + AND landed = vInventoryDate AND agencyModeFk = vAgencyModeFkInventory AND ref = 'inventario' LIMIT 1; - IF NOT vTravelFK THEN - - INSERT INTO travel SET - warehouseOutFk = vWarehouseOutFkInventory, - warehouseInFk = vWh, - shipped = vDate, - landed = vDate, - agencyModeFk = vAgencyModeFkInventory, - ref = 'inventario', - isDelivered = TRUE, - isReceived = TRUE; + IF vTravelFk IS NULL THEN + INSERT INTO travel + SET warehouseOutFk = vWarehouseOutFkInventory, + warehouseInFk = vWarehouseFk, + shipped = vInventoryDate, + landed = vInventoryDate, + agencyModeFk = vAgencyModeFkInventory, + ref = 'inventario', + isDelivered = TRUE, + isReceived = TRUE; SELECT LAST_INSERT_ID() INTO vTravelFk; - END IF; - -- Generamos entrada si no existe, o la vaciamos. - SET vEntryFk = 0; - + -- Generate an entry if it does not exist, or we empty it SELECT id INTO vEntryFk FROM entry WHERE supplierFk = vInventorySupplierFk AND travelFk = vTravelFk; - IF NOT vEntryFk THEN - - INSERT INTO entry SET - supplierFk = vInventorySupplierFk, - isConfirmed = TRUE, - isOrdered = TRUE, - travelFk = vTravelFk; + IF vEntryFk IS NULL THEN + INSERT INTO entry + SET supplierFk = vInventorySupplierFk, + isConfirmed = TRUE, + isOrdered = TRUE, + travelFk = vTravelFk; SELECT LAST_INSERT_ID() INTO vEntryFk; - ELSE - DELETE FROM buy WHERE entryFk = vEntryFk; - END IF; - -- Preparamos tabla auxilar - CREATE OR REPLACE TEMPORARY TABLE tmp.inventory ( - itemFk INT(11) NOT NULL PRIMARY KEY, - quantity int(11) DEFAULT '0', - buyingValue decimal(10,4) DEFAULT '0.0000', - freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - groupingMode tinyint(4) NOT NULL DEFAULT 0 , - comissionValue decimal(10,3) DEFAULT '0.000', - packageValue decimal(10,3) DEFAULT '0.000', - packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - price1 decimal(10,2) DEFAULT '0.00', - price2 decimal(10,2) DEFAULT '0.00', - price3 decimal(10,2) DEFAULT '0.00', - minPrice decimal(10,2) DEFAULT '0.00', - producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - INDEX (itemFK)) ENGINE = MEMORY; + -- Prepare the auxiliary table + CREATE OR REPLACE TEMPORARY TABLE tInventory ( + itemFk INT(11) NOT NULL PRIMARY KEY, + quantity int(11) DEFAULT '0', + buyingValue decimal(10,4) DEFAULT '0.0000', + freightValue decimal(10,3) DEFAULT '0.000', + packing int(11) DEFAULT '0', + `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', + groupingMode tinyint(4) NOT NULL DEFAULT 0 , + comissionValue decimal(10,3) DEFAULT '0.000', + packageValue decimal(10,3) DEFAULT '0.000', + packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + price1 decimal(10,2) DEFAULT '0.00', + price2 decimal(10,2) DEFAULT '0.00', + price3 decimal(10,2) DEFAULT '0.00', + minPrice decimal(10,2) DEFAULT '0.00', + producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + INDEX (itemFK) + ) ENGINE = MEMORY; - -- Compras - INSERT INTO tmp.inventory(itemFk,quantity) + -- Buys + INSERT INTO tInventory(itemFk, quantity) SELECT b.itemFk, SUM(b.quantity) FROM buy b JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseInFk = vWh - AND tr.landed BETWEEN vDateLastInventory - AND vDateYesterday + WHERE tr.warehouseInFk = vWarehouseFk + AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk; - SELECT vDateLastInventory , vDateYesterday; - -- Traslados - INSERT INTO tmp.inventory(itemFk, quantity) + -- Transfers + INSERT INTO tInventory(itemFk, quantity) SELECT itemFk, quantityOut - FROM ( + FROM ( SELECT b.itemFk,- SUM(b.quantity) quantityOut FROM buy b JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseOutFk = vWh - AND tr.shipped BETWEEN vDateLastInventory - AND vDateYesterday + WHERE tr.warehouseOutFk = vWarehouseFk + AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut; - -- Ventas - INSERT INTO tmp.inventory(itemFk,quantity) + -- Sales + INSERT INTO tInventory(itemFk, quantity) SELECT itemFk, saleOut - FROM ( + FROM ( SELECT s.itemFk, - SUM(s.quantity) saleOut FROM sale s JOIN ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWh + WHERE t.warehouseFk = vWarehouseFk AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday GROUP BY s.itemFk ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; - -- Actualiza valores de la ultima compra - UPDATE tmp.inventory inv - JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh + -- Update values of the last purchase + UPDATE tInventory inv + JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWarehouseFk JOIN buy b ON b.id = lb.buy_id JOIN item i ON i.id = b.itemFk LEFT JOIN producer p ON p.id = i.producerFk @@ -194,7 +187,7 @@ proc: BEGIN inv.minPrice = b.minPrice, inv.producer = p.name; - INSERT INTO buy( itemFk, + INSERT INTO buy(itemFk, quantity, buyingValue, freightValue, @@ -224,42 +217,53 @@ proc: BEGIN price3, minPrice, vEntryFk - FROM tmp.inventory; + FROM tInventory; - SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory; - - -- Actualizamos el campo lastUsed de item - UPDATE item i - JOIN tmp.inventory i2 ON i2.itemFk = i.id - SET i.lastUsed = NOW() - WHERE i2.quantity; - - -- DROP TEMPORARY TABLE tmp.inventory; + -- Update the 'lastUsed' field of the item + UPDATE item i + JOIN tInventory i2 ON i2.itemFk = i.id + SET i.lastUsed = NOW() + WHERE i2.quantity; + + DROP TEMPORARY TABLE tInventory; END LOOP; - + CLOSE cWarehouses; - UPDATE config SET inventoried = vDate; - SET @isModeInventory := FALSE; + UPDATE config SET inventoried = vInventoryDate; - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - CREATE TEMPORARY TABLE tmp.entryToDelete - (INDEX(entryId) USING BTREE) ENGINE = MEMORY - SELECT e.id as entryId, - t.id as travelId + SET @isModeInventory := FALSE; + + CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete + (INDEX(entryId)) ENGINE = MEMORY + SELECT e.id entryId, + t.id travelId FROM travel t JOIN `entry` e ON e.travelFk = t.id + JOIN ( + SELECT t.shipped + FROM travel t + JOIN `entry` e ON e.travelFk = t.id + WHERE e.supplierFk = vInventorySupplierFk + AND t.shipped <= vInventoryDate + GROUP BY t.shipped + ORDER BY t.shipped DESC + OFFSET vMaxRecentInventories ROWS + ) sub WHERE e.supplierFk = vInventorySupplierFk - AND t.shipped <= util.VN_CURDATE() - INTERVAL 12 DAY - AND (DAY(t.shipped) <> 1 OR shipped < util.VN_CURDATE() - INTERVAL 12 DAY); + AND t.shipped IN (sub.shipped); - DELETE e + DELETE e FROM `entry` e - JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; + JOIN tEntryToDelete tmp ON tmp.entryId = e.id; DELETE IGNORE t FROM travel t - JOIN tmp.entryToDelete tmp ON tmp.travelId = t.id; + JOIN tEntryToDelete tmp ON tmp.travelId = t.id; + + DROP TEMPORARY TABLE IF EXISTS tEntryToDelete; + + COMMIT; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/inventoryMakeLauncher.sql b/db/routines/vn/procedures/inventoryMakeLauncher.sql index 6f362f70e..717e3c163 100644 --- a/db/routines/vn/procedures/inventoryMakeLauncher.sql +++ b/db/routines/vn/procedures/inventoryMakeLauncher.sql @@ -2,10 +2,11 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`inventoryMakeLauncher`() BEGIN /** - * Recalcula los inventarios de todos los almacenes. + * Recalculate the inventories of all warehouses */ - - call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_CURDATE()), 0); - + CALL inventoryMake( + util.VN_CURDATE() - + INTERVAL (SELECT daysInPastForInventory FROM inventoryConfig LIMIT 1) DAY + ); END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql b/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql index f41504669..2ff478d6b 100644 --- a/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql +++ b/db/routines/vn/procedures/invoiceInTaxMakeByDua.sql @@ -1,32 +1,35 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTaxMakeByDua`(vDuaFk INT) BEGIN - - DECLARE done BOOL DEFAULT FALSE; +/** + * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular + */ + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceInFk INT; - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; + DECLARE vInvoices CURSOR FOR + SELECT DISTINCT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + OPEN vInvoices; + l: LOOP + SET vDone = FALSE; + FETCH vInvoices INTO vInvoiceInFk; - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO + IF vDone THEN + LEAVE l; + END IF; CALL vn2008.recibidaIvaInsert(vInvoiceInFk); CALL invoiceInDueDay_recalc(vInvoiceInFk); - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - + END LOOP; + CLOSE vInvoices; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/invoiceInTax_getFromDua.sql b/db/routines/vn/procedures/invoiceInTax_getFromDua.sql index c7574f72f..bf2cbe61e 100644 --- a/db/routines/vn/procedures/invoiceInTax_getFromDua.sql +++ b/db/routines/vn/procedures/invoiceInTax_getFromDua.sql @@ -1,32 +1,35 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromDua`(vDuaFk INT) BEGIN - - DECLARE done BOOL DEFAULT FALSE; +/** + * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular + */ + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceInFk INT; - DECLARE rs CURSOR FOR - SELECT invoiceInFk + DECLARE vInvoices CURSOR FOR + SELECT DISTINCT invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id WHERE de.duaFk = vDuaFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + OPEN vInvoices; + l: LOOP + SET vDone = FALSE; + FETCH vInvoices INTO vInvoiceInFk; - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO + IF vDone THEN + LEAVE l; + END IF; CALL invoiceInTax_getFromEntries(vInvoiceInFk); CALL invoiceInDueDay_calculate(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; + END LOOP; + CLOSE vInvoices; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql b/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql index 14cc43e15..5a53b7543 100644 --- a/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql +++ b/db/routines/vn/procedures/invoiceInTax_getFromEntries.sql @@ -1,13 +1,22 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromEntries`(IN vId INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromEntries`(IN vInvoiceInFk INT) BEGIN DECLARE vRate DOUBLE DEFAULT 1; DECLARE vDated DATE; DECLARE vExpenseFk VARCHAR(10); + DECLARE vIsBooked BOOLEAN DEFAULT FALSE; + SELECT isBooked INTO vIsBooked + FROM invoiceIn ii + WHERE id = vInvoiceInFk; + + IF vIsBooked THEN + CALL util.throw('A booked invoice cannot be modified'); + END IF; + SELECT MAX(rr.dated) INTO vDated FROM referenceRate rr - JOIN invoiceIn ii ON ii.id = vId + JOIN invoiceIn ii ON ii.id = vInvoiceInFk WHERE rr.dated <= ii.issued AND rr.currencyFk = ii.currencyFk ; @@ -24,7 +33,7 @@ BEGIN LIMIT 1; DELETE FROM invoiceInTax - WHERE invoiceInFk = vId; + WHERE invoiceInFk = vInvoiceInFk; INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) SELECT ii.id, @@ -39,7 +48,7 @@ BEGIN JOIN buy b ON b.entryFk = e.id LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk AND rr.dated = ii.issued - WHERE ii.id = vId + WHERE ii.id = vInvoiceInFk HAVING taxableBase IS NOT NULL; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/itemProposal_Add.sql b/db/routines/vn/procedures/itemProposal_Add.sql index 5a01cb67a..ac4dfa5d5 100644 --- a/db/routines/vn/procedures/itemProposal_Add.sql +++ b/db/routines/vn/procedures/itemProposal_Add.sql @@ -67,4 +67,4 @@ BEGIN COMMIT; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/db/routines/vn/procedures/itemShelving_selfConsumption.sql b/db/routines/vn/procedures/itemShelving_selfConsumption.sql index aa6c34199..c974d9903 100644 --- a/db/routines/vn/procedures/itemShelving_selfConsumption.sql +++ b/db/routines/vn/procedures/itemShelving_selfConsumption.sql @@ -20,20 +20,23 @@ BEGIN DECLARE vCompanyFk INT; DECLARE vAgencyModeFk INT; DECLARE vItemShelvingFk INT; + DECLARE vAddressFk INT; SELECT c.id, pc.clientSelfConsumptionFk, - s.warehouseFk + s.warehouseFk, + pc.addressSelfConsumptionFk INTO vCompanyFk, vClientFk, - vWarehouseFk + vWarehouseFk, + vAddressFk FROM company c JOIN address a ON a.clientFk = c.clientFk JOIN warehouse w ON w.addressFk = a.id JOIN sector s ON s.warehouseFk = w.id JOIN parking p ON p.sectorFk = s.id JOIN shelving s2 ON s2.parkingFk = p.id - JOIN productionConfig pc ON TRUE + JOIN productionConfig pc WHERE s2.code = vShelvingFk; IF vClientFk IS NULL THEN @@ -65,7 +68,7 @@ BEGIN vClientFk, vWarehouseFk, CURDATE(), - NULL, + vAddressFk, vCompanyFk, NULL, vTicketFk diff --git a/db/routines/vn/procedures/test.sql b/db/routines/vn/procedures/test.sql deleted file mode 100644 index 69340291d..000000000 --- a/db/routines/vn/procedures/test.sql +++ /dev/null @@ -1,6 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`test`() -BEGIN -select 'procedimiento ejecutado con éxito'; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/ticket_getMovable.sql b/db/routines/vn/procedures/ticket_getMovable.sql index b69fa220a..eee165538 100644 --- a/db/routines/vn/procedures/ticket_getMovable.sql +++ b/db/routines/vn/procedures/ticket_getMovable.sql @@ -1,44 +1,55 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getMovable`( + vTicketFk INT, + vNewShipped DATETIME, + vWarehouseFk INT +) BEGIN /** * Cálcula el stock movible para los artículos de un ticket - * vDatedNew debe ser menor que vDatedOld, en los otros casos se + * vNewShipped debe ser menor que vOldShipped, en los otros casos se * asume que siempre es posible * * @param vTicketFk -> Ticket - * @param vDatedNew -> Nueva fecha + * @param vNewShipped -> Nueva fecha * @return Sales con Movible -*/ - DECLARE vDatedOld DATETIME; - SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY); +*/ + DECLARE vOldShipped DATETIME; - SELECT t.shipped INTO vDatedOld - FROM ticket t + SELECT t.shipped INTO vOldShipped + FROM ticket t WHERE t.id = vTicketFk; - CALL item_getStock(vWarehouseFk, vDatedNew, NULL); - CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL); - - SELECT s.id, - s.itemFk, - s.quantity, - s.concept, - s.price, + -- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive + CALL item_getStock(vWarehouseFk, DATE_ADD(vNewShipped, INTERVAL 1 DAY), NULL); + CALL item_getMinacum( + vWarehouseFk, + vNewShipped, + DATEDIFF(DATE_SUB(vOldShipped, INTERVAL 1 DAY), vNewShipped), + NULL + ); + + SELECT s.id, + s.itemFk, + s.quantity, + s.concept, + s.price, s.reserved, - s.discount, - i.image, - i.subName, + s.discount, + i.image, + i.subName, il.stock + IFNULL(im.amount, 0) AS movable FROM ticket t JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk + AND im.warehouseFk = vWarehouseFk LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk WHERE t.id = vTicketFk; - DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; - + DROP TEMPORARY TABLE IF EXISTS + tmp.itemList, + tmp.itemMinacum; + END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/calendar_afterDelete.sql b/db/routines/vn/triggers/calendar_afterDelete.sql index acd2c55b7..5d0114ea8 100644 --- a/db/routines/vn/triggers/calendar_afterDelete.sql +++ b/db/routines/vn/triggers/calendar_afterDelete.sql @@ -1,12 +1,12 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_afterDelete` - AFTER DELETE ON `calendar` - FOR EACH ROW +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_afterDelete` + AFTER DELETE ON `calendar` + FOR EACH ROW BEGIN INSERT INTO workerLog SET `action` = 'delete', `changedModel` = 'Calendar', `changedModelId` = OLD.id, `userFk` = account.myUser_getId(); -END$$ -DELIMITER ; \ No newline at end of file +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/calendar_beforeInsert.sql b/db/routines/vn/triggers/calendar_beforeInsert.sql index 9e51e6d18..3e265a099 100644 --- a/db/routines/vn/triggers/calendar_beforeInsert.sql +++ b/db/routines/vn/triggers/calendar_beforeInsert.sql @@ -5,4 +5,4 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeInsert BEGIN SET NEW.editorFk = account.myUser_getId(); END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/db/routines/vn/triggers/calendar_beforeUpdate.sql b/db/routines/vn/triggers/calendar_beforeUpdate.sql index bb1ba53c3..f015dc29a 100644 --- a/db/routines/vn/triggers/calendar_beforeUpdate.sql +++ b/db/routines/vn/triggers/calendar_beforeUpdate.sql @@ -1,8 +1,8 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeUpdate` - BEFORE UPDATE ON `calendar` - FOR EACH ROW +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`calendar_beforeUpdate` + BEFORE UPDATE ON `calendar` + FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); -END$$ -DELIMITER ; \ No newline at end of file +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/saleGroup_beforeInser.sql b/db/routines/vn/triggers/saleGroup_beforeInsert.sql similarity index 100% rename from db/routines/vn/triggers/saleGroup_beforeInser.sql rename to db/routines/vn/triggers/saleGroup_beforeInsert.sql diff --git a/db/routines/vn/triggers/workerTimeControl_afterDelete.sql b/db/routines/vn/triggers/workerTimeControl_afterDelete.sql index 6f0f00dbf..19653c913 100644 --- a/db/routines/vn/triggers/workerTimeControl_afterDelete.sql +++ b/db/routines/vn/triggers/workerTimeControl_afterDelete.sql @@ -1,12 +1,12 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_afterDelete` - AFTER DELETE ON `workerTimeControl` - FOR EACH ROW +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_afterDelete` + AFTER DELETE ON `workerTimeControl` + FOR EACH ROW BEGIN INSERT INTO workerLog SET `action` = 'delete', `changedModel` = 'WorkerTimeControl', `changedModelId` = OLD.id, `userFk` = account.myUser_getId(); -END$$ -DELIMITER ; \ No newline at end of file +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql b/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql index a899b879a..ad7acb784 100644 --- a/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql +++ b/db/routines/vn/triggers/workerTimeControl_beforeInsert.sql @@ -1,8 +1,8 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeInsert` - BEFORE INSERT ON `workerTimeControl` - FOR EACH ROW +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeInsert` + BEFORE INSERT ON `workerTimeControl` + FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); -END$$ -DELIMITER ; \ No newline at end of file +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql b/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql index 969e08711..bb391ad61 100644 --- a/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql +++ b/db/routines/vn/triggers/workerTimeControl_beforeUpdate.sql @@ -1,8 +1,8 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeUpdate` - BEFORE UPDATE ON `workerTimeControl` - FOR EACH ROW +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`workerTimeControl_beforeUpdate` + BEFORE UPDATE ON `workerTimeControl` + FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); -END$$ -DELIMITER ; \ No newline at end of file +END$$ +DELIMITER ; diff --git a/db/routines/vn/views/awbVolume.sql b/db/routines/vn/views/awbVolume.sql index 2c77973ca..df3b1ed1a 100644 --- a/db/routines/vn/views/awbVolume.sql +++ b/db/routines/vn/views/awbVolume.sql @@ -28,4 +28,4 @@ FROM ( JOIN `vn`.`volumeConfig` `vc` ) WHERE `t`.`shipped` > makedate(year(`util`.`VN_CURDATE`()) - 1, 1) - AND t.awbFk \ No newline at end of file + AND `t`.`awbFk` <> 0 diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql index 4e9e8cb0e..07627e817 100644 --- a/db/routines/vn/views/expeditionPallet_Print.sql +++ b/db/routines/vn/views/expeditionPallet_Print.sql @@ -9,7 +9,7 @@ AS SELECT `et2`.`description` AS `truck`, `et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`, `t`.`warehouseFk` AS `warehouseFk`, IF( - `r`.`created` > util.VN_CURDATE() + INTERVAL 1 DAY, + `r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, ucase(dayname(`r`.`created`)), NULL ) AS `nombreDia` diff --git a/db/routines/vn/views/itemShelvingAvailable.sql b/db/routines/vn/views/itemShelvingAvailable.sql index ee4ef62b6..868d6a963 100644 --- a/db/routines/vn/views/itemShelvingAvailable.sql +++ b/db/routines/vn/views/itemShelvingAvailable.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`itemShelvingAvailable` -AS SELECT `s`.`id` `saleFk`, +AS SELECT `s`.`id` AS `saleFk`, `tst`.`updated` AS `Modificado`, `s`.`ticketFk` AS `ticketFk`, 0 AS `isPicked`, diff --git a/db/routines/vn/views/ticketStateToday.sql b/db/routines/vn/views/ticketStateToday.sql index 2ee65b7c2..1f10aceb1 100644 --- a/db/routines/vn/views/ticketStateToday.sql +++ b/db/routines/vn/views/ticketStateToday.sql @@ -1,8 +1,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`ticketStateToday` -AS SELECT - `ts`.`ticketFk` AS `ticketFk`, +AS SELECT `ts`.`ticketFk` AS `ticketFk`, `ts`.`state` AS `state`, `ts`.`productionOrder` AS `productionOrder`, `ts`.`alertLevel` AS `alertLevel`, @@ -10,6 +9,8 @@ AS SELECT `ts`.`code` AS `code`, `ts`.`updated` AS `updated`, `ts`.`isPicked` AS `isPicked` -FROM `ticketState` `ts` - JOIN `ticket` `t` ON `t`.`id` = `ts`.`ticketFk` -WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()); +FROM ( + `vn`.`ticketState` `ts` + JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`) + ) +WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()) diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql index 621d1a8f0..081ccb0bd 100644 --- a/db/routines/vn/views/zoneEstimatedDelivery.sql +++ b/db/routines/vn/views/zoneEstimatedDelivery.sql @@ -1,25 +1,48 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`zoneEstimatedDelivery` - AS SELECT t.zoneFk, - zc.`hour` zoneClosureHour, - z.`hour` zoneHour, - sv.volume volume, - al.hasToRecalcPrice, - lhp.m3, - dl.minSpeed - FROM ticket t - JOIN ticketStateToday tst ON tst.ticketFk = t.id - JOIN state s ON s.id = tst.state - JOIN saleVolume sv ON sv.ticketFk = t.id - LEFT JOIN lastHourProduction lhp ON lhp.warehouseFk = t.warehouseFk - JOIN warehouse w ON w.id = t.warehouseFk - JOIN warehouseAlias wa ON wa.id = w.aliasFk - STRAIGHT_JOIN `zone` z ON z.id = t.zoneFk - LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk - AND zc.dated = util.VN_CURDATE() - LEFT JOIN cache.departure_limit dl ON dl.warehouse_id = t.warehouseFk - AND dl.fecha = util.VN_CURDATE() - JOIN alertLevel al ON al.id = s.alertLevel - WHERE w.hasProduction - AND DATE(t.shipped) = util.VN_CURDATE() +AS SELECT `t`.`zoneFk` AS `zoneFk`, + `zc`.`hour` AS `zoneClosureHour`, + `z`.`hour` AS `zoneHour`, + `sv`.`volume` AS `volume`, + `al`.`hasToRecalcPrice` AS `hasToRecalcPrice`, + `lhp`.`m3` AS `m3`, + `dl`.`minSpeed` AS `minSpeed` +FROM ( + ( + ( + ( + ( + ( + ( + ( + ( + ( + `vn`.`ticket` `t` + JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) + ) + JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) + ) + JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) + ) + LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + ) + JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) + ) + JOIN `vn`.`warehouseAlias` `wa` ON(`wa`.`id` = `w`.`aliasFk`) + ) STRAIGHT_JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`) + ) + LEFT JOIN `vn`.`zoneClosure` `zc` ON( + `zc`.`zoneFk` = `t`.`zoneFk` + AND `zc`.`dated` = `util`.`VN_CURDATE`() + ) + ) + LEFT JOIN `cache`.`departure_limit` `dl` ON( + `dl`.`warehouse_id` = `t`.`warehouseFk` + AND `dl`.`fecha` = `util`.`VN_CURDATE`() + ) + ) + JOIN `vn`.`alertLevel` `al` ON(`al`.`id` = `s`.`alertLevel`) + ) +WHERE `w`.`hasProduction` <> 0 + AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() diff --git a/db/routines/vn2008/procedures/recobro_credito.sql b/db/routines/vn2008/procedures/recobro_credito.sql index ca5304b6c..fbb5ea1aa 100644 --- a/db/routines/vn2008/procedures/recobro_credito.sql +++ b/db/routines/vn2008/procedures/recobro_credito.sql @@ -52,4 +52,4 @@ BEGIN DROP TEMPORARY TABLE clientes_credit; COMMIT; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/db/routines/vn2008/views/v_xsubcuentas.sql b/db/routines/vn2008/views/v_xsubcuentas.sql index a200e4ad9..7f2075a83 100644 --- a/db/routines/vn2008/views/v_xsubcuentas.sql +++ b/db/routines/vn2008/views/v_xsubcuentas.sql @@ -17,7 +17,7 @@ AS SELECT `Clientes`.`Cuenta` AS `COD`, `province`.`name` AS `PROVINCIA`, `Clientes`.`codPostal` AS `CODPOSTAL`, `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, + `sub`.`empresa_id` AS `empresa_id`, substr( `Clientes`.`e-mail`, 1, @@ -49,9 +49,7 @@ FROM ( `Recibos`.`empresa_id` AS `empresa_id` FROM `vn2008`.`Recibos` WHERE `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH - ) sub ON( - `Clientes`.`id_cliente` = sub.`Id_Cliente` - ) + ) `sub` ON(`Clientes`.`id_cliente` = `sub`.`Id_Cliente`) ) LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Clientes`.`Id_Pais`) ) @@ -60,7 +58,7 @@ FROM ( ) ) GROUP BY `Clientes`.`id_cliente`, - sub.`empresa_id` + `sub`.`empresa_id` UNION ALL SELECT `Proveedores`.`cuenta` AS `Cuenta`, `Proveedores`.`Proveedor` AS `Proveedor`, @@ -78,7 +76,7 @@ SELECT `Proveedores`.`cuenta` AS `Cuenta`, `prov`.`name` AS `Provincia`, `Proveedores`.`codpos` AS `CP`, `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, + `sub`.`empresa_id` AS `empresa_id`, substr( `c`.`email`, 1, @@ -104,8 +102,8 @@ FROM ( WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH GROUP BY `pago`.`id_proveedor`, `pago`.`empresa_id` - ) sub ON( - `Proveedores`.`Id_Proveedor` = sub.`proveedor_id` + ) `sub` ON( + `Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id` ) ) LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`) @@ -117,8 +115,8 @@ FROM ( LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`) ) WHERE `Proveedores`.`oficial` <> 0 -GROUP BY sub.`proveedor_id`, - sub.`empresa_id` +GROUP BY `sub`.`proveedor_id`, + `sub`.`empresa_id` UNION ALL SELECT `Gastos`.`Id_Gasto` COLLATE utf8mb3_unicode_ci AS `Id_Gasto`, `Gastos`.`Gasto` COLLATE utf8mb3_unicode_ci AS `Gasto`, @@ -160,7 +158,7 @@ SELECT lpad(right(`Proveedores`.`cuenta`, 5), 10, '47510000') AS `Cuenta`, `prov`.`name` AS `Provincia`, `Proveedores`.`codpos` AS `CP`, `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, + `sub`.`empresa_id` AS `empresa_id`, substr( `c`.`email`, 1, @@ -186,8 +184,8 @@ FROM ( WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH GROUP BY `pago`.`id_proveedor`, `pago`.`empresa_id` - ) sub ON( - `Proveedores`.`Id_Proveedor` = sub.`proveedor_id` + ) `sub` ON( + `Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id` ) ) LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`) @@ -203,5 +201,5 @@ WHERE ( OR `Proveedores`.`cuenta` LIKE '_____2____' ) AND `Proveedores`.`oficial` = 1 -GROUP BY sub.`proveedor_id`, - sub.`empresa_id` +GROUP BY `sub`.`proveedor_id`, + `sub`.`empresa_id` From f63abc1a6e6880b76b119dda51edeb303bd9d057 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 15 Feb 2024 11:07:47 +0100 Subject: [PATCH 112/116] fix: refs #6859 zoneEstimatedDelivery --- .../vn/views/zoneEstimatedDelivery.sql | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql index 081ccb0bd..90c7381d8 100644 --- a/db/routines/vn/views/zoneEstimatedDelivery.sql +++ b/db/routines/vn/views/zoneEstimatedDelivery.sql @@ -17,19 +17,17 @@ FROM ( ( ( ( - ( - `vn`.`ticket` `t` - JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) - ) - JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) + `vn`.`ticket` `t` + JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) ) - JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) + JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`) ) - LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + JOIN `vn`.`saleVolume` `sv` ON(`sv`.`ticketFk` = `t`.`id`) ) - JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) + LEFT JOIN `vn`.`lastHourProduction` `lhp` ON(`lhp`.`warehouseFk` = `t`.`warehouseFk`) + ) + JOIN `vn`.`warehouse` `w` ON(`w`.`id` = `t`.`warehouseFk`) ) - JOIN `vn`.`warehouseAlias` `wa` ON(`wa`.`id` = `w`.`aliasFk`) ) STRAIGHT_JOIN `vn`.`zone` `z` ON(`z`.`id` = `t`.`zoneFk`) ) LEFT JOIN `vn`.`zoneClosure` `zc` ON( @@ -43,6 +41,5 @@ FROM ( ) ) JOIN `vn`.`alertLevel` `al` ON(`al`.`id` = `s`.`alertLevel`) - ) WHERE `w`.`hasProduction` <> 0 - AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() + AND cast(`t`.`shipped` AS date) = `util`.`VN_CURDATE`() \ No newline at end of file From cc24ecdc7dd64547316181db0a55030b8f8f8e36 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 15 Feb 2024 11:28:46 +0100 Subject: [PATCH 113/116] build(dump): refs #6859 --- db/.pullinfo.json | 16 +- db/dump/.dump/data.sql | 131 +- db/dump/.dump/privileges.sql | 42 +- db/dump/.dump/structure.sql | 3237 ++++--------------- db/dump/.dump/triggers.sql | 439 ++- db/routines/vn/views/__coolerPathDetail.sql | 7 - package-lock.json | 10 +- package.json | 2 +- 8 files changed, 1036 insertions(+), 2848 deletions(-) delete mode 100644 db/routines/vn/views/__coolerPathDetail.sql diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 20a294f1f..2702f2f29 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -1,4 +1,16 @@ { "lastPull": "2024-02-15T08:58:24.000Z", - "shaSums": {} -} \ No newline at end of file + "shaSums": { + "srt": { + "view": { + "routePalletized": "765f8933a6a5a86dfe8f22825cc77351bc8620cdf1be9d3f25abb130460f3a61", + "ticketPalletized": "c327f3243e717cc607f01d3747967ba68158f90ef1038986b0aa6ae6d5ce7309" + } + }, + "vn": { + "view": { + "expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb" + } + } + } +} diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 8bbe54598..8367471bc 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,8 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL); -INSERT INTO `version` VALUES ('vn-database','10818','b7edbbe12f35d0cbc3e6b83e54977ac1c8acfc74','2024-01-25 10:00:48','10831'); +INSERT INTO `version` VALUES ('vn-database','10861','6685a201143a320920bbe04db7f8d0d1bd32d415','2024-02-15 10:04:54','10886'); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); @@ -539,6 +538,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10757','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10758','00-sectorType.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10758','01-dipole.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10758','02-agencyMode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10758','03-item.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:44',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10761','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10764','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-04 12:07:59',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10768','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:37',NULL,NULL); @@ -546,6 +546,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10771','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10773','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10775','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10778','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10781','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:54',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10782','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10783','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-24 14:49:17',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10784','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL); @@ -574,7 +575,45 @@ INSERT INTO `versionLog` VALUES ('vn-database','10815','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10816','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10817','00-invoiceOutConfig_refLen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-24 21:47:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10818','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10819','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10820','00-grants.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10825','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-01 10:24:54',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10827','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-23 12:32:13',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10828','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10828','01-RevokeClientes_regalos_lista.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_commit.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_rollback.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_start.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','01-update_procedure_TravelCloneWithEntries.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10832','02-grant_privileges_util_tx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10838','00-createInventoryConfig.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-07 22:36:27',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10845','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10848','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','00-roleLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','01-userLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','02-entryLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','03-clientLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','04-itemLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','05-shelvingLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','06-workerLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','07-deviceProductionLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','08-zoneLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','09-rateLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','10-ticketLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','11-userLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','12-routeLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','13-claimLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','14-supplierLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','15-invoiceInLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','16-travelLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10849','17-packingSiteDeviceLog.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10851','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-01-30 13:31:15',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:05',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10855','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10858','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10861','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -631,7 +670,7 @@ INSERT INTO `role` VALUES (57,'deliveryBoss','Jefe de personal de reparto',1,'20 INSERT INTO `role` VALUES (58,'packager','Departamento encajadores',1,'2019-01-21 13:43:45','2019-01-21 13:43:45',NULL); INSERT INTO `role` VALUES (59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 13:44:10','2019-01-21 13:44:10',NULL); INSERT INTO `role` VALUES (60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 14:29:01','2019-01-29 14:29:01',NULL); -INSERT INTO `role` VALUES (61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 08:44:07','2019-07-01 08:44:07',NULL); +INSERT INTO `role` VALUES (61,'replenisherBoss','Jefe de Complementos/Camara',1,'2019-07-01 08:44:07','2024-02-01 12:07:29',19336); INSERT INTO `role` VALUES (62,'noLogin','Role without login access to MySQL',0,'2019-07-01 08:50:19','2019-07-02 15:42:05',NULL); INSERT INTO `role` VALUES (64,'balanceSheet','Consulta de Balance',0,'2019-07-16 14:12:08','2019-07-16 14:12:08',NULL); INSERT INTO `role` VALUES (65,'officeBoss','Jefe de filial',1,'2019-08-02 08:54:26','2019-08-02 08:54:26',NULL); @@ -669,6 +708,7 @@ INSERT INTO `role` VALUES (124,'hrBuyer','Recursos Humanos con Buyer',1,'2023-10 INSERT INTO `role` VALUES (125,'claimViewer','Trabajadores que consulta las reclamaciones ',1,'2023-11-16 09:14:46','2023-11-16 09:14:46',10578); INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11-16 14:32:13','2023-11-16 14:32:13',NULL); INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL); +INSERT INTO `role` VALUES (129,'buyerAssistant','Comprador que tienes mas permisos para ayudar al buyerBoss en algunas tareas',1,'2024-02-06 06:59:12','2024-02-06 06:59:12',783); INSERT INTO `roleInherit` VALUES (1,1,2,NULL); INSERT INTO `roleInherit` VALUES (2,1,3,NULL); @@ -932,6 +972,7 @@ INSERT INTO `roleInherit` VALUES (355,127,11,NULL); INSERT INTO `roleInherit` VALUES (356,123,125,NULL); INSERT INTO `roleInherit` VALUES (357,36,35,NULL); INSERT INTO `roleInherit` VALUES (358,36,49,NULL); +INSERT INTO `roleInherit` VALUES (359,129,35,NULL); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); @@ -1508,7 +1549,7 @@ INSERT INTO `ACL` VALUES (676,'Ticket','invoiceTickets','WRITE','ALLOW','ROLE',' INSERT INTO `ACL` VALUES (680,'MailAliasAccount','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (681,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (682,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','itManagement'); +INSERT INTO `ACL` VALUES (683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','developerBoss'); INSERT INTO `ACL` VALUES (684,'WorkerDisableExcluded','*','READ','ALLOW','ROLE','itManagement'); INSERT INTO `ACL` VALUES (685,'WorkerDisableExcluded','*','WRITE','ALLOW','ROLE','itManagement'); INSERT INTO `ACL` VALUES (686,'MailForward','*','*','ALLOW','ROLE','hr'); @@ -1519,7 +1560,6 @@ INSERT INTO `ACL` VALUES (690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss') INSERT INTO `ACL` VALUES (691,'Roadmap','*','*','ALLOW','ROLE','productionBoss'); INSERT INTO `ACL` VALUES (692,'ExpeditionTruck','*','*','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss'); -INSERT INTO `ACL` VALUES (694,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','marketingBoss'); INSERT INTO `ACL` VALUES (695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'); @@ -1610,6 +1650,8 @@ INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery'); +INSERT INTO `ACL` VALUES (787,'Ticket','makePdfList','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (788,'Ticket','invoiceTicketsAndPdf','*','ALLOW','ROLE','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); @@ -1909,6 +1951,7 @@ INSERT INTO `component` VALUES (45,'maná reclamacion',7,4,NULL,0,'manaClaim',0) INSERT INTO `component` VALUES (46,'recargo a particular',2,NULL,0.25,0,'individual',0); INSERT INTO `component` VALUES (47,'promocion Italia',4,NULL,NULL,1,'italianOffer',0); INSERT INTO `component` VALUES (48,'fusión de lineas',4,NULL,NULL,1,'lineFusion',0); +INSERT INTO `component` VALUES (49,'sustitución',4,NULL,NULL,1,'substitution',0); INSERT INTO `componentType` VALUES (1,'coste',1,0,'COST'); INSERT INTO `componentType` VALUES (2,'com ventas',1,1,NULL); @@ -1929,59 +1972,61 @@ INSERT INTO `continent` VALUES (3,'África','AF'); INSERT INTO `continent` VALUES (4,'Europa','EU'); INSERT INTO `continent` VALUES (5,'Oceanía','OC'); -INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,106,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL); INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,33,NULL,72,1,1,1,10,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL); +INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL); INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',34,35,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (43,'VT','VENTAS',36,61,NULL,0,0,0,1,12,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (44,'management','GERENCIA',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (46,'delivery','REPARTO',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',68,69,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (43,'VT','VENTAS',38,65,NULL,0,0,0,1,13,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (44,'management','GERENCIA',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (46,'delivery','REPARTO',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',72,73,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL); INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL); -INSERT INTO `department` VALUES (58,'CMP','CAMPOS',78,81,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (61,NULL,'VNH',86,89,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (58,'CMP','CAMPOS',82,85,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',92,93,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',37,38,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (89,NULL,'COORDINACION',96,97,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (90,NULL,'TRAILER',87,88,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',39,40,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',39,40,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',41,42,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',43,44,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',45,46,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',47,48,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',49,50,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',51,52,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',41,42,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',43,44,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',45,46,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',47,48,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',49,50,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',51,52,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',53,54,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL); INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',79,80,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',53,54,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',55,56,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (134,NULL,'EQUIPO RODRI',57,58,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (137,'sorter','SORTER',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (139,NULL,'EQUIPO MIRIAM MAR 2',59,60,3803,0,0,0,2,0,43,'/1/43/','mir2_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',83,84,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',55,56,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',57,58,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',59,60,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',61,62,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',63,64,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL); INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL); diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 290c8a2a3..4012a6406 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -108,7 +108,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','item_feature','alexm INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemTag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemCategoryL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Vistas','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','Tipos','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','producer','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mdbVersion','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -300,7 +299,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','manager','v_botanic_expor INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Clientes','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','clientes_regalos_lista_enc','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','jerarquia','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','warehouse','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerBusinessAgreement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -335,7 +333,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','preservedBoss','travel',' INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','credit','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); @@ -492,8 +489,6 @@ 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 ('','vn2008','productionAssi','Rutas_Master','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas_monitor','alexm@%','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',''); @@ -588,7 +583,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','saleGoal','al INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleGroup','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleGroupDetail','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','accion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','volumeConfig','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','currency','alexm@%','0000-00-00 00:00:00','Select',''); @@ -831,7 +826,6 @@ 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 ('','vn2008','buyer','tarifas','alexm@%','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',''); @@ -969,7 +963,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','travel','alexm@%', INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelClonedWeekly','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','facturacion_media_anual','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','travelObservation','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','tarifas','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelThermograph','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','tillConfig','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','till','juan@%','0000-00-00 00:00:00','Select',''); @@ -1340,6 +1333,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','company','juan@db-p INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','buffer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); 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','guillermo@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','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','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +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',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; @@ -1659,6 +1657,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan' INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buyultimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofyear','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1812,7 +1811,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','guest','myuser_hasroutine INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionAssi','timebusiness_calculateall','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','timecontrol_geterror','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','travel_weeklyclone','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workerTimeControl_add','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByBuy','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerAssist','itemproposal','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getsuppliersdebt','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','agency','desglose_volume','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); @@ -1827,7 +1826,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_TIMESTAMP','F INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_getsaledate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','ticket_setState','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','invoicing','invoiceout_new','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_next','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','workerjourney_replace','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','account','developerBoss','role_sync','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1940,7 +1939,12 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemShelving_getinf INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_get','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','item_comparative','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_getBoxPickingList','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_rollback','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_start','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPrices','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByAwb','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','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 */; @@ -1962,25 +1966,25 @@ INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_ INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerAssist','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_questions\": 0, \"max_updates\": 30000, \"max_connections\": 300000, \"max_user_connections\": 400, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','delivery','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); @@ -1989,10 +1993,10 @@ INSERT IGNORE INTO `global_priv` VALUES ('','invoicing','{\"access\":0,\"versio INSERT IGNORE INTO `global_priv` VALUES ('','itBoss','{\"access\": 541165846527, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','itManagement','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','itemPicker','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','logistic','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); 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\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBos','{\"access\":0,\"version_id\":100707,\"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 ('','marketing','{\"access\": 0, \"is_role\": true}'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index 0c7966b82..696cb8359 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -1,4 +1,4 @@ --- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ @@ -361,7 +361,6 @@ CREATE TABLE `roleLog` ( KEY `userFk` (`userFk`), KEY `roleLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `roleLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `roleLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `roleLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -503,7 +502,6 @@ CREATE TABLE `userLog` ( KEY `userFk` (`userFk`), KEY `userLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `userLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3210,7 +3208,7 @@ BEGIN tm.year AS Año, tm.month AS Mes, tm.week AS Semana, - v.vista AS Vista, + dm.description AS Vista, bt.importe AS Importe FROM bs.ventas bt LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id @@ -3222,7 +3220,7 @@ BEGIN JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - LEFT JOIN vn2008.Vistas v ON v.vista_id = a.Vista + LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna LEFT JOIN vn2008.province p ON p.province_id = cs.province_id LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id @@ -26171,6 +26169,84 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `tx_commit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_commit`(isTx BOOL) +BEGIN +/** + * Confirma los cambios asociados a una transacción. + * + * @param isTx es true si existe transacción asociada +*/ + IF isTx THEN + COMMIT; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `tx_rollback` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_rollback`(isTx BOOL) +BEGIN +/** + * Deshace los cambios asociados a una transacción. + * + * @param isTx es true si existe transacción asociada +*/ + IF isTx THEN + ROLLBACK; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `tx_start` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tx_start`(isTx BOOL) +BEGIN +/** + * Inicia una transacción. + * + * @param isTx es true si existe transacción asociada +*/ + IF isTx THEN + START TRANSACTION; + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `warn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26282,20 +26358,6 @@ CREATE TABLE `XDiario` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `__coolerPathDetail` --- - -DROP TABLE IF EXISTS `__coolerPathDetail`; -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `__coolerPathDetail` AS SELECT - 1 AS `id`, - 1 AS `coolerPathFk`, - 1 AS `hallway` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `absenceType` -- @@ -27450,6 +27512,7 @@ CREATE TABLE `calendar` ( `businessFk` int(11) NOT NULL, `dayOffTypeFk` int(11) NOT NULL, `dated` date NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `calendar_UN` (`businessFk`,`dated`), KEY `calendar_employee_business_labour_id_idx` (`businessFk`), @@ -27819,7 +27882,6 @@ CREATE TABLE `claimLog` ( KEY `userFk` (`userFk`), KEY `claimLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `claimLog_claimLog` (`originFk`,`creationDate`), - CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28277,7 +28339,6 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), KEY `clientLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `clientLog_clientLog` (`originFk`,`creationDate`), - CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28446,7 +28507,7 @@ CREATE TABLE `clientSms` ( KEY `clientSms_FK_2` (`ticketFk`), CONSTRAINT `clientSms_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, CONSTRAINT `clientSms_FK_1` FOREIGN KEY (`smsFk`) REFERENCES `sms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE + CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29711,7 +29772,6 @@ CREATE TABLE `deviceProductionLog` ( KEY `userFk` (`userFk`), KEY `deviceProductionLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `deviceProductionLog_deviceProductionLog` (`originFk`,`creationDate`), - CONSTRAINT `deviceProductionOriginFk` FOREIGN KEY (`originFk`) REFERENCES `deviceProduction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `deviceProductionUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -30279,7 +30339,6 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), KEY `entryLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `entryLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31518,6 +31577,30 @@ CREATE TABLE `intrastat` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `inventoryConfig` +-- + +DROP TABLE IF EXISTS `inventoryConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `inventoryConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `maxRecentInventories` int(11) DEFAULT NULL COMMENT 'The maximum number of recent inventories to retain without deletion', + `daysInPastForInventory` int(11) DEFAULT NULL COMMENT 'The number of days in the past to consider for inventory calculations', + `warehouseOutFk` smallint(6) unsigned DEFAULT NULL COMMENT 'The identifier for the inventory output warehouse', + `agencyModeFk` int(11) DEFAULT NULL COMMENT 'The identifier for the default inventory agencyMode', + `supplierFk` int(10) unsigned DEFAULT NULL COMMENT 'The identifier for the default inventory supplier', + PRIMARY KEY (`id`), + KEY `inventoryConfig_supplier_FK` (`supplierFk`), + KEY `inventoryConfig_warehouse_FK` (`warehouseOutFk`), + KEY `inventoryConfig_agencyMode_FK` (`agencyModeFk`), + CONSTRAINT `inventoryConfig_agencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), + CONSTRAINT `inventoryConfig_supplier_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`), + CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `inventoryFailure` -- @@ -31779,7 +31862,6 @@ CREATE TABLE `invoiceInLog` ( KEY `userFk` (`userFk`), KEY `invoiceInLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `invoiceInLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32108,7 +32190,7 @@ CREATE TABLE `item` ( `itemPackingTypeFk` varchar(1) DEFAULT NULL, `packingOut` decimal(10,2) DEFAULT NULL COMMENT 'cantidad que cabe en una caja de verdnatura', `genericFk` int(11) DEFAULT NULL COMMENT 'Item genérico', - `packingShelve` int(11) DEFAULT NULL COMMENT 'unidades que caben en una bandeja, en el caso de los sacadores', + `packingShelve__` int(11) DEFAULT NULL COMMENT '@deprecated 2024-31-01', `isLaid` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indica si el producto se puede tumbar a efectos del transporte desde Holanda', `lastUsed` datetime DEFAULT current_timestamp(), `weightByPiece` int(10) unsigned DEFAULT NULL COMMENT 'peso por defecto para un articulo por tallo/unidad', @@ -32116,6 +32198,7 @@ CREATE TABLE `item` ( `recycledPlastic` int(11) DEFAULT NULL, `nonRecycledPlastic` int(11) DEFAULT NULL, `minQuantity` int(10) unsigned DEFAULT NULL COMMENT 'Cantidad mínima para una línea de venta', + `isBoxPickingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'FALSE: using item.packingOut TRUE: boxPicking using itemShelving.packing', PRIMARY KEY (`id`), UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`), KEY `Color` (`inkFk`), @@ -32462,7 +32545,6 @@ CREATE TABLE `itemLog` ( KEY `itemLogUserFk_idx` (`userFk`), KEY `itemLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `itemLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -33863,14 +33945,14 @@ DROP TABLE IF EXISTS `operator`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `operator` ( `workerFk` int(10) unsigned NOT NULL, - `numberOfWagons` int(11) DEFAULT 1, + `numberOfWagons` int(11) DEFAULT 2, `trainFk` int(11) NOT NULL DEFAULT 1, `itemPackingTypeFk` varchar(1) NOT NULL DEFAULT 'H', `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60, `sectorFk` int(11) DEFAULT NULL, `labelerFk` tinyint(3) unsigned DEFAULT NULL, - `linesLimit` int(11) DEFAULT NULL COMMENT 'Límite de lineas en una colección para la asignación de pedidos', - `volumeLimit` decimal(10,6) DEFAULT NULL COMMENT 'Límite de volumen en una colección para la asignación de pedidos', + `linesLimit` int(11) DEFAULT 20 COMMENT 'Límite de lineas en una colección para la asignación de pedidos', + `volumeLimit` decimal(10,6) DEFAULT 0.500000 COMMENT 'Límite de volumen en una colección para la asignación de pedidos', PRIMARY KEY (`workerFk`), KEY `operator_FK` (`workerFk`), KEY `operator_FK_1` (`trainFk`), @@ -34278,7 +34360,6 @@ CREATE TABLE `packingSiteDeviceLog` ( KEY `userFk` (`userFk`), KEY `packingSiteDeviceLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `packingSiteDeviceLog_packingSiteDeviceLog` (`originFk`,`creationDate`), - CONSTRAINT `packingSiteDeviceLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `packingSiteDeviceLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35080,11 +35161,14 @@ CREATE TABLE `productionConfig` ( `shortageAddressFk` int(11) DEFAULT NULL COMMENT 'Consignatario por defecto para añadir un item de alta', `clientSelfConsumptionFk` int(11) DEFAULT NULL COMMENT 'Cliente para crear el ticket de autoconsumo', `itemPreviousDefaultSize` int(11) DEFAULT NULL COMMENT 'Altura por defecto para los artículos de previa', + `addressSelfConsumptionFk` int(11) DEFAULT 2613 COMMENT 'Consignatario para crear el ticket de autoconsumo', PRIMARY KEY (`id`), KEY `productionConfig_FK` (`shortageAddressFk`), KEY `productionConfig_FK_1` (`clientSelfConsumptionFk`), + KEY `productionConfig_FK_2` (`addressSelfConsumptionFk`), CONSTRAINT `productionConfig_FK` FOREIGN KEY (`shortageAddressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, - CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35487,7 +35571,6 @@ CREATE TABLE `rateLog` ( KEY `logRateuserFk` (`userFk`), KEY `rateLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `rateLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `rateOriginFk` FOREIGN KEY (`originFk`) REFERENCES `rate` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `rateUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35962,7 +36045,6 @@ CREATE TABLE `routeLog` ( KEY `userFk` (`userFk`), KEY `routeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `routeLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36931,7 +37013,6 @@ CREATE TABLE `shelvingLog` ( KEY `userFk` (`userFk`), KEY `shelvingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `shelvingLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `shelvingLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37636,8 +37717,7 @@ CREATE TABLE `supplierLog` ( KEY `supplierLog_ibfk_2` (`userFk`), KEY `supplierLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `supplierLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, - CONSTRAINT `supplierLog_supplierFk` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38165,7 +38245,6 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), KEY `ticketLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `ticketLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38542,11 +38621,11 @@ DROP TABLE IF EXISTS `ticketStateToday`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `ticketStateToday` AS SELECT - 1 AS `ticket`, + 1 AS `ticketFk`, 1 AS `state`, 1 AS `productionOrder`, 1 AS `alertLevel`, - 1 AS `worker`, + 1 AS `userFk`, 1 AS `code`, 1 AS `updated`, 1 AS `isPicked` */; @@ -39102,7 +39181,6 @@ CREATE TABLE `travelLog` ( KEY `userFk` (`userFk`), KEY `travelLog_changedModel` (`changedModel`,`changedModelId`,`originFk`), KEY `travelLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39299,7 +39377,6 @@ CREATE TABLE `userLog` ( PRIMARY KEY (`id`), KEY `originFk` (`originFk`), KEY `userFk` (`userFk`), - CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39790,7 +39867,7 @@ CREATE TABLE `worker` ( `lastName` varchar(50) DEFAULT NULL, `sub` int(11) unsigned DEFAULT NULL, `photo` blob DEFAULT NULL, - `phone` varchar(9) DEFAULT NULL, + `phone` varchar(15) DEFAULT NULL, `mobileExtension` int(4) DEFAULT NULL, `bossFk` int(10) unsigned DEFAULT 103, `fiDueDate` datetime DEFAULT NULL, @@ -40176,7 +40253,7 @@ CREATE TABLE `workerLog` ( `action` set('insert','update','delete') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), `description` text DEFAULT NULL, - `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms') NOT NULL DEFAULT 'Worker', + `changedModel` enum('Worker','Calendar','WorkerTimeControlMail','Business','WorkerDms','WorkerTimeControl') NOT NULL DEFAULT 'Worker', `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), `changedModelId` int(11) NOT NULL, @@ -40185,8 +40262,7 @@ CREATE TABLE `workerLog` ( KEY `userFk_idx` (`userFk`), KEY `workerLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `workerLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40419,11 +40495,14 @@ CREATE TABLE `workerTimeControl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userFk` int(10) unsigned NOT NULL, `timed` datetime NOT NULL, + `direction` enum('in','out','middle') DEFAULT 'middle', `manual` tinyint(4) NOT NULL DEFAULT 0, `order` int(11) DEFAULT NULL, + `device` varchar(255) DEFAULT NULL COMMENT 'Dispositivo en el que se ha fichado', `warehouseFk` smallint(6) unsigned DEFAULT NULL, - `direction` enum('in','out','middle') DEFAULT 'middle', `isSendMail` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail', + `logExclude` tinyint(1) GENERATED ALWAYS AS (if(`manual`,0,1)) VIRTUAL, + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `userFk_Timed_uniq` (`userFk`,`timed`), KEY `warehouseFkfk1_idx` (`warehouseFk`), @@ -40957,7 +41036,6 @@ CREATE TABLE `zoneLog` ( KEY `userFk` (`userFk`), KEY `zoneLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `zoneLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -45653,144 +45731,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - DECLARE vLastInsertedId INT; - - SELECT dayStayMax INTO vDayStayMax - FROM workerTimeControlParams; - - SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - SET vLastInsertedId = LAST_INSERT_ID(); - - CALL workerTimeControlSOWP(vUserFk, vTimed); - - RETURN vLastInsertedId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_addDirection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - DECLARE vLastInsertedId INT; - - SELECT dayStayMax INTO vDayStayMax - FROM workerTimeControlParams; - - SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - SET vLastInsertedId = LAST_INSERT_ID(); - - CALL workerTimeControlSOWP(vUserFk, vTimed); - - RETURN vLastInsertedId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `worker_getCode` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -45875,38 +45815,38 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `worker_isInDepartment` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isInDepartment`(vDepartmentCode VARCHAR(255)) RETURNS int(11) DETERMINISTIC -BEGIN -/** - * Devuelve booleano si el trabajador conectado pertenece - * al departamento vDepartmentCode o a sus departamentos subordinados - * - * @param vDepartmentCode code del departamento que se desea comprobar. - * @return Devuelve verdadero si es jefe del empleado por escala jerárquica. - */ - DECLARE vIsInDepartment BOOLEAN; - WITH RECURSIVE department AS ( - SELECT d.id FROM vn.department d WHERE code = vDepartmentCode - UNION - SELECT d.id - FROM department ds - JOIN vn.department d ON ds.id = d.parentFk - ) - SELECT COUNT(*) INTO vIsInDepartment FROM department ds - JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id - WHERE wd.workerFk = account.myUser_getId(); - - RETURN vIsInDepartment; +BEGIN +/** + * Devuelve booleano si el trabajador conectado pertenece + * al departamento vDepartmentCode o a sus departamentos subordinados + * + * @param vDepartmentCode code del departamento que se desea comprobar. + * @return Devuelve verdadero si es jefe del empleado por escala jerárquica. + */ + DECLARE vIsInDepartment BOOLEAN; + WITH RECURSIVE department AS ( + SELECT d.id FROM vn.department d WHERE code = vDepartmentCode + UNION + SELECT d.id + FROM department ds + JOIN vn.department d ON ds.id = d.parentFk + ) + SELECT COUNT(*) INTO vIsInDepartment FROM department ds + JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id + WHERE wd.workerFk = account.myUser_getId(); + + RETURN vIsInDepartment; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47949,6 +47889,7 @@ BEGIN DECLARE v26Month DATE; DECLARE v3Month DATE; DECLARE vTrashId VARCHAR(15); + DECLARE v2Years DATE; DECLARE v5Years DATE; SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH; @@ -47958,6 +47899,7 @@ BEGIN SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH; SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH; SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH; + SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR; SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; DELETE FROM ticketParking WHERE created < vDateShort; @@ -48102,7 +48044,11 @@ BEGIN FROM tmp.duaToDelete tmp JOIN vn.dua d ON d.id = tmp.id; - DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + DELETE a + FROM vn.awb a + LEFT JOIN vn.travel t ON t.awbFk = a.id + WHERE a.created < v2Years + AND t.id IS NULL; -- Borra los registros de collection y ticketcollection DELETE FROM vn.collection WHERE created < vDateShort; @@ -51437,71 +51383,75 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) BEGIN - +/** + * Genera el asiento de un DUA y marca las entradas como confirmadas + * + * @param vDuaFk Id del dua a recalcular + */ DECLARE done BOOL DEFAULT FALSE; DECLARE vInvoiceFk INT; - DECLARE vASIEN BIGINT DEFAULT 0; - DECLARE vCounter INT DEFAULT 0; - + DECLARE vASIEN BIGINT DEFAULT 0; + DECLARE vCounter INT DEFAULT 0; + DECLARE rs CURSOR FOR - SELECT e.invoiceInFk + SELECT DISTINCT e.invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE de.duaFk = vDuaFk + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE de.duaFk = vDuaFk AND de.customsValue AND ii.isBooked = FALSE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id - JOIN duaEntry de ON de.entryFk = e.id - JOIN dua d ON d.id = de.duaFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk SET ii.isBooked = TRUE, ii.booked = IFNULL(ii.booked,d.booked), ii.operated = IFNULL(ii.operated,d.operated), - ii.issued = IFNULL(ii.issued,d.issued), - ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), - e.isConfirmed = TRUE + ii.issued = IFNULL(ii.issued,d.issued), + ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isConfirmed = TRUE WHERE d.id = vDuaFk; - - SELECT IFNULL(ASIEN,0) INTO vASIEN + + SELECT IFNULL(ASIEN,0) INTO vASIEN FROM dua WHERE id = vDuaFk; - + FETCH rs INTO vInvoiceFk; - + WHILE NOT done DO CALL invoiceIn_booking(vInvoiceFk); - - IF vCounter > 0 OR vASIEN > 0 THEN - + + IF vCounter > 0 OR vASIEN > 0 THEN + UPDATE vn2008.XDiario x - JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN - SET x.ASIEN = vASIEN; - - ELSE - - SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig; - + JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN + SET x.ASIEN = vASIEN; + + ELSE + + SELECT lastBookEntry INTO vASIEN FROM ledgerConfig; + END IF; - - SET vCounter = vCounter + 1; - + + SET vCounter = vCounter + 1; + FETCH rs INTO vInvoiceFk; END WHILE; - - CLOSE rs; - - UPDATE dua - SET ASIEN = vASIEN - WHERE id = vDuaFk; - + + CLOSE rs; + + UPDATE dua + SET ASIEN = vASIEN + WHERE id = vDuaFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54397,184 +54347,177 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vDate DATE, vWh INT) -proc: BEGIN +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vInventoryDate DATE) +BEGIN /** -* Recalcula los inventarios de todos los almacenes, si vWh = 0 +* Recalculate the inventories * -* @param vDate Fecha de los nuevos inventarios -* @param vWh almacen al cual hacer el inventario +* @param vInventoryDate date for the new inventory */ - DECLARE vDone BOOL; DECLARE vEntryFk INT; DECLARE vTravelFk INT; DECLARE vDateLastInventory DATE; - DECLARE vDateYesterday DATETIME DEFAULT vDate - INTERVAL 1 SECOND; + DECLARE vDateYesterday DATETIME DEFAULT vInventoryDate - INTERVAL 1 SECOND; DECLARE vWarehouseOutFkInventory INT; DECLARE vInventorySupplierFk INT; DECLARE vAgencyModeFkInventory INT; + DECLARE vMaxRecentInventories INT; + DECLARE vWarehouseFk INT; DECLARE cWarehouses CURSOR FOR SELECT id FROM warehouse - WHERE isInventory - AND vWh IN (0,id); + WHERE isInventory; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + SELECT inventorySupplierFk INTO vInventorySupplierFk FROM entryConfig LIMIT 1; + SELECT inventoried INTO vDateLastInventory FROM config LIMIT 1; + SELECT maxRecentInventories, + warehouseOutFk, + agencyModeFk + INTO vMaxRecentInventories, + vWarehouseOutFkInventory, + vAgencyModeFkInventory + FROM inventoryConfig + LIMIT 1; + + IF vDateLastInventory IS NULL + OR vInventorySupplierFk IS NULL + OR vMaxRecentInventories IS NULL + OR vInventoryDate IS NULL + OR vWarehouseOutFkInventory IS NULL + OR vAgencyModeFkInventory IS NULL THEN + CALL util.throw('Some config parameters are not set'); + END IF; + + START TRANSACTION; + OPEN cWarehouses; + -- Environment variable to disable the triggers of the affected tables SET @isModeInventory := TRUE; l: LOOP - SET vDone = FALSE; - FETCH cWarehouses INTO vWh; + SET vEntryFk = NULL; + SET vTravelFk = NULL; + + FETCH cWarehouses INTO vWarehouseFk; IF vDone THEN LEAVE l; END IF; - SELECT w.id INTO vWarehouseOutFkInventory - FROM warehouse w - WHERE w.code = 'inv'; - - SELECT inventorySupplierFk INTO vInventorySupplierFk - FROM entryConfig; - - SELECT am.id INTO vAgencyModeFkInventory - FROM agencyMode am - where code = 'inv'; - - SELECT MAX(landed) INTO vDateLastInventory - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - JOIN buy b ON b.entryFk = e.id - WHERE warehouseOutFk = vWarehouseOutFkInventory - AND landed < vDate - AND e.supplierFk = vInventorySupplierFk - AND warehouseInFk = vWh - AND NOT isRaid; - - IF vDateLastInventory IS NULL THEN - SELECT inventoried INTO vDateLastInventory FROM config; - END IF; - - -- Generamos travel, si no existe. - SET vTravelFK = 0; - + -- Generate travel, if it does not exist SELECT id INTO vTravelFk FROM travel WHERE warehouseOutFk = vWarehouseOutFkInventory - AND warehouseInFk = vWh - AND landed = vDate + AND warehouseInFk = vWarehouseFk + AND landed = vInventoryDate AND agencyModeFk = vAgencyModeFkInventory AND ref = 'inventario' LIMIT 1; - IF NOT vTravelFK THEN - - INSERT INTO travel SET - warehouseOutFk = vWarehouseOutFkInventory, - warehouseInFk = vWh, - shipped = vDate, - landed = vDate, - agencyModeFk = vAgencyModeFkInventory, - ref = 'inventario', - isDelivered = TRUE, - isReceived = TRUE; + IF vTravelFk IS NULL THEN + INSERT INTO travel + SET warehouseOutFk = vWarehouseOutFkInventory, + warehouseInFk = vWarehouseFk, + shipped = vInventoryDate, + landed = vInventoryDate, + agencyModeFk = vAgencyModeFkInventory, + ref = 'inventario', + isDelivered = TRUE, + isReceived = TRUE; SELECT LAST_INSERT_ID() INTO vTravelFk; - END IF; - -- Generamos entrada si no existe, o la vaciamos. - SET vEntryFk = 0; - + -- Generate an entry if it does not exist, or we empty it SELECT id INTO vEntryFk FROM entry WHERE supplierFk = vInventorySupplierFk AND travelFk = vTravelFk; - IF NOT vEntryFk THEN - - INSERT INTO entry SET - supplierFk = vInventorySupplierFk, - isConfirmed = TRUE, - isOrdered = TRUE, - travelFk = vTravelFk; + IF vEntryFk IS NULL THEN + INSERT INTO entry + SET supplierFk = vInventorySupplierFk, + isConfirmed = TRUE, + isOrdered = TRUE, + travelFk = vTravelFk; SELECT LAST_INSERT_ID() INTO vEntryFk; - ELSE - DELETE FROM buy WHERE entryFk = vEntryFk; - END IF; - -- Preparamos tabla auxilar - CREATE OR REPLACE TEMPORARY TABLE tmp.inventory ( - itemFk INT(11) NOT NULL PRIMARY KEY, - quantity int(11) DEFAULT '0', - buyingValue decimal(10,4) DEFAULT '0.0000', - freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - groupingMode tinyint(4) NOT NULL DEFAULT 0 , - comissionValue decimal(10,3) DEFAULT '0.000', - packageValue decimal(10,3) DEFAULT '0.000', - packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - price1 decimal(10,2) DEFAULT '0.00', - price2 decimal(10,2) DEFAULT '0.00', - price3 decimal(10,2) DEFAULT '0.00', - minPrice decimal(10,2) DEFAULT '0.00', - producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - INDEX (itemFK)) ENGINE = MEMORY; + -- Prepare the auxiliary table + CREATE OR REPLACE TEMPORARY TABLE tInventory ( + itemFk INT(11) NOT NULL PRIMARY KEY, + quantity int(11) DEFAULT '0', + buyingValue decimal(10,4) DEFAULT '0.0000', + freightValue decimal(10,3) DEFAULT '0.000', + packing int(11) DEFAULT '0', + `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', + groupingMode tinyint(4) NOT NULL DEFAULT 0 , + comissionValue decimal(10,3) DEFAULT '0.000', + packageValue decimal(10,3) DEFAULT '0.000', + packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + price1 decimal(10,2) DEFAULT '0.00', + price2 decimal(10,2) DEFAULT '0.00', + price3 decimal(10,2) DEFAULT '0.00', + minPrice decimal(10,2) DEFAULT '0.00', + producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + INDEX (itemFK) + ) ENGINE = MEMORY; - -- Compras - INSERT INTO tmp.inventory(itemFk,quantity) + -- Buys + INSERT INTO tInventory(itemFk, quantity) SELECT b.itemFk, SUM(b.quantity) FROM buy b JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseInFk = vWh - AND tr.landed BETWEEN vDateLastInventory - AND vDateYesterday + WHERE tr.warehouseInFk = vWarehouseFk + AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk; - SELECT vDateLastInventory , vDateYesterday; - -- Traslados - INSERT INTO tmp.inventory(itemFk, quantity) + -- Transfers + INSERT INTO tInventory(itemFk, quantity) SELECT itemFk, quantityOut - FROM ( + FROM ( SELECT b.itemFk,- SUM(b.quantity) quantityOut FROM buy b JOIN entry e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseOutFk = vWh - AND tr.shipped BETWEEN vDateLastInventory - AND vDateYesterday + WHERE tr.warehouseOutFk = vWarehouseFk + AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday AND NOT isRaid GROUP BY b.itemFk ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut; - -- Ventas - INSERT INTO tmp.inventory(itemFk,quantity) + -- Sales + INSERT INTO tInventory(itemFk, quantity) SELECT itemFk, saleOut - FROM ( + FROM ( SELECT s.itemFk, - SUM(s.quantity) saleOut FROM sale s JOIN ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWh + WHERE t.warehouseFk = vWarehouseFk AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday GROUP BY s.itemFk ) sub ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; - -- Actualiza valores de la ultima compra - UPDATE tmp.inventory inv - JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh + -- Update values of the last purchase + UPDATE tInventory inv + JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWarehouseFk JOIN buy b ON b.id = lb.buy_id JOIN item i ON i.id = b.itemFk LEFT JOIN producer p ON p.id = i.producerFk @@ -54592,7 +54535,7 @@ proc: BEGIN inv.minPrice = b.minPrice, inv.producer = p.name; - INSERT INTO buy( itemFk, + INSERT INTO buy(itemFk, quantity, buyingValue, freightValue, @@ -54622,43 +54565,54 @@ proc: BEGIN price3, minPrice, vEntryFk - FROM tmp.inventory; + FROM tInventory; - SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory; - - -- Actualizamos el campo lastUsed de item - UPDATE item i - JOIN tmp.inventory i2 ON i2.itemFk = i.id - SET i.lastUsed = NOW() - WHERE i2.quantity; - - -- DROP TEMPORARY TABLE tmp.inventory; + -- Update the 'lastUsed' field of the item + UPDATE item i + JOIN tInventory i2 ON i2.itemFk = i.id + SET i.lastUsed = NOW() + WHERE i2.quantity; + + DROP TEMPORARY TABLE tInventory; END LOOP; - + CLOSE cWarehouses; - UPDATE config SET inventoried = vDate; - SET @isModeInventory := FALSE; + UPDATE config SET inventoried = vInventoryDate; - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - CREATE TEMPORARY TABLE tmp.entryToDelete - (INDEX(entryId) USING BTREE) ENGINE = MEMORY - SELECT e.id as entryId, - t.id as travelId + SET @isModeInventory := FALSE; + + CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete + (INDEX(entryId)) ENGINE = MEMORY + SELECT e.id entryId, + t.id travelId FROM travel t JOIN `entry` e ON e.travelFk = t.id + JOIN ( + SELECT t.shipped + FROM travel t + JOIN `entry` e ON e.travelFk = t.id + WHERE e.supplierFk = vInventorySupplierFk + AND t.shipped <= vInventoryDate + GROUP BY t.shipped + ORDER BY t.shipped DESC + OFFSET vMaxRecentInventories ROWS + ) sub WHERE e.supplierFk = vInventorySupplierFk - AND t.shipped <= util.VN_CURDATE() - INTERVAL 12 DAY - AND (DAY(t.shipped) <> 1 OR shipped < util.VN_CURDATE() - INTERVAL 12 DAY); + AND t.shipped IN (sub.shipped); - DELETE e + DELETE e FROM `entry` e - JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; + JOIN tEntryToDelete tmp ON tmp.entryId = e.id; DELETE IGNORE t FROM travel t - JOIN tmp.entryToDelete tmp ON tmp.travelId = t.id; + JOIN tEntryToDelete tmp ON tmp.travelId = t.id; + + DROP TEMPORARY TABLE IF EXISTS tEntryToDelete; + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54678,11 +54632,12 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`() BEGIN /** - * Recalcula los inventarios de todos los almacenes. + * Recalculate the inventories of all warehouses */ - - call vn.inventoryMake(TIMESTAMPADD(DAY, -10, util.VN_CURDATE()), 0); - + CALL inventoryMake( + util.VN_CURDATE() - + INTERVAL (SELECT daysInPastForInventory FROM inventoryConfig LIMIT 1) DAY + ); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55072,33 +55027,36 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) BEGIN - - DECLARE done BOOL DEFAULT FALSE; +/** + * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular + */ + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceInFk INT; - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; + DECLARE vInvoices CURSOR FOR + SELECT DISTINCT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + OPEN vInvoices; + l: LOOP + SET vDone = FALSE; + FETCH vInvoices INTO vInvoiceInFk; - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO + IF vDone THEN + LEAVE l; + END IF; CALL vn2008.recibidaIvaInsert(vInvoiceInFk); CALL invoiceInDueDay_recalc(vInvoiceInFk); - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - + END LOOP; + CLOSE vInvoices; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55153,33 +55111,36 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) BEGIN - - DECLARE done BOOL DEFAULT FALSE; +/** + * Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular + */ + DECLARE vDone BOOL DEFAULT FALSE; DECLARE vInvoiceInFk INT; - DECLARE rs CURSOR FOR - SELECT invoiceInFk + DECLARE vInvoices CURSOR FOR + SELECT DISTINCT invoiceInFk FROM entry e JOIN duaEntry de ON de.entryFk = e.id WHERE de.duaFk = vDuaFk; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN rs; + OPEN vInvoices; + l: LOOP + SET vDone = FALSE; + FETCH vInvoices INTO vInvoiceInFk; - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO + IF vDone THEN + LEAVE l; + END IF; CALL invoiceInTax_getFromEntries(vInvoiceInFk); CALL invoiceInDueDay_calculate(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; + END LOOP; + CLOSE vInvoices; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55196,15 +55157,24 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vInvoiceInFk INT) BEGIN DECLARE vRate DOUBLE DEFAULT 1; DECLARE vDated DATE; DECLARE vExpenseFk VARCHAR(10); + DECLARE vIsBooked BOOLEAN DEFAULT FALSE; + SELECT isBooked INTO vIsBooked + FROM invoiceIn ii + WHERE id = vInvoiceInFk; + + IF vIsBooked THEN + CALL util.throw('A booked invoice cannot be modified'); + END IF; + SELECT MAX(rr.dated) INTO vDated FROM referenceRate rr - JOIN invoiceIn ii ON ii.id = vId + JOIN invoiceIn ii ON ii.id = vInvoiceInFk WHERE rr.dated <= ii.issued AND rr.currencyFk = ii.currencyFk ; @@ -55221,7 +55191,7 @@ BEGIN LIMIT 1; DELETE FROM invoiceInTax - WHERE invoiceInFk = vId; + WHERE invoiceInFk = vInvoiceInFk; INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) SELECT ii.id, @@ -55236,7 +55206,7 @@ BEGIN JOIN buy b ON b.entryFk = e.id LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk AND rr.dated = ii.issued - WHERE ii.id = vId + WHERE ii.id = vInvoiceInFk HAVING taxableBase IS NOT NULL; END ;; DELIMITER ; @@ -57526,9 +57496,15 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`( + vSectorFk INT +) proc:BEGIN - +/** + * Calcula la información detallada respecto un sector. + * + * @param vSectorFk Id de sector + */ DECLARE vCalcVisibleFk INT; DECLARE vCalcAvailableFk INT; DECLARE hasFatherSector BOOLEAN; @@ -57617,7 +57593,7 @@ proc:BEGIN JOIN vn.item i ON i.id = ishr.itemFk LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed FROM vn.ticket t - JOIN vn.ticketStateToday tst ON tst.ticket = t.id + JOIN vn.ticketStateToday tst ON tst.ticketFk = t.id JOIN vn.sale s ON s.ticketFk = t.id WHERE t.warehouseFk = vWarehouseFk AND tst.alertLevel = 0 @@ -58917,20 +58893,23 @@ BEGIN DECLARE vCompanyFk INT; DECLARE vAgencyModeFk INT; DECLARE vItemShelvingFk INT; + DECLARE vAddressFk INT; SELECT c.id, pc.clientSelfConsumptionFk, - s.warehouseFk + s.warehouseFk, + pc.addressSelfConsumptionFk INTO vCompanyFk, vClientFk, - vWarehouseFk + vWarehouseFk, + vAddressFk FROM company c JOIN address a ON a.clientFk = c.clientFk JOIN warehouse w ON w.addressFk = a.id JOIN sector s ON s.warehouseFk = w.id JOIN parking p ON p.sectorFk = s.id JOIN shelving s2 ON s2.parkingFk = p.id - JOIN productionConfig pc ON TRUE + JOIN productionConfig pc WHERE s2.code = vShelvingFk; IF vClientFk IS NULL THEN @@ -58962,7 +58941,7 @@ BEGIN vClientFk, vWarehouseFk, CURDATE(), - NULL, + vAddressFk, vCompanyFk, NULL, vTicketFk @@ -61214,36 +61193,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingShelve` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT) -BEGIN - - /** - * Actualiza el valor de item.packingShelve - * - * @param vSelf Identificador de vn.item - * @param vPacking Cantidad de unidades de venta que caben en una bandeja - */ - - UPDATE vn.item i - SET i.packingShelve = vPacking - WHERE i.id = vSelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingType` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63332,8 +63281,8 @@ proc: BEGIN rm.bufferFk FROM tmp.productionTicket tt JOIN ticket t ON tt.ticketFk = t.id - LEFT JOIN ticketStateToday tst ON tst.ticket = t.id - LEFT JOIN state st ON st.id = tst.state + LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id + LEFT JOIN `state` st ON st.id = tst.state LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk JOIN address a ON a.id = t.addressFk @@ -65549,7 +65498,7 @@ BEGIN CALL productionControl(vWarehouseFk, 0); - -- Products without vn.item.packingOut, pay atention to vn.itemShelving.packing + -- Products with vn.item.isBoxPickingMode = TRUE, pay atention to vn.itemShelving.packing CREATE OR REPLACE TEMPORARY TABLE tmp.sale (saleFk INT PRIMARY KEY) SELECT @@ -65585,7 +65534,7 @@ BEGIN LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk LEFT JOIN buy b ON b.id = lb.buy_id WHERE s.quantity BETWEEN ish.packing AND (ish.visible - IFNULL(tISS.reserve,0)) - AND i.packingOut IS NULL + AND i.isBoxPickingMode AND NOT pb.problem AND sgd.saleFk IS NULL AND p.sectorFk = vSectorFk @@ -65732,7 +65681,6 @@ DECLARE vIsCollection BOOL; s.isAdded, IF(c.workerFk IS NULL, getUser(), c.workerFk) workerFk, IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity, - i.packingShelve, MIN(iss.created) picked, IF(sm.id, TRUE, FALSE) hasMistake, sg.sectorFk @@ -66287,148 +66235,148 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_replaceItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT) -BEGIN -/** - * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. - * - * @param vSaleFk id de la tabla sale - * @param vNewItemFk articulo sustituto - * @param vQuantity cantidad que se va a sustituir - */ - DECLARE vTicketFk INT; - DECLARE vItemFk INT; - DECLARE vWarehouseFk SMALLINT; - DECLARE vDate DATE; - DECLARE vGrouping INT; - DECLARE vGroupingModeFk INT; - DECLARE vPacking INT; - DECLARE vRoundQuantity INT DEFAULT 1; - DECLARE vLanded DATE; - DECLARE vAddressFk INT; - DECLARE vAgencyModeFk INT; - DECLARE vNewPrice DECIMAL(10,2); - DECLARE vOldPrice DECIMAL(10,2); - DECLARE vOption INT DEFAULT NULL; - DECLARE vNewSaleFk INT; - DECLARE vChangePrice INT DEFAULT 1; - DECLARE vBuyerDiscount INT DEFAULT 4; - DECLARE vManaDiscount INT DEFAULT 3; - DECLARE vForceToGrouping INT DEFAULT 1; - DECLARE vForceToPacking INT DEFAULT 2; - DECLARE vFinalPrice DECIMAL(10,2); - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SELECT s.ticketFk, - LEAST(s.quantity, vQuantity), - s.itemFk, - t.shipped, - t.warehouseFk, - t.landed, - t.addressFk, - t.agencyModeFk, - s.price - INTO vTicketFk, - vQuantity, - vItemFk, - vDate, - vWarehouseFk, - vLanded, - vAddressFk, - vAgencyModeFk, - vOldPrice - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE s.id = vSaleFk; - - CALL buyUltimate(vWarehouseFk, vDate); - - SELECT `grouping`, groupingMode, packing - INTO vGrouping,vGroupingModeFk,vPacking - FROM buy b - JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk - WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk; - - IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN - SET vRoundQuantity = vPacking; - END IF; - IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN - SET vRoundQuantity = vGrouping; - END IF; - - CALL catalog_calcFromItem( - vLanded, - vAddressFk, - vAgencyModeFk, - vNewItemFk); - - SELECT price INTO vNewPrice - FROM tmp.ticketCalculateItem; - - IF vNewPrice IS NULL THEN - CALL util.throw('price retrieval failed'); - END IF; - IF vNewPrice > vOldPrice THEN - SET vFinalPrice = vOldPrice; - IF worker_isInDepartment('vt') THEN - SET vOption = vManaDiscount; - ELSE - SET vOption = vBuyerDiscount; - END IF; - ELSE - SET vFinalPrice = vNewPrice; - SET vOption = vChangePrice; - END IF; - - START TRANSACTION; - - UPDATE sale - SET quantity = quantity - vQuantity - WHERE id = vSaleFk; - - INSERT INTO vn.sale(ticketFk, - itemFk, - quantity, - concept, - price) - SELECT vTicketFk, - vNewItemFk, - CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName), - vFinalPrice - FROM vn.item i - WHERE id = vNewItemFk; - - SELECT LAST_INSERT_ID() INTO vNewSaleFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) - ENGINE = MEMORY - SELECT id saleFk, vWarehouseFk warehouseFk - FROM sale s WHERE id = vNewSaleFk; - - CALL ticketComponentUpdateSale(vOption); - CALL catalog_componentPurge(); - - INSERT INTO itemProposal(itemFk, mateFk, counter) - VALUES(vItemFk, vNewItemFk, 1) - ON DUPLICATE KEY UPDATE counter = counter + 1; - - COMMIT; +BEGIN +/** + * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. + * + * @param vSaleFk id de la tabla sale + * @param vNewItemFk articulo sustituto + * @param vQuantity cantidad que se va a sustituir + */ + DECLARE vTicketFk INT; + DECLARE vItemFk INT; + DECLARE vWarehouseFk SMALLINT; + DECLARE vDate DATE; + DECLARE vGrouping INT; + DECLARE vGroupingModeFk INT; + DECLARE vPacking INT; + DECLARE vRoundQuantity INT DEFAULT 1; + DECLARE vLanded DATE; + DECLARE vAddressFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vNewPrice DECIMAL(10,2); + DECLARE vOldPrice DECIMAL(10,2); + DECLARE vOption INT DEFAULT NULL; + DECLARE vNewSaleFk INT; + DECLARE vChangePrice INT DEFAULT 1; + DECLARE vBuyerDiscount INT DEFAULT 4; + DECLARE vManaDiscount INT DEFAULT 3; + DECLARE vForceToGrouping INT DEFAULT 1; + DECLARE vForceToPacking INT DEFAULT 2; + DECLARE vFinalPrice DECIMAL(10,2); + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT s.ticketFk, + LEAST(s.quantity, vQuantity), + s.itemFk, + t.shipped, + t.warehouseFk, + t.landed, + t.addressFk, + t.agencyModeFk, + s.price + INTO vTicketFk, + vQuantity, + vItemFk, + vDate, + vWarehouseFk, + vLanded, + vAddressFk, + vAgencyModeFk, + vOldPrice + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + WHERE s.id = vSaleFk; + + CALL buyUltimate(vWarehouseFk, vDate); + + SELECT `grouping`, groupingMode, packing + INTO vGrouping,vGroupingModeFk,vPacking + FROM buy b + JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk + WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk; + + IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN + SET vRoundQuantity = vPacking; + END IF; + IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN + SET vRoundQuantity = vGrouping; + END IF; + + CALL catalog_calcFromItem( + vLanded, + vAddressFk, + vAgencyModeFk, + vNewItemFk); + + SELECT price INTO vNewPrice + FROM tmp.ticketCalculateItem; + + IF vNewPrice IS NULL THEN + CALL util.throw('price retrieval failed'); + END IF; + IF vNewPrice > vOldPrice THEN + SET vFinalPrice = vOldPrice; + IF worker_isInDepartment('vt') THEN + SET vOption = vManaDiscount; + ELSE + SET vOption = vBuyerDiscount; + END IF; + ELSE + SET vFinalPrice = vNewPrice; + SET vOption = vChangePrice; + END IF; + + START TRANSACTION; + + UPDATE sale + SET quantity = quantity - vQuantity + WHERE id = vSaleFk; + + INSERT INTO vn.sale(ticketFk, + itemFk, + quantity, + concept, + price) + SELECT vTicketFk, + vNewItemFk, + CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName), + vFinalPrice + FROM vn.item i + WHERE id = vNewItemFk; + + SELECT LAST_INSERT_ID() INTO vNewSaleFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT id saleFk, vWarehouseFk warehouseFk + FROM sale s WHERE id = vNewSaleFk; + + CALL ticketComponentUpdateSale(vOption); + CALL catalog_componentPurge(); + + INSERT INTO itemProposal(itemFk, mateFk, counter) + VALUES(vItemFk, vNewItemFk, 1) + ON DUPLICATE KEY UPDATE counter = counter + 1; + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67801,25 +67749,6 @@ BEGIN GROUP BY p.supplierFk) sdpmc ON sdpmc.supplierFk = s.id SET s.isPayMethodChecked = FALSE; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `test` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `test`() -BEGIN -select 'procedimiento ejecutado con éxito'; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68653,7 +68582,7 @@ BEGIN JOIN vn.parking p ON p.id = tp.parkingFk JOIN vn.sector sc ON sc.id = p.sectorFk LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk JOIN vn.ticket t ON t.id = tp.ticketFk JOIN vn.zone z ON z.id = t.zoneFk JOIN vn.agencyMode am ON am.id = z.agencyModeFk @@ -68956,7 +68885,7 @@ BEGIN JOIN vn.parking p ON p.id = tp.parkingFk JOIN vn.sector sc ON sc.id = p.sectorFk LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk JOIN vn.ticket t ON t.id = tp.ticketFk JOIN vn.zone z ON z.id = t.zoneFk JOIN vn.agencyMode am ON am.id = z.agencyModeFk @@ -69073,7 +69002,7 @@ BEGIN SELECT s.alertLevel INTO vAlertLevel FROM state s JOIN ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vTicketFk + WHERE tst.ticketFk = vTicketFk LIMIT 1; IF vAlertLevel < 2 THEN @@ -70917,47 +70846,58 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`( + vTicketFk INT, + vNewShipped DATETIME, + vWarehouseFk INT +) BEGIN /** * Cálcula el stock movible para los artículos de un ticket - * vDatedNew debe ser menor que vDatedOld, en los otros casos se + * vNewShipped debe ser menor que vOldShipped, en los otros casos se * asume que siempre es posible * * @param vTicketFk -> Ticket - * @param vDatedNew -> Nueva fecha + * @param vNewShipped -> Nueva fecha * @return Sales con Movible -*/ - DECLARE vDatedOld DATETIME; - SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY); +*/ + DECLARE vOldShipped DATETIME; - SELECT t.shipped INTO vDatedOld - FROM ticket t + SELECT t.shipped INTO vOldShipped + FROM ticket t WHERE t.id = vTicketFk; - CALL item_getStock(vWarehouseFk, vDatedNew, NULL); - CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL); - - SELECT s.id, - s.itemFk, - s.quantity, - s.concept, - s.price, + -- Añadimos un dia más para calcular el stock hasta vNewShipped inclusive + CALL item_getStock(vWarehouseFk, DATE_ADD(vNewShipped, INTERVAL 1 DAY), NULL); + CALL item_getMinacum( + vWarehouseFk, + vNewShipped, + DATEDIFF(DATE_SUB(vOldShipped, INTERVAL 1 DAY), vNewShipped), + NULL + ); + + SELECT s.id, + s.itemFk, + s.quantity, + s.concept, + s.price, s.reserved, - s.discount, - i.image, - i.subName, + s.discount, + i.image, + i.subName, il.stock + IFNULL(im.amount, 0) AS movable FROM ticket t JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk + AND im.warehouseFk = vWarehouseFk LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk WHERE t.id = vTicketFk; - DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; - + DROP TEMPORARY TABLE IF EXISTS + tmp.itemList, + tmp.itemMinacum; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72880,29 +72820,6 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `timeWorkerControl_check` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) -proc: BEGIN -/** - * deprecated call workerTimeControl_check - */ -CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73194,22 +73111,21 @@ DELIMITER ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, + IN vTravelFk INT, + IN vDateStart DATE, IN vDateEnd DATE, IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, OUT vNewTravelFk INT) BEGIN /** * Clona un travel junto con sus entradas y compras - * * @param vTravelFk travel plantilla a clonar * @param vDateStart fecha del shipment del nuevo travel * @param vDateEnd fecha del landing del nuevo travel - * @param vWarehouseOutFk fecha del salida del nuevo travel + * @param vWarehouseOutFk warehouse del salida del nuevo travel * @param vWarehouseInFk warehouse de landing del nuevo travel * @param vRef referencia del nuevo travel * @param vAgencyModeFk del nuevo travel @@ -73219,34 +73135,35 @@ BEGIN DECLARE vEvaNotes VARCHAR(255); DECLARE vDone BOOL; DECLARE vAuxEntryFk INT; + DECLARE vTx BOOLEAN DEFAULT @@in_transaction; DECLARE vRsEntry CURSOR FOR SELECT e.id FROM entry e JOIN travel t ON t.id = e.travelFk WHERE e.travelFk = vTravelFk; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; + BEGIN + CALL util.tx_rollback(vTx); RESIGNAL; END; - - START TRANSACTION; + + CALL util.tx_start(vTx); INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom) SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk FROM travel WHERE id = vTravelFk; - + SET vNewTravelFk = LAST_INSERT_ID(); SET vDone = FALSE; SET @isModeInventory = TRUE; OPEN vRsEntry; - + l: LOOP SET vDone = FALSE; FETCH vRsEntry INTO vAuxEntryFk; @@ -73256,7 +73173,7 @@ BEGIN END IF; CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk); - CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); + CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk); SELECT evaNotes INTO vEvaNotes FROM entry @@ -73270,7 +73187,7 @@ BEGIN SET @isModeInventory = FALSE; CLOSE vRsEntry; - COMMIT; + CALL util.tx_commit(vTx); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74778,88 +74695,6 @@ BEGIN INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) VALUES(vWorkerFk, vWorkerMistakeTypeFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME) -BEGIN - - /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk) - VALUES(vUserFk, vDated, FALSE, vWarehouseFk); - - CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ - - CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlPinGenerate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlPinGenerate`( - vWorkerFk INT) -BEGIN -/** - * Create new pin for workerFk or new pin for all workers if vWorkerFk is null - * - */ - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSetOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder`() -BEGIN - - SET @order := 1; - SET @userFk := 0; - SET @day := 0; - - UPDATE tmp.workerTimeControl - SET `order` = IF(userFk = @userFk AND day(timed) = @day, @order := @order + 1, @order := 1), - userFk = @userFk := userFk, - manual = manual + (0 * @day := day(timed)) - ORDER BY userFk, timed; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74894,27 +74729,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) -BEGIN - - - SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_calculateOddDays` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -75309,33 +75123,35 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_clockIn` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`( vWorkerFk INT, vTimed DATETIME, - vDirection VARCHAR(10) + vDirection VARCHAR(10), + vDevice VARCHAR(255) ) BEGIN /** - * Verifica si el empleado puede fichar - * @param vWorkerFk Identificador del trabajador - * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW - * @param vDirection solo se pueden pasa los valores del campo - * workerTimeControl.direction ENUM('in', 'out', 'middle') - * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. - * Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario - * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá - * fichada a la tabla vn.workerTimeControl - */ - +* Verifica si el empleado puede fichar +* @param vWorkerFk Identificador del trabajador +* @param vTimed Balor de la fichada, IF vTimed IS NULL vTimed = NOW +* @param vDirection Solo se pueden pasa los valores del campo +* workerTimeControl.direction ENUM('in', 'out', 'middle') +* @param vDevice Dispositivo en el que se ha fichado +* @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. +* Si hay algún problema, devuelve el mesaje que se debe mostrar al usuario +* Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá +* fichada a la tabla vn.workerTimeControl +*/ + DECLARE vLastIn DATETIME; DECLARE vLastOut DATETIME; DECLARE vNextIn DATETIME; @@ -75588,16 +75404,16 @@ BEGIN GROUP BY breakCounter HAVING hasError LIMIT 1; - + IF vIsError THEN SET vErrorCode = 'BREAK_WEEK'; CALL util.throw(vErrorCode); END IF; END IF; - - -- SE PERMITE FICHAR - INSERT INTO workerTimeControl(userFk, timed, direction, `manual`) - VALUES(vWorkerFk, vTimed, vDirection, vIsManual); + + -- Se permite fichar + INSERT INTO workerTimeControl(userFk, timed, direction, device, `manual`) + VALUES(vWorkerFk, vTimed, vDirection, vDevice, vIsManual); SELECT LAST_INSERT_ID() id; @@ -75867,58 +75683,6 @@ BEGIN CALL vn.workerTimeControlSOWP(vUserFk, vTimed); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_repair` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_repair`() -proc: BEGIN -/** - * Corrige las fichadas - * - */ - -/*1- poner todos a middle*/ -UPDATE vn.workerTimeControl SET direction = 'middle'; - -/*2- poner los out*/ -UPDATE vn.workerTimeControl wtc - JOIN - (SELECT userFk,MAX(timed) maxTimed FROM - (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub - GROUP BY userFk,dated - )sub - SET direction = "out" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed; - - /*3- poner los in*/ -UPDATE vn.workerTimeControl wtc - JOIN - (SELECT userFk,MIN(timed) maxTimed FROM - (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub - GROUP BY userFk,dated - )sub - SET direction = "in" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed ; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76094,34 +75858,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_setOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE) -BEGIN - - SET @order := 0; - SET @day := '2000-01-01'; - - UPDATE vn.workerTimeControl w - SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1 - WHERE w.userFk = vUserFk - AND w.timed BETWEEN vStarted AND util.dayend(vFinished) - ORDER BY w.timed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_weekCheckBreak` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -79800,60 +79536,6 @@ SET character_set_client = utf8; 1 AS `description` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `Rutas_Master` --- - -DROP TABLE IF EXISTS `Rutas_Master`; -/*!50001 DROP VIEW IF EXISTS `Rutas_Master`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Rutas_Master` AS SELECT - 1 AS `id`, - 1 AS `warehouse_id`, - 1 AS `km`, - 1 AS `bultos`, - 1 AS `vehiculos_coste`, - 1 AS `personal_coste`, - 1 AS `vehiculos_numero`, - 1 AS `personal_numero`, - 1 AS `gasoil`, - 1 AS `autonomos`, - 1 AS `año`, - 1 AS `mes`, - 1 AS `gastos`, - 1 AS `bultos_autonomos`, - 1 AS `coste_km`, - 1 AS `coste_bulto`, - 1 AS `coste_bulto_autonomo`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Rutas_monitor` --- - -DROP TABLE IF EXISTS `Rutas_monitor`; -/*!50001 DROP VIEW IF EXISTS `Rutas_monitor`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Rutas_monitor` AS SELECT - 1 AS `Id_Ruta`, - 1 AS `name`, - 1 AS `Ubicacion`, - 1 AS `pedidosEncajados`, - 1 AS `pedidosLibres`, - 1 AS `pedidosProduccion`, - 1 AS `bultos`, - 1 AS `notas`, - 1 AS `fecha`, - 1 AS `dockFk`, - 1 AS `m3`, - 1 AS `priority`, - 1 AS `etd`, - 1 AS `expeditionTruckFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `Saldos_Prevision` -- @@ -80193,37 +79875,6 @@ CREATE TABLE `Vehiculos_consumo` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `VerEspionaje` --- - -DROP TABLE IF EXISTS `VerEspionaje`; -/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `VerEspionaje` AS SELECT - 1 AS `CodigoTrabajador`, - 1 AS `Fecha`, - 1 AS `HoraEntrada`, - 1 AS `HoraSalida`, - 1 AS `Id_Equipo`, - 1 AS `Id_Trabajador` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Vistas` --- - -DROP TABLE IF EXISTS `Vistas`; -/*!50001 DROP VIEW IF EXISTS `Vistas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Vistas` AS SELECT - 1 AS `vista_id`, - 1 AS `code`, - 1 AS `vista` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `XDiario` -- @@ -80603,7 +80254,7 @@ CREATE TABLE `awb_component` ( `Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2, `recibida_id` mediumint(8) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`,`Fecha`), + UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`), KEY `Id_Moneda` (`Id_Moneda`), KEY `awb_component_fk` (`awb_component_type_id`), KEY `awb_role_fk` (`awb_role_id`), @@ -81212,84 +80863,6 @@ SET character_set_client = utf8; 1 AS `addressFk` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `client_observation` --- - -DROP TABLE IF EXISTS `client_observation`; -/*!50001 DROP VIEW IF EXISTS `client_observation`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `client_observation` AS SELECT - 1 AS `client_observation_id`, - 1 AS `Id_Cliente`, - 1 AS `Id_Trabajador`, - 1 AS `text`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_gestdoc` --- - -DROP TABLE IF EXISTS `clientes_gestdoc`; -/*!50001 DROP VIEW IF EXISTS `clientes_gestdoc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_gestdoc` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `gest_doc_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_regalos_enc` --- - -DROP TABLE IF EXISTS `clientes_regalos_enc`; -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_enc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_regalos_enc` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `Id_Regalo`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_regalos_lista_enc` --- - -DROP TABLE IF EXISTS `clientes_regalos_lista_enc`; -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_lista_enc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_regalos_lista_enc` AS SELECT - 1 AS `Id_Regalo`, - 1 AS `Descripcion`, - 1 AS `foto`, - 1 AS `activo`, - 1 AS `datstart`, - 1 AS `datend`, - 1 AS `warehouse_id`, - 1 AS `province_id`, - 1 AS `countryFk` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `clientes_tipo` --- - -DROP TABLE IF EXISTS `clientes_tipo`; -/*!50001 DROP VIEW IF EXISTS `clientes_tipo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientes_tipo` AS SELECT - 1 AS `clientes_tipo_id`, - 1 AS `code`, - 1 AS `tipo`, - 1 AS `isCreatedAsServed` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `commission` -- @@ -81404,20 +80977,6 @@ CREATE TABLE `cooler_path` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define el orden en que se imprimen los F5'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `cooler_path_detail` --- - -DROP TABLE IF EXISTS `cooler_path_detail`; -/*!50001 DROP VIEW IF EXISTS `cooler_path_detail`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cooler_path_detail` AS SELECT - 1 AS `cooler_path_detail_id`, - 1 AS `cooler_path_id`, - 1 AS `pasillo` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `cp` -- @@ -81435,22 +80994,6 @@ CREATE TABLE `cp` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `credit` --- - -DROP TABLE IF EXISTS `credit`; -/*!50001 DROP VIEW IF EXISTS `credit`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `credit` AS SELECT - 1 AS `id`, - 1 AS `Id_Cliente`, - 1 AS `Id_Trabajador`, - 1 AS `amount`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `credit_card` -- @@ -81900,25 +81443,6 @@ SET character_set_client = utf8; 1 AS `hasCompany` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `escritos_det` --- - -DROP TABLE IF EXISTS `escritos_det`; -/*!50001 DROP VIEW IF EXISTS `escritos_det`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `escritos_det` AS SELECT - 1 AS `id`, - 1 AS `Id_Cliente`, - 1 AS `escritos_id`, - 1 AS `fecha`, - 1 AS `Id_Trabajador`, - 1 AS `userFk`, - 1 AS `empresa_id`, - 1 AS `saldo` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `expeditions` -- @@ -82327,74 +81851,6 @@ SET character_set_client = utf8; 1 AS `ticketFk` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `iva_codigo` --- - -DROP TABLE IF EXISTS `iva_codigo`; -/*!50001 DROP VIEW IF EXISTS `iva_codigo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_codigo` AS SELECT - 1 AS `id`, - 1 AS `fecha`, - 1 AS `codigo`, - 1 AS `iva_tipo_id`, - 1 AS `iva`, - 1 AS `recargo`, - 1 AS `tipo`, - 1 AS `link`, - 1 AS `isActive`, - 1 AS `updated`, - 1 AS `transactionCode` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `iva_group` --- - -DROP TABLE IF EXISTS `iva_group`; -/*!50001 DROP VIEW IF EXISTS `iva_group`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_group` AS SELECT - 1 AS `iva_group_id`, - 1 AS `description`, - 1 AS `code` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `iva_group_codigo` --- - -DROP TABLE IF EXISTS `iva_group_codigo`; -/*!50001 DROP VIEW IF EXISTS `iva_group_codigo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_group_codigo` AS SELECT - 1 AS `iva_group_id`, - 1 AS `date`, - 1 AS `iva_codigo_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `iva_tipo` --- - -DROP TABLE IF EXISTS `iva_tipo`; -/*!50001 DROP VIEW IF EXISTS `iva_tipo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `iva_tipo` AS SELECT - 1 AS `id`, - 1 AS `alias`, - 1 AS `isAccrued`, - 1 AS `serie_id`, - 1 AS `TIPOOPE`, - 1 AS `descripcion`, - 1 AS `Id_Pais` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `jerarquia` -- @@ -82545,89 +82001,6 @@ CREATE TABLE `nichos` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `observation_type` --- - -DROP TABLE IF EXISTS `observation_type`; -/*!50001 DROP VIEW IF EXISTS `observation_type`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `observation_type` AS SELECT - 1 AS `observation_type_id`, - 1 AS `description` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order` --- - -DROP TABLE IF EXISTS `order`; -/*!50001 DROP VIEW IF EXISTS `order`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order` AS SELECT - 1 AS `id`, - 1 AS `date_make`, - 1 AS `date_send`, - 1 AS `customer_id`, - 1 AS `delivery_method_id`, - 1 AS `agency_id`, - 1 AS `address_id`, - 1 AS `note`, - 1 AS `confirmed`, - 1 AS `is_bionic`, - 1 AS `source_app` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order_Tickets` --- - -DROP TABLE IF EXISTS `order_Tickets`; -/*!50001 DROP VIEW IF EXISTS `order_Tickets`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_Tickets` AS SELECT - 1 AS `order_id`, - 1 AS `Id_Ticket` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order_component` --- - -DROP TABLE IF EXISTS `order_component`; -/*!50001 DROP VIEW IF EXISTS `order_component`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_component` AS SELECT - 1 AS `order_row_id`, - 1 AS `component_id`, - 1 AS `price` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `order_row` --- - -DROP TABLE IF EXISTS `order_row`; -/*!50001 DROP VIEW IF EXISTS `order_row`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_row` AS SELECT - 1 AS `id`, - 1 AS `order_id`, - 1 AS `item_id`, - 1 AS `warehouse_id`, - 1 AS `shipment`, - 1 AS `amount`, - 1 AS `price`, - 1 AS `rate`, - 1 AS `created`, - 1 AS `Id_Movimiento` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `pago` -- @@ -83335,58 +82708,6 @@ CREATE TABLE `scan_line` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `sharingcart` --- - -DROP TABLE IF EXISTS `sharingcart`; -/*!50001 DROP VIEW IF EXISTS `sharingcart`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `sharingcart` AS SELECT - 1 AS `id`, - 1 AS `Id_Trabajador`, - 1 AS `datSTART`, - 1 AS `datEND`, - 1 AS `Id_Suplente`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `sharingclient` --- - -DROP TABLE IF EXISTS `sharingclient`; -/*!50001 DROP VIEW IF EXISTS `sharingclient`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `sharingclient` AS SELECT - 1 AS `id`, - 1 AS `Id_Trabajador`, - 1 AS `datSTART`, - 1 AS `datEND`, - 1 AS `Id_Cliente` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `sms` --- - -DROP TABLE IF EXISTS `sms`; -/*!50001 DROP VIEW IF EXISTS `sms`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `sms` AS SELECT - 1 AS `id`, - 1 AS `Id_trabajador`, - 1 AS `from`, - 1 AS `to`, - 1 AS `text`, - 1 AS `sent`, - 1 AS `response`, - 1 AS `DATE_ODBC` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `sort_merge_results_ernesto` -- @@ -83510,24 +82831,6 @@ SET character_set_client = utf8; 1 AS `base` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `tarifas` --- - -DROP TABLE IF EXISTS `tarifas`; -/*!50001 DROP VIEW IF EXISTS `tarifas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `tarifas` AS SELECT - 1 AS `tarifa_id`, - 1 AS `fecha`, - 1 AS `warehouse_id`, - 1 AS `t0`, - 1 AS `t1`, - 1 AS `t2`, - 1 AS `t3` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `tblContadores` -- @@ -83659,48 +82962,6 @@ SET character_set_client = utf8; 1 AS `model` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `ticketCreationData` --- - -DROP TABLE IF EXISTS `ticketCreationData`; -/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketCreationData` AS SELECT - 1 AS `DiadelaSemana`, - 1 AS `Hora`, - 1 AS `Fecha`, - 1 AS `Dispositivo` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `ticketMRW` --- - -DROP TABLE IF EXISTS `ticketMRW`; -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketMRW` AS SELECT - 1 AS `id_Agencia`, - 1 AS `empresa_id`, - 1 AS `Consignatario`, - 1 AS `DOMICILIO`, - 1 AS `POBLACION`, - 1 AS `CODPOSTAL`, - 1 AS `telefono`, - 1 AS `movil`, - 1 AS `IF`, - 1 AS `Id_Ticket`, - 1 AS `warehouse_id`, - 1 AS `Id_Consigna`, - 1 AS `CodigoPais`, - 1 AS `Fecha`, - 1 AS `province_id`, - 1 AS `landing` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `ticket_location__` -- @@ -83796,32 +83057,6 @@ CREATE TABLE `tmpNEWTARIFAS` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `tr2` --- - -DROP TABLE IF EXISTS `tr2`; -/*!50001 DROP VIEW IF EXISTS `tr2`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `tr2` AS SELECT - 1 AS `id`, - 1 AS `shipped`, - 1 AS `shipmentHour`, - 1 AS `landed`, - 1 AS `landingHour`, - 1 AS `warehouseInFk`, - 1 AS `warehouseOutFk`, - 1 AS `agencyFk`, - 1 AS `ref`, - 1 AS `isDelivered`, - 1 AS `isReceived`, - 1 AS `m3`, - 1 AS `kg`, - 1 AS `cargoSupplierFk`, - 1 AS `totalEntries` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `transport` -- @@ -83921,24 +83156,6 @@ CREATE TABLE `travel_reserve` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla almacenamos los m3 que cada comprador tiene asignados, por travel.'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `travel_thermograph` --- - -DROP TABLE IF EXISTS `travel_thermograph`; -/*!50001 DROP VIEW IF EXISTS `travel_thermograph`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `travel_thermograph` AS SELECT - 1 AS `thermograph_id`, - 1 AS `odbc_date`, - 1 AS `warehouse_id`, - 1 AS `travel_id`, - 1 AS `temperature`, - 1 AS `result`, - 1 AS `gestdoc_id` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `trolley` -- @@ -84098,53 +83315,6 @@ SET character_set_client = utf8; 1 AS `ediBotanic` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_account` --- - -DROP TABLE IF EXISTS `v_account`; -/*!50001 DROP VIEW IF EXISTS `v_account`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_account` AS SELECT - 1 AS `user_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_analisis_ventas` --- - -DROP TABLE IF EXISTS `v_analisis_ventas`; -/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_analisis_ventas` AS SELECT - 1 AS `Familia`, - 1 AS `Reino`, - 1 AS `Comercial`, - 1 AS `Comprador`, - 1 AS `Provincia`, - 1 AS `almacen`, - 1 AS `Año`, - 1 AS `Mes`, - 1 AS `Semana`, - 1 AS `Vista`, - 1 AS `Importe` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_barcodes` --- - -DROP TABLE IF EXISTS `v_barcodes`; -/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_barcodes` AS SELECT - 1 AS `code`, - 1 AS `Id_Article` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_compres` -- @@ -84211,41 +83381,6 @@ SET character_set_client = utf8; 1 AS `producer_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_departure_limit` --- - -DROP TABLE IF EXISTS `v_departure_limit`; -/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_departure_limit` AS SELECT - 1 AS `warehouse_id`, - 1 AS `fecha`, - 1 AS `hora`, - 1 AS `minSpeed` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_descuadre_bionic` --- - -DROP TABLE IF EXISTS `v_descuadre_bionic`; -/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_descuadre_bionic` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `Alias`, - 1 AS `Concepte`, - 1 AS `suma_componente`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `diferencia`, - 1 AS `Fecha`, - 1 AS `benvenut` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_empresa` -- @@ -84272,24 +83407,6 @@ SET character_set_client = utf8; 1 AS `abbreviation` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_inter` --- - -DROP TABLE IF EXISTS `v_inter`; -/*!50001 DROP VIEW IF EXISTS `v_inter`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_inter` AS SELECT - 1 AS `inter_id`, - 1 AS `state_id`, - 1 AS `nota`, - 1 AS `odbc_date`, - 1 AS `Id_Ticket`, - 1 AS `Id_Trabajador`, - 1 AS `Id_supervisor` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_jerarquia` -- @@ -84303,84 +83420,6 @@ SET character_set_client = utf8; 1 AS `boss_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_miriam` --- - -DROP TABLE IF EXISTS `v_miriam`; -/*!50001 DROP VIEW IF EXISTS `v_miriam`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_miriam` AS SELECT - 1 AS `Id_Article`, - 1 AS `Concepte`, - 1 AS `Cantidad`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `Fecha`, - 1 AS `Id_Cliente`, - 1 AS `Importe` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_price_fixed` --- - -DROP TABLE IF EXISTS `v_price_fixed`; -/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_price_fixed` AS SELECT - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `rate_0`, - 1 AS `rate_1`, - 1 AS `rate_2`, - 1 AS `rate_3`, - 1 AS `date_start`, - 1 AS `date_end`, - 1 AS `bonus`, - 1 AS `grouping`, - 1 AS `Packing`, - 1 AS `caja` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_price_fixed_group` --- - -DROP TABLE IF EXISTS `v_price_fixed_group`; -/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_price_fixed_group` AS SELECT - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `rate_0`, - 1 AS `rate_1`, - 1 AS `rate_2`, - 1 AS `rate_3`, - 1 AS `date_start`, - 1 AS `date_end`, - 1 AS `bonus`, - 1 AS `grouping`, - 1 AS `Packing`, - 1 AS `caja` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_ticket_amount` --- - -DROP TABLE IF EXISTS `v_ticket_amount`; -/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ticket_amount` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `amount` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_ventes` -- @@ -84425,32 +83464,6 @@ SET character_set_client = utf8; 1 AS `producer_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_warehouse` --- - -DROP TABLE IF EXISTS `v_warehouse`; -/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_warehouse` AS SELECT - 1 AS `id`, - 1 AS `almacen` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_xsubclien` --- - -DROP TABLE IF EXISTS `v_xsubclien`; -/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubclien` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `empresa_id` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `v_xsubcuentas` -- @@ -84473,19 +83486,6 @@ SET character_set_client = utf8; 1 AS `IDNIF` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_xsubprov` --- - -DROP TABLE IF EXISTS `v_xsubprov`; -/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubprov` AS SELECT - 1 AS `proveedor_id`, - 1 AS `empresa_id` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `versiones` -- @@ -84517,52 +83517,6 @@ CREATE TABLE `viaxpress` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `vnCreditClassification` --- - -DROP TABLE IF EXISTS `vnCreditClassification`; -/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnCreditClassification` AS SELECT - 1 AS `id`, - 1 AS `client`, - 1 AS `dateStart`, - 1 AS `dateEnd` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `vnCreditInsurance` --- - -DROP TABLE IF EXISTS `vnCreditInsurance`; -/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnCreditInsurance` AS SELECT - 1 AS `id`, - 1 AS `creditClassification`, - 1 AS `credit`, - 1 AS `creationDate`, - 1 AS `grade` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `vnSolunionCAP` --- - -DROP TABLE IF EXISTS `vnSolunionCAP`; -/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnSolunionCAP` AS SELECT - 1 AS `creditInsurance`, - 1 AS `dateStart`, - 1 AS `dateEnd`, - 1 AS `dateLeaving` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `warehouse` -- @@ -84591,19 +83545,6 @@ SET character_set_client = utf8; 1 AS `hasConfectionTeam` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `warehouse_alias` --- - -DROP TABLE IF EXISTS `warehouse_alias`; -/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouse_alias` AS SELECT - 1 AS `warehouse_alias_id`, - 1 AS `alias` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `warehouse_filtro` -- @@ -84738,20 +83679,6 @@ CREATE TABLE `wks` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `workcenter_holiday` --- - -DROP TABLE IF EXISTS `workcenter_holiday`; -/*!50001 DROP VIEW IF EXISTS `workcenter_holiday`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workcenter_holiday` AS SELECT - 1 AS `workcenter_id`, - 1 AS `day`, - 1 AS `year` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `workerDocument` -- @@ -84781,21 +83708,6 @@ SET character_set_client = utf8; 1 AS `user` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `zoneNickname` --- - -DROP TABLE IF EXISTS `zoneNickname`; -/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `zoneNickname` AS SELECT - 1 AS `warehouse_id`, - 1 AS `agency_id`, - 1 AS `zona`, - 1 AS `alias` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `zones` -- @@ -85865,14 +84777,12 @@ proc: BEGIN SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR; SET vRangeDeleteTicket = 60; - DELETE FROM Rutas_monitor WHERE fecha < vDate; DELETE FROM cdr WHERE calldate < vDate18; DELETE FROM Monitoring WHERE ODBC_TIME < vDate; DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < vDate; DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; - DELETE FROM sms WHERE DATE_ODBC < vDate18; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; @@ -85892,8 +84802,6 @@ proc: BEGIN JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate; DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; - DELETE FROM sharingcart where datEND < vDate; - DELETE FROM sharingclient where datEND < vDate; DELETE tt.* FROM Tickets_turno tt @@ -86366,7 +85274,20 @@ BEGIN SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION FROM Tickets t JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna - JOIN v_ticket_amount v ON v.Id_Ticket = t.Id_Ticket + JOIN ( + SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`, + sum( + `Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100 + ) AS `amount` + FROM ( + `vn2008`.`Movimientos` + JOIN `vn2008`.`Tickets` ON( + `Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket` + ) + ) + WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH + GROUP BY `Movimientos`.`Id_Ticket` + ) v ON v.Id_Ticket = t.Id_Ticket WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date) AND t.Id_Cliente = v_Client_Id; @@ -89675,24 +88596,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `__coolerPathDetail` --- - -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `__coolerPathDetail` AS select `c`.`cooler_path_detail_id` AS `id`,`c`.`cooler_path_id` AS `coolerPathFk`,`c`.`pasillo` AS `hallway` from `vn2008`.`cooler_path_detail` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `agencyTerm` -- @@ -90228,7 +89131,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`vn`.`expeditionTruck` `et` join `vn`.`expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) join `vn`.`expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `vn`.`expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `vn`.`ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `vn`.`route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `vn2008`.`Rutas_monitor` `rm` on(`rm`.`Id_Ruta` = `r`.`id`)) left join `vn`.`expeditionTruck` `et2` on(`et2`.`id` = `rm`.`expeditionTruckFk`)) group by `ep`.`id`,`t`.`routeFk` */; +/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,`et`.`id` <=> `rm`.`expeditionTruckFk` AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if(`r`.`created` > `util`.`VN_CURDATE`() + interval 1 day,ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`expeditionTruck` `et` join `expeditionPallet` `ep` on(`ep`.`truckFk` = `et`.`id`)) join `expeditionScan` `es` on(`es`.`palletFk` = `ep`.`id`)) join `expedition` `e` on(`e`.`id` = `es`.`expeditionFk`)) join `ticket` `t` on(`t`.`id` = `e`.`ticketFk`)) join `route` `r` on(`r`.`id` = `t`.`routeFk`)) left join `routesMonitor` `rm` on(`rm`.`routeFk` = `r`.`id`)) left join `expeditionTruck` `et2` on(`et2`.`id` = `rm`.`expeditionTruckFk`)) group by `ep`.`id`,`t`.`routeFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90660,7 +89563,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; +/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`sale` `s` join `ticket` `t` on(`t`.`id` = `s`.`ticketFk`)) join `agencyMode` `am` on(`am`.`id` = `t`.`agencyModeFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `tst`.`state`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `itemShelvingStock` `stock` on(`stock`.`itemFk` = `i`.`id`)) left join `saleTracking` `stk` on(`stk`.`saleFk` = `s`.`id`)) left join `zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `saleVolume` `sv` on(`sv`.`saleFk` = `s`.`id`)) where `t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(`util`.`VN_CURDATE`()) and `stk`.`id` is null and `stock`.`visible` > 0 and `stk`.`saleFk` is null and `st`.`isPreviousPreparable` <> 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91488,7 +90391,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticket` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`worker`)) where `td`.`selected` = 2 */; +/*!50001 VIEW `ticketDownBuffer` AS select `td`.`ticketFk` AS `ticketFk`,`td`.`created` AS `created`,`td`.`selected` AS `selected`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `sacador`,`pk`.`code` AS `parking` from ((((`ticketDown` `td` join `ticketParking` `tp` on(`tp`.`ticketFk` = `td`.`ticketFk`)) join `parking` `pk` on(`pk`.`id` = `tp`.`parkingFk`)) join `ticketStateToday` `tst` on(`tst`.`ticketFk` = `td`.`ticketFk`)) join `worker` `w` on(`w`.`id` = `tst`.`userFk`)) where `td`.`selected` = 2 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91632,7 +90535,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `worker`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */; +/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticketFk` AS `ticketFk`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`userFk` AS `userFk`,`ts`.`code` AS `code`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` from (`ticketState` `ts` join `ticket` `t` on(`t`.`id` = `ts`.`ticketFk`)) where `t`.`shipped` between `util`.`VN_CURDATE`() and `MIDNIGHT`(`util`.`VN_CURDATE`()) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -92028,7 +90931,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticket` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -92633,42 +91536,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Rutas_Master` --- - -/*!50001 DROP VIEW IF EXISTS `Rutas_Master`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Rutas_Master` AS select `rm`.`id` AS `id`,`rm`.`warehouseFk` AS `warehouse_id`,`rm`.`km` AS `km`,`rm`.`packages` AS `bultos`,`rm`.`vehicleCost` AS `vehiculos_coste`,`rm`.`staffCost` AS `personal_coste`,`rm`.`vehicle` AS `vehiculos_numero`,`rm`.`staff` AS `personal_numero`,`rm`.`fuel` AS `gasoil`,`rm`.`freelancers` AS `autonomos`,`rm`.`year` AS `año`,`rm`.`month` AS `mes`,`rm`.`expense` AS `gastos`,`rm`.`freelancersPackages` AS `bultos_autonomos`,`rm`.`kmCost` AS `coste_km`,`rm`.`packageCost` AS `coste_bulto`,`rm`.`freelancerPackageCost` AS `coste_bulto_autonomo`,`rm`.`created` AS `odbc_date` from `vn`.`routeMaster` `rm` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Rutas_monitor` --- - -/*!50001 DROP VIEW IF EXISTS `Rutas_monitor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Rutas_monitor` AS select `vn`.`routesMonitor`.`routeFk` AS `Id_Ruta`,`vn`.`routesMonitor`.`name` AS `name`,`vn`.`routesMonitor`.`beachFk` AS `Ubicacion`,`vn`.`routesMonitor`.`ticketPacked` AS `pedidosEncajados`,`vn`.`routesMonitor`.`ticketFree` AS `pedidosLibres`,`vn`.`routesMonitor`.`ticketProduction` AS `pedidosProduccion`,`vn`.`routesMonitor`.`packages` AS `bultos`,`vn`.`routesMonitor`.`note` AS `notas`,`vn`.`routesMonitor`.`dated` AS `fecha`,`vn`.`routesMonitor`.`dockFk` AS `dockFk`,`vn`.`routesMonitor`.`m3` AS `m3`,`vn`.`routesMonitor`.`priority` AS `priority`,`vn`.`routesMonitor`.`etd` AS `etd`,`vn`.`routesMonitor`.`expeditionTruckFk` AS `expeditionTruckFk` from `vn`.`routesMonitor` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Tickets` -- @@ -92813,42 +91680,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `VerEspionaje` --- - -/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `VerEspionaje` AS select `Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`vn2008`.`Espionajes`.`Fecha` AS `Fecha`,`vn2008`.`Espionajes`.`HoraEntrada` AS `HoraEntrada`,`vn2008`.`Espionajes`.`HoraSalida` AS `HoraSalida`,`vn2008`.`Espionajes`.`Id_Equipo` AS `Id_Equipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`Espionajes` join `vn2008`.`Trabajadores` on(`vn2008`.`Espionajes`.`Id_Trabajador` = `Trabajadores`.`Id_Trabajador`)) order by `Trabajadores`.`CodigoTrabajador`,`vn2008`.`Espionajes`.`Fecha` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Vistas` --- - -/*!50001 DROP VIEW IF EXISTS `Vistas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Vistas` AS select `dm`.`id` AS `vista_id`,`dm`.`code` AS `code`,`dm`.`description` AS `vista` from `vn`.`deliveryMethod` `dm` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `XDiario` -- @@ -93209,96 +92040,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `client_observation` --- - -/*!50001 DROP VIEW IF EXISTS `client_observation`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `client_observation` AS select `co`.`id` AS `client_observation_id`,`co`.`clientFk` AS `Id_Cliente`,`co`.`workerFk` AS `Id_Trabajador`,`co`.`text` AS `text`,`co`.`created` AS `odbc_date` from `vn`.`clientObservation` `co` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientes_gestdoc` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_gestdoc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_gestdoc` AS select `cd`.`clientFk` AS `Id_Cliente`,`cd`.`dmsFk` AS `gest_doc_id` from `vn`.`clientDms` `cd` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientes_regalos_enc` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_enc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_regalos_enc` AS select `cpg`.`clientFk` AS `Id_Cliente`,`cpg`.`giftFk` AS `Id_Regalo`,`cpg`.`added` AS `odbc_date` from `vn`.`clientPackagingGifts` `cpg` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientes_regalos_lista_enc` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_regalos_lista_enc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_regalos_lista_enc` AS select `pg`.`id` AS `Id_Regalo`,`pg`.`description` AS `Descripcion`,`pg`.`photo` AS `foto`,if(`util`.`VN_CURDATE`() between `pg`.`started` and `pg`.`ended`,1,0) AS `activo`,`pg`.`started` AS `datstart`,`pg`.`ended` AS `datend`,ifnull(`pg`.`warehouseFk`,0) AS `warehouse_id`,ifnull(`pg`.`provinceFk`,0) AS `province_id`,ifnull(`pg`.`countryFk`,0) AS `countryFk` from `vn`.`packagingGifts` `pg` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientes_tipo` --- - -/*!50001 DROP VIEW IF EXISTS `clientes_tipo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientes_tipo` AS select `ct`.`id` AS `clientes_tipo_id`,`ct`.`code` AS `code`,`ct`.`type` AS `tipo`,`ct`.`isCreatedAsServed` AS `isCreatedAsServed` from `vn`.`clientType` `ct` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `config_host` -- @@ -93335,42 +92076,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `cooler_path_detail` --- - -/*!50001 DROP VIEW IF EXISTS `cooler_path_detail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cooler_path_detail` AS select `cpd`.`id` AS `cooler_path_detail_id`,`cpd`.`coolerPathFk` AS `cooler_path_id`,`cpd`.`hallway` AS `pasillo` from `vn`.`coolerPathDetail` `cpd` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `credit` --- - -/*!50001 DROP VIEW IF EXISTS `credit`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `credit` AS select `c`.`id` AS `id`,`c`.`clientFk` AS `Id_Cliente`,`c`.`workerFk` AS `Id_Trabajador`,`c`.`amount` AS `amount`,`c`.`created` AS `odbc_date` from `vn`.`clientCredit` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `deliveryPoint` -- @@ -93677,24 +92382,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `escritos_det` --- - -/*!50001 DROP VIEW IF EXISTS `escritos_det`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `escritos_det` AS select `cs`.`id` AS `id`,`cs`.`clientFk` AS `Id_Cliente`,`cs`.`typeFk` AS `escritos_id`,`cs`.`created` AS `fecha`,`cs`.`workerFk` AS `Id_Trabajador`,`cs`.`userFk` AS `userFk`,`cs`.`companyFk` AS `empresa_id`,`cs`.`balance` AS `saldo` from `vn`.`clientSample` `cs` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `expeditions` -- @@ -93857,78 +92544,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `iva_codigo` --- - -/*!50001 DROP VIEW IF EXISTS `iva_codigo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_codigo` AS select `tc`.`id` AS `id`,`tc`.`dated` AS `fecha`,`tc`.`code` AS `codigo`,`tc`.`taxTypeFk` AS `iva_tipo_id`,`tc`.`rate` AS `iva`,`tc`.`equalizationTax` AS `recargo`,`tc`.`type` AS `tipo`,`tc`.`link` AS `link`,`tc`.`isActive` AS `isActive`,`tc`.`updated` AS `updated`,`tc`.`transactionCode` AS `transactionCode` from `vn`.`taxCode` `tc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `iva_group` --- - -/*!50001 DROP VIEW IF EXISTS `iva_group`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_group` AS select `tc`.`id` AS `iva_group_id`,`tc`.`description` AS `description`,`tc`.`code` AS `code` from `vn`.`taxClass` `tc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `iva_group_codigo` --- - -/*!50001 DROP VIEW IF EXISTS `iva_group_codigo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_group_codigo` AS select `tcc`.`taxClassFk` AS `iva_group_id`,`tcc`.`effectived` AS `date`,`tcc`.`taxCodeFk` AS `iva_codigo_id` from `vn`.`taxClassCode` `tcc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `iva_tipo` --- - -/*!50001 DROP VIEW IF EXISTS `iva_tipo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `iva_tipo` AS select `tt`.`id` AS `id`,`tt`.`nickname` AS `alias`,`tt`.`isAccrued` AS `isAccrued`,`tt`.`serial` AS `serie_id`,`tt`.`TIPOOPE` AS `TIPOOPE`,`tt`.`description` AS `descripcion`,`tt`.`countryFk` AS `Id_Pais` from `vn`.`taxType` `tt` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `mail` -- @@ -93983,96 +92598,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `observation_type` --- - -/*!50001 DROP VIEW IF EXISTS `observation_type`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `observation_type` AS select `co`.`id` AS `observation_type_id`,`co`.`description` AS `description` from `vn`.`observationType` `co` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order` --- - -/*!50001 DROP VIEW IF EXISTS `order`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order` AS select `hedera`.`order`.`id` AS `id`,`hedera`.`order`.`date_make` AS `date_make`,`hedera`.`order`.`date_send` AS `date_send`,`hedera`.`order`.`customer_id` AS `customer_id`,`hedera`.`order`.`delivery_method_id` AS `delivery_method_id`,`hedera`.`order`.`agency_id` AS `agency_id`,`hedera`.`order`.`address_id` AS `address_id`,`hedera`.`order`.`note` AS `note`,`hedera`.`order`.`confirmed` AS `confirmed`,`hedera`.`order`.`is_bionic` AS `is_bionic`,`hedera`.`order`.`source_app` AS `source_app` from `hedera`.`order` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order_Tickets` --- - -/*!50001 DROP VIEW IF EXISTS `order_Tickets`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_Tickets` AS select `ot`.`orderFk` AS `order_id`,`ot`.`ticketFk` AS `Id_Ticket` from `vn`.`orderTicket` `ot` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order_component` --- - -/*!50001 DROP VIEW IF EXISTS `order_component`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_component` AS select `c`.`order_row_id` AS `order_row_id`,`c`.`component_id` AS `component_id`,`c`.`price` AS `price` from `hedera`.`order_component` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order_row` --- - -/*!50001 DROP VIEW IF EXISTS `order_row`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_row` AS select `order_row`.`id` AS `id`,`order_row`.`order_id` AS `order_id`,`order_row`.`item_id` AS `item_id`,`order_row`.`warehouse_id` AS `warehouse_id`,`order_row`.`shipment` AS `shipment`,`order_row`.`amount` AS `amount`,`order_row`.`price` AS `price`,`order_row`.`rate` AS `rate`,`order_row`.`created` AS `created`,`order_row`.`Id_Movimiento` AS `Id_Movimiento` from `hedera`.`order_row` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `pago` -- @@ -94451,60 +92976,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `sharingcart` --- - -/*!50001 DROP VIEW IF EXISTS `sharingcart`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sharingcart` AS select `sc`.`id` AS `id`,`sc`.`workerFk` AS `Id_Trabajador`,`sc`.`started` AS `datSTART`,`sc`.`ended` AS `datEND`,`sc`.`workerSubstitute` AS `Id_Suplente`,`sc`.`created` AS `odbc_date` from `vn`.`sharingCart` `sc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `sharingclient` --- - -/*!50001 DROP VIEW IF EXISTS `sharingclient`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sharingclient` AS select `sc`.`id` AS `id`,`sc`.`workerFk` AS `Id_Trabajador`,`sc`.`started` AS `datSTART`,`sc`.`ended` AS `datEND`,`sc`.`clientFk` AS `Id_Cliente` from `vn`.`sharingClient` `sc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `sms` --- - -/*!50001 DROP VIEW IF EXISTS `sms`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sms` AS select `t`.`id` AS `id`,`t`.`senderFk` AS `Id_trabajador`,`t`.`sender` AS `from`,`t`.`destination` AS `to`,`t`.`message` AS `text`,`t`.`statusCode` AS `sent`,`t`.`status` AS `response`,`t`.`created` AS `DATE_ODBC` from `vn`.`sms` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `state` -- @@ -94577,24 +93048,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `tarifas` --- - -/*!50001 DROP VIEW IF EXISTS `tarifas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `tarifas` AS select `r`.`id` AS `tarifa_id`,`r`.`dated` AS `fecha`,`r`.`warehouseFk` AS `warehouse_id`,`r`.`rate0` AS `t0`,`r`.`rate1` AS `t1`,`r`.`rate2` AS `t2`,`r`.`rate3` AS `t3` from `vn`.`rate` `r` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `tblContadores` -- @@ -94631,42 +93084,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `ticketCreationData` --- - -/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketCreationData` AS select dayname(`h`.`confirm_date`) AS `DiadelaSemana`,hour(`h`.`confirm_date`) AS `Hora`,cast(`h`.`confirm_date` as date) AS `Fecha`,`h`.`source_app` AS `Dispositivo` from `hedera`.`order` `h` where `h`.`confirm_date` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ticketMRW` --- - -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketMRW` AS select `Tickets`.`Id_Agencia` AS `id_Agencia`,`Tickets`.`empresa_id` AS `empresa_id`,`Consignatarios`.`consignatario` AS `Consignatario`,`Consignatarios`.`domicilio` AS `DOMICILIO`,`Consignatarios`.`poblacion` AS `POBLACION`,`Consignatarios`.`codPostal` AS `CODPOSTAL`,`Consignatarios`.`telefono` AS `telefono`,`Consignatarios`.`movil` AS `movil`,`Clientes`.`if` AS `IF`,`Tickets`.`Id_Ticket` AS `Id_Ticket`,`Tickets`.`warehouse_id` AS `warehouse_id`,`Consignatarios`.`id_consigna` AS `Id_Consigna`,`Paises`.`Codigo` AS `CodigoPais`,`Tickets`.`Fecha` AS `Fecha`,`province`.`province_id` AS `province_id`,`Tickets`.`landing` AS `landing` from ((((`vn2008`.`Clientes` join `vn2008`.`Consignatarios` on(`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`)) join `vn2008`.`Tickets` on(`Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna`)) join `vn2008`.`province` on(`Consignatarios`.`province_id` = `province`.`province_id`)) join `vn2008`.`Paises` on(`province`.`Paises_Id` = `Paises`.`Id`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `ticket_observation` -- @@ -94721,24 +93138,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `tr2` --- - -/*!50001 DROP VIEW IF EXISTS `tr2`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `tr2` AS select `vn`.`travel`.`id` AS `id`,`vn`.`travel`.`shipped` AS `shipped`,`vn`.`travel`.`shipmentHour` AS `shipmentHour`,`vn`.`travel`.`landed` AS `landed`,`vn`.`travel`.`landingHour` AS `landingHour`,`vn`.`travel`.`warehouseInFk` AS `warehouseInFk`,`vn`.`travel`.`warehouseOutFk` AS `warehouseOutFk`,`vn`.`travel`.`agencyModeFk` AS `agencyFk`,`vn`.`travel`.`ref` AS `ref`,`vn`.`travel`.`isDelivered` AS `isDelivered`,`vn`.`travel`.`isReceived` AS `isReceived`,`vn`.`travel`.`m3` AS `m3`,`vn`.`travel`.`kg` AS `kg`,`vn`.`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,`vn`.`travel`.`totalEntries` AS `totalEntries` from `vn`.`travel` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `travel` -- @@ -94757,24 +93156,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `travel_thermograph` --- - -/*!50001 DROP VIEW IF EXISTS `travel_thermograph`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `travel_thermograph` AS select `tt`.`thermographFk` AS `thermograph_id`,`tt`.`created` AS `odbc_date`,`tt`.`warehouseFk` AS `warehouse_id`,`tt`.`travelFk` AS `travel_id`,`tt`.`temperatureFk` AS `temperature`,`tt`.`result` AS `result`,`tt`.`dmsFk` AS `gestdoc_id` from `vn`.`travelThermograph` `tt` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `v_Articles_botanical` -- @@ -94793,60 +93174,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_account` --- - -/*!50001 DROP VIEW IF EXISTS `v_account`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_account` AS select `a`.`id` AS `user_id` from `account`.`account` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_analisis_ventas` --- - -/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_analisis_ventas` AS select `bi`.`analisis_ventas`.`Familia` AS `Familia`,`bi`.`analisis_ventas`.`Reino` AS `Reino`,`bi`.`analisis_ventas`.`Comercial` AS `Comercial`,`bi`.`analisis_ventas`.`Comprador` AS `Comprador`,`bi`.`analisis_ventas`.`Provincia` AS `Provincia`,`bi`.`analisis_ventas`.`almacen` AS `almacen`,`bi`.`analisis_ventas`.`Año` AS `Año`,`bi`.`analisis_ventas`.`Mes` AS `Mes`,`bi`.`analisis_ventas`.`Semana` AS `Semana`,`bi`.`analisis_ventas`.`Vista` AS `Vista`,`bi`.`analisis_ventas`.`Importe` AS `Importe` from `bi`.`analisis_ventas` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_barcodes` --- - -/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_barcodes` AS select `Articles`.`Id_Article` AS `code`,`Articles`.`Id_Article` AS `Id_Article` from `vn2008`.`Articles` union all select `barcodes`.`code` AS `code`,`barcodes`.`Id_Article` AS `Id_Article` from `vn2008`.`barcodes` union all select `c`.`Id_Compra` AS `Id_Compra`,`c`.`Id_Article` AS `Id_Article` from ((`vn2008`.`Compres` `c` join `vn2008`.`Entradas` `e` on(`c`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `tr` on(`tr`.`id` = `e`.`travel_id`)) where `tr`.`landing` >= `util`.`VN_CURDATE`() + interval -15 day */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `v_compres` -- @@ -94865,42 +93192,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_departure_limit` --- - -/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_departure_limit` AS select `cache`.`departure_limit`.`warehouse_id` AS `warehouse_id`,`cache`.`departure_limit`.`fecha` AS `fecha`,`cache`.`departure_limit`.`hora` AS `hora`,`cache`.`departure_limit`.`minSpeed` AS `minSpeed` from `cache`.`departure_limit` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_descuadre_bionic` --- - -/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_descuadre_bionic` AS select `t`.`Id_Ticket` AS `Id_Ticket`,`t`.`Alias` AS `Alias`,`m`.`Concepte` AS `Concepte`,sum(`mc`.`Valor`) AS `suma_componente`,`m`.`Preu` AS `Preu`,`m`.`Descuento` AS `Descuento`,`m`.`Preu` * (100 - `m`.`Descuento`) / 100 - sum(`mc`.`Valor`) AS `diferencia`,`t`.`Fecha` AS `Fecha`,`m`.`Preu` > 0 and `tp`.`reino_id` <> 6 and `a`.`tipo_id` not in (7,115) AS `benvenut` from ((((((`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on(`m`.`Id_Ticket` = `t`.`Id_Ticket`)) join `vn2008`.`Clientes` `c` on(`t`.`Id_Cliente` = `c`.`id_cliente`)) join `vn2008`.`warehouse` `w` on(`w`.`id` = `t`.`warehouse_id`)) join `vn2008`.`Articles` `a` on(`m`.`Id_Article` = `a`.`Id_Article`)) join `vn2008`.`Tipos` `tp` on(`a`.`tipo_id` = `tp`.`tipo_id`)) left join `vn2008`.`Movimientos_componentes` `mc` on(`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`)) where `t`.`Fecha` >= '2015-09-01' and `t`.`empresa_id` in (442,791,567) and `w`.`reserve` <> 0 and `c`.`real` <> 0 and `tp`.`reino_id` <> 6 group by `m`.`Id_Movimiento` having abs(`diferencia`) > 0.01 or `diferencia` is null */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `v_empresa` -- @@ -94919,24 +93210,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_inter` --- - -/*!50001 DROP VIEW IF EXISTS `v_inter`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb3 */; -/*!50001 SET character_set_results = utf8mb3 */; -/*!50001 SET collation_connection = utf8mb3_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_inter` AS select `tt`.`id` AS `inter_id`,`tt`.`stateFk` AS `state_id`,`tt`.`notes` AS `nota`,`tt`.`created` AS `odbc_date`,`tt`.`ticketFk` AS `Id_Ticket`,`tt`.`userFk` AS `Id_Trabajador`,`tt`.`supervisorFk` AS `Id_supervisor` from `vn`.`ticketTracking` `tt` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `v_jerarquia` -- @@ -94955,78 +93228,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_miriam` --- - -/*!50001 DROP VIEW IF EXISTS `v_miriam`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_miriam` AS select `M`.`Id_Article` AS `Id_Article`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,`T`.`Fecha` AS `Fecha`,`T`.`Id_Cliente` AS `Id_Cliente`,`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe` from (((`vn2008`.`Tickets` `T` join `vn2008`.`Movimientos` `M` on(`T`.`Id_Ticket` = `M`.`Id_Ticket`)) join `vn2008`.`Articles` `A` on(`M`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) where `T`.`Fecha` >= '2011-01-01' and `A`.`tipo_id` = 7 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_price_fixed` --- - -/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_price_fixed` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `vn2008`.`price_fixed` `pf` where `pf`.`warehouse_id` < 1000 union all select `wg`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from (`vn2008`.`price_fixed` `pf` join `vn2008`.`warehouse_group` `wg`) where `wg`.`warehouse_alias_id` + 1000 = `pf`.`warehouse_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_price_fixed_group` --- - -/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_price_fixed_group` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `vn2008`.`v_price_fixed` `pf` group by `pf`.`warehouse_id`,`pf`.`item_id`,`pf`.`date_start`,`pf`.`date_end` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_ticket_amount` --- - -/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ticket_amount` AS select `Movimientos`.`Id_Ticket` AS `Id_Ticket`,sum(`Movimientos`.`Cantidad` * `Movimientos`.`Preu` * (100 - `Movimientos`.`Descuento`) / 100) AS `amount` from (`vn2008`.`Movimientos` join `vn2008`.`Tickets` on(`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`)) where `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + interval -6 month group by `Movimientos`.`Id_Ticket` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `v_ventes` -- @@ -95045,42 +93246,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_warehouse` --- - -/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `vn2008`.`warehouse` union all select 1000 + `warehouse_alias`.`warehouse_alias_id` AS `warehouse_alias_id`,concat(`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `vn2008`.`warehouse_alias` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubclien` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubclien` AS select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `v_xsubcuentas` -- @@ -95094,25 +93259,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`v_xsubclien`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join `vn2008`.`v_xsubclien` on(`Clientes`.`id_cliente` = `v_xsubclien`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`v_xsubclien`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join `vn2008`.`v_xsubprov` on(`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join `vn2008`.`v_xsubprov` on(`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubprov` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubprov` AS select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id` */; +/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join (select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month) `sub` on(`Clientes`.`id_cliente` = `sub`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`sub`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `sub`.`proveedor_id`,`sub`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `sub`.`proveedor_id`,`sub`.`empresa_id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -95135,60 +93282,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `vnCreditClassification` --- - -/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnCreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `client`,`vn`.`creditClassification`.`dateStart` AS `dateStart`,`vn`.`creditClassification`.`dateEnd` AS `dateEnd` from `vn`.`creditClassification` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `vnCreditInsurance` --- - -/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnCreditInsurance` AS select `vn`.`creditInsurance`.`id` AS `id`,`vn`.`creditInsurance`.`creditClassification` AS `creditClassification`,`vn`.`creditInsurance`.`credit` AS `credit`,`vn`.`creditInsurance`.`creationDate` AS `creationDate`,`vn`.`creditInsurance`.`grade` AS `grade` from `vn`.`creditInsurance` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `vnSolunionCAP` --- - -/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnSolunionCAP` AS select `vn`.`solunionCAP`.`creditInsurance` AS `creditInsurance`,`vn`.`solunionCAP`.`dateStart` AS `dateStart`,`vn`.`solunionCAP`.`dateEnd` AS `dateEnd`,`vn`.`solunionCAP`.`dateLeaving` AS `dateLeaving` from `vn`.`solunionCAP` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `warehouse` -- @@ -95207,42 +93300,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `warehouse_alias` --- - -/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouse_alias` AS select `wa`.`id` AS `warehouse_alias_id`,`wa`.`name` AS `alias` from `vn`.`warehouseAlias` `wa` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workcenter_holiday` --- - -/*!50001 DROP VIEW IF EXISTS `workcenter_holiday`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workcenter_holiday` AS select `wh`.`workCenterFk` AS `workcenter_id`,`wh`.`days` AS `day`,`wh`.`year` AS `year` from `vn`.`workCenterHoliday` `wh` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `workerDocument` -- @@ -95278,24 +93335,6 @@ USE `vn2008`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `zoneNickname` --- - -/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneNickname` AS select `ap`.`warehouse_id` AS `warehouse_id`,`ap`.`agency_id` AS `agency_id`,`ap`.`zona` AS `zona`,concat('ZONA ',`ap`.`zona`,' ',if(`ap`.`zona` = 20,'Madrid',`p`.`name`)) AS `alias` from (`vn2008`.`Agencias_province` `ap` join `vn2008`.`province` `p` on(`p`.`province_id` = `ap`.`province_id`)) group by `ap`.`zona`,`ap`.`warehouse_id`,`ap`.`agency_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -95306,4 +93345,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-01-25 16:24:11 +-- Dump completed on 2024-02-15 10:21:18 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index f68b463d2..2da83db43 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -1,4 +1,4 @@ --- MariaDB dump 10.19 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: db.verdnatura.es Database: account -- ------------------------------------------------------ @@ -517,7 +517,7 @@ USE `bs`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`clientNewBorn_beforeUpdate` BEFORE UPDATE ON `clientNewBorn` FOR EACH ROW BEGIN @@ -540,7 +540,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTask_beforeInsert` BEFORE INSERT ON `nightTask` FOR EACH ROW BEGIN @@ -566,7 +566,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTaskBeforeUpdate` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `bs`.`nightTask_beforeUpdate` BEFORE UPDATE ON `nightTask` FOR EACH ROW BEGIN @@ -610,7 +610,7 @@ USE `edi`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`item_feature_bi` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`item_feature_beforeInsert` BEFORE INSERT ON `item_feature` FOR EACH ROW BEGIN @@ -632,7 +632,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_beforeInsert` BEFORE INSERT ON `putOrder` FOR EACH ROW BEGIN @@ -658,7 +658,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`BEFORE UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_beforeUpdate` BEFORE UPDATE ON `putOrder` FOR EACH ROW BEGIN @@ -708,7 +708,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`putOrder_afterUpdate` AFTER UPDATE ON `putOrder` FOR EACH ROW BEGIN @@ -795,7 +795,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`supplyResponse_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `edi`.`supplyResponse_afterUpdate` AFTER UPDATE ON `supplyResponse` FOR EACH ROW BEGIN @@ -1412,7 +1412,7 @@ USE `sage`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `sage`.`movConta_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `sage`.`movConta_beforeUpdate` BEFORE UPDATE ON `movConta` FOR EACH ROW BEGIN @@ -1446,7 +1446,7 @@ USE `srt`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_BU` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`expedition_beforeUpdate` BEFORE UPDATE ON `expedition` FOR EACH ROW BEGIN @@ -1464,11 +1464,11 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`moving_AI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `srt`.`moving_afterInsert` AFTER INSERT ON `moving` FOR EACH ROW BEGIN @@ -1924,7 +1924,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeInsert` BEFORE INSERT ON `autonomy` FOR EACH ROW BEGIN @@ -1946,7 +1946,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_BU` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_beforeUpdate` BEFORE UPDATE ON `autonomy` FOR EACH ROW BEGIN @@ -1974,7 +1974,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_AD` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`autonomy_afterDelete` AFTER DELETE ON `autonomy` FOR EACH ROW BEGIN @@ -1994,7 +1994,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_bi` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awb_beforeInsert` BEFORE INSERT ON `awb` FOR EACH ROW BEGIN @@ -2059,7 +2059,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_BeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_beforeInsert` BEFORE INSERT ON `budgetNotes` FOR EACH ROW BEGIN @@ -2551,6 +2551,70 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeInsert` + BEFORE INSERT ON `calendar` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_beforeUpdate` + BEFORE UPDATE ON `calendar` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`calendar_afterDelete` + AFTER DELETE ON `calendar` + FOR EACH ROW +BEGIN + INSERT INTO workerLog + SET `action` = 'delete', + `changedModel` = 'Calendar', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`claim_beforeInsert` BEFORE INSERT ON `claim` FOR EACH ROW @@ -3026,13 +3090,13 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_AfterInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_afterInsert` AFTER INSERT ON `client` FOR EACH ROW BEGIN @@ -3246,15 +3310,15 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER clientCredit_AfterInsert -AFTER INSERT -ON clientCredit FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`clientCredit_afterInsert` + AFTER INSERT ON `clientCredit` + FOR EACH ROW BEGIN DECLARE vSender VARCHAR(50); @@ -3501,39 +3565,39 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE` - BEFORE UPDATE ON `collection` - FOR EACH ROW -BEGIN - - DECLARE vStateFk INT; - DECLARE vTotalLines INT; - DECLARE vPickedLines INT; - - IF NEW.saleTotalCount <= NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount - OR NEW.salePickedCount != OLD.salePickedCount) - THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'PREPARED'; - - SET NEW.stateFk = vStateFk; - - END IF; - - IF NEW.saleTotalCount > NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'ON_PREPARATION'; - - SET NEW.stateFk = vStateFk; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_beforeUpdate` + BEFORE UPDATE ON `collection` + FOR EACH ROW +BEGIN + + DECLARE vStateFk INT; + DECLARE vTotalLines INT; + DECLARE vPickedLines INT; + + IF NEW.saleTotalCount <= NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount + OR NEW.salePickedCount != OLD.salePickedCount) + THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'PREPARED'; + + SET NEW.stateFk = vStateFk; + + END IF; + + IF NEW.saleTotalCount > NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'ON_PREPARATION'; + + SET NEW.stateFk = vStateFk; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3743,7 +3807,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`country_afterInsert` AFTER INSERT ON `country` FOR EACH ROW BEGIN @@ -4414,7 +4478,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeInsert` BEFORE INSERT ON `duaTax` FOR EACH ROW BEGIN @@ -4435,7 +4499,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`duaTax_beforeUpdate` BEFORE UPDATE ON `duaTax` FOR EACH ROW BEGIN @@ -4858,7 +4922,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionPallet_beforeInsert` BEFORE INSERT ON `expeditionPallet` FOR EACH ROW BEGIN @@ -4886,7 +4950,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionScan_beforeInsert` BEFORE INSERT ON `expeditionScan` FOR EACH ROW BEGIN @@ -4908,7 +4972,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_BeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_beforeInsert` BEFORE INSERT ON `expeditionState` FOR EACH ROW BEGIN @@ -4922,15 +4986,15 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER expeditionState_AfterInsert -AFTER INSERT -ON expeditionState FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_afterInsert` + AFTER INSERT ON `expeditionState` + FOR EACH ROW BEGIN UPDATE vn.expedition e @@ -4952,7 +5016,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeInsert` BEFORE INSERT ON `expeditionTruck` FOR EACH ROW BEGIN @@ -4974,7 +5038,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeUpdate` BEFORE UPDATE ON `expeditionTruck` FOR EACH ROW BEGIN @@ -4996,7 +5060,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`floramondoConfig_afterInsert` AFTER INSERT ON `floramondoConfig` FOR EACH ROW BEGIN @@ -5122,7 +5186,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_bi` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeInsert` BEFORE INSERT ON `invoiceIn` FOR EACH ROW BEGIN @@ -5186,7 +5250,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_bu` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_beforeUpdate` BEFORE UPDATE ON `invoiceIn` FOR EACH ROW BEGIN @@ -5227,7 +5291,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_au` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`invoiceIn_afterUpdate` AFTER UPDATE ON `invoiceIn` FOR EACH ROW BEGIN @@ -5664,15 +5728,7 @@ BEGIN DECLARE vNewPackingShelve INT; SET NEW.editorFk = account.myUser_getId(); - - IF ISNULL(NEW.packingShelve) AND NOT ISNULL(NEW.packingOut) THEN - SELECT NEW.packingOut * vc.shelveVolume / vc.standardFlowerBox - INTO vNewPackingShelve - FROM vn.volumeConfig vc; - - SET NEW.packingShelve = vNewPackingShelve; - END IF; - + IF NEW.itemPackingTypeFk = '' THEN SET NEW.itemPackingTypeFk = NULL; END IF; @@ -5867,7 +5923,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemCategory_afterInsert` AFTER INSERT ON `itemCategory` FOR EACH ROW BEGIN @@ -5955,7 +6011,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeInsert` BEFORE INSERT ON `itemShelving` FOR EACH ROW BEGIN @@ -5977,7 +6033,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterInsert` AFTER INSERT ON `itemShelving` FOR EACH ROW INSERT INTO vn.itemShelvingLog( itemShelvingFk, @@ -6011,7 +6067,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeUpdate` BEFORE UPDATE ON `itemShelving` FOR EACH ROW BEGIN @@ -6034,11 +6090,10 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_afterUpdate` AFTER UPDATE ON `itemShelving` FOR EACH ROW - - INSERT INTO itemShelvingLog +INSERT INTO itemShelvingLog SET itemShelvingFk = NEW.id, workerFk = account.myUser_getId(), accion = 'CAMBIO', @@ -6061,7 +6116,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_BEFORE_DELETE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_beforeDelete` BEFORE DELETE ON `itemShelving` FOR EACH ROW INSERT INTO vn.itemShelvingLog(itemShelvingFk, @@ -6106,13 +6161,13 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_afterInsert` AFTER INSERT ON `itemShelvingSale` FOR EACH ROW BEGIN @@ -6366,7 +6421,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_BI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_beforeInsert` BEFORE INSERT ON `machine` FOR EACH ROW BEGIN @@ -6584,7 +6639,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeInsert` BEFORE INSERT ON `parking` FOR EACH ROW BEGIN @@ -6606,7 +6661,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_beforeUpdate` BEFORE UPDATE ON `parking` FOR EACH ROW BEGIN @@ -6935,13 +6990,13 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER projectNotes_BeforeInsert -BEFORE INSERT -ON projectNotes FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`projectNotes_beforeInsert` + BEFORE INSERT ON `projectNotes` + FOR EACH ROW BEGIN IF ISNULL(NEW.userFk) THEN @@ -7742,7 +7797,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_BEFORE_DELETE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeDelete` BEFORE DELETE ON `sale` FOR EACH ROW BEGIN @@ -7832,7 +7887,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_beforeInsert` BEFORE INSERT ON `saleBuy` FOR EACH ROW BEGIN @@ -7854,31 +7909,6 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI` - AFTER INSERT ON `saleBuy` - FOR EACH ROW -BEGIN -/* Activar de nuevo cuando volvamos a vender fruta y verdura - * - UPDATE vn.sale s - SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk) - WHERE s.id = NEW.saleFk; -*/ -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleGroup_beforeInsert` BEFORE INSERT ON `saleGroup` FOR EACH ROW @@ -7943,7 +7973,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_After_Insert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_afterInsert` AFTER INSERT ON `saleTracking` FOR EACH ROW BEGIN @@ -8122,7 +8152,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeUpdate` BEFORE UPDATE ON `shelving` FOR EACH ROW BEGIN @@ -8174,7 +8204,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterInsert` AFTER INSERT ON `solunionCAP` FOR EACH ROW BEGIN @@ -8197,7 +8227,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_afterUpdate` AFTER UPDATE ON `solunionCAP` FOR EACH ROW BEGIN @@ -8227,7 +8257,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_BEFORE_DELETE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_beforeDelete` BEFORE DELETE ON `solunionCAP` FOR EACH ROW BEGIN @@ -8250,7 +8280,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeInsert` BEFORE INSERT ON `specie` FOR EACH ROW BEGIN @@ -8270,7 +8300,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_beforeUpdate` BEFORE UPDATE ON `specie` FOR EACH ROW BEGIN @@ -8582,7 +8612,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_beforeInsert` BEFORE INSERT ON `tag` FOR EACH ROW BEGIN @@ -9051,7 +9081,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_beforeInsert` BEFORE INSERT ON `ticketPackaging` FOR EACH ROW BEGIN @@ -9117,7 +9147,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_beforeInsert` BEFORE INSERT ON `ticketParking` FOR EACH ROW BEGIN @@ -9313,7 +9343,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ai` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterInsert` AFTER INSERT ON `ticketService` FOR EACH ROW BEGIN @@ -9355,7 +9385,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_au` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterUpdate` AFTER UPDATE ON `ticketService` FOR EACH ROW BEGIN @@ -9380,7 +9410,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ad` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_afterDelete` AFTER DELETE ON `ticketService` FOR EACH ROW BEGIN @@ -9450,7 +9480,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketTracking_beforeUpdate` BEFORE UPDATE ON `ticketTracking` @@ -9632,7 +9662,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_afterUpdate` AFTER UPDATE ON `time` FOR EACH ROW BEGIN @@ -10203,13 +10233,11 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_AI` - AFTER INSERT ON `workerTimeControl` - FOR EACH ROW -BEGIN - IF NEW.timed > DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY) THEN - CALL util.throw('date in the future'); - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeInsert` + BEFORE INSERT ON `workerTimeControl` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10225,7 +10253,73 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHoursBeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterInsert` + AFTER INSERT ON `workerTimeControl` + FOR EACH ROW +BEGIN + IF NEW.timed > (util.VN_NOW() + INTERVAL 1 DAY) THEN + CALL util.throw('date in the future'); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_beforeUpdate` + BEFORE UPDATE ON `workerTimeControl` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_afterDelete` + AFTER DELETE ON `workerTimeControl` + FOR EACH ROW +BEGIN + INSERT INTO workerLog + SET `action` = 'delete', + `changedModel` = 'WorkerTimeControl', + `changedModelId` = OLD.id, + `userFk` = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHours_beforeInsert` BEFORE INSERT ON `workingHours` FOR EACH ROW BEGIN @@ -10375,7 +10469,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeInsert` BEFORE INSERT ON `zoneExclusion` FOR EACH ROW BEGIN @@ -10397,7 +10491,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_beforeUpdate` BEFORE UPDATE ON `zoneExclusion` FOR EACH ROW BEGIN @@ -10619,7 +10713,7 @@ USE `vn2008`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_ai` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_afterInsert` AFTER INSERT ON `Conteo` FOR EACH ROW BEGIN @@ -10645,7 +10739,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_BEFORE_INSERT` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_beforeInsert` BEFORE INSERT ON `account_conciliacion` FOR EACH ROW set new.id_calculated = replace( @@ -10671,7 +10765,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hourBeforeInsert` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_beforeInsert` BEFORE INSERT ON `agency_hour` FOR EACH ROW BEGIN @@ -10704,7 +10798,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_AFTER_UPDATE` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_afterUpdate` AFTER UPDATE ON `agency_hour` FOR EACH ROW BEGIN @@ -10734,7 +10828,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_ad` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_afterDelete` AFTER DELETE ON `awb_recibida` FOR EACH ROW IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0 @@ -10759,10 +10853,9 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_au` +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_afterUpdate` AFTER UPDATE ON `movement_label` FOR EACH ROW --- Edit trigger body code below this line. Do not edit lines above this one IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento; END IF */;; @@ -10777,4 +10870,4 @@ DELIMITER ; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-01-25 16:24:46 +-- Dump completed on 2024-02-15 10:21:45 diff --git a/db/routines/vn/views/__coolerPathDetail.sql b/db/routines/vn/views/__coolerPathDetail.sql deleted file mode 100644 index 375d9e2d0..000000000 --- a/db/routines/vn/views/__coolerPathDetail.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`__coolerPathDetail` -AS SELECT `c`.`cooler_path_detail_id` AS `id`, - `c`.`cooler_path_id` AS `coolerPathFk`, - `c`.`pasillo` AS `hallway` -FROM `vn2008`.`cooler_path_detail` `c` diff --git a/package-lock.json b/package-lock.json index 5bc2e7cd7..3eedff6c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/preset-env": "^7.11.0", "@babel/register": "^7.7.7", - "@verdnatura/myt": "^1.6.3", + "@verdnatura/myt": "^1.6.7", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", @@ -99,6 +99,7 @@ } }, "loopback": { + "name": "vn-loopback", "version": "1.0.0", "license": "GPL-3.0" }, @@ -4639,9 +4640,9 @@ } }, "node_modules/@verdnatura/myt": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.6.6.tgz", - "integrity": "sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==", + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.6.7.tgz", + "integrity": "sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==", "dev": true, "dependencies": { "@sqltools/formatter": "^1.2.5", @@ -28279,6 +28280,7 @@ } }, "print": { + "name": "vn-print", "version": "2.0.0", "license": "GPL-3.0", "dependencies": { diff --git a/package.json b/package.json index 622bf6f55..cb2cf23b4 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/preset-env": "^7.11.0", "@babel/register": "^7.7.7", - "@verdnatura/myt": "^1.6.3", + "@verdnatura/myt": "^1.6.7", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", From 38cfb6e03eff2644aacc925c07ae5ec5e5f7a9a7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 15 Feb 2024 11:47:33 +0100 Subject: [PATCH 114/116] build: refs #6859 Merge from test --- db/.pullinfo.json | 2 +- db/versions/10835-brownCarnation/12-account_conciliacion.sql | 2 +- db/versions/10835-brownCarnation/25-awb_recibida.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 2702f2f29..f4afbc5fb 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -13,4 +13,4 @@ } } } -} +} \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/12-account_conciliacion.sql b/db/versions/10835-brownCarnation/12-account_conciliacion.sql index d8469e035..22399da1b 100644 --- a/db/versions/10835-brownCarnation/12-account_conciliacion.sql +++ b/db/versions/10835-brownCarnation/12-account_conciliacion.sql @@ -1,4 +1,4 @@ -DROP TRIGGER IF EXISTS vn2008.account_conciliacion_BEFORE_INSERT; +DROP TRIGGER IF EXISTS vn2008.account_conciliacion_beforeInsert; ALTER TABLE IF EXISTS `vn2008`.`account_conciliacion` RENAME `vn`.`accountReconciliation`; diff --git a/db/versions/10835-brownCarnation/25-awb_recibida.sql b/db/versions/10835-brownCarnation/25-awb_recibida.sql index e403775c9..82dc01ab2 100644 --- a/db/versions/10835-brownCarnation/25-awb_recibida.sql +++ b/db/versions/10835-brownCarnation/25-awb_recibida.sql @@ -1,4 +1,4 @@ -DROP TRIGGER IF EXISTS vn2008.awb_recibida_ad; +DROP TRIGGER IF EXISTS vn2008.awb_recibida_afterDelete; ALTER TABLE IF EXISTS `vn2008`.`awb_recibida` RENAME `vn`.`awbInvoiceIn`; From acc9d05530fecb2b3ad6827798a6f7829b2400c1 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 15 Feb 2024 11:49:25 +0100 Subject: [PATCH 115/116] build: refs #6859 pnpm-lock.yaml updated --- pnpm-lock.yaml | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 221008dd9..025be234e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,8 +93,11 @@ dependencies: specifier: ^1.3.0 version: 1.3.0 puppeteer: - specifier: ^21.10.0 - version: 21.10.0 + specifier: ^21.11.0 + version: 21.11.0 + read-chunk: + specifier: ^3.2.0 + version: 3.2.0 require-yaml: specifier: 0.0.1 version: 0.0.1 @@ -128,8 +131,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.6 - version: 1.6.6 + specifier: ^1.6.7 + version: 1.6.7 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2630,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.6: - resolution: {integrity: sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==} + /@verdnatura/myt@1.6.7: + resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5 @@ -4057,8 +4060,8 @@ packages: engines: {node: '>=6.0'} dev: true - /chromium-bidi@0.5.6(devtools-protocol@0.0.1232444): - resolution: {integrity: sha512-ber8smgoAs4EqSUHRb0I8fpx371ZmvsdQav8HRM9oO4fk5Ox16vQiNYXlsZkRj4FfvVL2dCef+zBFQixp+79CA==} + /chromium-bidi@0.5.8(devtools-protocol@0.0.1232444): + resolution: {integrity: sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==} peerDependencies: devtools-protocol: '*' dependencies: @@ -10680,7 +10683,6 @@ packages: /p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} - dev: true /pac-proxy-agent@7.0.1: resolution: {integrity: sha512-ASV8yU4LLKBAjqIPMbrgtaKIvxQri/yh2OpI+S6hVa9JRkUI3Y3NPFbfngDtY7oFtSMD3w31Xns89mDa3Feo5A==} @@ -11220,12 +11222,12 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - /puppeteer-core@21.10.0: - resolution: {integrity: sha512-NVaqO3K462qwMuLO4Gurs/Mau1Wss+08QgNYzF0dIqZWMvpskrt/TbxbmHU+7zMTUOvPEq/lR4BLJmjMBgBGfQ==} + /puppeteer-core@21.11.0: + resolution: {integrity: sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==} engines: {node: '>=16.13.2'} dependencies: '@puppeteer/browsers': 1.9.1 - chromium-bidi: 0.5.6(devtools-protocol@0.0.1232444) + chromium-bidi: 0.5.8(devtools-protocol@0.0.1232444) cross-fetch: 4.0.0 debug: 4.3.4(supports-color@6.1.0) devtools-protocol: 0.0.1232444 @@ -11237,15 +11239,15 @@ packages: - utf-8-validate dev: false - /puppeteer@21.10.0: - resolution: {integrity: sha512-Y1yQjcLE00hHTDAmv3M3A6hhW0Ytjdp6xr6nyjl7FZ7E7hzp/6Rsw80FbaTJzJHFCplBNi082wrgynbmD7RlYw==} + /puppeteer@21.11.0: + resolution: {integrity: sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==} engines: {node: '>=16.13.2'} hasBin: true requiresBuild: true dependencies: '@puppeteer/browsers': 1.9.1 cosmiconfig: 9.0.0 - puppeteer-core: 21.10.0 + puppeteer-core: 21.11.0 transitivePeerDependencies: - bufferutil - encoding @@ -11367,6 +11369,14 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: true + /read-chunk@3.2.0: + resolution: {integrity: sha512-CEjy9LCzhmD7nUpJ1oVOE6s/hBkejlcJEgLQHVnQznOSilOPb+kpKktlLfFDK3/WP43+F80xkUTM2VOkYoSYvQ==} + engines: {node: '>=6'} + dependencies: + pify: 4.0.1 + with-open-file: 0.1.7 + dev: false + /read-pkg-up@1.0.1: resolution: {integrity: sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==} engines: {node: '>=0.10.0'} @@ -14119,6 +14129,15 @@ packages: resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==} dev: true + /with-open-file@0.1.7: + resolution: {integrity: sha512-ecJS2/oHtESJ1t3ZfMI3B7KIDKyfN0O16miWxdn30zdh66Yd3LsRFebXZXq6GU4xfxLf6nVxp9kIqElb5fqczA==} + engines: {node: '>=6'} + dependencies: + p-finally: 1.0.0 + p-try: 2.2.0 + pify: 4.0.1 + dev: false + /word-count@0.2.2: resolution: {integrity: sha512-tPRTbQ+nTCPY3F0z1f/y0PX22ScE6l/4/8j9KqA3h77JhlZ/w6cbVS8LIO5Pq/aV96SWBOoiE2IEgzxF0Cn+kA==} dev: false From 8cb17762f8e10716ea3df6711c3a29fde07db8c0 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 15 Feb 2024 12:21:45 +0100 Subject: [PATCH 116/116] refs #6863 deployt: init version 24.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6f0624360..47b3a1564 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.8.0", + "version": "24.10.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0",