diff --git a/.vscode/settings.json b/.vscode/settings.json
index 9ed1c8fc2..03479d27a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,7 +3,7 @@
// Carácter predeterminado de final de línea.
"files.eol": "\n",
"editor.codeActionsOnSave": {
- "source.fixAll.eslint": true
+ "source.fixAll.eslint": "explicit"
},
"search.useIgnoreFiles": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
@@ -11,7 +11,12 @@
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
+ "[json]": {
+ "editor.defaultFormatter": "vscode.json-language-features"
+ },
"cSpell.words": [
- "salix"
+ "salix",
+ "fdescribe",
+ "Loggable"
]
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30afaa69b..69e93a309 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,12 +5,42 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [2348.01] - 2023-11-30
+## [2404.01] - 2024-01-25
### Added
### Changed
### Fixed
+
+## [2402.01] - 2024-01-11
+
+### Added
+### Changed
+### Fixed
+
+## [2400.01] - 2024-01-04
+
+### Added
+### Changed
+### Fixed
+
+## [2350.01] - 2023-12-14
+
+### Características Añadidas 🆕
+- **Tickets → Expediciones:** Añadido soporte para Viaexpress
+
+
+## [2348.01] - 2023-11-30
+
+### Características Añadidas 🆕
+- **Tickets → Adelantar:** Permite mover lineas sin generar negativos
+- **Tickets → Adelantar:** Permite modificar la fecha de los tickets
+- **Trabajadores → Notificaciones:** Nueva sección (lilium)
+
+### Correcciones 🛠️
+- **Tickets → RocketChat:** Arreglada detección de cambios
+
+
## [2346.01] - 2023-11-16
### Added
diff --git a/Dockerfile b/Dockerfile
index e1173ad73..61dd758b8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM debian:bullseye-slim
+FROM debian:bookworm-slim
ENV TZ Europe/Madrid
ARG DEBIAN_FRONTEND=noninteractive
@@ -25,7 +25,13 @@ RUN apt-get update \
libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \
libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
- fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
+ fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
+
+# Extra dependencies
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ samba-common-bin samba-dsdb-modules\
&& rm -rf /var/lib/apt/lists/* \
&& npm -g install pm2
diff --git a/README.md b/README.md
index 59f5dbcf7..b420bc44f 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Salix is also the scientific name of a beautifull tree! :)
Required applications.
-* Node.js >= 16.x LTS
+* Node.js
* Docker
* Git
@@ -17,20 +17,7 @@ You will need to install globally the following items.
$ sudo npm install -g jest gulp-cli
```
-For the usage of jest --watch on macOs.
-```
-$ brew install watchman
-```
-* [watchman](https://facebook.github.io/watchman/)
-
-## Linux Only Prerequisites
-
-Your user must be on the docker group to use it so you will need to run this command:
-```
-$ sudo usermod -a -G docker yourusername
-```
-
-## Getting Started // Installing
+## Installing dependencies and launching
Pull from repository.
@@ -76,29 +63,6 @@ In Visual Studio Code we use the ESLint extension.
ext install dbaeumer.vscode-eslint
```
-Gitlens for visualization of code authorship
-```
-ext install eamodio.gitlens
-```
-
-Spanish language pack
-```
-ext install ms-ceintl.vscode-language-pack-es
-```
-
-### Recommended extensions
-
-Material icon Theme
-```
-ext install pkief.material-icon-theme
-```
-
-Material UI Themes
-```
-ext install equinusocio.vsc-material-theme
-```
-
-
## Built With
* [angularjs](https://angularjs.org/)
diff --git a/back/methods/collection/getTickets.js b/back/methods/collection/getTickets.js
index f04822697..50117b954 100644
--- a/back/methods/collection/getTickets.js
+++ b/back/methods/collection/getTickets.js
@@ -49,7 +49,7 @@ module.exports = Self => {
ish.packing,
ish.grouping,
s.isAdded,
- s.originalQuantity,
+ s.originalQuantity,
s.quantity saleQuantity,
iss.quantity reservedQuantity,
SUM(iss.quantity) OVER (PARTITION BY s.id ORDER BY ish.id) accumulatedQuantity,
@@ -75,7 +75,7 @@ module.exports = Self => {
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
LEFT JOIN origin o ON o.id = i.originFk
WHERE tc.collectionFk = ?
- GROUP BY ish.id, p.code, p2.code
+ GROUP BY s.id, ish.id, p.code, p2.code
ORDER BY pickingOrder;`, [id], myOptions);
if (print)
@@ -105,7 +105,7 @@ module.exports = Self => {
LEFT JOIN vn.buy c ON c.itemFk = s.itemFk
LEFT JOIN vn.entry e ON e.id = c.entryFk
LEFT JOIN vn.travel tr ON tr.id = e.travelFk
- WHERE s.ticketFk = ?
+ WHERE s.ticketFk = ?
AND tr.landed >= util.VN_CURDATE() - INTERVAL 1 YEAR`,
[ticketId], myOptions);
ticket.sales = [];
diff --git a/back/methods/collection/newCollection.js b/back/methods/collection/newCollection.js
deleted file mode 100644
index 2be9f8b0e..000000000
--- a/back/methods/collection/newCollection.js
+++ /dev/null
@@ -1,133 +0,0 @@
-module.exports = Self => {
- Self.remoteMethodCtx('newCollection', {
- description: 'Make a new collection of tickets',
- accessType: 'WRITE',
- accepts: [{
- arg: 'collectionFk',
- type: 'Number',
- required: false,
- description: 'The collection id'
- }, {
- arg: 'sectorFk',
- type: 'Number',
- required: true,
- description: 'The sector of worker'
- }, {
- arg: 'vWagons',
- type: 'Number',
- required: true,
- description: 'The number of wagons'
- }],
- returns: {
- type: 'Object',
- root: true
- },
- http: {
- path: `/newCollection`,
- verb: 'POST'
- }
- });
-
- Self.newCollection = async(ctx, collectionFk, sectorFk, vWagons) => {
- let query = '';
- const userId = ctx.req.accessToken.userId;
-
- if (!collectionFk) {
- query = `CALL vn.collectionTrain_newBeta(?,?,?)`;
- const [result] = await Self.rawSql(query, [sectorFk, vWagons, userId], {userId});
- if (result.length == 0)
- throw new Error(`No collections for today`);
-
- collectionFk = result[0].vCollectionFk;
- }
-
- query = `CALL vn.collectionTicket_get(?)`;
- const [tickets] = await Self.rawSql(query, [collectionFk], {userId});
-
- query = `CALL vn.collectionSale_get(?)`;
- const [sales] = await Self.rawSql(query, [collectionFk], {userId});
-
- query = `CALL vn.collectionPlacement_get(?)`;
- const [placements] = await Self.rawSql(query, [collectionFk], {userId});
-
- query = `CALL vn.collectionSticker_print(?,?)`;
- await Self.rawSql(query, [collectionFk, sectorFk], {userId});
-
- return makeCollection(tickets, sales, placements, collectionFk);
- };
-
- /**
- * Returns a collection json
- * @param {*} tickets - Request tickets
- * @param {*} sales - Request sales
- * @param {*} placements - Request placements
- * @param {*} collectionFk - Request placements
- * @return {Object} Collection JSON
- */
- async function makeCollection(tickets, sales, placements, collectionFk) {
- let collection = [];
-
- for (let i = 0; i < tickets.length; i++) {
- let ticket = {};
- ticket['ticketFk'] = tickets[i]['ticketFk'];
- ticket['level'] = tickets[i]['level'];
- ticket['agencyName'] = tickets[i]['agencyName'];
- ticket['warehouseFk'] = tickets[i]['warehouseFk'];
- ticket['salesPersonFk'] = tickets[i]['salesPersonFk'];
-
- let ticketSales = [];
-
- for (let x = 0; x < sales.length; x++) {
- if (sales[x]['ticketFk'] == ticket['ticketFk']) {
- let sale = {};
- sale['collectionFk'] = collectionFk;
- sale['ticketFk'] = sales[x]['ticketFk'];
- sale['saleFk'] = sales[x]['saleFk'];
- sale['itemFk'] = sales[x]['itemFk'];
- sale['quantity'] = sales[x]['quantity'];
- if (sales[x]['quantityPicked'] != null)
- sale['quantityPicked'] = sales[x]['quantityPicked'];
- else
- sale['quantityPicked'] = 0;
- sale['longName'] = sales[x]['longName'];
- sale['size'] = sales[x]['size'];
- sale['color'] = sales[x]['color'];
- sale['discount'] = sales[x]['discount'];
- sale['price'] = sales[x]['price'];
- sale['stems'] = sales[x]['stems'];
- sale['category'] = sales[x]['category'];
- sale['origin'] = sales[x]['origin'];
- sale['clientFk'] = sales[x]['clientFk'];
- sale['productor'] = sales[x]['productor'];
- sale['reserved'] = sales[x]['reserved'];
- sale['isPreviousPrepared'] = sales[x]['isPreviousPrepared'];
- sale['isPrepared'] = sales[x]['isPrepared'];
- sale['isControlled'] = sales[x]['isControlled'];
-
- let salePlacements = [];
-
- for (let z = 0; z < placements.length; z++) {
- if (placements[z]['saleFk'] == sale['saleFk']) {
- let placement = {};
- placement['saleFk'] = placements[z]['saleFk'];
- placement['itemFk'] = placements[z]['itemFk'];
- placement['placement'] = placements[z]['placement'];
- placement['shelving'] = placements[z]['shelving'];
- placement['created'] = placements[z]['created'];
- placement['visible'] = placements[z]['visible'];
- placement['order'] = placements[z]['order'];
- placement['grouping'] = placements[z]['grouping'];
- salePlacements.push(placement);
- }
- }
- sale['placements'] = salePlacements;
- ticketSales.push(sale);
- }
- }
- ticket['sales'] = ticketSales;
- collection.push(ticket);
- }
-
- return collection;
- }
-};
diff --git a/back/methods/collection/spec/newCollection.spec.js b/back/methods/collection/spec/newCollection.spec.js
deleted file mode 100644
index e729594d1..000000000
--- a/back/methods/collection/spec/newCollection.spec.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const {models} = require('vn-loopback/server/server');
-
-describe('newCollection()', () => {
- it('should return a new collection', async() => {
- pending('#3400 analizar que hacer con rutas de back collection');
- let ctx = {req: {accessToken: {userId: 1106}}};
- let response = await models.Collection.newCollection(ctx, 1, 1, 1);
-
- expect(response.length).toBeGreaterThan(0);
- expect(response[0].ticketFk).toEqual(2);
- });
-});
diff --git a/back/methods/dms/removeFile.js b/back/methods/dms/removeFile.js
index a9ff36883..dc55b4d38 100644
--- a/back/methods/dms/removeFile.js
+++ b/back/methods/dms/removeFile.js
@@ -22,8 +22,8 @@ module.exports = Self => {
Self.removeFile = async(ctx, id, options) => {
const models = Self.app.models;
- let tx;
const myOptions = {};
+ let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
diff --git a/back/methods/docuware/specs/upload.spec.js b/back/methods/docuware/specs/upload.spec.js
index 3b8c55a50..866499b66 100644
--- a/back/methods/docuware/specs/upload.spec.js
+++ b/back/methods/docuware/specs/upload.spec.js
@@ -24,15 +24,40 @@ describe('docuware upload()', () => {
});
it('should try upload file', async() => {
+ const tx = await models.Docuware.beginTransaction({});
spyOn(ticketModel, 'deliveryNotePdf').and.returnValue(new Promise(resolve => resolve({})));
let error;
try {
- await models.Docuware.upload(ctx, ticketIds, fileCabinetName);
+ const options = {transaction: tx};
+ const user = await models.UserConfig.findById(userId, null, options);
+ await user.updateAttribute('tabletFk', 'Tablet1', options);
+ await models.Docuware.upload(ctx, ticketIds, fileCabinetName, options);
+
+ await tx.rollback();
} catch (e) {
- error = e.message;
+ error = e;
+ await tx.rollback();
}
- expect(error).toEqual('Action not allowed on the test environment');
+ expect(error.message).toEqual('Action not allowed on the test environment');
+ });
+
+ it('should throw error when not have tablet assigned', async() => {
+ const tx = await models.Docuware.beginTransaction({});
+ spyOn(ticketModel, 'deliveryNotePdf').and.returnValue(new Promise(resolve => resolve({})));
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ await models.Docuware.upload(ctx, ticketIds, fileCabinetName, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error.message).toEqual('This user does not have an assigned tablet');
});
});
diff --git a/back/methods/docuware/upload.js b/back/methods/docuware/upload.js
index 7055bf8d5..27be72295 100644
--- a/back/methods/docuware/upload.js
+++ b/back/methods/docuware/upload.js
@@ -29,12 +29,24 @@ module.exports = Self => {
}
});
- Self.upload = async function(ctx, ticketIds, fileCabinet) {
+ Self.upload = async function(ctx, ticketIds, fileCabinet, options) {
delete ctx.args.ticketIds;
const models = Self.app.models;
const action = 'store';
- const options = await Self.getOptions();
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ const userConfig = await models.UserConfig.findById(ctx.req.accessToken.userId, {
+ fields: ['tabletFk']
+ }, myOptions);
+
+ if (!userConfig?.tabletFk)
+ throw new UserError('This user does not have an assigned tablet');
+
+ const docuwareOptions = await Self.getOptions();
const fileCabinetId = await Self.getFileCabinet(fileCabinet);
const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId);
@@ -45,7 +57,7 @@ module.exports = Self => {
const deliveryNote = await models.Ticket.deliveryNotePdf(ctx, {
id,
type: 'deliveryNote'
- });
+ }, myOptions);
// get ticket data
const ticket = await models.Ticket.findById(id, {
include: [{
@@ -54,7 +66,7 @@ module.exports = Self => {
fields: ['id', 'name', 'fi']
}
}]
- });
+ }, myOptions);
// upload file
const templateJson = {
@@ -102,7 +114,7 @@ module.exports = Self => {
{
'FieldName': 'FILTRO_TABLET',
'ItemElementName': 'string',
- 'Item': 'Tablet1',
+ 'Item': userConfig.tabletFk,
}
]
};
@@ -116,11 +128,11 @@ module.exports = Self => {
const deleteJson = {
'Field': [{'FieldName': 'ESTADO', 'Item': 'Pendiente eliminar', 'ItemElementName': 'String'}]
};
- const deleteUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents/${docuwareFile.id}/Fields`;
- await axios.put(deleteUri, deleteJson, options.headers);
+ const deleteUri = `${docuwareOptions.url}/FileCabinets/${fileCabinetId}/Documents/${docuwareFile.id}/Fields`;
+ await axios.put(deleteUri, deleteJson, docuwareOptions.headers);
}
- const uploadUri = `${options.url}/FileCabinets/${fileCabinetId}/Documents?StoreDialogId=${dialogId}`;
+ const uploadUri = `${docuwareOptions.url}/FileCabinets/${fileCabinetId}/Documents?StoreDialogId=${dialogId}`;
const FormData = require('form-data');
const data = new FormData();
@@ -130,7 +142,7 @@ module.exports = Self => {
headers: {
'Content-Type': 'multipart/form-data',
'X-File-ModifiedDate': Date.vnNew(),
- 'Cookie': options.headers.headers.Cookie,
+ 'Cookie': docuwareOptions.headers.headers.Cookie,
...data.getHeaders()
},
};
@@ -141,11 +153,11 @@ module.exports = Self => {
const $t = ctx.req.__;
const message = $t('Failed to upload delivery note', {id});
if (uploaded.length)
- await models.TicketTracking.setDelivered(ctx, uploaded);
+ await models.TicketTracking.setDelivered(ctx, uploaded, myOptions);
throw new UserError(message);
}
uploaded.push(id);
}
- return models.TicketTracking.setDelivered(ctx, ticketIds);
+ return models.TicketTracking.setDelivered(ctx, ticketIds, myOptions);
};
};
diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js
index 5b9ebb4e3..135774919 100644
--- a/back/methods/osticket/sendToSupport.js
+++ b/back/methods/osticket/sendToSupport.js
@@ -35,10 +35,17 @@ module.exports = Self => {
let html = `Motivo: ${reason} `;
html += `Usuario: ${ctx.req.accessToken.userId} ${emailUser.email} `;
+ delete additionalData.backError.config.headers.Authorization;
+ const httpRequest = JSON.parse(additionalData?.httpRequest);
+
+ if (httpRequest)
+ delete httpRequest.config.headers.Authorization;
+ additionalData.httpRequest = httpRequest;
+
for (const data in additionalData)
html += `${data}: ${tryParse(additionalData[data])} `;
- const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error;
+ const subjectReason = httpRequest?.data?.error;
smtp.send({
to: `${config.app.reportEmail}, ${emailUser.email}`,
subject:
diff --git a/back/methods/viaexpress-config/deleteExpedition.ejs b/back/methods/viaexpress-config/deleteExpedition.ejs
new file mode 100644
index 000000000..3be459a8d
--- /dev/null
+++ b/back/methods/viaexpress-config/deleteExpedition.ejs
@@ -0,0 +1,11 @@
+
+
+
+
+ <%= viaexpressConfig.client %>
+ <%= viaexpressConfig.user %>
+ <%= viaexpressConfig.password %>
+ <%= externalId %>
+
+
+
diff --git a/back/methods/viaexpress-config/deleteExpedition.js b/back/methods/viaexpress-config/deleteExpedition.js
new file mode 100644
index 000000000..189745554
--- /dev/null
+++ b/back/methods/viaexpress-config/deleteExpedition.js
@@ -0,0 +1,45 @@
+const axios = require('axios');
+const {DOMParser} = require('xmldom');
+
+module.exports = Self => {
+ Self.remoteMethod('deleteExpedition', {
+ description: 'Delete a shipment by providing the expedition ID, interacting with Viaexpress API',
+ accessType: 'WRITE',
+ accepts: [{
+ arg: 'expeditionFk',
+ type: 'number',
+ required: true
+ }],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/deleteExpedition`,
+ verb: 'POST'
+ }
+ });
+
+ Self.deleteExpedition = async expeditionFk => {
+ const models = Self.app.models;
+
+ const viaexpressConfig = await models.ViaexpressConfig.findOne({
+ fields: ['url']
+ });
+
+ const renderedXml = await models.ViaexpressConfig.deleteExpeditionRenderer(expeditionFk);
+ const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, renderedXml, {
+ headers: {
+ 'Content-Type': 'application/soap+xml; charset=utf-8'
+ }
+ });
+
+ const xmlString = response.data;
+ const parser = new DOMParser();
+ const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
+ const resultElement = xmlDoc.getElementsByTagName('DeleteEnvioResult')[0];
+ const result = resultElement.textContent;
+
+ return result;
+ };
+};
diff --git a/back/methods/viaexpress-config/deleteExpeditionRenderer.js b/back/methods/viaexpress-config/deleteExpeditionRenderer.js
new file mode 100644
index 000000000..645eaddd1
--- /dev/null
+++ b/back/methods/viaexpress-config/deleteExpeditionRenderer.js
@@ -0,0 +1,44 @@
+const fs = require('fs');
+const ejs = require('ejs');
+
+module.exports = Self => {
+ Self.remoteMethod('deleteExpeditionRenderer', {
+ description: 'Renders the data from an XML',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'expeditionFk',
+ type: 'number',
+ required: true
+ }],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/deleteExpeditionRenderer`,
+ verb: 'GET'
+ }
+ });
+
+ Self.deleteExpeditionRenderer = async expeditionFk => {
+ const models = Self.app.models;
+
+ const viaexpressConfig = await models.ViaexpressConfig.findOne({
+ fields: ['client', 'user', 'password']
+ });
+
+ const expedition = await models.Expedition.findOne({
+ fields: ['id', 'externalId'],
+ where: {id: expeditionFk}
+ });
+
+ const data = {
+ viaexpressConfig,
+ externalId: expedition.externalId
+ };
+
+ const template = fs.readFileSync(__dirname + '/deleteExpedition.ejs', 'utf-8');
+ const renderedXml = ejs.render(template, data);
+ return renderedXml;
+ };
+};
diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js
index 698bb1dac..df50b21e5 100644
--- a/back/methods/viaexpress-config/internationalExpedition.js
+++ b/back/methods/viaexpress-config/internationalExpedition.js
@@ -20,7 +20,7 @@ module.exports = Self => {
}
});
- Self.internationalExpedition = async expeditionFk => {
+ Self.internationalExpedition = async (expeditionFk) => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js
index e9abce5ca..c8533ea6b 100644
--- a/back/methods/viaexpress-config/renderer.js
+++ b/back/methods/viaexpress-config/renderer.js
@@ -20,11 +20,11 @@ module.exports = Self => {
}
});
- Self.renderer = async expeditionFk => {
+ Self.renderer = async (expeditionFk) => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
- fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType']
+ fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType', 'agencyModeFk']
});
const expedition = await models.Expedition.findOne({
@@ -34,7 +34,7 @@ module.exports = Self => {
{
relation: 'ticket',
scope: {
- fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'],
+ fields: ['shipped', 'addressFk', 'clientFk', 'companyFk', 'agencyModeFk'],
include: [
{
relation: 'client',
@@ -102,7 +102,6 @@ module.exports = Self => {
}
]
}
-
}
]
});
@@ -110,13 +109,15 @@ module.exports = Self => {
const ticket = expedition.ticket();
const sender = ticket.company().client();
const shipped = ticket.shipped.toISOString();
+ const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk)
const data = {
viaexpressConfig,
sender,
senderAddress: sender.defaultAddress(),
client: ticket.client(),
address: ticket.address(),
- shipped
+ shipped,
+ isInterdia
};
const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8');
diff --git a/back/methods/viaexpress-config/template.ejs b/back/methods/viaexpress-config/template.ejs
index 0b6eb468c..f9acfe316 100644
--- a/back/methods/viaexpress-config/template.ejs
+++ b/back/methods/viaexpress-config/template.ejs
@@ -13,7 +13,7 @@
000
- 0
+ <%= isInterdia %>0
diff --git a/back/methods/vn-user/privileges.js b/back/methods/vn-user/privileges.js
index 08cfaaae8..9f936c29b 100644
--- a/back/methods/vn-user/privileges.js
+++ b/back/methods/vn-user/privileges.js
@@ -68,7 +68,7 @@ module.exports = Self => {
userToUpdate.hasGrant = hasGrant;
if (roleFk) {
- const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions);
+ const role = await models.VnRole.findById(roleFk, {fields: ['name']}, myOptions);
const hasRole = await Self.hasRole(userId, role.name, myOptions);
if (!hasRole)
diff --git a/back/methods/vn-user/renew-token.js b/back/methods/vn-user/renew-token.js
index 9850267d6..d00085d8a 100644
--- a/back/methods/vn-user/renew-token.js
+++ b/back/methods/vn-user/renew-token.js
@@ -1,4 +1,4 @@
-const UserError = require('vn-loopback/util/user-error');
+const {models} = require('vn-loopback/server/server');
module.exports = Self => {
Self.remoteMethodCtx('renewToken', {
@@ -16,20 +16,31 @@ module.exports = Self => {
});
Self.renewToken = async function(ctx) {
- const models = Self.app.models;
- const token = ctx.req.accessToken;
+ const {accessToken: token} = ctx.req;
- const now = new Date();
+ // Check if current token is valid
+
+ const {renewPeriod, courtesyTime} = await models.AccessTokenConfig.findOne({
+ fields: ['renewPeriod', 'courtesyTime']
+ });
+ const now = Date.now();
const differenceMilliseconds = now - token.created;
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
+ const isNotExceeded = differenceSeconds < renewPeriod - courtesyTime;
+ if (isNotExceeded)
+ return token;
- const fields = ['renewPeriod', 'courtesyTime'];
- const accessTokenConfig = await models.AccessTokenConfig.findOne({fields});
+ // Schedule to remove current token
+ setTimeout(async() => {
+ try {
+ await Self.logout(token.id);
+ } catch (err) {
+ // eslint-disable-next-line no-console
+ console.error(err);
+ }
+ }, courtesyTime * 1000);
- if (differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime)
- throw new UserError(`The renew period has not been exceeded`, 'periodNotExceeded');
-
- await Self.logout(token.id);
+ // Create new accessToken
const user = await Self.findById(token.userId);
const accessToken = await user.createAccessToken();
diff --git a/back/methods/vn-user/sign-in.js b/back/methods/vn-user/sign-in.js
index b9e0d2f70..782046641 100644
--- a/back/methods/vn-user/sign-in.js
+++ b/back/methods/vn-user/sign-in.js
@@ -49,8 +49,7 @@ module.exports = Self => {
if (vnUser.twoFactor)
throw new ForbiddenError(null, 'REQUIRES_2FA');
}
-
- return Self.validateLogin(user, password);
+ return Self.validateLogin(user, password, ctx);
};
Self.passExpired = async vnUser => {
diff --git a/back/methods/vn-user/specs/privileges.spec.js b/back/methods/vn-user/specs/privileges.spec.js
index 3d25eecf9..04d9c09ff 100644
--- a/back/methods/vn-user/specs/privileges.spec.js
+++ b/back/methods/vn-user/specs/privileges.spec.js
@@ -70,7 +70,7 @@ describe('VnUser privileges()', () => {
const tx = await models.VnUser.beginTransaction({});
const options = {transaction: tx};
- const agency = await models.Role.findOne({
+ const agency = await models.VnRole.findOne({
where: {
name: 'agency'
}
diff --git a/back/methods/vn-user/specs/renew-token.spec.js b/back/methods/vn-user/specs/renew-token.spec.js
new file mode 100644
index 000000000..8d9bbf11c
--- /dev/null
+++ b/back/methods/vn-user/specs/renew-token.spec.js
@@ -0,0 +1,50 @@
+const {models} = require('vn-loopback/server/server');
+describe('Renew Token', () => {
+ const startingTime = Date.now();
+ let ctx = null;
+ beforeAll(async() => {
+ const unAuthCtx = {
+ req: {
+ headers: {},
+ connection: {
+ remoteAddress: '127.0.0.1'
+ },
+ getLocale: () => 'en'
+ },
+ args: {}
+ };
+ let login = await models.VnUser.signIn(unAuthCtx, 'salesAssistant', 'nightmare');
+ let accessToken = await models.AccessToken.findById(login.token);
+ ctx = {req: {accessToken: accessToken}};
+ });
+
+ beforeEach(() => {
+ jasmine.clock().install();
+ jasmine.clock().mockDate(new Date(startingTime));
+ });
+
+ afterEach(() => {
+ jasmine.clock().uninstall();
+ });
+
+ it('should renew token', async() => {
+ const mockDate = new Date(startingTime + 26600000);
+ jasmine.clock().mockDate(mockDate);
+ const {id} = await models.VnUser.renewToken(ctx);
+
+ expect(id).not.toEqual(ctx.req.accessToken.id);
+ });
+
+ it('NOT should renew', async() => {
+ let error;
+ let response;
+ try {
+ response = await models.VnUser.renewToken(ctx);
+ } catch (e) {
+ error = e;
+ }
+
+ expect(error).toBeUndefined();
+ expect(response.id).toEqual(ctx.req.accessToken.id);
+ });
+});
diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js
index f4cad88b9..a14dd301e 100644
--- a/back/methods/vn-user/specs/sign-in.spec.js
+++ b/back/methods/vn-user/specs/sign-in.spec.js
@@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
describe('VnUser Sign-in()', () => {
const employeeId = 1;
- const unauthCtx = {
+ const unAuthCtx = {
req: {
headers: {},
connection: {
@@ -12,10 +12,21 @@ describe('VnUser Sign-in()', () => {
},
args: {}
};
- const {VnUser, AccessToken} = models;
+ const {VnUser, AccessToken, SignInLog} = models;
describe('when credentials are correct', () => {
+ it('should return the token if user uses email', async() => {
+ let login = await VnUser.signIn(unAuthCtx, 'salesAssistant@mydomain.com', 'nightmare');
+ let accessToken = await AccessToken.findById(login.token);
+ let ctx = {req: {accessToken: accessToken}};
+ let signInLog = await SignInLog.find({where: {token: accessToken.id}});
+
+ expect(signInLog.length).toEqual(0);
+
+ await VnUser.logout(ctx.req.accessToken.id);
+ });
+
it('should return the token', async() => {
- let login = await VnUser.signIn(unauthCtx, 'salesAssistant', 'nightmare');
+ let login = await VnUser.signIn(unAuthCtx, 'salesAssistant', 'nightmare');
let accessToken = await AccessToken.findById(login.token);
let ctx = {req: {accessToken: accessToken}};
@@ -25,7 +36,7 @@ describe('VnUser Sign-in()', () => {
});
it('should return the token if the user doesnt exist but the client does', async() => {
- let login = await VnUser.signIn(unauthCtx, 'PetterParker', 'nightmare');
+ let login = await VnUser.signIn(unAuthCtx, 'PetterParker', 'nightmare');
let accessToken = await AccessToken.findById(login.token);
let ctx = {req: {accessToken: accessToken}};
@@ -40,7 +51,7 @@ describe('VnUser Sign-in()', () => {
let error;
try {
- await VnUser.signIn(unauthCtx, 'IDontExist', 'TotallyWrongPassword');
+ await VnUser.signIn(unAuthCtx, 'IDontExist', 'TotallyWrongPassword');
} catch (e) {
error = e;
}
@@ -61,7 +72,7 @@ describe('VnUser Sign-in()', () => {
const options = {transaction: tx};
await employee.updateAttribute('twoFactor', 'email', options);
- await VnUser.signIn(unauthCtx, 'employee', 'nightmare', options);
+ await VnUser.signIn(unAuthCtx, 'employee', 'nightmare', options);
await tx.rollback();
} catch (e) {
await tx.rollback();
@@ -86,7 +97,7 @@ describe('VnUser Sign-in()', () => {
const options = {transaction: tx};
await employee.updateAttribute('passExpired', yesterday, options);
- await VnUser.signIn(unauthCtx, 'employee', 'nightmare', options);
+ await VnUser.signIn(unAuthCtx, 'employee', 'nightmare', options);
await tx.rollback();
} catch (e) {
await tx.rollback();
diff --git a/back/methods/vn-user/validate-token.js b/back/methods/vn-user/validate-token.js
deleted file mode 100644
index 7bccfe0b1..000000000
--- a/back/methods/vn-user/validate-token.js
+++ /dev/null
@@ -1,17 +0,0 @@
-module.exports = Self => {
- Self.remoteMethod('validateToken', {
- description: 'Validates the current logged user token',
- returns: {
- type: 'Boolean',
- root: true
- },
- http: {
- path: `/validateToken`,
- verb: 'GET'
- }
- });
-
- Self.validateToken = async function() {
- return true;
- };
-};
diff --git a/back/model-config.json b/back/model-config.json
index ebc0e321b..27a94498c 100644
--- a/back/model-config.json
+++ b/back/model-config.json
@@ -139,9 +139,6 @@
"Warehouse": {
"dataSource": "vn"
},
- "VnUser": {
- "dataSource": "vn"
- },
"OsTicket": {
"dataSource": "osticket"
},
@@ -156,6 +153,12 @@
},
"ViaexpressConfig": {
"dataSource": "vn"
+ },
+ "VnUser": {
+ "dataSource": "vn"
+ },
+ "VnRole": {
+ "dataSource": "vn"
}
}
diff --git a/back/models/collection.js b/back/models/collection.js
index bfa906af6..1c10d49fa 100644
--- a/back/models/collection.js
+++ b/back/models/collection.js
@@ -1,6 +1,5 @@
module.exports = Self => {
require('../methods/collection/getCollection')(Self);
- require('../methods/collection/newCollection')(Self);
require('../methods/collection/getSectors')(Self);
require('../methods/collection/setSaleQuantity')(Self);
require('../methods/collection/previousLabel')(Self);
diff --git a/back/models/dms-type.json b/back/models/dms-type.json
index de3d564b4..d3e96a986 100644
--- a/back/models/dms-type.json
+++ b/back/models/dms-type.json
@@ -17,10 +17,6 @@
"type": "string",
"required": true
},
- "path": {
- "type": "string",
- "required": true
- },
"code": {
"type": "string",
"required": true
@@ -29,12 +25,12 @@
"relations": {
"readRole": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "readRoleFk"
},
"writeRole": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "writeRoleFk"
}
},
diff --git a/back/models/docuwareTablet.json b/back/models/docuwareTablet.json
new file mode 100644
index 000000000..dbbf62f56
--- /dev/null
+++ b/back/models/docuwareTablet.json
@@ -0,0 +1,17 @@
+{
+ "name": "docuwareTablet",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "docuwareTablet"
+ }
+ },
+ "properties": {
+ "tablet": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ }
+ }
+}
diff --git a/back/models/image-collection.json b/back/models/image-collection.json
index 186ab0208..ae0e0adcd 100644
--- a/back/models/image-collection.json
+++ b/back/models/image-collection.json
@@ -46,12 +46,12 @@
},
"readRole": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "readRoleFk"
},
"writeRole": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "writeRoleFk"
}
},
@@ -64,4 +64,3 @@
}
]
}
-
\ No newline at end of file
diff --git a/back/models/notificationAcl.json b/back/models/notificationAcl.json
index a20187961..9ab85530f 100644
--- a/back/models/notificationAcl.json
+++ b/back/models/notificationAcl.json
@@ -24,8 +24,8 @@
},
"role": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "roleFk"
}
}
-}
\ No newline at end of file
+}
diff --git a/back/models/specs/mailAliasAccount.spec.js b/back/models/specs/mailAliasAccount.spec.js
new file mode 100644
index 000000000..c13cc7ae8
--- /dev/null
+++ b/back/models/specs/mailAliasAccount.spec.js
@@ -0,0 +1,73 @@
+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;
+
+ try {
+ const options = {transaction: tx, accessToken: {userId: 9}};
+ await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error).toBeUndefined();
+ });
+
+ it('should add a mail Alias of an inherit role', async() => {
+ const tx = await models.MailAliasAccount.beginTransaction({});
+ let error;
+
+ try {
+ const options = {transaction: tx, accessToken: {userId: 9}};
+ await models.MailAliasAccount.create({mailAlias: 3, account: 5}, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error).toBeUndefined();
+ });
+
+ it('should delete a mail Alias', async() => {
+ const tx = await models.MailAliasAccount.beginTransaction({});
+ let error;
+
+ try {
+ const options = {transaction: tx, accessToken: {userId: 1}};
+ const mailAclId = 2;
+ await models.MailAliasAccount.destroyAll({id: mailAclId}, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error).toBeUndefined();
+ });
+});
+
diff --git a/back/models/user-config.json b/back/models/user-config.json
index 52125dc01..5c5df1b9e 100644
--- a/back/models/user-config.json
+++ b/back/models/user-config.json
@@ -26,6 +26,9 @@
},
"darkMode": {
"type": "boolean"
+ },
+ "tabletFk": {
+ "type": "string"
}
},
"relations": {
@@ -43,6 +46,11 @@
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "userFk"
- }
+ },
+ "Tablet": {
+ "type": "belongsTo",
+ "model": "docuwareTablet",
+ "foreignKey": "tabletFk"
+ }
}
}
diff --git a/back/models/viaexpress-config.js b/back/models/viaexpress-config.js
index d0335b28b..d00c99e82 100644
--- a/back/models/viaexpress-config.js
+++ b/back/models/viaexpress-config.js
@@ -1,4 +1,6 @@
module.exports = Self => {
require('../methods/viaexpress-config/internationalExpedition')(Self);
require('../methods/viaexpress-config/renderer')(Self);
+ require('../methods/viaexpress-config/deleteExpedition')(Self);
+ require('../methods/viaexpress-config/deleteExpeditionRenderer')(Self);
};
diff --git a/back/models/viaexpress-config.json b/back/models/viaexpress-config.json
index 8df24201b..acab1f7e6 100644
--- a/back/models/viaexpress-config.json
+++ b/back/models/viaexpress-config.json
@@ -29,6 +29,9 @@
},
"deliveryType": {
"type": "string"
+ },
+ "agencyModeFk": {
+ "type": "number"
}
}
}
diff --git a/back/models/vn-role.json b/back/models/vn-role.json
new file mode 100644
index 000000000..c7d7e172b
--- /dev/null
+++ b/back/models/vn-role.json
@@ -0,0 +1,13 @@
+{
+ "name": "VnRole",
+ "base": "Role",
+ "validateUpsert": true,
+ "options": {
+ "mysql": {
+ "table": "account.role"
+ }
+ },
+ "mixins": {
+ "Loggable": true
+ }
+}
diff --git a/back/models/vn-user.js b/back/models/vn-user.js
index de5bf7b63..39e7008ca 100644
--- a/back/models/vn-user.js
+++ b/back/models/vn-user.js
@@ -2,6 +2,7 @@ const vnModel = require('vn-loopback/common/models/vn-model');
const {Email} = require('vn-print');
const ForbiddenError = require('vn-loopback/util/forbiddenError');
const LoopBackContext = require('loopback-context');
+const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) {
vnModel(Self);
@@ -9,7 +10,6 @@ module.exports = function(Self) {
require('../methods/vn-user/sign-in')(Self);
require('../methods/vn-user/acl')(Self);
require('../methods/vn-user/recover-password')(Self);
- require('../methods/vn-user/validate-token')(Self);
require('../methods/vn-user/privileges')(Self);
require('../methods/vn-user/validate-auth')(Self);
require('../methods/vn-user/renew-token')(Self);
@@ -92,7 +92,11 @@ module.exports = function(Self) {
};
Self.on('resetPasswordRequest', async function(info) {
- const url = await Self.app.models.Url.getUrl();
+ const loopBackContext = LoopBackContext.getCurrentContext();
+ const httpCtx = {req: loopBackContext.active};
+ const httpRequest = httpCtx.req.http.req;
+ const headers = httpRequest.headers;
+ const origin = headers.origin;
const defaultHash = '/reset-password?access_token=$token$';
const recoverHashes = {
@@ -108,7 +112,7 @@ module.exports = function(Self) {
const params = {
recipient: info.email,
lang: user.lang,
- url: url.slice(0, -1) + recoverHash
+ url: origin + '/#!' + recoverHash
};
const options = Object.assign({}, info.options);
@@ -120,11 +124,43 @@ module.exports = function(Self) {
return email.send();
});
- Self.validateLogin = async function(user, password) {
- let loginInfo = Object.assign({password}, Self.userUses(user));
- token = await Self.login(loginInfo, 'user');
+ /**
+ * Sign-in validate
+ * @param {String} user The user
+ * @param {Object} userToken Options
+ * @param {Object} token accessToken
+ * @param {Object} ctx context
+ */
+ Self.signInValidate = async(user, userToken, token, ctx) => {
+ const [[key, value]] = Object.entries(Self.userUses(user));
+ const isOwner = Self.rawSql(`SELECT ? = ? `, [userToken[key], value]);
+ if (!isOwner) {
+ await Self.app.models.SignInLog.create({
+ userName: user,
+ token: token.id,
+ userFk: userToken.id,
+ ip: ctx.req.ip,
+ owner: isOwner
+ });
+ throw new UserError('Try again');
+ }
+ };
+
+ /**
+ * Validate login params
+ * @param {String} user The user
+ * @param {String} password
+ * @param {Object} ctx context
+ */
+ Self.validateLogin = async function(user, password, ctx) {
+ const loginInfo = Object.assign({password}, Self.userUses(user));
+ const token = await Self.login(loginInfo, 'user');
const userToken = await token.user.get();
+
+ if (ctx)
+ await Self.signInValidate(user, userToken, token, ctx);
+
try {
await Self.app.models.Account.sync(userToken.name, password);
} catch (err) {
@@ -173,8 +209,8 @@ module.exports = function(Self) {
};
Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls =
- Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls
- .filter(acl => acl.property != 'changePassword');
+ Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls
+ .filter(acl => acl.property != 'changePassword');
Self.userSecurity = async(ctx, userId, options) => {
const models = Self.app.models;
@@ -212,23 +248,30 @@ module.exports = function(Self) {
const env = process.env.NODE_ENV;
const liliumUrl = await Self.app.models.Url.findOne({
- where: {and: [
- {appName: 'lilium'},
- {environment: env}
- ]}
+ where: {
+ and: [
+ {appName: 'lilium'},
+ {environment: env}
+ ]
+ }
});
class Mailer {
async send(verifyOptions, cb) {
- const params = {
- url: verifyOptions.verifyHref,
- recipient: verifyOptions.to
- };
+ try {
+ const url = new URL(verifyOptions.verifyHref);
+ if (process.env.NODE_ENV) url.port = '';
- const email = new Email('email-verify', params);
- email.send();
+ const email = new Email('email-verify', {
+ url: url.href,
+ recipient: verifyOptions.to
+ });
+ await email.send();
- cb(null, verifyOptions.to);
+ cb(null, verifyOptions.to);
+ } catch (err) {
+ cb(err);
+ }
}
}
diff --git a/back/models/vn-user.json b/back/models/vn-user.json
index 0f6daff5a..639603643 100644
--- a/back/models/vn-user.json
+++ b/back/models/vn-user.json
@@ -7,6 +7,9 @@
"table": "account.user"
}
},
+ "mixins": {
+ "Loggable": true
+ },
"resetPasswordTokenTTL": "604800",
"properties": {
"id": {
@@ -63,7 +66,7 @@
"relations": {
"role": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "roleFk"
},
"roles": {
@@ -95,34 +98,30 @@
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
- },
- {
- "property": "recoverPassword",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$everyone",
- "permission": "ALLOW"
- },
- {
- "property": "validateToken",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$authenticated",
- "permission": "ALLOW"
- },
- {
- "property": "validateAuth",
+ }, {
+ "property": "recoverPassword",
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
- },
- {
+ }, {
+ "property": "validateAuth",
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ }, {
"property": "privileges",
"accessType": "*",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
+ }, {
+ "property": "renewToken",
+ "accessType": "WRITE",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
}
],
"scopes": {
diff --git a/back/tests.js b/back/tests.js
index 97e548d33..2678f6744 100644
--- a/back/tests.js
+++ b/back/tests.js
@@ -7,6 +7,10 @@ process.on('warning', warning => {
console.log(warning.stack);
});
+process.on('SIGUSR2', async() => {
+ if (container) await container.rm();
+});
+
process.on('exit', async function() {
if (container) await container.rm();
});
@@ -55,8 +59,8 @@ async function test() {
const JunitReporter = require('jasmine-reporters');
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
- jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
jasmine.exitOnCompletion = true;
+ jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 900000;
}
const backSpecs = [
diff --git a/db/.archive/225201/00-invoiceOut_new.sql b/db/.archive/225201/00-invoiceOut_new.sql
index 4c60b50bc..c0f6bc697 100644
--- a/db/.archive/225201/00-invoiceOut_new.sql
+++ b/db/.archive/225201/00-invoiceOut_new.sql
@@ -74,7 +74,7 @@ BEGIN
clientFk,
dued,
companyFk,
- cplusInvoiceType477Fk
+ siiTypeInvoiceOutFk
)
SELECT
1,
@@ -118,13 +118,13 @@ BEGIN
SELECT 'UPDATE', account.myUser_getId(), ti.id, CONCAT('Crea factura ', vNewRef)
FROM tmp.ticketToInvoice ti;
- CALL invoiceExpenceMake(vNewInvoiceId);
+ CALL invoiceExpenseMake(vNewInvoiceId);
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
UPDATE invoiceOut io
JOIN (
SELECT SUM(amount) AS total
- FROM invoiceOutExpence
+ FROM invoiceOutExpense
WHERE invoiceOutFk = vNewInvoiceId
) base
JOIN (
@@ -166,18 +166,18 @@ BEGIN
SET @vTaxableBaseServices := 0.00;
SET @vTaxCodeGeneral := NULL;
- INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
- SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenceFk, sub.taxTypeSageFk , sub.transactionTypeSageFk
+ INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenseFk, sub.taxTypeSageFk , sub.transactionTypeSageFk
FROM (
- SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk
+ SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenseFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk
FROM tmp.ticketServiceTax tst
JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code
WHERE i.isService
HAVING taxableBase
) sub;
- INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
- SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk
+ INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenseFk, i.taxTypeSageFk , i.transactionTypeSageFk
FROM tmp.ticketTax tt
JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code
WHERE !i.isService
diff --git a/db/.archive/231001/02-invoiceOut_new.sql b/db/.archive/231001/02-invoiceOut_new.sql
index d2b96eff7..e87c44cd0 100644
--- a/db/.archive/231001/02-invoiceOut_new.sql
+++ b/db/.archive/231001/02-invoiceOut_new.sql
@@ -96,7 +96,7 @@ BEGIN
clientFk,
dued,
companyFk,
- cplusInvoiceType477Fk
+ siiTypeInvoiceOutFk
)
SELECT
1,
@@ -139,13 +139,13 @@ BEGIN
SELECT 'UPDATE', account.myUser_getId(), ti.id, CONCAT('Crea factura ', vNewRef)
FROM tmp.ticketToInvoice ti;
- CALL invoiceExpenceMake(vNewInvoiceId);
+ CALL invoiceExpenseMake(vNewInvoiceId);
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
UPDATE invoiceOut io
JOIN (
SELECT SUM(amount) total
- FROM invoiceOutExpence
+ FROM invoiceOutExpense
WHERE invoiceOutFk = vNewInvoiceId
) base
JOIN (
@@ -182,15 +182,15 @@ BEGIN
SET @vTaxableBaseServices := 0.00;
SET @vTaxCodeGeneral := NULL;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
@vTaxableBaseServices,
- sub.expenceFk,
+ sub.expenseFk,
sub.taxTypeSageFk,
sub.transactionTypeSageFk
FROM (
SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
- i.expenceFk,
+ i.expenseFk,
i.taxTypeSageFk,
i.transactionTypeSageFk,
@vTaxCodeGeneral := i.taxClassCodeFk
@@ -200,11 +200,11 @@ BEGIN
HAVING taxableBase
) sub;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
@vTaxableBaseServices, 0) taxableBase,
- i.expenceFk,
+ i.expenseFk,
i.taxTypeSageFk ,
i.transactionTypeSageFk
FROM tmp.ticketTax tt
diff --git a/db/.archive/232001/00-invoiceOut_new.sql b/db/.archive/232001/00-invoiceOut_new.sql
index b4fc5c824..175c31b74 100644
--- a/db/.archive/232001/00-invoiceOut_new.sql
+++ b/db/.archive/232001/00-invoiceOut_new.sql
@@ -96,7 +96,7 @@ BEGIN
clientFk,
dued,
companyFk,
- cplusInvoiceType477Fk
+ siiTypeInvoiceOutFk
)
SELECT
1,
@@ -135,13 +135,13 @@ BEGIN
INSERT INTO ticketTracking(stateFk,ticketFk,workerFk)
SELECT * FROM tmp.updateInter;
- CALL invoiceExpenceMake(vNewInvoiceId);
+ CALL invoiceExpenseMake(vNewInvoiceId);
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
UPDATE invoiceOut io
JOIN (
SELECT SUM(amount) total
- FROM invoiceOutExpence
+ FROM invoiceOutExpense
WHERE invoiceOutFk = vNewInvoiceId
) base
JOIN (
@@ -178,15 +178,15 @@ BEGIN
SET @vTaxableBaseServices := 0.00;
SET @vTaxCodeGeneral := NULL;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
@vTaxableBaseServices,
- sub.expenceFk,
+ sub.expenseFk,
sub.taxTypeSageFk,
sub.transactionTypeSageFk
FROM (
SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
- i.expenceFk,
+ i.expenseFk,
i.taxTypeSageFk,
i.transactionTypeSageFk,
@vTaxCodeGeneral := i.taxClassCodeFk
@@ -196,11 +196,11 @@ BEGIN
HAVING taxableBase
) sub;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
@vTaxableBaseServices, 0) taxableBase,
- i.expenceFk,
+ i.expenseFk,
i.taxTypeSageFk ,
i.transactionTypeSageFk
FROM tmp.ticketTax tt
diff --git a/db/changes/233001/.gitkeep b/db/.archive/233001/.gitkeep
similarity index 100%
rename from db/changes/233001/.gitkeep
rename to db/.archive/233001/.gitkeep
diff --git a/db/changes/233001/00-aclSaleTracking.sql b/db/.archive/233001/00-aclSaleTracking.sql
similarity index 100%
rename from db/changes/233001/00-aclSaleTracking.sql
rename to db/.archive/233001/00-aclSaleTracking.sql
diff --git a/db/changes/233001/00-clientSms.sql b/db/.archive/233001/00-clientSms.sql
similarity index 100%
rename from db/changes/233001/00-clientSms.sql
rename to db/.archive/233001/00-clientSms.sql
diff --git a/db/changes/233001/00-company.sql b/db/.archive/233001/00-company.sql
similarity index 100%
rename from db/changes/233001/00-company.sql
rename to db/.archive/233001/00-company.sql
diff --git a/db/changes/233001/00-fixACLVehicle.sql b/db/.archive/233001/00-fixACLVehicle.sql
similarity index 100%
rename from db/changes/233001/00-fixACLVehicle.sql
rename to db/.archive/233001/00-fixACLVehicle.sql
diff --git a/db/changes/233001/00-itemRecycle.sql b/db/.archive/233001/00-itemRecycle.sql
similarity index 100%
rename from db/changes/233001/00-itemRecycle.sql
rename to db/.archive/233001/00-itemRecycle.sql
diff --git a/db/changes/233001/00-itemShelving_inventory.sql b/db/.archive/233001/00-itemShelving_inventory.sql
similarity index 100%
rename from db/changes/233001/00-itemShelving_inventory.sql
rename to db/.archive/233001/00-itemShelving_inventory.sql
diff --git a/db/changes/233001/00-noUniqueSocialName.sql b/db/.archive/233001/00-noUniqueSocialName.sql
similarity index 100%
rename from db/changes/233001/00-noUniqueSocialName.sql
rename to db/.archive/233001/00-noUniqueSocialName.sql
diff --git a/db/changes/233001/00-roadmap.sql b/db/.archive/233001/00-roadmap.sql
similarity index 100%
rename from db/changes/233001/00-roadmap.sql
rename to db/.archive/233001/00-roadmap.sql
diff --git a/db/changes/233001/00-roadmapACL.sql b/db/.archive/233001/00-roadmapACL.sql
similarity index 100%
rename from db/changes/233001/00-roadmapACL.sql
rename to db/.archive/233001/00-roadmapACL.sql
diff --git a/db/changes/233001/00-ticketWeight.sql b/db/.archive/233001/00-ticketWeight.sql
similarity index 100%
rename from db/changes/233001/00-ticketWeight.sql
rename to db/.archive/233001/00-ticketWeight.sql
diff --git a/db/changes/233201/.gitkeep b/db/.archive/233201/.gitkeep
similarity index 100%
rename from db/changes/233201/.gitkeep
rename to db/.archive/233201/.gitkeep
diff --git a/db/changes/233201/00-acl_viaexpressConfig.sql b/db/.archive/233201/00-acl_viaexpressConfig.sql
similarity index 100%
rename from db/changes/233201/00-acl_viaexpressConfig.sql
rename to db/.archive/233201/00-acl_viaexpressConfig.sql
diff --git a/db/changes/233201/00-transferClient.sql b/db/.archive/233201/00-transferClient.sql
similarity index 100%
rename from db/changes/233201/00-transferClient.sql
rename to db/.archive/233201/00-transferClient.sql
diff --git a/db/changes/233201/00-updatePrice.sql b/db/.archive/233201/00-updatePrice.sql
similarity index 100%
rename from db/changes/233201/00-updatePrice.sql
rename to db/.archive/233201/00-updatePrice.sql
diff --git a/db/changes/233201/00-viaexpress.sql b/db/.archive/233201/00-viaexpress.sql
similarity index 100%
rename from db/changes/233201/00-viaexpress.sql
rename to db/.archive/233201/00-viaexpress.sql
diff --git a/db/changes/233201/00-workerDocuware.sql b/db/.archive/233201/00-workerDocuware.sql
similarity index 100%
rename from db/changes/233201/00-workerDocuware.sql
rename to db/.archive/233201/00-workerDocuware.sql
diff --git a/db/changes/233202/00-client_create_upper.sql b/db/.archive/233202/00-client_create_upper.sql
similarity index 100%
rename from db/changes/233202/00-client_create_upper.sql
rename to db/.archive/233202/00-client_create_upper.sql
diff --git a/db/changes/233202/00-ticketSmsACL.sql b/db/.archive/233202/00-ticketSmsACL.sql
similarity index 100%
rename from db/changes/233202/00-ticketSmsACL.sql
rename to db/.archive/233202/00-ticketSmsACL.sql
diff --git a/db/changes/233401/00-setDeleted_acl.sql b/db/.archive/233401/00-setDeleted_acl.sql
similarity index 100%
rename from db/changes/233401/00-setDeleted_acl.sql
rename to db/.archive/233401/00-setDeleted_acl.sql
diff --git a/db/changes/233601/.gitkeep b/db/.archive/233601/.gitkeep
similarity index 100%
rename from db/changes/233601/.gitkeep
rename to db/.archive/233601/.gitkeep
diff --git a/db/changes/233601/00-aclWorker.sql b/db/.archive/233601/00-aclWorker.sql
similarity index 100%
rename from db/changes/233601/00-aclWorker.sql
rename to db/.archive/233601/00-aclWorker.sql
diff --git a/db/changes/233601/00-addExpeditionState.sql b/db/.archive/233601/00-addExpeditionState.sql
similarity index 100%
rename from db/changes/233601/00-addExpeditionState.sql
rename to db/.archive/233601/00-addExpeditionState.sql
diff --git a/db/changes/233601/00-department.sql b/db/.archive/233601/00-department.sql
similarity index 100%
rename from db/changes/233601/00-department.sql
rename to db/.archive/233601/00-department.sql
diff --git a/db/changes/233601/00-saleGroupDetail.sql b/db/.archive/233601/00-saleGroupDetail.sql
similarity index 100%
rename from db/changes/233601/00-saleGroupDetail.sql
rename to db/.archive/233601/00-saleGroupDetail.sql
diff --git a/db/changes/233801/.gitkeep b/db/.archive/233801/.gitkeep
similarity index 100%
rename from db/changes/233801/.gitkeep
rename to db/.archive/233801/.gitkeep
diff --git a/db/changes/233801/00-firstScript.sql b/db/.archive/233801/00-firstScript.sql
similarity index 100%
rename from db/changes/233801/00-firstScript.sql
rename to db/.archive/233801/00-firstScript.sql
diff --git a/db/changes/233801/01-deviceLog_acl.sql b/db/.archive/233801/01-deviceLog_acl.sql
similarity index 100%
rename from db/changes/233801/01-deviceLog_acl.sql
rename to db/.archive/233801/01-deviceLog_acl.sql
diff --git a/db/changes/233802/.gitkeep b/db/.archive/233802/.gitkeep
similarity index 100%
rename from db/changes/233802/.gitkeep
rename to db/.archive/233802/.gitkeep
diff --git a/db/changes/233802/00-collectionGetTicketsACL.sql b/db/.archive/233802/00-collectionGetTicketsACL.sql
similarity index 100%
rename from db/changes/233802/00-collectionGetTicketsACL.sql
rename to db/.archive/233802/00-collectionGetTicketsACL.sql
diff --git a/db/Dockerfile b/db/Dockerfile
index 8eeed35e5..0020e8950 100644
--- a/db/Dockerfile
+++ b/db/Dockerfile
@@ -1,4 +1,4 @@
-FROM mariadb:10.7.7
+FROM mariadb:10.11.6
ENV MYSQL_ROOT_PASSWORD root
ENV TZ Europe/Madrid
diff --git a/db/changes/234601/00-transferInvoice.sql b/db/changes/234601/00-transferInvoice.sql
index 7a9890ae4..d9ae39464 100644
--- a/db/changes/234601/00-transferInvoice.sql
+++ b/db/changes/234601/00-transferInvoice.sql
@@ -1,6 +1,6 @@
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('CplusRectificationType', '*', 'READ', 'ALLOW', 'ROLE', 'administrative'),
- ('CplusInvoiceType477', '*', 'READ', 'ALLOW', 'ROLE', 'administrative'),
+ ('SiiTypeInvoiceOut', '*', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('InvoiceCorrectionType', '*', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('InvoiceOut', 'transferInvoice', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
diff --git a/db/changes/234601/00-updateCourtesyTime.sql b/db/changes/234601/00-updateCourtesyTime.sql
new file mode 100644
index 000000000..4751b2e03
--- /dev/null
+++ b/db/changes/234601/00-updateCourtesyTime.sql
@@ -0,0 +1,4 @@
+-- Auto-generated SQL script #202311061003
+UPDATE salix.accessTokenConfig
+ SET courtesyTime=60
+ WHERE id=1;
diff --git a/db/changes/234602/00-roleSync.sql b/db/changes/234602/00-roleSync.sql
new file mode 100644
index 000000000..7ce277748
--- /dev/null
+++ b/db/changes/234602/00-roleSync.sql
@@ -0,0 +1 @@
+CALL `account`.`role_sync`();
diff --git a/db/changes/234604/00-sambaConfigUserDn.sql b/db/changes/234604/00-sambaConfigUserDn.sql
new file mode 100644
index 000000000..cacb30e97
--- /dev/null
+++ b/db/changes/234604/00-sambaConfigUserDn.sql
@@ -0,0 +1,2 @@
+ALTER TABLE account.sambaConfig
+ ADD userDn varchar(255) NOT NULL COMMENT 'Base DN for users without domain DN part';
diff --git a/db/changes/234801/00-ACL_executeRoutine.sql b/db/changes/234801/00-ACL_executeRoutine.sql
new file mode 100644
index 000000000..cfe7018e9
--- /dev/null
+++ b/db/changes/234801/00-ACL_executeRoutine.sql
@@ -0,0 +1,4 @@
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('Application', 'executeProc', '*', 'ALLOW', 'ROLE', 'employee'),
+ ('Application', 'executeFunc', '*', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/changes/234801/00-ticket_canAdvance_update.sql b/db/changes/234801/00-ticket_canAdvance_update.sql
new file mode 100644
index 000000000..afe0a4dc6
--- /dev/null
+++ b/db/changes/234801/00-ticket_canAdvance_update.sql
@@ -0,0 +1,152 @@
+DELIMITER $$
+$$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
+BEGIN
+/**
+ * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
+ *
+ * @param vDateFuture Fecha de los tickets que se quieren adelantar.
+ * @param vDateToAdvance Fecha a cuando se quiere adelantar.
+ * @param vWarehouseFk Almacén
+ */
+ DECLARE vDateInventory DATE;
+
+ SELECT inventoried INTO vDateInventory FROM config;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.stock
+ (itemFk INT PRIMARY KEY,
+ amount INT)
+ ENGINE = MEMORY;
+
+ INSERT INTO tmp.stock(itemFk, amount)
+ SELECT itemFk, SUM(quantity) amount FROM
+ (
+ SELECT itemFk, quantity
+ FROM itemTicketOut
+ WHERE shipped >= vDateInventory
+ AND shipped < vDateFuture
+ AND warehouseFk = vWarehouseFk
+ UNION ALL
+ SELECT itemFk, quantity
+ FROM itemEntryIn
+ WHERE landed >= vDateInventory
+ AND landed <= vDateToAdvance
+ AND isVirtualStock = FALSE
+ AND warehouseInFk = vWarehouseFk
+ UNION ALL
+ SELECT itemFk, quantity
+ FROM itemEntryOut
+ WHERE shipped >= vDateInventory
+ AND shipped < vDateFuture
+ AND warehouseOutFk = vWarehouseFk
+ ) t
+ GROUP BY itemFk HAVING amount != 0;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.filter
+ (INDEX (id))
+ SELECT
+ origin.ticketFk futureId,
+ dest.ticketFk id,
+ dest.state,
+ origin.futureState,
+ origin.futureIpt,
+ dest.ipt,
+ origin.workerFk,
+ origin.futureLiters,
+ origin.futureLines,
+ dest.shipped,
+ origin.shipped futureShipped,
+ dest.totalWithVat,
+ origin.totalWithVat futureTotalWithVat,
+ dest.agency,
+ dest.agencyModeFk,
+ origin.futureAgency,
+ origin.agencyModeFk futureAgencyModeFk,
+ dest.lines,
+ dest.liters,
+ origin.futureLines - origin.hasStock AS notMovableLines,
+ (origin.futureLines = origin.hasStock) AS isFullMovable,
+ dest.zoneFk,
+ origin.futureZoneFk,
+ origin.futureZoneName,
+ origin.classColor futureClassColor,
+ dest.classColor,
+ origin.clientFk futureClientFk,
+ origin.addressFk futureAddressFk,
+ origin.warehouseFk futureWarehouseFk,
+ origin.companyFk futureCompanyFk,
+ IFNULL(dest.nickname, origin.nickname) nickname,
+ dest.landed
+ FROM (
+ SELECT
+ s.ticketFk,
+ c.salesPersonFk workerFk,
+ t.shipped,
+ t.totalWithVat,
+ st.name futureState,
+ am.name futureAgency,
+ count(s.id) futureLines,
+ GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
+ CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
+ SUM((s.quantity <= IFNULL(st.amount,0))) hasStock,
+ z.id futureZoneFk,
+ z.name futureZoneName,
+ st.classColor,
+ t.clientFk,
+ t.nickname,
+ t.addressFk,
+ t.warehouseFk,
+ t.companyFk,
+ t.agencyModeFk
+ FROM ticket t
+ JOIN client c ON c.id = t.clientFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN saleVolume sv ON sv.saleFk = s.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN ticketState ts ON ts.ticketFk = t.id
+ JOIN state st ON st.id = ts.stateFk
+ JOIN agencyMode am ON t.agencyModeFk = am.id
+ JOIN zone z ON t.zoneFk = z.id
+ LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
+ LEFT JOIN tmp.stock st ON st.itemFk = i.id
+ WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
+ AND t.warehouseFk = vWarehouseFk
+ GROUP BY t.id
+ ) origin
+ LEFT JOIN (
+ SELECT
+ t.id ticketFk,
+ st.name state,
+ GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
+ t.shipped,
+ t.totalWithVat,
+ am.name agency,
+ CAST(SUM(litros) AS DECIMAL(10,0)) liters,
+ CAST(COUNT(*) AS DECIMAL(10,0)) `lines`,
+ st.classColor,
+ t.clientFk,
+ t.nickname,
+ t.addressFk,
+ t.zoneFk,
+ t.warehouseFk,
+ t.companyFk,
+ t.landed,
+ t.agencyModeFk
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN saleVolume sv ON sv.saleFk = s.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN ticketState ts ON ts.ticketFk = t.id
+ JOIN state st ON st.id = ts.stateFk
+ JOIN agencyMode am ON t.agencyModeFk = am.id
+ LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
+ WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
+ AND t.warehouseFk = vWarehouseFk
+ AND st.order <= 5
+ GROUP BY t.id
+ ) dest ON dest.addressFk = origin.addressFk
+ WHERE origin.hasStock;
+
+ DROP TEMPORARY TABLE tmp.stock;
+END$$
+DELIMITER ;
diff --git a/db/changes/234802/00-createSignInLogTable.sql b/db/changes/234802/00-createSignInLogTable.sql
new file mode 100644
index 000000000..942f651c9
--- /dev/null
+++ b/db/changes/234802/00-createSignInLogTable.sql
@@ -0,0 +1,21 @@
+
+--
+-- Table structure for table `signInLog`
+-- Description: log to debug cross-login error
+--
+
+DROP TABLE IF EXISTS `account`.`signInLog`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `account`.`signInLog` (
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ `token` varchar(255) NOT NULL ,
+ `userFk` int(10) unsigned DEFAULT NULL,
+ `creationDate` timestamp NULL DEFAULT current_timestamp(),
+ `userName` varchar(30) NOT NULL,
+ `ip` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `owner` tinyint(1) DEFAULT 1,
+ KEY `userFk` (`userFk`),
+ CONSTRAINT `signInLog_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
diff --git a/db/changes/235001/.gitkeep b/db/changes/235001/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/db/changes/235001/00-getRoutesByWorker.sql b/db/changes/235001/00-getRoutesByWorker.sql
new file mode 100644
index 000000000..00d6e658a
--- /dev/null
+++ b/db/changes/235001/00-getRoutesByWorker.sql
@@ -0,0 +1,26 @@
+DELETE FROM `salix`.`ACL`
+ WHERE
+ model = 'Route'
+ AND property = '*'
+ AND accessType = 'READ';
+
+INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+ VALUES
+ ('Route', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'findById', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'findOne', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getRoutesByWorker', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'canViewAllRoute', 'READ', 'ALLOW', 'ROLE', 'deliveryBoss'),
+ ('Route', 'cmr', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'downloadCmrsZip', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'downloadZip', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getByWorker', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getDeliveryPoint', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getExternalCmrs', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getSuggestedTickets', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getTickets', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'guessPriority', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'insertTicket', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('Route', 'getDeliveryPoint', 'READ', 'ALLOW', 'ROLE', 'deliveryBoss'),
+ ('Route', 'summary', 'READ', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/changes/235001/00-updateACL_Role_VnRole.sql b/db/changes/235001/00-updateACL_Role_VnRole.sql
new file mode 100644
index 000000000..b08a44138
--- /dev/null
+++ b/db/changes/235001/00-updateACL_Role_VnRole.sql
@@ -0,0 +1,6 @@
+INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES
+ ('VnRole','*','READ','ALLOW','ROLE','employee'),
+ ('VnRole','*','WRITE','ALLOW','ROLE','it');
+
+DELETE FROM`salix`.`ACL` WHERE model='Role';
+
diff --git a/db/changes/240001/00-alterTable.sql b/db/changes/240001/00-alterTable.sql
new file mode 100644
index 000000000..b6974b715
--- /dev/null
+++ b/db/changes/240001/00-alterTable.sql
@@ -0,0 +1 @@
+ALTER TABLE `vn`.`ticketTracking` CHANGE `workerFk` `userFk` int(10) unsigned DEFAULT NULL NULL;
\ No newline at end of file
diff --git a/db/changes/240001/00-clientCreditLimitToRoleCreditLimit.sql b/db/changes/240001/00-clientCreditLimitToRoleCreditLimit.sql
new file mode 100644
index 000000000..2bc0f830d
--- /dev/null
+++ b/db/changes/240001/00-clientCreditLimitToRoleCreditLimit.sql
@@ -0,0 +1,4 @@
+RENAME TABLE `vn`.`clientCreditLimit` TO `vn`.`roleCreditLimit`;
+ALTER TABLE `vn`.`roleCreditLimit` DROP FOREIGN KEY `clientCreditLimit_FK`;
+ALTER TABLE `vn`.`roleCreditLimit` ADD CONSTRAINT `roleCreditLimit_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+
diff --git a/db/changes/240001/01-procedures.sql b/db/changes/240001/01-procedures.sql
new file mode 100644
index 000000000..3777708d5
--- /dev/null
+++ b/db/changes/240001/01-procedures.sql
@@ -0,0 +1,1129 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(vSelf INT, vUserId INT)
+BEGIN
+/**
+ * Confirms an order, creating each of its tickets on the corresponding
+ * date, store and user.
+ *
+ * @param vSelf The order identifier
+ * @param vUser The user identifier
+ */
+ DECLARE vOk BOOL;
+ DECLARE vDone BOOL DEFAULT FALSE;
+ DECLARE vWarehouse INT;
+ DECLARE vShipment DATE;
+ DECLARE vTicket INT;
+ DECLARE vNotes VARCHAR(255);
+ DECLARE vItem INT;
+ DECLARE vConcept VARCHAR(30);
+ DECLARE vAmount INT;
+ DECLARE vPrice DECIMAL(10,2);
+ DECLARE vSale INT;
+ DECLARE vRate INT;
+ DECLARE vRowId INT;
+ DECLARE vPriceFixed DECIMAL(10,2);
+ DECLARE vDelivery DATE;
+ DECLARE vAddress INT;
+ DECLARE vIsConfirmed BOOL;
+ DECLARE vClientId INT;
+ DECLARE vCompanyId INT;
+ DECLARE vAgencyModeId INT;
+ DECLARE TICKET_FREE INT DEFAULT 2;
+ DECLARE vCalc INT;
+ DECLARE vIsLogifloraItem BOOL;
+ DECLARE vOldQuantity INT;
+ DECLARE vNewQuantity INT;
+ DECLARE vIsTaxDataChecked BOOL;
+
+ DECLARE cDates CURSOR FOR
+ SELECT zgs.shipped, r.warehouse_id
+ FROM `order` o
+ JOIN order_row r ON r.order_id = o.id
+ LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
+ WHERE o.id = vSelf AND r.amount != 0
+ GROUP BY r.warehouse_id;
+
+ DECLARE cRows CURSOR FOR
+ SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo
+ FROM order_row r
+ JOIN vn.item i ON i.id = r.item_id
+ WHERE r.amount != 0
+ AND r.warehouse_id = vWarehouse
+ AND r.order_id = vSelf
+ ORDER BY r.rate DESC;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND
+ SET vDone = TRUE;
+
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ RESIGNAL;
+ END;
+
+ -- Carga los datos del pedido
+ SELECT o.date_send, o.address_id, o.note, a.clientFk,
+ o.company_id, o.agency_id, c.isTaxDataChecked
+ INTO vDelivery, vAddress, vNotes, vClientId,
+ vCompanyId, vAgencyModeId, vIsTaxDataChecked
+ FROM hedera.`order` o
+ JOIN vn.address a ON a.id = o.address_id
+ JOIN vn.client c ON c.id = a.clientFk
+ WHERE o.id = vSelf;
+
+ -- Verifica si el cliente tiene los datos comprobados
+ IF NOT vIsTaxDataChecked THEN
+ CALL util.throw ('clientNotVerified');
+ END IF;
+
+ -- Carga las fechas de salida de cada almacen
+ CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
+
+ -- Trabajador que realiza la accion
+ IF vUserId IS NULL THEN
+ SELECT employeeFk INTO vUserId FROM orderConfig;
+ END IF;
+
+ START TRANSACTION;
+
+ CALL order_checkEditable(vSelf);
+
+ -- Check order is not empty
+
+ SELECT COUNT(*) > 0 INTO vOk
+ FROM order_row WHERE order_id = vSelf AND amount > 0;
+
+ IF NOT vOk THEN
+ CALL util.throw ('ORDER_EMPTY');
+ END IF;
+
+ -- Crea los tickets del pedido
+
+ OPEN cDates;
+
+ lDates:
+ LOOP
+ SET vTicket = NULL;
+ SET vDone = FALSE;
+ FETCH cDates INTO vShipment, vWarehouse;
+
+ IF vDone THEN
+ LEAVE lDates;
+ END IF;
+
+ -- Busca un ticket existente que coincida con los parametros
+ WITH tPrevia AS
+ (SELECT DISTINCT s.ticketFk
+ FROM vn.sale s
+ JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN vn.ticket t ON t.id = s.ticketFk
+ WHERE t.shipped BETWEEN vShipment AND util.dayend(vShipment)
+ )
+ SELECT t.id INTO vTicket
+ FROM vn.ticket t
+ LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
+ LEFT JOIN vn.ticketState tls on tls.ticket = t.id
+ JOIN hedera.`order` o
+ ON o.address_id = t.addressFk
+ AND vWarehouse = t.warehouseFk
+ AND o.date_send = t.landed
+ AND DATE(t.shipped) = vShipment
+ WHERE o.id = vSelf
+ AND t.refFk IS NULL
+ AND tp.ticketFk IS NULL
+ AND IFNULL(tls.alertLevel,0) = 0
+ LIMIT 1;
+
+ -- Crea el ticket en el caso de no existir uno adecuado
+ IF vTicket IS NULL
+ THEN
+
+ SET vShipment = IFNULL(vShipment, util.VN_CURDATE());
+
+ CALL vn.ticket_add(
+ vClientId,
+ vShipment,
+ vWarehouse,
+ vCompanyId,
+ vAddress,
+ vAgencyModeId,
+ NULL,
+ vDelivery,
+ vUserId,
+ TRUE,
+ vTicket
+ );
+ ELSE
+ INSERT INTO vn.ticketTracking
+ SET ticketFk = vTicket,
+ userFk = vUserId,
+ stateFk = TICKET_FREE;
+ END IF;
+
+ INSERT IGNORE INTO vn.orderTicket
+ SET orderFk = vSelf,
+ ticketFk = vTicket;
+
+ -- Añade las notas
+
+ IF vNotes IS NOT NULL AND vNotes != ''
+ THEN
+ INSERT INTO vn.ticketObservation SET
+ ticketFk = vTicket,
+ observationTypeFk = 4 /* salesperson */,
+ `description` = vNotes
+ ON DUPLICATE KEY UPDATE
+ `description` = CONCAT(VALUES(`description`),'. ', `description`);
+ END IF;
+
+ -- Añade los movimientos y sus componentes
+
+ OPEN cRows;
+
+ lRows: LOOP
+ SET vDone = FALSE;
+ FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
+
+ IF vDone THEN
+ LEAVE lRows;
+ END IF;
+
+ SET vSale = NULL;
+
+ SELECT s.id, s.quantity INTO vSale, vOldQuantity
+ FROM vn.sale s
+ WHERE ticketFk = vTicket
+ AND price = vPrice
+ AND itemFk = vItem
+ AND discount = 0
+ LIMIT 1;
+
+ IF vSale THEN
+ UPDATE vn.sale
+ SET quantity = quantity + vAmount,
+ originalQuantity = quantity
+ WHERE id = vSale;
+
+ SELECT s.quantity INTO vNewQuantity
+ FROM vn.sale s
+ WHERE id = vSale;
+ ELSE
+ -- Obtiene el coste
+ SELECT SUM(rc.`price`) valueSum INTO vPriceFixed
+ FROM orderRowComponent rc
+ JOIN vn.component c ON c.id = rc.componentFk
+ JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
+ WHERE rc.rowFk = vRowId;
+
+ INSERT INTO vn.sale
+ SET itemFk = vItem,
+ ticketFk = vTicket,
+ concept = vConcept,
+ quantity = vAmount,
+ price = vPrice,
+ priceFixed = vPriceFixed,
+ isPriceFixed = TRUE;
+
+ SET vSale = LAST_INSERT_ID();
+
+ INSERT INTO vn.saleComponent
+ (saleFk, componentFk, `value`)
+ SELECT vSale, rc.componentFk, rc.price
+ FROM orderRowComponent rc
+ JOIN vn.component c ON c.id = rc.componentFk
+ WHERE rc.rowFk = vRowId
+ GROUP BY vSale, rc.componentFk;
+ END IF;
+
+ UPDATE order_row SET Id_Movimiento = vSale
+ WHERE id = vRowId;
+
+ -- Inserta en putOrder si la compra es de Floramondo
+ IF vIsLogifloraItem THEN
+ CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment);
+
+ SET @available := 0;
+
+ SELECT GREATEST(0,available) INTO @available
+ FROM cache.availableNoRaids
+ WHERE calc_id = vCalc
+ AND item_id = vItem;
+
+ UPDATE cache.availableNoRaids
+ SET available = GREATEST(0,available - vAmount)
+ WHERE item_id = vItem
+ AND calc_id = vCalc;
+
+ INSERT INTO edi.putOrder (
+ deliveryInformationID,
+ supplyResponseId,
+ quantity ,
+ EndUserPartyId,
+ EndUserPartyGLN,
+ FHAdminNumber,
+ saleFk
+ )
+ SELECT di.ID,
+ i.supplyResponseFk,
+ CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask),
+ o.address_id ,
+ vClientId,
+ IFNULL(ca.fhAdminNumber, fhc.defaultAdminNumber),
+ vSale
+ FROM edi.deliveryInformation di
+ JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID
+ JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
+ LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientId
+ JOIN edi.floraHollandConfig fhc
+ JOIN hedera.`order` o ON o.id = vSelf
+ WHERE i.id = vItem
+ AND di.LatestOrderDateTime > util.VN_NOW()
+ AND vAmount > @available
+ LIMIT 1;
+ END IF;
+ END LOOP;
+
+ CLOSE cRows;
+ END LOOP;
+
+ CLOSE cDates;
+
+ UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW()
+ WHERE id = vSelf;
+
+ COMMIT;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`(
+ vSerial VARCHAR(255),
+ vInvoiceDate DATE,
+ vTaxArea VARCHAR(25),
+ OUT vNewInvoiceId INT)
+BEGIN
+/**
+ * Creación de facturas emitidas.
+ * requiere previamente tabla tmp.ticketToInvoice(id).
+ *
+ * @param vSerial serie a la cual se hace la factura
+ * @param vInvoiceDate fecha de la factura
+ * @param vTaxArea tipo de iva en relacion a la empresa y al cliente
+ * @param vNewInvoiceId id de la factura que se acaba de generar
+ * @return vNewInvoiceId
+ */
+ DECLARE vIsAnySaleToInvoice BOOL;
+ DECLARE vIsAnyServiceToInvoice BOOL;
+ DECLARE vNewRef VARCHAR(255);
+ DECLARE vWorker INT DEFAULT account.myUser_getId();
+ DECLARE vCompanyFk INT;
+ DECLARE vInterCompanyFk INT;
+ DECLARE vClientFk INT;
+ DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1;
+ DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6;
+ DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2;
+ DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R';
+ DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S';
+ DECLARE vNewInvoiceInFk INT;
+ DECLARE vIsInterCompany BOOL DEFAULT FALSE;
+ DECLARE vIsCEESerial BOOL DEFAULT FALSE;
+ DECLARE vIsCorrectInvoiceDate BOOL;
+ DECLARE vMaxShipped DATE;
+ DECLARE vDone BOOL;
+ DECLARE vTicketFk INT;
+ DECLARE vCursor CURSOR FOR
+ SELECT id
+ FROM tmp.ticketToInvoice;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE());
+
+ SELECT t.clientFk,
+ t.companyFk,
+ MAX(DATE(t.shipped)),
+ DATE(vInvoiceDate) >= invoiceOut_getMaxIssued(
+ vSerial,
+ t.companyFk,
+ YEAR(vInvoiceDate))
+ INTO vClientFk,
+ vCompanyFk,
+ vMaxShipped,
+ vIsCorrectInvoiceDate
+ FROM tmp.ticketToInvoice tt
+ JOIN ticket t ON t.id = tt.id;
+
+ IF(vMaxShipped > vInvoiceDate) THEN
+ CALL util.throw("Invoice date can't be less than max date");
+ END IF;
+
+ IF NOT vIsCorrectInvoiceDate THEN
+ CALL util.throw('Exists an invoice with a previous date');
+ END IF;
+
+ -- Eliminem de tmp.ticketToInvoice els tickets que no han de ser facturats
+ DELETE ti.*
+ FROM tmp.ticketToInvoice ti
+ JOIN ticket t ON t.id = ti.id
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN supplier su ON su.id = t.companyFk
+ JOIN client c ON c.id = t.clientFk
+ LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
+ WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted)
+ OR c.isTaxDataChecked = FALSE
+ OR t.isDeleted
+ OR c.hasToInvoice = FALSE
+ OR itc.id IS NULL;
+
+ SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0
+ INTO vIsAnySaleToInvoice
+ FROM tmp.ticketToInvoice t
+ JOIN sale s ON s.ticketFk = t.id;
+
+ SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice
+ FROM tmp.ticketToInvoice t
+ JOIN ticketService ts ON ts.ticketFk = t.id;
+
+ IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice)
+ AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase())
+ THEN
+
+ -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial
+ INSERT INTO invoiceOut(
+ ref,
+ serial,
+ issued,
+ clientFk,
+ dued,
+ companyFk,
+ siiTypeInvoiceOutFk
+ )
+ SELECT
+ 1,
+ vSerial,
+ vInvoiceDate,
+ vClientFk,
+ getDueDate(vInvoiceDate, dueDay),
+ vCompanyFk,
+ IF(vSerial = vCorrectingSerial,
+ vCplusCorrectingInvoiceTypeFk,
+ IF(vSerial = vSimplifiedSerial,
+ vCplusSimplifiedInvoiceTypeFk,
+ vCplusStandardInvoiceTypeFk))
+ FROM client
+ WHERE id = vClientFk;
+
+ SET vNewInvoiceId = LAST_INSERT_ID();
+
+ SELECT `ref`
+ INTO vNewRef
+ FROM invoiceOut
+ WHERE id = vNewInvoiceId;
+
+ OPEN vCursor;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vCursor INTO vTicketFk;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CALL ticket_recalc(vTicketFk, vTaxArea);
+
+ END LOOP;
+ CLOSE vCursor;
+
+ UPDATE ticket t
+ JOIN tmp.ticketToInvoice ti ON ti.id = t.id
+ SET t.refFk = vNewRef;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.updateInter;
+ CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY
+ SELECT s.id, ti.id ticket_id, vWorker Id_Trabajador
+ FROM tmp.ticketToInvoice ti
+ LEFT JOIN ticketState ts ON ti.id = ts.ticket
+ JOIN state s
+ WHERE IFNULL(ts.alertLevel, 0) < 3 and s.`code` = getAlert3State(ti.id);
+
+ INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
+ SELECT * FROM tmp.updateInter;
+
+ CALL invoiceExpenseMake(vNewInvoiceId);
+ CALL invoiceTaxMake(vNewInvoiceId, vTaxArea);
+
+ UPDATE invoiceOut io
+ JOIN (
+ SELECT SUM(amount) total
+ FROM invoiceOutExpense
+ WHERE invoiceOutFk = vNewInvoiceId
+ ) base
+ JOIN (
+ SELECT SUM(vat) total
+ FROM invoiceOutTax
+ WHERE invoiceOutFk = vNewInvoiceId
+ ) vat
+ SET io.amount = base.total + vat.total
+ WHERE io.id = vNewInvoiceId;
+
+ DROP TEMPORARY TABLE tmp.updateInter;
+
+ SELECT COUNT(*), id
+ INTO vIsInterCompany, vInterCompanyFk
+ FROM company
+ WHERE clientFk = vClientFk;
+
+ IF (vIsInterCompany) THEN
+
+ INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk)
+ SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk;
+
+ SET vNewInvoiceInFk = LAST_INSERT_ID();
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
+ CREATE TEMPORARY TABLE tmp.ticket
+ (KEY (ticketFk))
+ ENGINE = MEMORY
+ SELECT id ticketFk
+ FROM tmp.ticketToInvoice;
+
+ CALL `ticket_getTax`('NATIONAL');
+
+ SET @vTaxableBaseServices := 0.00;
+ SET @vTaxCodeGeneral := NULL;
+
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInFk,
+ @vTaxableBaseServices,
+ sub.expenseFk,
+ sub.taxTypeSageFk,
+ sub.transactionTypeSageFk
+ FROM (
+ SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
+ i.expenseFk,
+ i.taxTypeSageFk,
+ i.transactionTypeSageFk,
+ @vTaxCodeGeneral := i.taxClassCodeFk
+ FROM tmp.ticketServiceTax tst
+ JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code
+ WHERE i.isService
+ HAVING taxableBase
+ ) sub;
+
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInFk,
+ SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
+ @vTaxableBaseServices, 0) taxableBase,
+ i.expenseFk,
+ i.taxTypeSageFk ,
+ i.transactionTypeSageFk
+ FROM tmp.ticketTax tt
+ JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code
+ WHERE !i.isService
+ GROUP BY tt.pgcFk
+ HAVING taxableBase
+ ORDER BY tt.priority;
+
+ CALL invoiceInDueDay_calculate(vNewInvoiceInFk);
+
+ SELECT COUNT(*) INTO vIsCEESerial
+ FROM invoiceOutSerial
+ WHERE code = vSerial;
+
+ IF vIsCEESerial THEN
+
+ INSERT INTO invoiceInIntrastat (
+ invoiceInFk,
+ intrastatFk,
+ amount,
+ stems,
+ countryFk,
+ net)
+ SELECT
+ vNewInvoiceInFk,
+ i.intrastatFk,
+ SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))),
+ SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))),
+ su.countryFk,
+ CAST(SUM(IFNULL(i.stems, 1)
+ * s.quantity
+ * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2))
+ FROM sale s
+ JOIN ticket t ON s.ticketFk = t.id
+ JOIN supplier su ON su.id = t.companyFk
+ JOIN item i ON i.id = s.itemFk
+ LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
+ WHERE t.refFk = vNewRef
+ GROUP BY i.intrastatFk;
+
+ END IF;
+ DROP TEMPORARY TABLE tmp.ticket;
+ DROP TEMPORARY TABLE tmp.ticketAmount;
+ DROP TEMPORARY TABLE tmp.ticketTax;
+ DROP TEMPORARY TABLE tmp.ticketServiceTax;
+ END IF;
+ END IF;
+ DROP TEMPORARY TABLE `tmp`.`ticketToInvoice`;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionError_add`()
+BEGIN
+ DECLARE vDatedFrom DATETIME;
+ DECLARE vDatedTo DATETIME;
+/**
+ * Rellena la tabla vn.productionError con estadisticas de encajadores, revisores y sacadores. Se ejecuta en el nightTask
+ */
+ SELECT util.VN_CURDATE() - INTERVAL 1 DAY, util.dayend(util.VN_CURDATE() - INTERVAL 1 DAY) INTO vDatedFrom, vDatedTo;
+ CALL timeControl_calculateAll(vDatedFrom, vDatedTo);
+
+ -- Rellena la tabla tmp.errorsByClaim con encajadores, revisores y sacadores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.errorsByClaim
+ ENGINE = MEMORY
+ SELECT COUNT(c.ticketFk) errors,
+ cd.workerFk
+ FROM claimDevelopment cd
+ JOIN claim c ON cd.claimFk = c.id
+ JOIN ticket t ON c.ticketFk = t.id
+ JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ AND cr.code IN ('pic', 'chk', 'pck')
+ GROUP BY cd.workerFk;
+
+ -- Genera la tabla tmp.volume con encajadores, sacadores y revisores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.volume
+ ENGINE = MEMORY
+ SELECT SUM(w.volume) volume,
+ w.workerFk
+ FROM bs.workerProductivity w
+ WHERE w.dated BETWEEN vDatedFrom AND vDatedTo
+ GROUP BY w.workerFk;
+
+ -- Rellena la tabla tmp.errorsByChecker con fallos de revisores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.errorsByChecker
+ ENGINE = MEMORY
+ SELECT st.workerFk,
+ COUNT(t.id) errors
+ FROM saleMistake sm
+ JOIN saleTracking st ON sm.saleFk = st.saleFk
+ JOIN `state` s2 ON s2.id = st.stateFk
+ JOIN sale s ON s.id = sm.saleFk
+ JOIN ticket t on t.id = s.ticketFk
+ WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
+ AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
+ GROUP BY st.workerFk;
+
+ -- Rellena la tabla tmp.expeditionErrors con fallos de expediciones
+ CREATE OR REPLACE TEMPORARY TABLE tmp.expeditionErrors
+ ENGINE = MEMORY
+ SELECT COUNT(t.id) errors,
+ e.workerFk
+ FROM vn.expeditionMistake pm
+ JOIN vn.expedition e ON e.id = pm.expeditionFk
+ JOIN vn.ticket t ON t.id = e.ticketFk
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ GROUP BY e.workerFk;
+
+ -- Genera la tabla tmp.total para sacadores y revisores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.total
+ ENGINE = MEMORY
+ SELECT st.workerFk,
+ COUNT(DISTINCT t.id) ticketCount,
+ COUNT(s.id) lineCount
+ FROM saleTracking st
+ JOIN `state` s2 ON s2.id = st.stateFk
+ JOIN sale s ON s.id = st.saleFk
+ JOIN ticket t ON s.ticketFk = t.id
+ WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
+ AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
+ GROUP BY st.workerFk;
+
+ -- Rellena la tabla vn.productionError con sacadores
+ INSERT INTO productionError(userFk,
+ firstname,
+ lastname,
+ rol,
+ ticketNumber,
+ lineNumber,
+ error,
+ volume,
+ hourStart,
+ hourEnd,
+ hourWorked,
+ dated)
+ SELECT w.id,
+ w.firstName,
+ w.lastName,
+ "Sacadores",
+ t.ticketCount totalTickets,
+ t.lineCount,
+ IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) errors,
+ v.volume volume,
+ SUBSTRING(tc.tableTimed, 1, 5) hourStart,
+ SUBSTRING(tc.tableTimed, LENGTH(tc.tableTimed)-4, 5) hourEnd,
+ IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked,
+ vDatedFrom dated
+ FROM tmp.total t
+ LEFT JOIN worker w ON w.id = t.workerFk
+ LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk
+ LEFT JOIN tmp.errorsByClaim ec ON ec.workerFk = t.workerFk
+ LEFT JOIN tmp.volume v ON v.workerFk = t.workerFk
+ LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = t.workerFk
+ JOIN (SELECT DISTINCT w.id -- Verificamos que son sacadores
+ FROM vn.collection c
+ JOIN vn.state s ON s.id = c.stateFk
+ JOIN vn.train tn ON tn.id = c.trainFk
+ JOIN vn.worker w ON w.id = c.workerFk
+ WHERE c.created BETWEEN vDatedFrom AND vDatedTo) sub ON sub.id = w.id
+ GROUP BY w.id;
+
+ CREATE OR REPLACE TEMPORARY TABLE itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores
+ ENGINE = MEMORY
+ SELECT COUNT(c.ticketFk) errors,
+ tt.userFk
+ FROM claimDevelopment cd
+ JOIN claim c ON cd.claimFk = c.id
+ JOIN ticket t ON c.ticketFk = t.id
+ JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
+ JOIN ticketTracking tt ON tt.ticketFk = t.id
+ JOIN `state` s ON s.id = tt.stateFk
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ AND cr.code = 'chk'
+ AND s.code = 'ON_PREPARATION'
+ GROUP BY tt.userFk;
+
+ UPDATE productionError ep
+ JOIN itemPickerErrors ipe ON ipe.workerFk = ep.userFk
+ SET ep.error = ep.error + ipe.errors
+ WHERE vDatedFrom = ep.dated AND ep.rol = 'Sacadores';
+
+ DROP TEMPORARY TABLE itemPickerErrors;
+
+ -- Rellena la tabla vn.productionError con revisores
+ CALL productionError_addCheckerPackager(vDatedFrom, vDatedTo, "Revisadores");
+
+ -- Genera la tabla tmp.total para encajadores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.total
+ ENGINE = MEMORY
+ SELECT e.workerFk,
+ COUNT(DISTINCT t.id) ticketCount,
+ COUNT(s.id) lineCount
+ FROM expedition e
+ JOIN ticket t ON e.ticketFk = t.id
+ JOIN sale s ON s.ticketFk = t.id
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ GROUP BY e.workerFk;
+
+ -- Rellena la tabla vn.productionError con encajadores
+ CALL productionError_addCheckerPackager(vDatedFrom, vDatedTo, "Encajadores");
+
+ DROP TEMPORARY TABLE tmp.errorsByClaim,
+ tmp.volume,
+ tmp.errorsByChecker,
+ tmp.expeditionErrors,
+ tmp.total;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorProductivity_add`()
+BEGIN
+ DECLARE vDatedFrom DATETIME;
+ DECLARE vDatedTo DATETIME;
+
+ SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate;
+ DROP TEMPORARY TABLE IF EXISTS tmp.errorsByChecker;
+ DROP TEMPORARY TABLE IF EXISTS tmp.previousErrors;
+
+ CALL timeControl_calculateAll(vDatedFrom, vDatedTo);
+
+ CREATE TEMPORARY TABLE tmp.errorsByChecker
+ ENGINE = MEMORY
+ SELECT sc.userFk workerFk, COUNT(DISTINCT s.ticketFk) errorsByChecker
+ FROM saleMistake sm
+ JOIN vn.saleGroupDetail sgd on sgd.saleFk = sm.saleFk
+ JOIN vn.sectorCollectionSaleGroup scsg on scsg.saleGroupFk = sgd.saleGroupFk
+ JOIN vn.sectorCollection sc on sc.id = scsg.sectorCollectionFk
+ JOIN sale s ON s.id = sm.saleFk
+ JOIN ticket t on t.id = s.ticketFk
+ WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
+ GROUP BY sc.userFk ;
+
+ CREATE TEMPORARY TABLE tmp.previousErrors -- Errores de previa, derivadores de los revisadores (por reclamación)
+ ENGINE = MEMORY
+ SELECT tt.userFk, COUNT(c.ticketFk) errorsByClaim
+ FROM claimDevelopment cd
+ JOIN claim c ON cd.claimFk = c.id
+ JOIN ticket t ON c.ticketFk = t.id
+ JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
+ JOIN ticketTracking tt ON tt.ticketFk = t.id
+ JOIN `state` s ON s.id = tt.stateFk
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = 'Revisadores' AND s.code = 'OK PREVIOUS'
+ GROUP BY cd.workerFk;
+
+ DELETE FROM sectorProductivity
+ WHERE dated = vDatedFrom
+ AND sector IN ('Algemesi Artificial','Algemesi Complementos');
+
+ INSERT INTO sectorProductivity(workerFk, firstName, lastName, sector, ticketCount, saleCount, error, volume, hourWorked, dated)
+ SELECT w.id workerFk,
+ w.firstName,
+ w.lastName,
+ se.description sector,
+ COUNT(DISTINCT s.ticketFk) ticketCount,
+ COUNT(sgd.id) saleCount,
+ IFNULL(ec2.errorsByChecker,0) + IFNULL(pe.errorsByClaim, 0) errors,
+ wp.volume,
+ IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) AS hourWorked,
+ DATE(vDatedFrom) dated
+ FROM vn.saleGroupDetail sgd
+ JOIN vn.saleGroup sg on sg.id = sgd.saleGroupFk
+ JOIN vn.sectorCollectionSaleGroup scsg on scsg.saleGroupFk = sgd.saleGroupFk
+ JOIN vn.sectorCollection sc on sc.id = scsg.sectorCollectionFk
+ join vn.sector se on se.id = sc.sectorFk
+ JOIN vn.worker w ON w.id = sc.userFk
+ LEFT JOIN vn.sale s ON s.id = sgd.saleFk
+ LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = w.id
+ LEFT JOIN bs.workerProductivity wp ON wp.workerFk = w.id
+ LEFT JOIN `state` s2 ON s2.id = wp.stateFk AND s2.code = 'OK PREVIOUS'
+ LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = w.id
+ LEFT JOIN tmp.previousErrors pe ON pe.workerFk = w.id
+ WHERE DATE(sc.created) = vDatedFrom
+ AND wp.dated = vDatedFrom
+ GROUP BY w.id;
+
+ DROP TEMPORARY TABLE tmp.timeControlCalculate;
+ DROP TEMPORARY TABLE tmp.errorsByChecker;
+ DROP TEMPORARY TABLE tmp.previousErrors;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketStateUpdate`(vTicketFk INT, vStateCode VARCHAR(45))
+BEGIN
+
+ /*
+ * @deprecated:utilizar ticket_setState
+ */
+
+ DECLARE vAlertLevel INT;
+
+ SELECT s.alertLevel INTO vAlertLevel
+ FROM vn.state s
+ JOIN vn.ticketState ts ON ts.stateFk = s.id
+ WHERE ts.ticketFk = vTicketFk;
+
+ IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN
+
+ INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
+ SELECT id, vTicketFk, account.myUser_getId()
+ FROM vn.state
+ WHERE `code` = vStateCode collate utf8_unicode_ci;
+
+ END IF;
+
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT)
+BEGIN
+/**
+ * Clona el contenido de un ticket en otro
+ *
+ * @param vOriginalTicket ticket Original
+ * @param vNewTicket ticket creado
+ */
+ DECLARE vStateFk INT;
+
+ INSERT INTO ticket (
+ clientFk,
+ shipped,
+ addressFk,
+ agencyModeFk,
+ nickname,
+ warehouseFk,
+ companyFk,
+ landed,
+ zoneFk,
+ zonePrice,
+ zoneBonus,
+ routeFk,
+ priority,
+ hasPriority,
+ clonedFrom
+ )
+ SELECT
+ clientFk,
+ shipped,
+ addressFk,
+ agencyModeFk,
+ nickname,
+ warehouseFk,
+ companyFk,
+ landed,
+ zoneFk,
+ zonePrice,
+ zoneBonus,
+ routeFk,
+ priority,
+ hasPriority,
+ vOriginalTicket
+ FROM ticket
+ WHERE id = vOriginalTicket;
+
+ SET vNewTicket = LAST_INSERT_ID();
+
+ INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
+ SELECT vNewTicket, observationTypeFk, description
+ FROM ticketObservation
+ WHERE ticketFk = vOriginalTicket;
+
+ INSERT INTO ticketTracking(ticketFk, stateFk, userFk, created)
+ SELECT vNewTicket, stateFk, userFk, created
+ FROM ticketTracking
+ WHERE ticketFk = vOriginalTicket
+ ORDER BY created;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_add`(
+ vClientId INT
+ ,vShipped DATE
+ ,vWarehouseFk INT
+ ,vCompanyFk INT
+ ,vAddressFk INT
+ ,vAgencyModeFk INT
+ ,vRouteFk INT
+ ,vlanded DATE
+ ,vUserId INT
+ ,vIsRequiredZone INT
+ ,OUT vNewTicket INT)
+BEGIN
+/**
+* Crea un ticket,
+* ¡¡NO se debe llamar directamente, llamar a salix que hace comprobaciones previas!!
+*
+* @param vClientId id del cliente
+* @param vShipped dia preparacion
+* @param vWarehouseFk id del warehouse
+* @param vCompanyFk id la empresa
+* @param vAddressFk id del consignatario
+* @param vAgencyModeFk id de la agencia
+* @param vRouteFk id de la ruta | NULL
+* @param vlanded dia llegada
+* @param vUserId que crea el ticket
+* @param vIsRequiredZone Indica si tiene que tener zona valida para ser creado
+* @return vNewTicket id del ticket creado
+*/
+ DECLARE vZoneFk INT;
+ DECLARE vPrice DECIMAL(10,2);
+ DECLARE vBonus DECIMAL(10,2);
+ DECLARE vIsActive BOOL;
+
+ IF vClientId IS NULL THEN
+ CALL util.throw ('CLIENT_NOT_ESPECIFIED');
+ END IF;
+
+ SELECT isActive INTO vIsActive
+ FROM vn.client
+ WHERE id = vClientId;
+
+ IF NOT vIsActive THEN
+ CALL util.throw ('CLIENT_NOT_ACTIVE');
+ END IF;
+
+ IF NOT vAddressFk OR vAddressFk IS NULL THEN
+ SELECT id INTO vAddressFk
+ FROM address
+ WHERE clientFk = vClientId
+ AND isDefaultAddress;
+ END IF;
+
+ IF vAgencyModeFk IS NOT NULL THEN
+ CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE);
+
+ SELECT zoneFk, price, bonus
+ INTO vZoneFk, vPrice, vBonus
+ FROM tmp.zoneGetShipped
+ WHERE shipped = vShipped
+ AND warehouseFk = vWarehouseFk
+ LIMIT 1;
+
+ IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN
+ CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS');
+ END IF;
+ END IF;
+
+ INSERT INTO ticket (
+ clientFk,
+ shipped,
+ addressFk,
+ agencyModeFk,
+ nickname,
+ warehouseFk,
+ routeFk,
+ companyFk,
+ landed,
+ zoneFk,
+ zonePrice,
+ zoneBonus
+ )
+ SELECT vClientId,
+ vShipped,
+ a.id,
+ vAgencyModeFk,
+ a.nickname,
+ vWarehouseFk,
+ IF(vRouteFk,vRouteFk,NULL),
+ vCompanyFk,
+ vlanded,
+ vZoneFk,
+ vPrice,
+ vBonus
+ FROM address a
+ JOIN agencyMode am ON am.id = a.agencyModeFk
+ WHERE a.id = vAddressFk;
+
+ SET vNewTicket = LAST_INSERT_ID();
+
+ INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
+ SELECT vNewTicket, ao.observationTypeFk, ao.description
+ FROM addressObservation ao
+ JOIN address a ON a.id = ao.addressFk
+ WHERE a.id = vAddressFk;
+
+ IF (SELECT COUNT(*)
+ FROM bs.clientNewBorn cnb
+ WHERE cnb.clientFk = vClientId
+ AND NOT cnb.isRookie) = 0 THEN
+
+ CALL vn.ticketObservation_addNewBorn(vNewTicket);
+ END IF;
+
+ IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN
+ INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
+ SELECT id, vNewTicket, account.myUser_getId()
+ FROM state
+ WHERE `code` = 'DELIVERED';
+ END IF;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setNextState`(vSelf INT)
+BEGIN
+/**
+ * Cambia el estado del ticket al siguiente estado según la tabla state
+ *
+ * @param vSelf id dle ticket
+ */
+ DECLARE vStateFk INT;
+ DECLARE vNewStateFk INT;
+
+ SELECT stateFk INTO vStateFk
+ FROM ticketState
+ WHERE ticketFk = vSelf;
+
+ SELECT nextStateFk INTO vNewStateFk
+ FROM state
+ WHERE id = vStateFk;
+
+ INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
+ VALUES (vNewStateFk, vSelf, account.myUser_getId());
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setPreviousState`(vTicketFk INT)
+BEGIN
+ DECLARE vControlFk INT;
+
+ SELECT MAX(id) INTO vControlFk
+ FROM ticketTracking
+ WHERE ticketFk = vTicketFk;
+
+ IF (SELECT s.code
+ FROM vn.state s
+ JOIN ticketTracking tt ON tt.stateFk = s.id
+ WHERE tt.id = vControlFk)
+ = 'PREVIOUS_PREPARATION' THEN
+ SELECT id
+ INTO vControlFk
+ FROM ticketTracking tt
+ JOIN vn.state s ON tt.stateFk = s.id
+ WHERE ticketFk = vTicketFk
+ AND id < vControlFk
+ AND s.code != 'PREVIOUS_PREPARATION'
+ ORDER BY id DESC
+ LIMIT 1;
+
+ INSERT INTO ticketTracking(stateFk, ticketFk, userFk)
+ SELECT s.nextStateFk, tt.ticketFk, account.myUser_getId()
+ FROM ticketTracking tt
+ JOIN vn.state s ON tt.stateFk = s.id
+ WHERE id = vControlFk;
+ END IF;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setState`(
+ vSelf INT,
+ vStateCode VARCHAR(255) COLLATE utf8_general_ci
+)
+BEGIN
+/**
+ * Modifica el estado de un ticket si se cumplen las condiciones necesarias.
+ *
+ * @param vSelf el id del ticket
+ * @param vStateCode estado a modificar del ticket
+ */
+ DECLARE vticketAlertLevel INT;
+ DECLARE vTicketStateCode VARCHAR(255);
+ DECLARE vCanChangeState BOOL;
+ DECLARE vPackedAlertLevel INT;
+ DECLARE vZoneFk INT;
+
+ SELECT s.alertLevel, s.`code`, t.zoneFk
+ INTO vticketAlertLevel, vTicketStateCode, vZoneFk
+ FROM state s
+ JOIN ticketTracking tt ON tt.stateFk = s.id
+ JOIN ticket t ON t.id = tt.ticketFk
+ WHERE tt.ticketFk = vSelf
+ ORDER BY tt.created DESC
+ LIMIT 1;
+
+ SELECT id INTO vPackedAlertLevel FROM alertLevel WHERE code = 'PACKED';
+
+ IF vStateCode = 'OK' AND vZoneFk IS NULL THEN
+ CALL util.throw('ASSIGN_ZONE_FIRST');
+ END IF;
+
+ SET vCanChangeState = (
+ vStateCode <> 'ON_CHECKING' OR
+ vticketAlertLevel < vPackedAlertLevel
+ )AND NOT (
+ vTicketStateCode IN ('CHECKED', 'CHECKING')
+ AND vStateCode IN ('PREPARED', 'ON_PREPARATION')
+ );
+
+ IF vCanChangeState THEN
+ INSERT INTO ticketTracking (stateFk, ticketFk, userFk)
+ SELECT id, vSelf, account.myUser_getId()
+ FROM state
+ WHERE `code` = vStateCode COLLATE utf8_unicode_ci;
+
+ IF vStateCode = 'PACKED' THEN
+ CALL ticket_doCmr(vSelf);
+ END IF;
+ ELSE
+ CALL util.throw('INCORRECT_TICKET_STATE');
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/changes/240001/02-views.sql b/db/changes/240001/02-views.sql
new file mode 100644
index 000000000..86a1049a7
--- /dev/null
+++ b/db/changes/240001/02-views.sql
@@ -0,0 +1,56 @@
+CREATE SCHEMA IF NOT EXISTS `vn2008`;
+USE `vn`;
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `ticketState`
+AS SELECT `tt`.`created` AS `updated`,
+ `tt`.`stateFk` AS `stateFk`,
+ `tt`.`userFk` AS `workerFk`,
+ `tls`.`ticketFk` AS `ticketFk`,
+ `s`.`id` AS `state`,
+ `s`.`order` AS `productionOrder`,
+ `s`.`alertLevel` AS `alertLevel`,
+ `s`.`code` AS `code`,
+ `tls`.`ticketFk` AS `ticket`,
+ `tt`.`userFk` AS `worker`,
+ `s`.`isPreviousPreparable` AS `isPreviousPreparable`,
+ `s`.`isPicked` AS `isPicked`
+FROM (
+ (
+ `ticketLastState` `tls`
+ JOIN `ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
+ )
+ JOIN `state` `s` ON(`s`.`id` = `tt`.`stateFk`)
+ );
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn2008`.`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`;
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `ticketStateToday`
+AS SELECT
+ `ts`.`ticket` AS `ticket`,
+ `ts`.`state` AS `state`,
+ `ts`.`productionOrder` AS `productionOrder`,
+ `ts`.`alertLevel` AS `alertLevel`,
+ `ts`.`worker` AS `worker`,
+ `ts`.`code` AS `code`,
+ `ts`.`updated` AS `updated`,
+ `ts`.`isPicked` AS `isPicked`
+FROM
+ (`ticketState` `ts`
+JOIN `ticket` `t` ON
+ (`t`.`id` = `ts`.`ticket`))
+WHERE
+ `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`());
diff --git a/db/changes/240002/00-silexToSalix.sql b/db/changes/240002/00-silexToSalix.sql
new file mode 100644
index 000000000..bad430ac2
--- /dev/null
+++ b/db/changes/240002/00-silexToSalix.sql
@@ -0,0 +1,46 @@
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert`
+ BEFORE INSERT ON `delivery`
+ FOR EACH ROW
+BEGIN
+
+ IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
+ THEN
+ UPDATE address
+ SET longitude = NEW.longitude,
+ latitude = NEW.latitude
+ WHERE id IN (
+ SELECT addressFK
+ FROM ticket
+ WHERE id = NEW.ticketFk
+ );
+ END IF;
+
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate`
+ BEFORE UPDATE ON `delivery`
+ FOR EACH ROW
+BEGIN
+
+IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
+ THEN
+ UPDATE address
+ SET longitude = NEW.longitude,
+ latitude = NEW.latitude
+ WHERE id IN (
+ SELECT addressFK
+ FROM ticket
+ WHERE id = NEW.ticketFk
+ );
+ END IF;
+
+END$$
+DELIMITER ;
+
+
+ALTER TABLE `vn`.`address` MODIFY COLUMN longitude decimal(11,7) DEFAULT NULL NULL COMMENT 'Indica la última longitud proporcionada por tabla delivery';
+ALTER TABLE `vn`.`address` MODIFY COLUMN latitude decimal(11,7) DEFAULT NULL NULL COMMENT 'Indica la última latitud proporcionada por tabla delivery';
diff --git a/db/changes/240201/.gitkeep b/db/changes/240201/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/db/changes/240201/00-aclsMails.sql b/db/changes/240201/00-aclsMails.sql
new file mode 100644
index 000000000..5cfea4030
--- /dev/null
+++ b/db/changes/240201/00-aclsMails.sql
@@ -0,0 +1,8 @@
+-- Definición de la tabla mailAliasACL
+
+CREATE OR REPLACE TABLE `account`.`mailAliasAcl` (
+ `mailAliasFk` int(10) unsigned NOT NULL,
+ `roleFk` int(10) unsigned NOT NULL,
+ FOREIGN KEY (`mailAliasFk`) REFERENCES `account`.`mailAlias` (`id`),
+ FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
diff --git a/db/changes/240201/00-fixInvoiceCorrectionConstraintsName.sql b/db/changes/240201/00-fixInvoiceCorrectionConstraintsName.sql
new file mode 100644
index 000000000..426afea90
--- /dev/null
+++ b/db/changes/240201/00-fixInvoiceCorrectionConstraintsName.sql
@@ -0,0 +1,7 @@
+ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `cplusInvoiceTyoeFk`;
+ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `invoiceCorrectionType_Fk33`;
+ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `invoiceCorrection_ibfk_1`;
+
+ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `siiTypeInvoiceOut_FK` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `vn`.`siiTypeInvoiceOut`(id) ON UPDATE CASCADE;
+ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `invoiceCorrectionType_FK` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `vn`.`invoiceCorrectionType`(id) ON UPDATE CASCADE;
+ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `cplusRectificationType_FK` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType`(id) ON UPDATE CASCADE;
diff --git a/db/changes/240201/00-getTaxBases.sql b/db/changes/240201/00-getTaxBases.sql
new file mode 100644
index 000000000..8bd1b745a
--- /dev/null
+++ b/db/changes/240201/00-getTaxBases.sql
@@ -0,0 +1,33 @@
+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/changes/240201/00-tabletDocuware.sql b/db/changes/240201/00-tabletDocuware.sql
new file mode 100644
index 000000000..ffa0226b3
--- /dev/null
+++ b/db/changes/240201/00-tabletDocuware.sql
@@ -0,0 +1,10 @@
+-- vn.docuwareTablet definition
+
+CREATE TABLE `vn`.`docuwareTablet` (
+ `tablet` varchar(100) NOT NULL PRIMARY KEY,
+ `description` varchar(255) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+ALTER TABLE `vn`.`userConfig`
+ADD COLUMN tabletFk varchar(100) DEFAULT NULL,
+ADD FOREIGN KEY (tabletFk) REFERENCES `vn`.`docuwareTablet`(tablet);
diff --git a/db/changes/240201/00-ticketSmsToClientSms.sql b/db/changes/240201/00-ticketSmsToClientSms.sql
new file mode 100644
index 000000000..cd3cf7dd3
--- /dev/null
+++ b/db/changes/240201/00-ticketSmsToClientSms.sql
@@ -0,0 +1,9 @@
+ALTER TABLE `vn`.`clientSms` ADD `ticketFk` int(11) NULL;
+ALTER TABLE `vn`.`clientSms` ADD CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `vn`.`ticket`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+
+INSERT INTO`vn`.`clientSms` (`clientFk`, `smsFk`, `ticketFk`)
+ SELECT `t`.`clientFk`, `s`.`smsFk`, `s`.`ticketFk`
+ FROM `vn`.`clientSms` `s`
+ JOIN `vn`.`ticket` `t` ON `t`.`id` = `s`.`ticketFk`;
+
+RENAME TABLE `vn`.`ticketSms` TO `vn`.`ticketSms__`;
diff --git a/db/changes/240201/00-timecontrol.sql b/db/changes/240201/00-timecontrol.sql
new file mode 100644
index 000000000..c3ddf5d96
--- /dev/null
+++ b/db/changes/240201/00-timecontrol.sql
@@ -0,0 +1,17 @@
+DELETE FROM `salix`.`ACL`
+ WHERE model = 'VnUser'
+ AND property = 'renewToken';
+
+INSERT INTO `account`.`role` (name, description)
+ VALUES ('timeControl','Tablet para fichar');
+
+INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
+ VALUES (127, 11);
+
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('WorkerTimeControl', 'login', 'READ', 'ALLOW', 'ROLE', 'timeControl'),
+ ('WorkerTimeControl', 'getClockIn', 'READ', 'ALLOW', 'ROLE', 'timeControl'),
+ ('WorkerTimeControl', 'clockIn', 'WRITE', 'ALLOW', 'ROLE', 'timeControl');
+
+CALL `account`.`role_sync`();
diff --git a/db/changes/240201/00-truncateWhereSignInLog.sql b/db/changes/240201/00-truncateWhereSignInLog.sql
new file mode 100644
index 000000000..db5d8e25d
--- /dev/null
+++ b/db/changes/240201/00-truncateWhereSignInLog.sql
@@ -0,0 +1,2 @@
+DELETE FROM `account`.`signInLog` where owner <> FALSE;
+
diff --git a/db/changes/240201/01-functions.sql b/db/changes/240201/01-functions.sql
new file mode 100644
index 000000000..7bbe1f442
--- /dev/null
+++ b/db/changes/240201/01-functions.sql
@@ -0,0 +1,81 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketPositionInPath`(vTicketId INT)
+ RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
+ DETERMINISTIC
+BEGIN
+
+ DECLARE vRestTicketsMaxOrder INT;
+ DECLARE vRestTicketsMinOrder INT;
+ DECLARE vRestTicketsPacking INT;
+ DECLARE vMyProductionOrder INT;
+ DECLARE vPosition VARCHAR(10) DEFAULT 'MID';
+ DECLARE vMyPath INT;
+ DECLARE vMyWarehouse INT;
+ DECLARE PACKING_ORDER INT;
+ DECLARE vExpeditionsCount INT;
+ DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE;
+
+
+
+SELECT `order`
+ INTO PACKING_ORDER
+ FROM state
+ WHERE code = 'PACKING';
+
+SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0)
+ INTO vMyPath, vMyWarehouse, vMyProductionOrder
+ FROM ticket t
+ LEFT JOIN ticketState ts on ts.ticketFk = t.id
+ WHERE t.id = vTicketId;
+
+SELECT (ag.`name` = 'VN_VALENCIA')
+ INTO vIsValenciaPath
+ FROM vn2008.Rutas r
+ JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia
+ JOIN vn2008.agency ag on ag.agency_id = a.agency_id
+ WHERE r.Id_Ruta = vMyPath;
+
+IF vIsValenciaPath THEN -- Rutas Valencia
+
+ SELECT COUNT(*)
+ INTO vExpeditionsCount
+ FROM expedition e
+ JOIN ticket t ON t.id = e.ticketFk
+ WHERE t.routeFk = vMyPath;
+
+ SELECT MAX(ts.productionOrder), MIN(ts.productionOrder)
+ INTO vRestTicketsMaxOrder, vRestTicketsMinOrder
+ FROM ticket t
+ LEFT JOIN ticketState ts on t.id = ts.ticketFk
+ WHERE t.routeFk = vMyPath
+ AND t.warehouseFk = vMyWarehouse
+ AND t.id != vTicketid;
+
+ SELECT COUNT(*)
+ INTO vRestTicketsPacking
+ FROM ticket t
+ LEFT JOIN ticketState ts on t.id = ts.ticketFk
+ WHERE ts.productionOrder = PACKING_ORDER
+ AND t.routeFk = vMyPath
+ AND t.warehouseFk = vMyWarehouse
+ AND t.id != vTicketid;
+
+ IF vExpeditionsCount = 1 THEN
+ SET vPosition = 'FIRST';
+ ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN
+ SET vPosition = 'LAST';
+ ELSEIF vRestTicketsPacking THEN
+ SET vPosition = 'SHARED';
+ ELSE
+ SET vPosition = 'MID';
+ END IF;
+
+ELSE
+ SET vPosition = 'MID';
+
+END IF;
+
+RETURN vPosition;
+
+END$$
+DELIMITER ;
diff --git a/db/changes/240201/01-newHasAnyPositiveBase.sql b/db/changes/240201/01-newHasAnyPositiveBase.sql
new file mode 100644
index 000000000..c4edfaed0
--- /dev/null
+++ b/db/changes/240201/01-newHasAnyPositiveBase.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/changes/240201/01-procedures.sql b/db/changes/240201/01-procedures.sql
new file mode 100644
index 000000000..ab52dbd1b
--- /dev/null
+++ b/db/changes/240201/01-procedures.sql
@@ -0,0 +1,1788 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`item_getVisible`(
+ vWarehouse TINYINT,
+ vDate DATE,
+ vType INT,
+ vPrefix VARCHAR(255))
+BEGIN
+
+/**
+ * Gets visible items of the specified type at specified date.
+ *
+ * @param vWarehouse The warehouse id
+ * @param vDate The visible date
+ * @param vType The type id
+ * @param vPrefix The article prefix to filter or %NULL for all
+ * @return tmp.itemVisible Visible items
+ */
+ DECLARE vPrefixLen SMALLINT;
+ DECLARE vFilter VARCHAR(255) DEFAULT NULL;
+ DECLARE vDateInv DATE DEFAULT vn.getInventoryDate();
+ DECLARE EXIT HANDLER FOR 1114
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1
+ @message = MESSAGE_TEXT;
+ CALL vn.mail_insert(
+ 'cau@verdnatura.es',
+ NULL,
+ CONCAT('hedera.item_getVisible error: ', @message),
+ CONCAT(
+ 'warehouse: ', IFNULL(vWarehouse, ''),
+ ', Fecha:', IFNULL(vDate, ''),
+ ', tipo: ', IFNULL(vType,''),
+ ', prefijo: ', IFNULL(vPrefix,'')));
+ RESIGNAL;
+ END;
+ SET vPrefixLen = IFNULL(LENGTH(vPrefix), 0) + 1;
+
+ IF vPrefixLen > 1 THEN
+ SET vFilter = CONCAT(vPrefix, '%');
+ END IF;
+
+ DROP TEMPORARY TABLE IF EXISTS `filter`;
+ CREATE TEMPORARY TABLE `filter`
+ (INDEX (itemFk))
+ ENGINE = MEMORY
+ SELECT id itemFk FROM vn.item
+ WHERE typeFk = vType
+ AND (vFilter IS NULL OR `name` LIKE vFilter);
+
+ DROP TEMPORARY TABLE IF EXISTS currentStock;
+ CREATE TEMPORARY TABLE currentStock
+ (INDEX (itemFk))
+ ENGINE = MEMORY
+ SELECT itemFk, SUM(quantity) quantity
+ FROM (
+ SELECT b.itemFk, b.quantity
+ FROM vn.buy b
+ JOIN vn.entry e ON e.id = b.entryFk
+ JOIN vn.travel t ON t.id = e.travelFk
+ WHERE t.landed BETWEEN vDateInv AND vDate
+ AND t.warehouseInFk = vWarehouse
+ AND NOT e.isRaid
+ UNION ALL
+ SELECT b.itemFk, -b.quantity
+ FROM vn.buy b
+ JOIN vn.entry e ON e.id = b.entryFk
+ JOIN vn.travel t ON t.id = e.travelFk
+ WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
+ AND t.warehouseOutFk = vWarehouse
+ AND NOT e.isRaid
+ AND t.isDelivered
+ UNION ALL
+ SELECT m.itemFk, -m.quantity
+ FROM vn.sale m
+ JOIN vn.ticket t ON t.id = m.ticketFk
+ JOIN vn.ticketState s ON s.ticketFk = t.id
+ WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
+ AND t.warehouseFk = vWarehouse
+ AND s.alertLevel = 3
+ ) t
+ GROUP BY itemFk
+ HAVING quantity > 0;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp;
+ CREATE TEMPORARY TABLE tmp
+ (INDEX (itemFk))
+ ENGINE = MEMORY
+ SELECT *
+ FROM (
+ SELECT b.itemFk, b.packagingFk, b.packing
+ FROM vn.buy b
+ JOIN vn.entry e ON e.id = b.entryFk
+ JOIN vn.travel t ON t.id = e.travelFk
+ WHERE t.landed BETWEEN vDateInv AND vDate
+ AND NOT b.isIgnored
+ AND b.price2 >= 0
+ AND b.packagingFk IS NOT NULL
+ ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC
+ LIMIT 10000000000000000000
+ ) t GROUP BY itemFk;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.itemVisible;
+ CREATE TEMPORARY TABLE tmp.itemVisible
+ ENGINE = MEMORY
+ SELECT i.id Id_Article,
+ SUBSTRING(i.`name`, vPrefixLen) Article,
+ t.packing, p.id Id_Cubo,
+ IF(p.depth > 0, p.depth, 0) depth, p.width, p.height,
+ CEIL(s.quantity / t.packing) etiquetas
+ FROM vn.item i
+ JOIN `filter` f ON f.itemFk = i.id
+ JOIN currentStock s ON s.itemFk = i.id
+ LEFT JOIN tmp t ON t.itemFk = i.id
+ LEFT JOIN vn.packaging p ON p.id = t.packagingFk
+ WHERE CEIL(s.quantity / t.packing) > 0
+ -- FIXME: Column Cubos.box not included in view vn.packaging
+ /* AND p.box */ ;
+
+ DROP TEMPORARY TABLE
+ `filter`,
+ currentStock,
+ tmp;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_confirmWithUser`(vSelf INT, vUserId INT)
+BEGIN
+/**
+ * Confirms an order, creating each of its tickets on the corresponding
+ * date, store and user.
+ *
+ * @param vSelf The order identifier
+ * @param vUser The user identifier
+ */
+ DECLARE vOk BOOL;
+ DECLARE vDone BOOL DEFAULT FALSE;
+ DECLARE vWarehouse INT;
+ DECLARE vShipment DATE;
+ DECLARE vTicket INT;
+ DECLARE vNotes VARCHAR(255);
+ DECLARE vItem INT;
+ DECLARE vConcept VARCHAR(30);
+ DECLARE vAmount INT;
+ DECLARE vPrice DECIMAL(10,2);
+ DECLARE vSale INT;
+ DECLARE vRate INT;
+ DECLARE vRowId INT;
+ DECLARE vPriceFixed DECIMAL(10,2);
+ DECLARE vDelivery DATE;
+ DECLARE vAddress INT;
+ DECLARE vIsConfirmed BOOL;
+ DECLARE vClientId INT;
+ DECLARE vCompanyId INT;
+ DECLARE vAgencyModeId INT;
+ DECLARE TICKET_FREE INT DEFAULT 2;
+ DECLARE vCalc INT;
+ DECLARE vIsLogifloraItem BOOL;
+ DECLARE vOldQuantity INT;
+ DECLARE vNewQuantity INT;
+ DECLARE vIsTaxDataChecked BOOL;
+
+ DECLARE cDates CURSOR FOR
+ SELECT zgs.shipped, r.warehouse_id
+ FROM `order` o
+ JOIN order_row r ON r.order_id = o.id
+ LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
+ WHERE o.id = vSelf AND r.amount != 0
+ GROUP BY r.warehouse_id;
+
+ DECLARE cRows CURSOR FOR
+ SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate, i.isFloramondo
+ FROM order_row r
+ JOIN vn.item i ON i.id = r.item_id
+ WHERE r.amount != 0
+ AND r.warehouse_id = vWarehouse
+ AND r.order_id = vSelf
+ ORDER BY r.rate DESC;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND
+ SET vDone = TRUE;
+
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ ROLLBACK;
+ RESIGNAL;
+ END;
+
+ -- Carga los datos del pedido
+ SELECT o.date_send, o.address_id, o.note, a.clientFk,
+ o.company_id, o.agency_id, c.isTaxDataChecked
+ INTO vDelivery, vAddress, vNotes, vClientId,
+ vCompanyId, vAgencyModeId, vIsTaxDataChecked
+ FROM hedera.`order` o
+ JOIN vn.address a ON a.id = o.address_id
+ JOIN vn.client c ON c.id = a.clientFk
+ WHERE o.id = vSelf;
+
+ -- Verifica si el cliente tiene los datos comprobados
+ IF NOT vIsTaxDataChecked THEN
+ CALL util.throw ('clientNotVerified');
+ END IF;
+
+ -- Carga las fechas de salida de cada almacen
+ CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
+
+ -- Trabajador que realiza la accion
+ IF vUserId IS NULL THEN
+ SELECT employeeFk INTO vUserId FROM orderConfig;
+ END IF;
+
+ START TRANSACTION;
+
+ CALL order_checkEditable(vSelf);
+
+ -- Check order is not empty
+
+ SELECT COUNT(*) > 0 INTO vOk
+ FROM order_row WHERE order_id = vSelf AND amount > 0;
+
+ IF NOT vOk THEN
+ CALL util.throw ('ORDER_EMPTY');
+ END IF;
+
+ -- Crea los tickets del pedido
+
+ OPEN cDates;
+
+ lDates:
+ LOOP
+ SET vTicket = NULL;
+ SET vDone = FALSE;
+ FETCH cDates INTO vShipment, vWarehouse;
+
+ IF vDone THEN
+ LEAVE lDates;
+ END IF;
+
+ -- Busca un ticket existente que coincida con los parametros
+ WITH tPrevia AS
+ (SELECT DISTINCT s.ticketFk
+ FROM vn.sale s
+ JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN vn.ticket t ON t.id = s.ticketFk
+ WHERE t.shipped BETWEEN vShipment AND util.dayend(vShipment)
+ )
+ SELECT t.id INTO vTicket
+ FROM vn.ticket t
+ LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
+ LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id
+ JOIN hedera.`order` o
+ ON o.address_id = t.addressFk
+ AND vWarehouse = t.warehouseFk
+ AND o.date_send = t.landed
+ AND DATE(t.shipped) = vShipment
+ WHERE o.id = vSelf
+ AND t.refFk IS NULL
+ AND tp.ticketFk IS NULL
+ AND IFNULL(tls.alertLevel,0) = 0
+ LIMIT 1;
+
+ -- Crea el ticket en el caso de no existir uno adecuado
+ IF vTicket IS NULL
+ THEN
+
+ SET vShipment = IFNULL(vShipment, util.VN_CURDATE());
+
+ CALL vn.ticket_add(
+ vClientId,
+ vShipment,
+ vWarehouse,
+ vCompanyId,
+ vAddress,
+ vAgencyModeId,
+ NULL,
+ vDelivery,
+ vUserId,
+ TRUE,
+ vTicket
+ );
+ ELSE
+ INSERT INTO vn.ticketTracking
+ SET ticketFk = vTicket,
+ workerFk = vUserId,
+ stateFk = TICKET_FREE;
+ END IF;
+
+ INSERT IGNORE INTO vn.orderTicket
+ SET orderFk = vSelf,
+ ticketFk = vTicket;
+
+ -- Añade las notas
+
+ IF vNotes IS NOT NULL AND vNotes != ''
+ THEN
+ INSERT INTO vn.ticketObservation SET
+ ticketFk = vTicket,
+ observationTypeFk = 4 /* salesperson */,
+ `description` = vNotes
+ ON DUPLICATE KEY UPDATE
+ `description` = CONCAT(VALUES(`description`),'. ', `description`);
+ END IF;
+
+ -- Añade los movimientos y sus componentes
+
+ OPEN cRows;
+
+ lRows: LOOP
+ SET vDone = FALSE;
+ FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate, vIsLogifloraItem;
+
+ IF vDone THEN
+ LEAVE lRows;
+ END IF;
+
+ SET vSale = NULL;
+
+ SELECT s.id, s.quantity INTO vSale, vOldQuantity
+ FROM vn.sale s
+ WHERE ticketFk = vTicket
+ AND price = vPrice
+ AND itemFk = vItem
+ AND discount = 0
+ LIMIT 1;
+
+ IF vSale THEN
+ UPDATE vn.sale
+ SET quantity = quantity + vAmount,
+ originalQuantity = quantity
+ WHERE id = vSale;
+
+ SELECT s.quantity INTO vNewQuantity
+ FROM vn.sale s
+ WHERE id = vSale;
+ ELSE
+ -- Obtiene el coste
+ SELECT SUM(rc.`price`) valueSum INTO vPriceFixed
+ FROM orderRowComponent rc
+ JOIN vn.component c ON c.id = rc.componentFk
+ JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
+ WHERE rc.rowFk = vRowId;
+
+ INSERT INTO vn.sale
+ SET itemFk = vItem,
+ ticketFk = vTicket,
+ concept = vConcept,
+ quantity = vAmount,
+ price = vPrice,
+ priceFixed = vPriceFixed,
+ isPriceFixed = TRUE;
+
+ SET vSale = LAST_INSERT_ID();
+
+ INSERT INTO vn.saleComponent
+ (saleFk, componentFk, `value`)
+ SELECT vSale, rc.componentFk, rc.price
+ FROM orderRowComponent rc
+ JOIN vn.component c ON c.id = rc.componentFk
+ WHERE rc.rowFk = vRowId
+ GROUP BY vSale, rc.componentFk;
+ END IF;
+
+ UPDATE order_row SET Id_Movimiento = vSale
+ WHERE id = vRowId;
+
+ -- Inserta en putOrder si la compra es de Floramondo
+ IF vIsLogifloraItem THEN
+ CALL cache.availableNoRaids_refresh(vCalc,FALSE,vWarehouse,vShipment);
+
+ SET @available := 0;
+
+ SELECT GREATEST(0,available) INTO @available
+ FROM cache.availableNoRaids
+ WHERE calc_id = vCalc
+ AND item_id = vItem;
+
+ UPDATE cache.availableNoRaids
+ SET available = GREATEST(0,available - vAmount)
+ WHERE item_id = vItem
+ AND calc_id = vCalc;
+
+ INSERT INTO edi.putOrder (
+ deliveryInformationID,
+ supplyResponseId,
+ quantity ,
+ EndUserPartyId,
+ EndUserPartyGLN,
+ FHAdminNumber,
+ saleFk
+ )
+ SELECT di.ID,
+ i.supplyResponseFk,
+ CEIL((vAmount - @available)/ sr.NumberOfItemsPerCask),
+ o.address_id ,
+ vClientId,
+ IFNULL(ca.fhAdminNumber, fhc.defaultAdminNumber),
+ vSale
+ FROM edi.deliveryInformation di
+ JOIN vn.item i ON i.supplyResponseFk = di.supplyResponseID
+ JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk
+ LEFT JOIN edi.clientFHAdminNumber ca ON ca.clientFk = vClientId
+ JOIN edi.floraHollandConfig fhc
+ JOIN hedera.`order` o ON o.id = vSelf
+ WHERE i.id = vItem
+ AND di.LatestOrderDateTime > util.VN_NOW()
+ AND vAmount > @available
+ LIMIT 1;
+ END IF;
+ END LOOP;
+
+ CLOSE cRows;
+ END LOOP;
+
+ CLOSE cDates;
+
+ UPDATE `order` SET confirmed = TRUE, confirm_date = util.VN_NOW()
+ WHERE id = vSelf;
+
+ COMMIT;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`(
+ vSerial VARCHAR(255),
+ vInvoiceDate DATE,
+ vTaxArea VARCHAR(25),
+ OUT vNewInvoiceId INT)
+BEGIN
+/**
+ * Creación de facturas emitidas.
+ * requiere previamente tabla tmp.ticketToInvoice(id).
+ *
+ * @param vSerial serie a la cual se hace la factura
+ * @param vInvoiceDate fecha de la factura
+ * @param vTaxArea tipo de iva en relacion a la empresa y al cliente
+ * @param vNewInvoiceId id de la factura que se acaba de generar
+ * @return vNewInvoiceId
+ */
+ DECLARE vIsAnySaleToInvoice BOOL;
+ DECLARE vIsAnyServiceToInvoice BOOL;
+ DECLARE vNewRef VARCHAR(255);
+ DECLARE vWorker INT DEFAULT account.myUser_getId();
+ DECLARE vCompanyFk INT;
+ DECLARE vInterCompanyFk INT;
+ DECLARE vClientFk INT;
+ DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1;
+ DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6;
+ DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2;
+ DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R';
+ DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S';
+ DECLARE vNewInvoiceInFk INT;
+ DECLARE vIsInterCompany BOOL DEFAULT FALSE;
+ DECLARE vIsCEESerial BOOL DEFAULT FALSE;
+ DECLARE vIsCorrectInvoiceDate BOOL;
+ DECLARE vMaxShipped DATE;
+ DECLARE vDone BOOL;
+ DECLARE vTicketFk INT;
+ DECLARE vCursor CURSOR FOR
+ SELECT id
+ FROM tmp.ticketToInvoice;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE());
+
+ SELECT t.clientFk,
+ t.companyFk,
+ MAX(DATE(t.shipped)),
+ DATE(vInvoiceDate) >= invoiceOut_getMaxIssued(
+ vSerial,
+ t.companyFk,
+ YEAR(vInvoiceDate))
+ INTO vClientFk,
+ vCompanyFk,
+ vMaxShipped,
+ vIsCorrectInvoiceDate
+ FROM tmp.ticketToInvoice tt
+ JOIN ticket t ON t.id = tt.id;
+
+ IF(vMaxShipped > vInvoiceDate) THEN
+ CALL util.throw("Invoice date can't be less than max date");
+ END IF;
+
+ IF NOT vIsCorrectInvoiceDate THEN
+ CALL util.throw('Exists an invoice with a previous date');
+ END IF;
+
+ -- Eliminem de tmp.ticketToInvoice els tickets que no han de ser facturats
+ DELETE ti.*
+ FROM tmp.ticketToInvoice ti
+ JOIN ticket t ON t.id = ti.id
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN supplier su ON su.id = t.companyFk
+ JOIN client c ON c.id = t.clientFk
+ LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
+ WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted)
+ OR c.isTaxDataChecked = FALSE
+ OR t.isDeleted
+ OR c.hasToInvoice = FALSE
+ OR itc.id IS NULL;
+
+ SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0
+ INTO vIsAnySaleToInvoice
+ FROM tmp.ticketToInvoice t
+ JOIN sale s ON s.ticketFk = t.id;
+
+ SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice
+ FROM tmp.ticketToInvoice t
+ JOIN ticketService ts ON ts.ticketFk = t.id;
+
+ IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice)
+ AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase())
+ THEN
+
+ -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial
+ INSERT INTO invoiceOut(
+ ref,
+ serial,
+ issued,
+ clientFk,
+ dued,
+ companyFk,
+ siiTypeInvoiceOutFk
+ )
+ SELECT
+ 1,
+ vSerial,
+ vInvoiceDate,
+ vClientFk,
+ getDueDate(vInvoiceDate, dueDay),
+ vCompanyFk,
+ IF(vSerial = vCorrectingSerial,
+ vCplusCorrectingInvoiceTypeFk,
+ IF(vSerial = vSimplifiedSerial,
+ vCplusSimplifiedInvoiceTypeFk,
+ vCplusStandardInvoiceTypeFk))
+ FROM client
+ WHERE id = vClientFk;
+
+ SET vNewInvoiceId = LAST_INSERT_ID();
+
+ SELECT `ref`
+ INTO vNewRef
+ FROM invoiceOut
+ WHERE id = vNewInvoiceId;
+
+ OPEN vCursor;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vCursor INTO vTicketFk;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CALL ticket_recalc(vTicketFk, vTaxArea);
+
+ END LOOP;
+ CLOSE vCursor;
+
+ UPDATE ticket t
+ JOIN tmp.ticketToInvoice ti ON ti.id = t.id
+ SET t.refFk = vNewRef;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.updateInter;
+ CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY
+ SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador
+ FROM tmp.ticketToInvoice ti
+ LEFT JOIN ticketState ts ON ti.id = ts.ticketFk
+ JOIN state s
+ WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id);
+
+ INSERT INTO ticketTracking(stateFk,ticketFk,userFk)
+ SELECT * FROM tmp.updateInter;
+
+ CALL invoiceExpenseMake(vNewInvoiceId);
+ CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
+
+ UPDATE invoiceOut io
+ JOIN (
+ SELECT SUM(amount) total
+ FROM invoiceOutExpense
+ WHERE invoiceOutFk = vNewInvoiceId
+ ) base
+ JOIN (
+ SELECT SUM(vat) total
+ FROM invoiceOutTax
+ WHERE invoiceOutFk = vNewInvoiceId
+ ) vat
+ SET io.amount = base.total + vat.total
+ WHERE io.id = vNewInvoiceId;
+
+ DROP TEMPORARY TABLE tmp.updateInter;
+
+ SELECT COUNT(*), id
+ INTO vIsInterCompany, vInterCompanyFk
+ FROM company
+ WHERE clientFk = vClientFk;
+
+ IF (vIsInterCompany) THEN
+
+ INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk)
+ SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk;
+
+ SET vNewInvoiceInFk = LAST_INSERT_ID();
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
+ CREATE TEMPORARY TABLE tmp.ticket
+ (KEY (ticketFk))
+ ENGINE = MEMORY
+ SELECT id ticketFk
+ FROM tmp.ticketToInvoice;
+
+ CALL `ticket_getTax`('NATIONAL');
+
+ SET @vTaxableBaseServices := 0.00;
+ SET @vTaxCodeGeneral := NULL;
+
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInFk,
+ @vTaxableBaseServices,
+ sub.expenseFk,
+ sub.taxTypeSageFk,
+ sub.transactionTypeSageFk
+ FROM (
+ SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
+ i.expenseFk,
+ i.taxTypeSageFk,
+ i.transactionTypeSageFk,
+ @vTaxCodeGeneral := i.taxClassCodeFk
+ FROM tmp.ticketServiceTax tst
+ JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code
+ WHERE i.isService
+ HAVING taxableBase
+ ) sub;
+
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInFk,
+ SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
+ @vTaxableBaseServices, 0) taxableBase,
+ i.expenseFk,
+ i.taxTypeSageFk ,
+ i.transactionTypeSageFk
+ FROM tmp.ticketTax tt
+ JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code
+ WHERE !i.isService
+ GROUP BY tt.pgcFk
+ HAVING taxableBase
+ ORDER BY tt.priority;
+
+ CALL invoiceInDueDay_calculate(vNewInvoiceInFk);
+
+ SELECT COUNT(*) INTO vIsCEESerial
+ FROM invoiceOutSerial
+ WHERE code = vSerial;
+
+ IF vIsCEESerial THEN
+
+ INSERT INTO invoiceInIntrastat (
+ invoiceInFk,
+ intrastatFk,
+ amount,
+ stems,
+ countryFk,
+ net)
+ SELECT
+ vNewInvoiceInFk,
+ i.intrastatFk,
+ SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))),
+ SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))),
+ su.countryFk,
+ CAST(SUM(IFNULL(i.stems, 1)
+ * s.quantity
+ * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2))
+ FROM sale s
+ JOIN ticket t ON s.ticketFk = t.id
+ JOIN supplier su ON su.id = t.companyFk
+ JOIN item i ON i.id = s.itemFk
+ LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
+ WHERE t.refFk = vNewRef
+ GROUP BY i.intrastatFk;
+
+ END IF;
+ DROP TEMPORARY TABLE tmp.ticket;
+ DROP TEMPORARY TABLE tmp.ticketAmount;
+ DROP TEMPORARY TABLE tmp.ticketTax;
+ DROP TEMPORARY TABLE tmp.ticketServiceTax;
+ END IF;
+ END IF;
+ DROP TEMPORARY TABLE `tmp`.`ticketToInvoice`;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(vSectorFk INT)
+proc:BEGIN
+
+ DECLARE vCalcVisibleFk INT;
+ DECLARE vCalcAvailableFk INT;
+ DECLARE hasFatherSector BOOLEAN;
+ DECLARE vBuyerFk INT DEFAULT 0;
+ DECLARE vWarehouseFk INT DEFAULT 0;
+ DECLARE vSonSectorFk INT;
+ DECLARE vWorkerFk INT;
+
+ SELECT s.workerFk
+ INTO vWorkerFk
+ FROM vn.sector s
+ WHERE s.id = vSectorFk;
+
+ SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk
+ FROM vn.worker w
+ JOIN vn.sector s ON s.code = w.code
+ WHERE s.id = vSectorFk;
+
+ SELECT s.id INTO vSectorFk
+ FROM vn.sector s
+ WHERE s.warehouseFk = vWarehouseFk
+ AND s.isMain;
+
+ SELECT COUNT(*) INTO hasFatherSector
+ FROM vn.sector
+ WHERE sonFk = vSectorFk;
+
+ SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk
+ FROM vn.sector
+ WHERE id = vSectorFk;
+
+ CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk);
+ CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar;
+
+ IF hasFatherSector THEN
+ CREATE TEMPORARY TABLE tmp.itemShelvingRadar
+ (PRIMARY KEY (itemFk))
+ ENGINE = MEMORY
+ SELECT *
+ FROM (
+ SELECT iss.itemFk,
+ i.longName,
+ i.size,
+ i.subName producer,
+ IFNULL(a.available,0) available,
+ SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs,
+ SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs,
+ IF(it.isPackaging, NULL, IFNULL(v.visible,0)) as visible,
+ vSectorFk sectorFk
+ FROM vn.itemShelvingStock iss
+ JOIN vn.sector s ON s.id = iss.sectorFk
+ JOIN vn.item i on i.id = iss.itemFk
+ JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
+ LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
+ LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
+ WHERE vSectorFk IN (iss.sectorFk, s.sonFk)
+ GROUP BY iss.itemFk
+
+ UNION ALL
+
+ SELECT v.item_id,
+ i.longName,
+ i.size,
+ i.subName producer,
+ IFNULL(a.available,0) as available,
+ 0 upstairs,
+ 0 downstairs,
+ IF(it.isPackaging, NULL, v.visible) visible,
+ vSectorFk as sectorFk
+ FROM cache.visible v
+ JOIN vn.item i on i.id = v.item_id
+ JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
+ LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk
+ LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk
+ WHERE v.calc_id = vCalcVisibleFk
+ AND iss.itemFk IS NULL
+ AND it.isInventory
+ ) sub GROUP BY itemFk;
+
+ SELECT ishr.*,
+ CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho,
+ CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente
+ FROM tmp.itemShelvingRadar ishr
+ 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.ticketFk = t.id
+ JOIN vn.sale s ON s.ticketFk = t.id
+ WHERE t.warehouseFk = vWarehouseFk
+ AND tst.alertLevel = 0
+ GROUP BY s.itemFk
+ ) sub ON sub.itemFk = ishr.itemFk
+ ORDER BY i.typeFk, i.longName;
+ ELSE
+ CREATE TEMPORARY TABLE tmp.itemShelvingRadar
+ (PRIMARY KEY (itemFk))
+ ENGINE = MEMORY
+ SELECT iss.itemFk,
+ 0 `hour`,
+ 0 `minute`,
+ '--' itemPlacementCode,
+ i.longName,
+ i.size,
+ i.subName producer,
+ i.upToDown,
+ IFNULL(a.available,0) available,
+ IFNULL(v.visible - iss.visible,0) dayEndVisible,
+ IFNULL(v.visible - iss.visible,0) firstNegative,
+ IFNULL(v.visible - iss.visible,0) itemPlacementVisible,
+ IFNULL(i.minimum * b.packing,0) itemPlacementSize,
+ ips.onTheWay,
+ iss.visible itemShelvingStock,
+ IFNULL(v.visible,0) visible,
+ b.isPickedOff,
+ iss.sectorFk
+ FROM vn.itemShelvingStock iss
+ JOIN vn.item i on i.id = iss.itemFk
+ LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk
+ LEFT JOIN vn.buy b ON b.id = lb.buy_id
+ LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
+ LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
+ LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay
+ FROM vn.itemPlacementSupplyList
+ WHERE saldo > 0
+ GROUP BY itemFk
+ ) ips ON ips.itemFk = i.id
+ WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk)
+ OR iss.sectorFk = vSectorFk;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime;
+ CREATE TEMPORARY TABLE tmp.itemOutTime
+ SELECT *,SUM(amount) quantity
+ FROM
+ (SELECT item_id itemFk,
+ 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
+ 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
+ LEFT JOIN vn.zone z ON z.id = t.zoneFk
+ LEFT JOIN (SELECT DISTINCT saleFk
+ FROM vn.saleTracking st
+ WHERE st.created > util.VN_CURDATE()
+ AND st.isChecked
+ ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk
+ WHERE t.warehouseFk = vWarehouseFk
+ AND s.isPicked = 0
+ AND NOT io.Reservado
+ AND stPrevious.saleFk IS NULL
+ AND io.dat >= util.VN_CURDATE()
+ AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY
+ ) sub
+ GROUP BY itemFk, hours, minutes;
+
+ INSERT INTO tmp.itemShelvingRadar (itemFk)
+ SELECT itemFk FROM tmp.itemOutTime
+ ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity,
+ firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity),
+ `hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0),
+ `minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0);
+
+ UPDATE tmp.itemShelvingRadar isr
+ JOIN (SELECT s.itemFk, sum(s.quantity) amount
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN ticketLastState tls ON tls.ticketFk = t.id
+ WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
+ AND tls.name = 'Prep Camara'
+ GROUP BY s.itemFk) sub ON sub.itemFk = isr.itemFk
+ SET isr.dayEndVisible = dayEndVisible + sub.amount,
+ firstNegative = firstNegative + sub.amount;
+
+ SELECT * FROM tmp.itemShelvingRadar;
+ END IF;
+
+ DROP TEMPORARY TABLE tmp.itemShelvingRadar;
+
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(
+ vItemFk INT,
+ vWarehouseFk INT,
+ vDate DATETIME
+)
+BEGIN
+/**
+ * @vItemFk item a buscar
+ * @vWarehouseFk almacen donde buscar
+ * @vDate Si la fecha es null, muestra el histórico desde el inventario.
+ * Si la fecha no es null, muestra histórico desde la fecha pasada.
+ */
+ DECLARE vDateInventory DATETIME;
+
+ IF vDate IS NULL THEN
+ SELECT inventoried INTO vDateInventory
+ FROM config;
+ ELSE
+ SELECT mockUtcTime INTO vDateInventory
+ FROM util.config;
+ END IF;
+
+ CREATE OR REPLACE TEMPORARY TABLE tItemDiary(
+ shipped DATE,
+ `in` INT(11),
+ `out` INT(11),
+ alertLevel INT(11),
+ stateName VARCHAR(20),
+ `name` VARCHAR(50),
+ reference VARCHAR(50),
+ origin INT(11),
+ clientFk INT(11),
+ isPicked INT(11),
+ isTicket TINYINT(1),
+ lineFk INT(11),
+ `order` TINYINT(3) UNSIGNED,
+ clientType VARCHAR(20),
+ claimFk INT(10) UNSIGNED,
+ inventorySupplierFk INT(10)
+ );
+
+ INSERT INTO tItemDiary
+ SELECT tr.landed shipped,
+ b.quantity `in`,
+ NULL `out`,
+ st.alertLevel ,
+ st.name stateName,
+ s.name `name`,
+ e.invoiceNumber reference,
+ e.id origin,
+ s.id clientFk,
+ IF(st.`code` = 'DELIVERED', TRUE, FALSE) isPicked,
+ FALSE isTicket,
+ b.id lineFk,
+ NULL `order`,
+ NULL clientType,
+ NULL claimFk,
+ ec.inventorySupplierFk
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN supplier s ON s.id = e.supplierFk
+ JOIN state st ON st.`code` = IF( tr.landed < util.VN_CURDATE()
+ OR (util.VN_CURDATE() AND tr.isReceived),
+ 'DELIVERED',
+ 'FREE')
+ JOIN entryConfig ec
+ WHERE tr.landed >= vDateInventory
+ AND vWarehouseFk = tr.warehouseInFk
+ AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
+ AND b.itemFk = vItemFk
+ AND e.isExcludedFromAvailable = FALSE
+ AND e.isRaid = FALSE
+ UNION ALL
+ SELECT tr.shipped,
+ NULL,
+ b.quantity,
+ st.alertLevel,
+ st.name,
+ s.name,
+ e.invoiceNumber,
+ e.id,
+ s.id,
+ IF(st.`code` = 'DELIVERED' , TRUE, FALSE),
+ FALSE,
+ b.id,
+ NULL,
+ NULL,
+ NULL,
+ ec.inventorySupplierFk
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN warehouse w ON w.id = tr.warehouseOutFk
+ JOIN supplier s ON s.id = e.supplierFk
+ JOIN state st ON st.`code` = IF(tr.shipped < util.VN_CURDATE()
+ OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived),
+ 'DELIVERED',
+ 'FREE')
+ JOIN entryConfig ec
+ WHERE tr.shipped >= vDateInventory
+ AND vWarehouseFk = tr.warehouseOutFk
+ AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
+ AND b.itemFk = vItemFk
+ AND e.isExcludedFromAvailable = FALSE
+ AND w.isFeedStock = FALSE
+ AND e.isRaid = FALSE
+ UNION ALL
+ SELECT DATE(t.shipped),
+ NULL,
+ s.quantity,
+ st2.alertLevel,
+ st2.name,
+ t.nickname,
+ t.refFk,
+ t.id,
+ t.clientFk,
+ stk.id,
+ TRUE,
+ s.id,
+ st.`order`,
+ ct.`code`,
+ cb.claimFk,
+ NULL
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ LEFT JOIN ticketState ts ON ts.ticketFk = t.id
+ LEFT JOIN state st ON st.`code` = ts.`code`
+ JOIN client c ON c.id = t.clientFk
+ JOIN clientType ct ON ct.id = c.clientTypeFk
+ JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
+ 'DELIVERED',
+ IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
+ 'FREE',
+ IFNULL(ts.code, 'FREE')))
+ LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
+ LEFT JOIN saleTracking stk ON stk.saleFk = s.id
+ AND stk.stateFk = stPrep.id
+ LEFT JOIN claimBeginning cb ON s.id = cb.saleFk
+ WHERE t.shipped >= vDateInventory
+ AND s.itemFk = vItemFk
+ AND vWarehouseFk =t.warehouseFk
+ ORDER BY shipped,
+ (inventorySupplierFk = clientFk) DESC,
+ alertLevel DESC,
+ isTicket,
+ `order` DESC,
+ isPicked DESC,
+ `in` DESC,
+ `out` DESC;
+
+ IF vDate IS NULL THEN
+
+ SET @a := 0;
+ SET @currentLineFk := 0;
+ SET @shipped := '';
+
+ SELECT DATE(@shipped:= shipped) shipped,
+ alertLevel,
+ stateName,
+ origin,
+ reference,
+ clientFk,
+ name,
+ `in` invalue,
+ `out`,
+ @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0) balance,
+ @currentLineFk := IF (@shipped < util.VN_CURDATE()
+ OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.`code` >= 'ON_PREPARATION')),
+ lineFk,
+ @currentLineFk) lastPreparedLineFk,
+ isTicket,
+ lineFk,
+ isPicked,
+ clientType,
+ claimFk
+ FROM tItemDiary
+ LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel;
+
+ ELSE
+ SELECT SUM(`in`) - SUM(`out`) INTO @a
+ FROM tItemDiary
+ WHERE shipped < vDate;
+
+ SELECT vDate shipped,
+ 0 alertLevel,
+ 0 stateName,
+ 0 origin,
+ '' reference,
+ 0 clientFk,
+ 'Inventario calculado',
+ @a invalue,
+ NULL `out`,
+ @a balance,
+ 0 lastPreparedLineFk,
+ 0 isTicket,
+ 0 lineFk,
+ 0 isPicked,
+ 0 clientType,
+ 0 claimFk
+ UNION ALL
+ SELECT shipped,
+ alertlevel,
+ stateName,
+ origin,
+ reference,
+ clientFk,
+ name, `in`,
+ `out`,
+ @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0),
+ 0,
+ isTicket,
+ lineFk,
+ isPicked,
+ clientType,
+ claimFk
+ FROM tItemDiary
+ WHERE shipped >= vDate;
+ END IF;
+
+ DROP TEMPORARY TABLE tItemDiary;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionControl`(
+ vWarehouseFk INT,
+ vScopeDays INT
+)
+proc: BEGIN
+/**
+ * Devuelve un listado de tickets con parámetros relativos a la producción de los días en rango.
+ *
+ * @param vWarehouseFk Identificador de warehouse
+ * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo.
+ *
+ * @return Table tmp.productionBuffer
+ */
+ DECLARE vEndingDate DATETIME;
+ DECLARE vIsTodayRelative BOOLEAN;
+
+ SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
+ INTO vEndingDate
+ FROM productionConfig;
+
+ SELECT isTodayRelative INTO vIsTodayRelative
+ FROM worker
+ WHERE id = getUser(); -- Cambiar por account.myUser_getId(), falta dar permisos
+
+ CALL prepareTicketList(util.yesterday(), vEndingDate);
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
+ SELECT * FROM tmp.productionTicket;
+
+ CALL prepareClientList();
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
+ (INDEX (ticketFk)) ENGINE = MEMORY
+ SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
+ FROM tmp.productionTicket tt
+ JOIN ticket t ON t.id = tt.ticketFk;
+
+ CALL ticket_getProblems(vIsTodayRelative);
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.productionBuffer
+ (PRIMARY KEY(ticketFk), previaParking VARCHAR(255))
+ ENGINE = MEMORY
+ SELECT tt.ticketFk,
+ tt.clientFk,
+ t.warehouseFk,
+ t.nickname,
+ t.packages,
+ IF(HOUR(t.shipped), HOUR(t.shipped), COALESCE(HOUR(zc.hour),HOUR(z.hour))) HH,
+ COALESCE(HOUR(zc.hour), HOUR(z.hour)) Departure,
+ COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) mm,
+ t.routeFk,
+ IF(dm.code = 'DELIVERY', z.`id`, 0) zona,
+ t.nickname addressNickname,
+ a.postalCode,
+ a.city,
+ p.name province,
+ CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency,
+ am.id agencyModeFk,
+ 0 `lines`,
+ CAST( 0 AS DECIMAL(5,2)) m3,
+ CAST( 0 AS DECIMAL(5,2)) preparationRate,
+ "" problem,
+ IFNULL(tls.state,2) state,
+ w.code workerCode,
+ DATE(t.shipped) shipped,
+ wk.code salesPersonCode,
+ p.id provinceFk,
+ tls.productionOrder,
+ IFNULL(tls.alertLevel, 0) alertLevel,
+ t.isBoxed palletized,
+ IF(rm.isPickingAllowed, rm.bufferFk, NULL) ubicacion,
+ tlu.lastUpdated,
+ IFNULL(st.graphCategory, 0) graphCategory,
+ pk.code parking,
+ 0 H,
+ 0 V,
+ 0 N,
+ st.isOk,
+ ag.isOwn,
+ 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 client c ON c.id = t.clientFk
+ LEFT JOIN worker wk ON wk.id = c.salesPersonFk
+ JOIN address a ON a.id = t.addressFk
+ LEFT JOIN province p ON p.id = a.provinceFk
+ JOIN agencyMode am ON am.id = t.agencyModeFk
+ JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
+ JOIN agency ag ON ag.id = am.agencyFk
+ LEFT JOIN ticketState tls ON tls.ticketFk = tt.ticketFk
+ LEFT JOIN ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk
+ LEFT JOIN worker w ON w.id = tls.userFk
+ LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
+ LEFT JOIN `zone` z ON z.id = t.zoneFk
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ AND DATE(t.shipped) = zc.dated
+ LEFT JOIN ticketParking tp ON tp.ticketFk = t.id
+ LEFT JOIN parking pk ON pk.id = tp.parkingFk
+ WHERE t.warehouseFk = vWarehouseFk
+ AND dm.code IN ('AGENCY', 'DELIVERY', 'PICKUP');
+
+ UPDATE tmp.productionBuffer pb
+ JOIN (
+ SELECT pb.ticketFk, GROUP_CONCAT(p.code) previaParking
+ FROM tmp.productionBuffer pb
+ JOIN sale s ON s.ticketFk = pb.ticketFk
+ JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
+ JOIN parking p ON p.id = sg.parkingFk
+ GROUP BY pb.ticketFk
+ ) t ON t.ticketFk = pb.ticketFk
+ SET pb.previaParking = t.previaParking;
+
+ -- Problemas por ticket
+ ALTER TABLE tmp.productionBuffer
+ CHANGE COLUMN `problem` `problem` VARCHAR(255),
+ ADD COLUMN `collectionH` INT,
+ ADD COLUMN `collectionV` INT,
+ ADD COLUMN `collectionN` INT;
+
+ UPDATE tmp.productionBuffer pb
+ JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk
+ SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage, ''),
+ IFNULL(tp.itemDelay, ''),
+ IFNULL(tp.itemLost, ''),
+ IF(tp.isFreezed, ' CONGELADO',''),
+ IF(tp.hasHighRisk, ' RIESGO',''),
+ IF(tp.hasTicketRequest, ' COD 100',''),
+ IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'),
+ IF(tp.hasComponentLack, ' COMPONENTES', ''),
+ IF(HOUR(util.VN_NOW()) < pb.HH AND tp.isTooLittle, ' PEQUEÑO', '')
+ ) AS char(255)));
+
+ -- Clientes Nuevos o Recuperados
+ UPDATE tmp.productionBuffer pb
+ LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk
+ JOIN productionConfig pc
+ SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255)))
+ WHERE (cnb.clientFk IS NULL OR cnb.isRookie)
+ AND pc.rookieDays;
+
+ -- Líneas y volumen por ticket
+ UPDATE tmp.productionBuffer pb
+ JOIN (
+ SELECT tt.ticketFk,
+ COUNT(*) `lines`,
+ SUM(sv.volume) m3,
+ IFNULL(SUM(IF(sv.isPicked, sv.volume, 0)) / SUM(sv.volume), 0) rate
+ FROM tmp.productionTicket tt
+ JOIN saleVolume sv ON sv.ticketFk = tt.ticketFk
+ GROUP BY tt.ticketFk
+ ) m ON m.ticketFk = pb.ticketFk
+ SET pb.`lines` = m.`lines`,
+ pb.m3 = m.m3,
+ pb.preparationRate = m.rate;
+
+ DELETE FROM tmp.productionBuffer
+ WHERE NOT `lines`;
+
+ -- Lineas por linea de encajado
+ UPDATE tmp.productionBuffer pb
+ JOIN (
+ SELECT ticketFk,
+ SUM(sub.H) H,
+ SUM(sub.V) V,
+ SUM(sub.N) N
+ FROM (
+ SELECT t.ticketFk,
+ SUM(i.itemPackingTypeFk = 'H') H,
+ SUM(i.itemPackingTypeFk = 'V') V,
+ SUM(i.itemPackingTypeFk IS NULL) N
+ FROM tmp.productionTicket t
+ JOIN sale s ON s.ticketFk = t.ticketFk
+ JOIN item i ON i.id = s.itemFk
+ GROUP BY t.ticketFk, i.itemPackingTypeFk
+ ) sub
+ GROUP BY ticketFk
+ ) sub2 ON sub2.ticketFk = pb.ticketFk
+ SET pb.H = sub2.H,
+ pb.V = sub2.V,
+ pb.N = sub2.N;
+
+ -- Colecciones segun tipo de encajado
+ UPDATE tmp.productionBuffer pb
+ JOIN ticketCollection tc ON pb.ticketFk = tc.ticketFk
+ SET pb.collectionH = IF(pb.H, tc.collectionFk, NULL),
+ pb.collectionV = IF(pb.V, tc.collectionFk, NULL),
+ pb.collectionN = IF(pb.N, tc.collectionFk, NULL);
+
+ -- Previa pendiente
+ ALTER TABLE tmp.productionBuffer
+ ADD previousWithoutParking BOOL DEFAULT FALSE;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.ticketWithPrevia
+ (ticketFk INT PRIMARY KEY,
+ salesCount INT DEFAULT 0,
+ salesInParkingCount INT DEFAULT 0)
+ ENGINE = MEMORY;
+
+ -- Insertamos todos los tickets que tienen productos parkineados
+ -- en sectores de previa, segun el sector
+ CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
+ (PRIMARY KEY(itemFk, sectorFk))
+ ENGINE = MEMORY
+ SELECT ish.itemFk,
+ p.sectorFk,
+ sc.isPreviousPrepared,
+ sc.itemPackingTypeFk
+ FROM itemShelving ish
+ JOIN shelving sh ON sh.code = ish.shelvingFk
+ JOIN parking p ON p.id = sh.parkingFk
+ JOIN sector sc ON sc.id = p.sectorFk
+ WHERE p.sectorFk
+ AND ish.visible
+ GROUP BY ish.itemFk, p.sectorFk;
+
+ INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount)
+ SELECT pb.ticketFk, COUNT(DISTINCT s.id)
+ FROM tmp.productionBuffer pb
+ JOIN sale s ON s.ticketFk = pb.ticketFk
+ JOIN tItemShelvingStock iss ON iss.itemFk = s.itemFk
+ JOIN sector sc ON sc.id = iss.sectorFk
+ JOIN item i ON i.id = iss.itemFk
+ WHERE iss.isPreviousPrepared
+ AND (sc.itemPackingTypeFk IS NULL
+ OR (i.itemPackingTypeFk IS NULL AND NOT pb.V)
+ OR sc.itemPackingTypeFk = i.itemPackingTypeFk)
+ AND s.quantity > 0
+ GROUP BY pb.ticketFk;
+
+ -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado
+ UPDATE tmp.ticketWithPrevia twp
+ JOIN (
+ SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
+ FROM tmp.productionBuffer pb
+ JOIN sale s ON s.ticketFk = pb.ticketFk
+ JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
+ WHERE sg.parkingFk IS NOT NULL
+ AND s.quantity > 0
+ GROUP BY pb.ticketFk
+ ) sub ON twp.ticketFk = sub.ticketFk
+ SET twp.salesInParkingCount = sub.salesInParkingCount;
+
+ -- Marcamos como pendientes aquellos que no coinciden las cantidades
+ UPDATE tmp.productionBuffer pb
+ JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk
+ SET pb.previousWithoutParking = TRUE
+ WHERE twp.salesCount > twp.salesInParkingCount;
+
+ DROP TEMPORARY TABLE
+ tmp.productionTicket,
+ tmp.ticket,
+ tmp.risk,
+ tmp.ticket_problems,
+ tmp.ticketWithPrevia,
+ tItemShelvingStock;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInsert`
+ BEFORE INSERT ON `expedition`
+ FOR EACH ROW
+BEGIN
+ DECLARE intcounter 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;
+
+ SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
+ FROM expedition e
+ INNER JOIN ticket t1 ON e.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
+ WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
+ AND t1.agencyModeFk = t2.agencyModeFk;
+
+ SET NEW.`counter` = intcounter;
+ END IF;
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_recalcComponent`(vOption INT)
+proc: BEGIN
+/**
+ * Este procedimiento recalcula los componentes de un conjunto de sales,
+ * eliminando los componentes existentes e insertandolos de nuevo
+ *
+ * @param vOption si no se quiere forzar llamar con NULL
+ * @table tmp.recalculateSales (id)
+ */
+ DECLARE vShipped DATE;
+ DECLARE vWarehouseFk SMALLINT;
+ DECLARE vAgencyModeFk INT;
+ DECLARE vAddressFk INT;
+ DECLARE vTicketFk INT;
+ DECLARE vLanded DATE;
+ DECLARE vIsEditable BOOLEAN;
+ DECLARE vZoneFk INTEGER;
+ DECLARE vDone BOOL DEFAULT FALSE;
+
+ DECLARE vCur CURSOR FOR
+ SELECT DISTINCT s.ticketFk
+ FROM tmp.recalculateSales rs
+ JOIN vn.sale s ON s.id = rs.id;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ OPEN vCur;
+
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vCur INTO vTicketFk;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ SELECT (hasToRecalcPrice OR ts.alertLevel IS NULL) AND t.refFk IS NULL,
+ t.zoneFk,
+ t.warehouseFk,
+ t.shipped,
+ t.addressFk,
+ t.agencyModeFk,
+ t.landed
+ INTO vIsEditable,
+ vZoneFk,
+ vWarehouseFk,
+ vShipped,
+ vAddressFk,
+ vAgencyModeFk,
+ vLanded
+ FROM ticket t
+ LEFT JOIN ticketState ts ON t.id = ts.ticketFk
+ LEFT JOIN alertLevel al ON al.id = ts.alertLevel
+ WHERE t.id = vTicketFk;
+
+ CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
+
+ IF NOT EXISTS (SELECT TRUE FROM tmp.zoneGetLanded LIMIT 1) THEN
+ CALL util.throw(CONCAT('There is no zone for these parameters ', vTicketFk));
+ END IF;
+
+ IF vLanded IS NULL OR vZoneFk IS NULL THEN
+
+ UPDATE ticket t
+ SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
+ WHERE t.id = vTicketFk AND t.landed IS NULL;
+
+ IF vZoneFk IS NULL THEN
+ SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
+ UPDATE ticket t
+ SET t.zoneFk = vZoneFk
+ WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
+ END IF;
+
+ END IF;
+
+ DROP TEMPORARY TABLE tmp.zoneGetLanded;
+
+ -- rellena la tabla buyUltimate con la ultima compra
+ CALL buyUltimate (vWarehouseFk, vShipped);
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale
+ (PRIMARY KEY (saleFk)) ENGINE = MEMORY
+ SELECT s.id saleFk, vWarehouseFk warehouseFk
+ FROM sale s
+ JOIN tmp.recalculateSales rs ON s.id = rs.id
+ WHERE s.ticketFk = vTicketFk;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.ticketLot
+ SELECT vWarehouseFk warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
+ FROM sale s
+ JOIN tmp.recalculateSales rs ON s.id = rs.id
+ LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
+ WHERE s.ticketFk = vTicketFk
+ GROUP BY s.itemFk;
+
+ CALL catalog_componentPrepare();
+ CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
+
+ IF vOption IS NULL THEN
+ SET vOption = IF(vIsEditable, 1, 6);
+ END IF;
+
+ CALL ticketComponentUpdateSale(vOption);
+ CALL catalog_componentPurge();
+
+ DROP TEMPORARY TABLE tmp.buyUltimate;
+ DROP TEMPORARY TABLE tmp.sale;
+
+ END LOOP;
+ CLOSE vCur;
+
+END$$
+DELIMITER ;
+
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`(
+ vSerial VARCHAR(255),
+ vInvoiceDate DATE,
+ vTaxArea VARCHAR(25),
+ OUT vNewInvoiceId INT)
+BEGIN
+/**
+ * Creación de facturas emitidas.
+ * requiere previamente tabla tmp.ticketToInvoice(id).
+ *
+ * @param vSerial serie a la cual se hace la factura
+ * @param vInvoiceDate fecha de la factura
+ * @param vTaxArea tipo de iva en relacion a la empresa y al cliente
+ * @param vNewInvoiceId id de la factura que se acaba de generar
+ * @return vNewInvoiceId
+ */
+ DECLARE vIsAnySaleToInvoice BOOL;
+ DECLARE vIsAnyServiceToInvoice BOOL;
+ DECLARE vNewRef VARCHAR(255);
+ DECLARE vWorker INT DEFAULT account.myUser_getId();
+ DECLARE vCompanyFk INT;
+ DECLARE vInterCompanyFk INT;
+ DECLARE vClientFk INT;
+ DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1;
+ DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6;
+ DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2;
+ DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R';
+ DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S';
+ DECLARE vNewInvoiceInFk INT;
+ DECLARE vIsInterCompany BOOL DEFAULT FALSE;
+ DECLARE vIsCEESerial BOOL DEFAULT FALSE;
+ DECLARE vIsCorrectInvoiceDate BOOL;
+ DECLARE vMaxShipped DATE;
+ DECLARE vDone BOOL;
+ DECLARE vTicketFk INT;
+ DECLARE vCursor CURSOR FOR
+ SELECT id
+ FROM tmp.ticketToInvoice;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE());
+
+ SELECT t.clientFk,
+ t.companyFk,
+ MAX(DATE(t.shipped)),
+ DATE(vInvoiceDate) >= invoiceOut_getMaxIssued(
+ vSerial,
+ t.companyFk,
+ YEAR(vInvoiceDate))
+ INTO vClientFk,
+ vCompanyFk,
+ vMaxShipped,
+ vIsCorrectInvoiceDate
+ FROM tmp.ticketToInvoice tt
+ JOIN ticket t ON t.id = tt.id;
+
+ IF(vMaxShipped > vInvoiceDate) THEN
+ CALL util.throw("Invoice date can't be less than max date");
+ END IF;
+
+ IF NOT vIsCorrectInvoiceDate THEN
+ CALL util.throw('Exists an invoice with a previous date');
+ END IF;
+
+ -- Eliminem de tmp.ticketToInvoice els tickets que no han de ser facturats
+ DELETE ti.*
+ FROM tmp.ticketToInvoice ti
+ JOIN ticket t ON t.id = ti.id
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN supplier su ON su.id = t.companyFk
+ JOIN client c ON c.id = t.clientFk
+ LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
+ WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted)
+ OR c.isTaxDataChecked = FALSE
+ OR t.isDeleted
+ OR c.hasToInvoice = FALSE
+ OR itc.id IS NULL;
+
+ SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0
+ INTO vIsAnySaleToInvoice
+ FROM tmp.ticketToInvoice t
+ JOIN sale s ON s.ticketFk = t.id;
+
+ SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice
+ FROM tmp.ticketToInvoice t
+ JOIN ticketService ts ON ts.ticketFk = t.id;
+
+ IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice)
+ AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase())
+ THEN
+
+ -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial
+ INSERT INTO invoiceOut(
+ ref,
+ serial,
+ issued,
+ clientFk,
+ dued,
+ companyFk,
+ siiTypeInvoiceOutFk
+ )
+ SELECT
+ 1,
+ vSerial,
+ vInvoiceDate,
+ vClientFk,
+ getDueDate(vInvoiceDate, dueDay),
+ vCompanyFk,
+ IF(vSerial = vCorrectingSerial,
+ vCplusCorrectingInvoiceTypeFk,
+ IF(vSerial = vSimplifiedSerial,
+ vCplusSimplifiedInvoiceTypeFk,
+ vCplusStandardInvoiceTypeFk))
+ FROM client
+ WHERE id = vClientFk;
+
+ SET vNewInvoiceId = LAST_INSERT_ID();
+
+ SELECT `ref`
+ INTO vNewRef
+ FROM invoiceOut
+ WHERE id = vNewInvoiceId;
+
+ OPEN vCursor;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vCursor INTO vTicketFk;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CALL ticket_recalc(vTicketFk, vTaxArea);
+
+ END LOOP;
+ CLOSE vCursor;
+
+ UPDATE ticket t
+ JOIN tmp.ticketToInvoice ti ON ti.id = t.id
+ SET t.refFk = vNewRef;
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.updateInter;
+ CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY
+ SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador
+ FROM tmp.ticketToInvoice ti
+ LEFT JOIN ticketState ts ON ti.id = ts.ticketFk
+ JOIN state s
+ WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id);
+
+ INSERT INTO ticketTracking(stateFk,ticketFk,userFk)
+ SELECT * FROM tmp.updateInter;
+
+ CALL invoiceExpenseMake(vNewInvoiceId);
+ CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
+
+ UPDATE invoiceOut io
+ JOIN (
+ SELECT SUM(amount) total
+ FROM invoiceOutExpense
+ WHERE invoiceOutFk = vNewInvoiceId
+ ) base
+ JOIN (
+ SELECT SUM(vat) total
+ FROM invoiceOutTax
+ WHERE invoiceOutFk = vNewInvoiceId
+ ) vat
+ SET io.amount = base.total + vat.total
+ WHERE io.id = vNewInvoiceId;
+
+ DROP TEMPORARY TABLE tmp.updateInter;
+
+ SELECT COUNT(*), id
+ INTO vIsInterCompany, vInterCompanyFk
+ FROM company
+ WHERE clientFk = vClientFk;
+
+ IF (vIsInterCompany) THEN
+
+ INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk)
+ SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk;
+
+ SET vNewInvoiceInFk = LAST_INSERT_ID();
+
+ DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
+ CREATE TEMPORARY TABLE tmp.ticket
+ (KEY (ticketFk))
+ ENGINE = MEMORY
+ SELECT id ticketFk
+ FROM tmp.ticketToInvoice;
+
+ CALL `ticket_getTax`('NATIONAL');
+
+ SET @vTaxableBaseServices := 0.00;
+ SET @vTaxCodeGeneral := NULL;
+
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInFk,
+ @vTaxableBaseServices,
+ sub.expenseFk,
+ sub.taxTypeSageFk,
+ sub.transactionTypeSageFk
+ FROM (
+ SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
+ i.expenseFk,
+ i.taxTypeSageFk,
+ i.transactionTypeSageFk,
+ @vTaxCodeGeneral := i.taxClassCodeFk
+ FROM tmp.ticketServiceTax tst
+ JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code
+ WHERE i.isService
+ HAVING taxableBase
+ ) sub;
+
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
+ SELECT vNewInvoiceInFk,
+ SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
+ @vTaxableBaseServices, 0) taxableBase,
+ i.expenseFk,
+ i.taxTypeSageFk ,
+ i.transactionTypeSageFk
+ FROM tmp.ticketTax tt
+ JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code
+ WHERE !i.isService
+ GROUP BY tt.pgcFk
+ HAVING taxableBase
+ ORDER BY tt.priority;
+
+ CALL invoiceInDueDay_calculate(vNewInvoiceInFk);
+
+ SELECT COUNT(*) INTO vIsCEESerial
+ FROM invoiceOutSerial
+ WHERE code = vSerial;
+
+ IF vIsCEESerial THEN
+
+ INSERT INTO invoiceInIntrastat (
+ invoiceInFk,
+ intrastatFk,
+ amount,
+ stems,
+ countryFk,
+ net)
+ SELECT
+ vNewInvoiceInFk,
+ i.intrastatFk,
+ SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))),
+ SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))),
+ su.countryFk,
+ CAST(SUM(IFNULL(i.stems, 1)
+ * s.quantity
+ * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2))
+ FROM sale s
+ JOIN ticket t ON s.ticketFk = t.id
+ JOIN supplier su ON su.id = t.companyFk
+ JOIN item i ON i.id = s.itemFk
+ LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
+ WHERE t.refFk = vNewRef
+ GROUP BY i.intrastatFk;
+
+ END IF;
+ DROP TEMPORARY TABLE tmp.ticket;
+ DROP TEMPORARY TABLE tmp.ticketAmount;
+ DROP TEMPORARY TABLE tmp.ticketTax;
+ DROP TEMPORARY TABLE tmp.ticketServiceTax;
+ END IF;
+ END IF;
+ DROP TEMPORARY TABLE `tmp`.`ticketToInvoice`;
+END$$
+DELIMITER ;
diff --git a/db/changes/240201/01-refactorHasAnyNegativeBase.sql b/db/changes/240201/01-refactorHasAnyNegativeBase.sql
new file mode 100644
index 000000000..a3eb2d9c7
--- /dev/null
+++ b/db/changes/240201/01-refactorHasAnyNegativeBase.sql
@@ -0,0 +1,32 @@
+DELIMITER $$
+$$
+CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`() RETURNS tinyint(1)
+ DETERMINISTIC
+BEGIN
+
+/**
+* Calcula si existe alguna base imponible negativa
+* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
+*
+* returns BOOLEAN
+*/
+
+ DECLARE hasAnyNegativeBase BOOLEAN;
+
+ CALL getTaxBases();
+
+ SELECT negative INTO hasAnyNegativeBase
+ FROM tmp.taxBases
+ LIMIT 1;
+
+ DROP TEMPORARY TABLE
+ tmp.ticketTax,
+ tmp.ticket,
+ tmp.taxBases;
+
+ RETURN hasAnyNegativeBase;
+
+END$$
+DELIMITER ;
+
+
diff --git a/db/changes/240201/01-triggers.sql b/db/changes/240201/01-triggers.sql
new file mode 100644
index 000000000..a7fa029b4
--- /dev/null
+++ b/db/changes/240201/01-triggers.sql
@@ -0,0 +1,27 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInsert`
+ BEFORE INSERT ON `expedition`
+ FOR EACH ROW
+BEGIN
+ DECLARE intcounter 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;
+
+ SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
+ FROM expedition e
+ INNER JOIN ticket t1 ON e.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
+ WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
+ AND t1.agencyModeFk = t2.agencyModeFk;
+
+ SET NEW.`counter` = intcounter;
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/changes/240201/01-views.sql b/db/changes/240201/01-views.sql
new file mode 100644
index 000000000..30b08b776
--- /dev/null
+++ b/db/changes/240201/01-views.sql
@@ -0,0 +1,58 @@
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn`.`expeditionRoute_freeTickets` AS
+SELECT
+ `t`.`routeFk` AS `routeFk`,
+ `tss`.`ticketFk` AS `ticket`,
+ `s`.`name` AS `code`,
+ `w`.`name` AS `almacen`,
+ `tss`.`updated` AS `updated`,
+ `p`.`code` AS `parkingCode`
+ FROM `vn`.`ticketState` `tss`
+ JOIN `vn`.`ticket` `t` ON `t`.`id` = `tss`.`ticketFk`
+ JOIN `vn`.`warehouse` `w` ON `w`.`id` = `t`.`warehouseFk`
+ JOIN `vn`.`state` `s` ON `s`.`id` = `tss`.`state`
+ LEFT JOIN `vn`.`ticketParking` `tp` ON `tp`.`ticketFk` = `t`.`id`
+ LEFT JOIN `vn`.`parking` `p` ON `p`.`id` = `tp`.`parkingFk`
+ WHERE IFNULL(`t`.`packages`, 0) = 0;
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn`.`ticketState`
+AS SELECT `tt`.`created` AS `updated`,
+ `tt`.`stateFk` AS `stateFk`,
+ `tt`.`userFk` AS `userFk`,
+ `tls`.`ticketFk` AS `ticketFk`,
+ `s`.`id` AS `state`,
+ `s`.`order` AS `productionOrder`,
+ `s`.`alertLevel` AS `alertLevel`,
+ `s`.`code` AS `code`,
+ `s`.`isPreviousPreparable` AS `isPreviousPreparable`,
+ `s`.`isPicked` AS `isPicked`
+FROM (
+ (
+ `vn`.`ticketLastState` `tls`
+ JOIN `vn`.`ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
+ )
+ JOIN `vn`.`state` `s` ON(`s`.`id` = `tt`.`stateFk`)
+ );
+
+CREATE OR REPLACE DEFINER=`root`@`localhost`
+ SQL SECURITY DEFINER
+ VIEW `vn`.`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
+ `vn`.`ticketState` `ts`
+ JOIN `vn`.`ticket` `t` ON `t`.`id` = `ts`.`ticketFk`
+WHERE
+ `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`VN_CURDATE`() + INTERVAL 1 DAY;
+
diff --git a/db/changes/240202/.gitkeep b/db/changes/240202/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/db/changes/240202/00-aclWorkerTimeControl.sql b/db/changes/240202/00-aclWorkerTimeControl.sql
new file mode 100644
index 000000000..5ccb3131d
--- /dev/null
+++ b/db/changes/240202/00-aclWorkerTimeControl.sql
@@ -0,0 +1,14 @@
+DELETE FROM salix.ACL
+ WHERE model = 'WorkerTimeControl'
+ AND property IN ('*','addTime');
+
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('WorkerTimeControl', 'addTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'deleteTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'updateTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'sendMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'updateWorkerTimeControlMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'weeklyHourRecordEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'getMailStates', 'READ', 'ALLOW', 'ROLE', 'employee'),
+ ('WorkerTimeControl', 'resendWeeklyHourEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/changes/240203/.gitkeep b/db/changes/240203/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/db/changes/240203/00-viaExpressConfig.sql b/db/changes/240203/00-viaExpressConfig.sql
new file mode 100644
index 000000000..57832e7cd
--- /dev/null
+++ b/db/changes/240203/00-viaExpressConfig.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `vn`.`viaexpressConfig` ADD agencyModeFk int DEFAULT NULL NULL COMMENT 'Indica el agencyMode que es interdia';
+ALTER TABLE `vn`.`viaexpressConfig` ADD CONSTRAINT viaexpressConfig_agencyMode_Fk FOREIGN KEY (agencyModeFK) REFERENCES vn.agencyMode(id) ON DELETE RESTRICT ON UPDATE RESTRICT;
diff --git a/db/changes/240401/.gitkeep b/db/changes/240401/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/db/changes/240401/00-removeStars.sql b/db/changes/240401/00-removeStars.sql
new file mode 100644
index 000000000..ecc1664c8
--- /dev/null
+++ b/db/changes/240401/00-removeStars.sql
@@ -0,0 +1 @@
+ALTER TABLE `vn`.`item` DROP COLUMN stars;
diff --git a/db/changes/240401/00-revokeItem.sql b/db/changes/240401/00-revokeItem.sql
new file mode 100644
index 000000000..2b75d67cf
--- /dev/null
+++ b/db/changes/240401/00-revokeItem.sql
@@ -0,0 +1,4 @@
+REVOKE UPDATE ON TABLE `vn`.`item` FROM `employee`;
+
+
+GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE vn.item TO employee;
diff --git a/db/changes/240401/00-supplier.sql b/db/changes/240401/00-supplier.sql
new file mode 100644
index 000000000..e60707eca
--- /dev/null
+++ b/db/changes/240401/00-supplier.sql
@@ -0,0 +1,12 @@
+ALTER TABLE `vn`.`company` MODIFY COLUMN `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'Cuenta por defecto para ingresos desde este pais';
+
+
+ALTER TABLE `vn`.`supplierAccount`
+ADD COLUMN `countryFk` mediumint(8) unsigned DEFAULT NULL,
+ADD CONSTRAINT `fk_supplierAccount_country`
+ FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE;
+
+ALTER TABLE `vn`.`supplierAccount`
+ADD UNIQUE KEY `uk_supplier_country` (`supplierFk`, `countryFk`);
+
+
diff --git a/db/changes/240401/00-ticket_canbePostponed.sql b/db/changes/240401/00-ticket_canbePostponed.sql
new file mode 100644
index 000000000..e0fbb99cf
--- /dev/null
+++ b/db/changes/240401/00-ticket_canbePostponed.sql
@@ -0,0 +1,74 @@
+DELIMITER $$
+$$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
+BEGIN
+/**
+ * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
+ *
+ * @param vOriginDated Fecha en cuestión
+ * @param vFutureDated Fecha en el futuro a sondear
+ * @param vWarehouseFk Identificador de vn.warehouse
+ */
+ CREATE OR REPLACE TEMPORARY TABLE tmp.filter
+ (INDEX (id))
+ SELECT sv.ticketFk id,
+ sub2.id futureId,
+ GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
+ CAST(sum(litros) AS DECIMAL(10,0)) liters,
+ CAST(count(*) AS DECIMAL(10,0)) `lines`,
+ st.name state,
+ sub2.iptd futureIpt,
+ sub2.state futureState,
+ t.clientFk,
+ t.warehouseFk,
+ ts.alertLevel,
+ t.shipped,
+ t.totalWithVat,
+ sub2.shipped futureShipped,
+ t.workerFk,
+ st.code stateCode,
+ sub2.code futureStateCode,
+ st.classColor,
+ sub2.classColor futureClassColor
+ FROM vn.saleVolume sv
+ JOIN vn.sale s ON s.id = sv.saleFk
+ JOIN vn.item i ON i.id = s.itemFk
+ JOIN vn.ticket t ON t.id = sv.ticketFk
+ JOIN vn.address a ON a.id = t.addressFk
+ JOIN vn.province p ON p.id = a.provinceFk
+ JOIN vn.country c ON c.id = p.countryFk
+ JOIN vn.ticketState ts ON ts.ticketFk = t.id
+ JOIN vn.state st ON st.id = ts.stateFk
+ JOIN vn.alertLevel al ON al.id = ts.alertLevel
+ LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
+ LEFT JOIN (
+ SELECT *
+ FROM (
+ SELECT
+ t.addressFk,
+ t.id,
+ t.shipped,
+ st.name state,
+ st.code,
+ st.classColor,
+ GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
+ FROM vn.ticket t
+ JOIN vn.ticketState ts ON ts.ticketFk = t.id
+ JOIN vn.state st ON st.id = ts.stateFk
+ JOIN vn.sale s ON s.ticketFk = t.id
+ JOIN vn.item i ON i.id = s.itemFk
+ WHERE t.shipped BETWEEN vFutureDated
+ AND util.dayend(vFutureDated)
+ AND t.warehouseFk = vWarehouseFk
+ GROUP BY t.id
+ ) sub
+ GROUP BY sub.addressFk
+ ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
+ WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
+ AND t.warehouseFk = vWarehouseFk
+ AND al.code = 'FREE'
+ AND tp.ticketFk IS NULL
+ GROUP BY sv.ticketFk
+ HAVING futureId;
+END$$
+DELIMITER ;
diff --git a/db/changes/240401/01-saleGroupDetailDefaultSize.sql b/db/changes/240401/01-saleGroupDetailDefaultSize.sql
new file mode 100644
index 000000000..12f17c5e7
--- /dev/null
+++ b/db/changes/240401/01-saleGroupDetailDefaultSize.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.productionConfig ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa';
+UPDATE IGNORE vn.productionConfig SET itemPreviousDefaultSize = 40 WHERE id = 1;
diff --git a/db/changes/240401/01-supplierAccount.sql b/db/changes/240401/01-supplierAccount.sql
new file mode 100644
index 000000000..1c0f1ef43
--- /dev/null
+++ b/db/changes/240401/01-supplierAccount.sql
@@ -0,0 +1,9 @@
+UPDATE vn.supplierAccount sa
+ JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'FR'
+ SET countryFk = c.id
+ WHERE iban = 'FR7630003012690002801121597';
+
+UPDATE vn.supplierAccount sa
+ JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'PT'
+ SET countryFk = c.id
+ WHERE iban = 'PT50001000005813059150168';
diff --git a/db/changes/240401/02-invoiceOutConfig_refLen.sql b/db/changes/240401/02-invoiceOutConfig_refLen.sql
new file mode 100644
index 000000000..8b91889f2
--- /dev/null
+++ b/db/changes/240401/02-invoiceOutConfig_refLen.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.invoiceOutConfig
+ ADD IF NOT EXISTS refLen TINYINT UNSIGNED DEFAULT 5 NOT NULL COMMENT 'Invoice reference identifier length';
diff --git a/db/changes/240401/03-fixInvoiceOutBeforeInsert.sql b/db/changes/240401/03-fixInvoiceOutBeforeInsert.sql
new file mode 100644
index 000000000..0081c8803
--- /dev/null
+++ b/db/changes/240401/03-fixInvoiceOutBeforeInsert.sql
@@ -0,0 +1,59 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInsert`
+ BEFORE INSERT ON `invoiceOut`
+ FOR EACH ROW
+BEGIN
+/**
+ * Generates the next reference for the invoice serial. There cannot be gaps
+ * between identifiers of the same serial!
+ *
+ * Reference format:
+ * {0} Invoice serial
+ * {1} The company code
+ * {2-3} Last two digits of issue year
+ * {4-$} Autoincrement identifier
+ */
+ DECLARE vRef INT DEFAULT 0;
+ DECLARE vRefLen INT;
+ DECLARE vRefPrefix VARCHAR(255);
+ DECLARE vLastRef VARCHAR(255);
+ DECLARE vCompanyCode INT;
+ DECLARE vYearLen INT DEFAULT 2;
+ DECLARE vPrefixLen INT;
+
+ SELECT companyCode INTO vCompanyCode
+ FROM company
+ WHERE id = NEW.companyFk;
+
+ IF vCompanyCode IS NULL THEN
+ CALL util.throw('companyCodeNotDefined');
+ END IF;
+
+ SELECT MAX(i.ref) INTO vLastRef
+ FROM invoiceOut i
+ WHERE i.serial = NEW.serial
+ AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.lastDayOfYear(NEW.issued)
+ AND i.companyFk = NEW.companyFk;
+
+ IF vLastRef IS NOT NULL THEN
+ SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
+ SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
+ SET vRefPrefix = LEFT(vLastRef, vPrefixLen);
+ SET vRef = RIGHT(vLastRef, vRefLen);
+ ELSE
+ SELECT refLen INTO vRefLen FROM invoiceOutConfig;
+ SET vRefPrefix = CONCAT(
+ NEW.serial,
+ vCompanyCode,
+ RIGHT(YEAR(NEW.issued), vYearLen)
+ );
+ END IF;
+
+ SET vRef = vRef + 1;
+ IF LENGTH(vRef) > vRefLen THEN
+ CALL util.throw('refIdLenExceeded');
+ END IF;
+
+ SET NEW.ref = CONCAT(vRefPrefix, LPAD(vRef, vRefLen, '0'));
+END$$
+DELIMITER ;
diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql
index 2e1511b59..3e46c8e04 100644
--- a/db/dump/dumpedFixtures.sql
+++ b/db/dump/dumpedFixtures.sql
@@ -22,7 +22,7 @@ USE `util`;
LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
-INSERT INTO `config` VALUES (1,'233401',0,'production',NULL,'2001-01-01 11:00:00',NULL,0);
+INSERT INTO `config` VALUES (1,'234604',0,'production',NULL,'2001-01-01 11:00:00',NULL,0);
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;
@@ -32,7 +32,7 @@ UNLOCK TABLES;
LOCK TABLES `version` WRITE;
/*!40000 ALTER TABLE `version` DISABLE KEYS */;
-INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10714','aeb89a7b54f62398ddbcf3a48c8d387f275fee47','2023-08-29 12:49:52','10716');
+INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10761','6c1146271aa71f7c3332e11d50d6812752391ea4','2023-11-20 11:55:47','10778');
/*!40000 ALTER TABLE `version` ENABLE KEYS */;
UNLOCK TABLES;
@@ -42,7 +42,7 @@ UNLOCK TABLES;
LOCK TABLES `versionLog` WRITE;
/*!40000 ALTER TABLE `versionLog` DISABLE KEYS */;
-INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10193','00-delete.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:35',NULL,NULL),('vn-database','10193','01-botanicExport.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:43',NULL,NULL),('vn-database','10193','02-item.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-autonomy.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-turn.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','04-country.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10379','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:16',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10384','00-business_workcenterFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10426','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:40',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10431','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:22',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10439','00-fixRole.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:26',NULL,NULL),('vn-database','10440','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10458','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10459','00-alterTableUtilConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','01-createFunctionCurdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','02-createFunctionMockTime.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','03-createFunctionMockTimeBase.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','04-createFunctionNow.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10470','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10471','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10472','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10477','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:31',NULL,NULL),('vn-database','10478','00-dropBasket.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','01-orderConfigured.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:16',NULL,NULL),('vn-database','10478','02-configuredUpdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10478','99-privileges.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL),('vn-database','10482','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-21 10:00:28',NULL,NULL),('vn-database','10485','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10488','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10491','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10492','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10493','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10495','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:19',NULL,NULL),('vn-database','10498','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:38',NULL,NULL),('vn-database','10500','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 07:06:03',NULL,NULL),('vn-database','10501','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 10:52:24',NULL,NULL),('vn-database','10502','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10504','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10506','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10506','01-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','02-secondScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','03-thirdScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10507','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:35:23',NULL,NULL),('vn-database','10508','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:43',NULL,NULL),('vn-database','10510','00-dropBusinessFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','01-createTableProfessionalCategory.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','02-exportToNewTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','03-RecreateFK.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10510','04-kkPostgresqlTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10511','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10512','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:52',NULL,NULL),('vn-database','10513','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:56',NULL,NULL),('vn-database','10514','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10516','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10521','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 06:58:13',NULL,NULL),('vn-database','10522','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10523','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10524','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:12',NULL,NULL),('vn-database','10524','01-rateEditorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:12',NULL,NULL),('vn-database','10525','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 12:42:50',NULL,NULL),('vn-database','10526','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:57',NULL,NULL),('vn-database','10528','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:00',NULL,NULL),('vn-database','10530','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-23 14:49:30',NULL,NULL),('vn-database','10531','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:47:10',NULL,NULL),('vn-database','10532','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:17:38',NULL,NULL),('vn-database','10533','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:04',NULL,NULL),('vn-database','10537','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-29 15:18:36',NULL,NULL),('vn-database','10538','00-createChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','01-createChronopostService.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','02-createChronopostExpedition.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','03-createChronopostSenderAddress.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','04-addgrantPrivilegies.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','05-updateChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 11:54:57',NULL,NULL),('vn-database','10539','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:07',NULL,NULL),('vn-database','10540','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10545','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-11 08:31:03',NULL,NULL),('vn-database','10546','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10547','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:21:58',NULL,NULL),('vn-database','10549','00-updateUpdateLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:29:22',NULL,NULL),('vn-database','10549','01-updateInsertLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:11',NULL,NULL),('vn-database','10549','02-updateDeleteLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:51',NULL,NULL),('vn-database','10549','03-deleteEmptyLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:31:34',NULL,NULL),('vn-database','10549','04-optimizeLogTables.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:33:58',NULL,NULL),('vn-database','10550','00-editorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:42:33',NULL,NULL),('vn-database','10550','01-originFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10552','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-13 08:25:10',NULL,NULL),('vn-database','10554','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10557','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-17 07:45:56',NULL,NULL),('vn-database','10559','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-18 10:53:50',NULL,NULL),('vn-database','10560','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-17 09:19:31',NULL,NULL),('vn-database','10562','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10563','00-delivery_ticketFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 09:30:53',NULL,NULL),('vn-database','10566','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:08:41',NULL,NULL),('vn-database','10567','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:18:06',NULL,NULL),('vn-database','10568','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10569','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-24 09:14:35',NULL,NULL),('vn-database','10570','00-createSendingConfig.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','01-createSendingServiceWeekday.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','02-createSendingService.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','03-permisos.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10571','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10573','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:23',NULL,NULL),('vn-database','10575','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-26 11:27:32',NULL,NULL),('vn-database','10577','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-27 14:00:12',NULL,NULL),('vn-database','10578','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10579','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-28 11:27:36',NULL,NULL),('vn-database','10580','00-itemTypeDropConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:18:52',NULL,NULL),('vn-database','10580','01-itemTypeAddConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:19:10',NULL,NULL),('vn-database','10581','00-itemTypeAutoIncrement.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 19:06:46',NULL,NULL),('vn-database','10582','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10583','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10584','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10585','00-ticketLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:20:10',NULL,NULL),('vn-database','10585','01-entryLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:21:12',NULL,NULL),('vn-database','10585','02-claimLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:36',NULL,NULL),('vn-database','10585','03-clientLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:54',NULL,NULL),('vn-database','10585','04-invoiceInLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:55',NULL,NULL),('vn-database','10585','05-itemLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:29:46',NULL,NULL),('vn-database','10585','06-routeLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:18',NULL,NULL),('vn-database','10585','07-shelvingLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','08-supplierLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','09-travelLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:41',NULL,NULL),('vn-database','10585','10-workerLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:42',NULL,NULL),('vn-database','10585','11-zoneLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:43',NULL,NULL),('vn-database','10585','12-userLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10585','13-roleLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10587','00-arcRead_addMinimum.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-16 13:13:15',NULL,NULL),('vn-database','10593','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10596','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10597','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10598','00-workerLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','01-supplierLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','02-workerTimeControlLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','03-workerClockLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10599','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10601','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-17 09:26:26',NULL,NULL),('vn-database','10602','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 08:52:15',NULL,NULL),('vn-database','10606','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 09:26:00',NULL,NULL),('vn-database','10608','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 12:36:31',NULL,NULL),('vn-database','10609','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 08:28:07',NULL,NULL),('vn-database','10610','00-updateCompanyId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:07',NULL,NULL),('vn-database','10610','01-updateSupplierId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:39',NULL,NULL),('vn-database','10610','02-invoiceOutCompany.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 09:49:55',NULL,NULL),('vn-database','10611','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-19 14:39:41',NULL,NULL),('vn-database','10613','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10614','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10615','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10616','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:18:55',NULL,NULL),('vn-database','10616','01-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:18:55',NULL,NULL),('vn-database','10617','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:41',NULL,NULL),('vn-database','10618','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 12:55:56',NULL,NULL),('vn-database','10619','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10620','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:20:53',NULL,NULL),('vn-database','10624','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-30 19:01:10',NULL,NULL),('vn-database','10626','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 13:32:32',NULL,NULL),('vn-database','10628','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10630','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-02 13:30:58',NULL,NULL),('vn-database','10631','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-05 08:37:25',NULL,NULL),('vn-database','10632','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10633','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10634','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-06 12:15:55',NULL,NULL),('vn-database','10637','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:19',NULL,NULL),('vn-database','10640','00-companyFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','00-updateCompany.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-07 14:22:13',1205,'Tiempo de espera de bloqueo excedido; intente rearrancar la transacción'),('vn-database','10640','01-companyFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','02-companyFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:47:04',NULL,NULL),('vn-database','10640','04-supplierFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:48:30',NULL,NULL),('vn-database','10640','05-supplierFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:53:17',NULL,NULL),('vn-database','10640','06-supplierFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 15:06:00',NULL,NULL),('vn-database','10642','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10643','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-09 15:04:35',NULL,NULL),('vn-database','10644','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:18',NULL,NULL),('vn-database','10647','00-renombrarTabla.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10648','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10649','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-16 10:59:06',NULL,NULL),('vn-database','10652','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10653','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:20',NULL,NULL),('vn-database','10655','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:24',NULL,NULL),('vn-database','10656','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10658','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:27',NULL,NULL),('vn-database','10659','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10662','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:33',NULL,NULL),('vn-database','10663','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:34',NULL,NULL),('vn-database','10665','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-30 08:52:51',NULL,NULL),('vn-database','10666','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:34',NULL,NULL),('vn-database','10667','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10668','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10671','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-25 14:56:50',NULL,NULL),('vn-database','10675','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10676','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10679','00-tables.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10680','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-18 14:58:36',NULL,NULL),('vn-database','10682','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10690','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-27 10:52:26',NULL,NULL),('vn-database','10691','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-31 13:37:21',NULL,NULL),('vn-database','10692','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10693','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10694','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-02 09:50:53',NULL,NULL),('vn-database','10695','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-02 13:40:16',NULL,NULL),('vn-database','10696','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-03 16:54:57',NULL,NULL),('vn-database','10698','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-03 08:53:12',NULL,NULL),('vn-database','10699','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-03 15:24:30',NULL,NULL),('vn-database','10700','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-29 09:42:11',NULL,NULL),('vn-database','10702','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 12:50:46',NULL,NULL),('vn-database','10704','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-29 09:42:14',NULL,NULL),('vn-database','10705','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-16 14:16:05',NULL,NULL),('vn-database','10707','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-21 12:31:18',NULL,NULL),('vn-database','10714','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-28 13:01:45',NULL,NULL);
+INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL),('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL),('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10119','00-AfegirFKPart1.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL),('vn-database','10119','01-AfegirFkPart2.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10125','00-firstScript.sql','jenkins@10.0.2.68','2022-05-18 18:44:30',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL),('vn-database','10132','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:22:25',NULL,NULL),('vn-database','10133','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 14:32:30',NULL,NULL),('vn-database','10134','00-firstScript.sql','jenkins@10.0.2.69','2022-05-06 07:45:25',NULL,NULL),('vn-database','10135','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10136','00-workerTimeControl.sql','jenkins@10.0.2.69','2022-05-09 13:51:12',NULL,NULL),('vn-database','10138','00-firstScript.sql','jenkins@10.0.2.69','2022-05-10 13:58:05',NULL,NULL),('vn-database','10139','00-firstScript.sql','jenkins@10.0.2.68','2022-05-16 14:32:37',NULL,NULL),('vn-database','10139','01-secondScript.sql','jenkins@10.0.2.68','2022-05-17 12:16:13',NULL,NULL),('vn-database','10141','00-firstScript.sql','jenkins@10.0.2.70','2022-05-12 08:27:31',NULL,NULL),('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL),('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL),('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL),('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL),('vn-database','10152','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10153','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10154','00-compressionKk.sql','jenkins@10.0.2.68','2022-05-20 09:22:34',NULL,NULL),('vn-database','10157','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:35',NULL,NULL),('vn-database','10158','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10160','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:30:50',NULL,NULL),('vn-database','10163','00-firstScript.sql','jenkins@10.0.2.68','2022-05-23 08:17:14',NULL,NULL),('vn-database','10164','00-borrarSectorsDesus.sql','jenkins@10.0.2.68','2022-06-02 12:47:21',NULL,NULL),('vn-database','10165','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10166','00-firstScript.sql','jenkins@10.0.2.68','2022-05-24 16:11:21',NULL,NULL),('vn-database','10167','00-renameVnActiveContrat.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10168','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','00-createTableBankEntityConfig.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10169','02-addNotNullToBankEntityBic.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10171','00-volumeConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 14:11:11',NULL,NULL),('vn-database','10171','01-itemWeight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10171','02-agencymode.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-18 16:01:34',NULL,NULL),('vn-database','10172','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10174','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 08:46:17',NULL,NULL),('vn-database','10175','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10177','00-crearTablaSpecialLabels.sql','jenkins@10.0.2.68','2022-06-02 12:47:22',NULL,NULL),('vn-database','10178','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10179','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10183','00-firstScript.sql','jenkins@10.0.2.68','2022-06-02 12:47:24',NULL,NULL),('vn-database','10184','00-firstScript.sql','jenkins@10.0.2.68','2022-06-03 08:05:34',NULL,NULL),('vn-database','10185','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 09:07:45',NULL,NULL),('vn-database','10186','00-desactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:31:23',NULL,NULL),('vn-database','10186','01-alter_Table_buy.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','02-alter_table_entryConfig.sql','jenkins@10.0.2.68','2022-06-07 09:34:47',NULL,NULL),('vn-database','10186','04-regularizar_Sticker_Inventario.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10186','09-reactivar_trigger.sql','jenkins@10.0.2.68','2022-06-07 09:34:51',NULL,NULL),('vn-database','10187','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 12:37:31',NULL,NULL),('vn-database','10188','00-firstScript.sql','jenkins@10.0.2.68','2022-06-06 14:03:36',NULL,NULL),('vn-database','10189','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10191','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10193','00-delete.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:35',NULL,NULL),('vn-database','10193','01-botanicExport.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:43',NULL,NULL),('vn-database','10193','02-item.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-autonomy.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','03-turn.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10193','04-country.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-15 12:14:44',NULL,NULL),('vn-database','10194','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10195','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:03:41',NULL,NULL),('vn-database','10200','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10201','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10202','00-Remove_FK_to_ediGenus.sql','jenkins@10.0.2.69','2022-06-17 09:04:00',NULL,NULL),('vn-database','10203','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10204','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:01',NULL,NULL),('vn-database','10205','00-firstScript.sql','jenkins@10.0.2.69','2022-06-17 09:04:21',NULL,NULL),('vn-database','10207','00-Alter_table_entry.sql','jenkins@10.0.2.69','2022-06-16 07:22:50',NULL,NULL),('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL),('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL),('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada'),('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL),('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL),('vn-database','10216','01-batchIndex.sql','jenkins@10.0.2.70','2022-06-27 18:10:55',NULL,NULL),('vn-database','10219','00-AddCollectionFkOnPackingSite.sql','jenkins@10.0.2.70','2022-06-29 09:23:42',NULL,NULL),('vn-database','10219','01-AddFkToCollectionFk.sql','jenkins@10.0.2.70','2022-06-29 09:23:43',NULL,NULL),('vn-database','10220','00-createPersonalProtectionEquipment.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL),('vn-database','10222','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:12:40',NULL,NULL),('vn-database','10223','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:52',NULL,NULL),('vn-database','10224','00-cosetes.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-21 12:03:45',NULL,NULL),('vn-database','10229','00-firstScript.sql','jenkins@10.0.2.69','2022-07-01 11:59:34',NULL,NULL),('vn-database','10231','01-tablaEktConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:25:39',NULL,NULL),('vn-database','10233','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10235','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10236','00-firstScript.sql','jenkins@10.0.2.69','2022-07-05 12:11:40',NULL,NULL),('vn-database','10237','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:13:53',NULL,NULL),('vn-database','10238','00-worker_mobileExtension.sql','jenkins@10.0.2.69','2022-07-14 09:14:09',NULL,NULL),('vn-database','10239','00-firstScript.sql','jenkins@10.0.2.69','2022-07-07 21:51:58',NULL,NULL),('vn-database','10241','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-29 08:14:01',NULL,NULL),('vn-database','10242','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10243','00-firstScript.sql','jenkins@10.0.2.69','2022-07-14 09:14:32',NULL,NULL),('vn-database','10245','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10247','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:34:51',NULL,NULL),('vn-database','10248','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-20 17:27:51',NULL,NULL),('vn-database','10250','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:40',NULL,NULL),('vn-database','10253','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:36:57',NULL,NULL),('vn-database','10254','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10256','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10258','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10259','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-02 08:54:56',NULL,NULL),('vn-database','10261','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-22 08:42:20',NULL,NULL),('vn-database','10262','00-createTablepackagingWithFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','01-alterTablePackagingConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','02-insertsInicials.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:13',NULL,NULL),('vn-database','10262','03-createTablepackingWithoutFreight.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10263','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10265','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-07-28 08:38:48',NULL,NULL),('vn-database','10267','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10267','01-fixMerge.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10275','00-improvedGeneralLog.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 09:55:56',NULL,NULL),('vn-database','10277','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10278','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-01 17:51:41',NULL,NULL),('vn-database','10279','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:17',NULL,NULL),('vn-database','10281','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10282','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10283','00-alterTable.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:34:18',NULL,NULL),('vn-database','10284','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-04 16:59:08',NULL,NULL),('vn-database','10285','00-firstScript.sql','jenkins@swarm-worker3.static.verdnatura.es','2022-08-05 09:19:33',NULL,NULL),('vn-database','10287','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10288','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-11 09:35:24',NULL,NULL),('vn-database','10289','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:36',NULL,NULL),('vn-database','10291','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-10 14:19:34',NULL,NULL),('vn-database','10293','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:32',NULL,NULL),('vn-database','10297','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-16 12:43:36',NULL,NULL),('vn-database','10298','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-08-13 21:04:13',NULL,NULL),('vn-database','10299','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','00-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','01-drop.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:14',NULL,NULL),('vn-database','10301','02-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','00-CreateTableEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','01-insertDataEntryType.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:15',NULL,NULL),('vn-database','10302','02-alterTableEntry.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:22',NULL,NULL),('vn-database','10303','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:22:23',NULL,NULL),('vn-database','10304','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:48',NULL,NULL),('vn-database','10304','01-altertableticket.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:23:51',NULL,NULL),('vn-database','10305','00-ektAssign.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:24:52',NULL,NULL),('vn-database','10306','00-deliveryInformation.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:25',NULL,NULL),('vn-database','10307','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:25:26',NULL,NULL),('vn-database','10308','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-02 17:26:43',NULL,NULL),('vn-database','10309','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:54',NULL,NULL),('vn-database','10310','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10311','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-06 11:37:55',NULL,NULL),('vn-database','10312','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:26:33',NULL,NULL),('vn-database','10313','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:27:21',NULL,NULL),('vn-database','10314','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:19',NULL,NULL),('vn-database','10315','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10317','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10318','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 10:31:43',NULL,NULL),('vn-database','10319','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-20 12:37:41',NULL,NULL),('vn-database','10320','00-operator.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','01-collection.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:37',NULL,NULL),('vn-database','10320','02-productionConfig.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10321','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-08 11:11:12',NULL,NULL),('vn-database','10322','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-09 09:19:05',NULL,NULL),('vn-database','10326','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10328','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10329','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:29:38',NULL,NULL),('vn-database','10330','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10332','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','00-collectionHotbed.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:30',NULL,NULL),('vn-database','10334','01-saleGroupDetail.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10335','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10336','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10337','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10339','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-19 09:41:19',NULL,NULL),('vn-database','10340','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10341','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:34:32',NULL,NULL),('vn-database','10342','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10343','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-22 08:35:30',NULL,NULL),('vn-database','10345','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10347','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10347','01-addVirtualField.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-29 11:08:03',NULL,NULL),('vn-database','10349','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10350','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-09-30 10:11:56',NULL,NULL),('vn-database','10352','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:16',NULL,NULL),('vn-database','10353','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10354','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10356','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','01-orderConfigFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10356','02-orderConfigDrop.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-10 22:35:00',NULL,NULL),('vn-database','10357','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:38',NULL,NULL),('vn-database','10359','00-improvedGeneralLog_collate.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10360','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 09:52:39',NULL,NULL),('vn-database','10361','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-06 11:16:07',NULL,NULL),('vn-database','10362','00-dropUdfs.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-10 11:01:15',NULL,NULL),('vn-database','10363','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10365','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-13 19:30:46',NULL,NULL),('vn-database','10368','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10369','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-14 13:38:06',NULL,NULL),('vn-database','10370','00-deleteForeignKey.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:41',NULL,NULL),('vn-database','10370','01-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:47',NULL,NULL),('vn-database','10370','02-deleteTable.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','03-accion.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:49',NULL,NULL),('vn-database','10370','04-inter.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10371','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10372','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:48',NULL,NULL),('vn-database','10373','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-10-19 08:31:58',NULL,NULL),('vn-database','10378','00-rename_routeUserPercentage.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-11-04 08:25:17',NULL,NULL),('vn-database','10379','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:16',NULL,NULL),('vn-database','10382','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10383','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:53',NULL,NULL),('vn-database','10384','00-business_workcenterFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10385','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10386','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 14:32:54',NULL,NULL),('vn-database','10387','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-16 14:05:33',NULL,NULL),('vn-database','10388','00-resizeUtilVerionLogCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10388','01-resizeUtilVersionCode.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:47:20',NULL,NULL),('vn-database','10390','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:16',NULL,NULL),('vn-database','10391','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10394','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:24',NULL,NULL),('vn-database','10395','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10396','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-17 15:36:38',NULL,NULL),('vn-database','10397','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10399','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10400','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10402','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-21 14:11:31',NULL,NULL),('vn-database','10404','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-12-01 08:50:29',NULL,NULL),('vn-database','10405','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:22',NULL,NULL),('vn-database','10407','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10408','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:23',NULL,NULL),('vn-database','10409','00-firstScript.sql','jenkins@swarm-worker2.static.verdnatura.es','2022-12-16 09:14:49',NULL,NULL),('vn-database','10412','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2022-11-30 12:45:44',NULL,NULL),('vn-database','10413','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10416','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:24',NULL,NULL),('vn-database','10420','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:25',NULL,NULL),('vn-database','10421','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-12 10:56:26',NULL,NULL),('vn-database','10426','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:40',NULL,NULL),('vn-database','10428','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10431','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:22',NULL,NULL),('vn-database','10433','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10434','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-26 13:27:05',NULL,NULL),('vn-database','10435','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-13 07:30:10',NULL,NULL),('vn-database','10436','00-createFkWorker.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:58:59',NULL,NULL),('vn-database','10436','01-addStateToWorkerProductivity.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','02-DeprecateVnSaleTrackingState.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:00',NULL,NULL),('vn-database','10436','03-DeprecateColumnVnSaleTrackingActionFk.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','04-DropSchemaVnControl.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10436','05-RemoveFkWorkerProductivity.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-17 14:51:19',NULL,NULL),('vn-database','10439','00-fixRole.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:26',NULL,NULL),('vn-database','10440','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10444','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:01',NULL,NULL),('vn-database','10445','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10448','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10450','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-27 08:28:04',NULL,NULL),('vn-database','10451','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-06 08:08:32',NULL,NULL),('vn-database','10452','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10453','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 14:04:37',NULL,NULL),('vn-database','10454','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10455','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:30:04',NULL,NULL),('vn-database','10456','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:30',NULL,NULL),('vn-database','10457','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-01-31 12:00:33',NULL,NULL),('vn-database','10458','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10459','00-alterTableUtilConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','01-createFunctionCurdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','02-createFunctionMockTime.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','03-createFunctionMockTimeBase.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10459','04-createFunctionNow.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:41',NULL,NULL),('vn-database','10460','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10461','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10463','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-03 12:59:26',NULL,NULL),('vn-database','10468','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10469','00-firstScript.sql','jenkins@swarm-worker1.static.verdnatura.es','2023-02-16 09:59:31',NULL,NULL),('vn-database','10470','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10471','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10472','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10477','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:31',NULL,NULL),('vn-database','10478','00-dropBasket.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:28:54',NULL,NULL),('vn-database','10478','01-orderConfigured.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:16',NULL,NULL),('vn-database','10478','02-configuredUpdate.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10478','99-privileges.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-23 10:29:53',NULL,NULL),('vn-database','10480','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 15:09:26',NULL,NULL),('vn-database','10481','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-02-17 16:37:22',NULL,NULL),('vn-database','10482','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-02-21 10:00:28',NULL,NULL),('vn-database','10485','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10488','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:17',NULL,NULL),('vn-database','10491','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10492','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:18',NULL,NULL),('vn-database','10493','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10495','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-09 08:40:19',NULL,NULL),('vn-database','10498','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:38',NULL,NULL),('vn-database','10500','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 07:06:03',NULL,NULL),('vn-database','10501','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-03 10:52:24',NULL,NULL),('vn-database','10502','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10504','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10506','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10506','01-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','02-secondScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10506','03-thirdScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10507','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:35:23',NULL,NULL),('vn-database','10508','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:43',NULL,NULL),('vn-database','10510','00-dropBusinessFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','01-createTableProfessionalCategory.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','02-exportToNewTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:47',NULL,NULL),('vn-database','10510','03-RecreateFK.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10510','04-kkPostgresqlTable.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:51',NULL,NULL),('vn-database','10511','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10512','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:52',NULL,NULL),('vn-database','10513','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:56',NULL,NULL),('vn-database','10514','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10516','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-23 09:09:48',NULL,NULL),('vn-database','10521','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 06:58:13',NULL,NULL),('vn-database','10522','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10523','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10524','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:12',NULL,NULL),('vn-database','10524','01-rateEditorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:12',NULL,NULL),('vn-database','10525','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-21 12:42:50',NULL,NULL),('vn-database','10526','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:36:57',NULL,NULL),('vn-database','10528','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:00',NULL,NULL),('vn-database','10530','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-03-23 14:49:30',NULL,NULL),('vn-database','10531','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:47:10',NULL,NULL),('vn-database','10532','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-24 11:17:38',NULL,NULL),('vn-database','10533','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:04',NULL,NULL),('vn-database','10537','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-03-29 15:18:36',NULL,NULL),('vn-database','10538','00-createChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','01-createChronopostService.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','02-createChronopostExpedition.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','03-createChronopostSenderAddress.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','04-addgrantPrivilegies.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:07:41',NULL,NULL),('vn-database','10538','05-updateChronopostConfig.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 11:54:57',NULL,NULL),('vn-database','10539','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-05 10:37:07',NULL,NULL),('vn-database','10540','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:18:01',NULL,NULL),('vn-database','10545','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-11 08:31:03',NULL,NULL),('vn-database','10546','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10547','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:21:58',NULL,NULL),('vn-database','10549','00-updateUpdateLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:29:22',NULL,NULL),('vn-database','10549','01-updateInsertLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:11',NULL,NULL),('vn-database','10549','02-updateDeleteLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:30:51',NULL,NULL),('vn-database','10549','03-deleteEmptyLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:31:34',NULL,NULL),('vn-database','10549','04-optimizeLogTables.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-21 07:33:58',NULL,NULL),('vn-database','10550','00-editorFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:42:33',NULL,NULL),('vn-database','10550','01-originFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10552','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-13 08:25:10',NULL,NULL),('vn-database','10554','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-20 09:08:10',NULL,NULL),('vn-database','10557','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-17 07:45:56',NULL,NULL),('vn-database','10559','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-18 10:53:50',NULL,NULL),('vn-database','10560','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-17 09:19:31',NULL,NULL),('vn-database','10562','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10563','00-delivery_ticketFk.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 09:30:53',NULL,NULL),('vn-database','10566','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:08:41',NULL,NULL),('vn-database','10567','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-20 10:18:06',NULL,NULL),('vn-database','10568','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10569','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-24 09:14:35',NULL,NULL),('vn-database','10570','00-createSendingConfig.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','01-createSendingServiceWeekday.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','02-createSendingService.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10570','03-permisos.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10571','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:13:27',NULL,NULL),('vn-database','10573','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:23',NULL,NULL),('vn-database','10575','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-26 11:27:32',NULL,NULL),('vn-database','10577','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-27 14:00:12',NULL,NULL),('vn-database','10578','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10579','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-04-28 11:27:36',NULL,NULL),('vn-database','10580','00-itemTypeDropConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:18:52',NULL,NULL),('vn-database','10580','01-itemTypeAddConstraint.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 18:19:10',NULL,NULL),('vn-database','10581','00-itemTypeAutoIncrement.sql','jenkins@db-proxy2.static.verdnatura.es','2023-04-28 19:06:46',NULL,NULL),('vn-database','10582','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10583','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10584','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:28',NULL,NULL),('vn-database','10585','00-ticketLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:20:10',NULL,NULL),('vn-database','10585','01-entryLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-25 09:21:12',NULL,NULL),('vn-database','10585','02-claimLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:36',NULL,NULL),('vn-database','10585','03-clientLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:54',NULL,NULL),('vn-database','10585','04-invoiceInLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:28:55',NULL,NULL),('vn-database','10585','05-itemLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:29:46',NULL,NULL),('vn-database','10585','06-routeLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:18',NULL,NULL),('vn-database','10585','07-shelvingLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','08-supplierLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:32',NULL,NULL),('vn-database','10585','09-travelLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:41',NULL,NULL),('vn-database','10585','10-workerLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:42',NULL,NULL),('vn-database','10585','11-zoneLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:43',NULL,NULL),('vn-database','10585','12-userLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10585','13-roleLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10587','00-arcRead_addMinimum.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-16 13:13:15',NULL,NULL),('vn-database','10593','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10596','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10597','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10598','00-workerLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','01-supplierLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','02-workerTimeControlLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10598','03-workerClockLog.sql','jenkins@db-proxy2.static.verdnatura.es','2023-05-12 09:45:29',NULL,NULL),('vn-database','10599','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 09:30:44',NULL,NULL),('vn-database','10601','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-17 09:26:26',NULL,NULL),('vn-database','10602','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 08:52:15',NULL,NULL),('vn-database','10606','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 09:26:00',NULL,NULL),('vn-database','10608','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-18 12:36:31',NULL,NULL),('vn-database','10609','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 08:28:07',NULL,NULL),('vn-database','10610','00-updateCompanyId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:07',NULL,NULL),('vn-database','10610','01-updateSupplierId.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:39',NULL,NULL),('vn-database','10610','02-invoiceOutCompany.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-01 09:49:55',NULL,NULL),('vn-database','10611','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-19 14:39:41',NULL,NULL),('vn-database','10613','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10614','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10615','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:40',NULL,NULL),('vn-database','10616','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:18:55',NULL,NULL),('vn-database','10616','01-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:18:55',NULL,NULL),('vn-database','10617','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-01 09:11:41',NULL,NULL),('vn-database','10618','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-25 12:55:56',NULL,NULL),('vn-database','10619','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10620','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:20:53',NULL,NULL),('vn-database','10624','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-05-30 19:01:10',NULL,NULL),('vn-database','10625','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:26',NULL,NULL),('vn-database','10626','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 13:32:32',NULL,NULL),('vn-database','10628','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10630','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-02 13:30:58',NULL,NULL),('vn-database','10631','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-05 08:37:25',NULL,NULL),('vn-database','10632','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10633','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:18',NULL,NULL),('vn-database','10634','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-06 12:15:55',NULL,NULL),('vn-database','10637','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:19',NULL,NULL),('vn-database','10640','00-companyFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','00-updateCompany.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-07 14:22:13',1205,'Tiempo de espera de bloqueo excedido; intente rearrancar la transacción'),('vn-database','10640','01-companyFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL),('vn-database','10640','02-companyFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:47:04',NULL,NULL),('vn-database','10640','04-supplierFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:48:30',NULL,NULL),('vn-database','10640','05-supplierFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:53:17',NULL,NULL),('vn-database','10640','06-supplierFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 15:06:00',NULL,NULL),('vn-database','10642','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10643','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-09 15:04:35',NULL,NULL),('vn-database','10644','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:18',NULL,NULL),('vn-database','10645','00-addNewFields.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:11',NULL,NULL),('vn-database','10645','01-updateCollectionWagonPrimaryKey.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:11',NULL,NULL),('vn-database','10645','02-updateWagonPrimaryKey.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10645','03-addFieldToPackingSite.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10647','00-renombrarTabla.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10648','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10649','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-16 10:59:06',NULL,NULL),('vn-database','10652','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-29 14:04:13',NULL,NULL),('vn-database','10653','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:20',NULL,NULL),('vn-database','10655','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:24',NULL,NULL),('vn-database','10656','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10657','00-renameErrorProduction.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10657','01-changeNightTask.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10657','02-addCodeToClaimResponsible.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10657','03-grantSelectGrafana.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10658','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:27',NULL,NULL),('vn-database','10659','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10661','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:27:50',NULL,NULL),('vn-database','10662','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:33',NULL,NULL),('vn-database','10663','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:34',NULL,NULL),('vn-database','10665','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-30 08:52:51',NULL,NULL),('vn-database','10666','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-13 11:22:34',NULL,NULL),('vn-database','10667','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10668','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10671','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-25 14:56:50',NULL,NULL),('vn-database','10675','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10676','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10677','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:22',NULL,NULL),('vn-database','10678','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10679','00-tables.sql','jenkins@db-proxy2.static.verdnatura.es','2023-07-27 09:17:24',NULL,NULL),('vn-database','10680','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-18 14:58:36',NULL,NULL),('vn-database','10682','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10683','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10684','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:26',NULL,NULL),('vn-database','10685','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-05 09:53:55',NULL,NULL),('vn-database','10690','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-27 10:52:26',NULL,NULL),('vn-database','10691','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-07-31 13:37:21',NULL,NULL),('vn-database','10692','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10693','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 11:50:13',NULL,NULL),('vn-database','10694','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-02 09:50:53',NULL,NULL),('vn-database','10695','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-02 13:40:16',NULL,NULL),('vn-database','10696','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-03 16:54:57',NULL,NULL),('vn-database','10698','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-03 08:53:12',NULL,NULL),('vn-database','10699','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-03 15:24:30',NULL,NULL),('vn-database','10700','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-29 09:42:11',NULL,NULL),('vn-database','10701','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:12',NULL,NULL),('vn-database','10702','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-10 12:50:46',NULL,NULL),('vn-database','10704','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-29 09:42:14',NULL,NULL),('vn-database','10705','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-16 14:16:05',NULL,NULL),('vn-database','10707','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-08-21 12:31:18',NULL,NULL),('vn-database','10708','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:13',NULL,NULL),('vn-database','10712','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-07 10:43:13',NULL,NULL),('vn-database','10714','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-08-28 13:01:45',NULL,NULL),('vn-database','10716','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:27:50',NULL,NULL),('vn-database','10717','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:28:54',NULL,NULL),('vn-database','10718','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:26',NULL,NULL),('vn-database','10719','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-01 12:53:30',NULL,NULL),('vn-database','10720','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:22',NULL,NULL),('vn-database','10721','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10722','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-09 13:00:29',NULL,NULL),('vn-database','10725','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-12 14:15:14',NULL,NULL),('vn-database','10726','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 15:32:20',NULL,NULL),('vn-database','10727','00-addPrinterField.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','01-createTableScreenModel.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','02-createTableScreen.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','03-createTableScreenModel.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','04-createTableScanner.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','05-createTablePackingSiteDeviceLog.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','06-alterTablePrinterModel.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL),('vn-database','10727','07-AddFieldsToPackingSite.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:30',NULL,NULL),('vn-database','10730','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-15 11:42:48',NULL,NULL),('vn-database','10733','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-05 09:54:00',NULL,NULL),('vn-database','10736','00-workerBossNull.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-22 00:02:05',NULL,NULL),('vn-database','10739','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-10 10:19:07',NULL,NULL),('vn-database','10740','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:26',NULL,NULL),('vn-database','10741','01-refactorCplusTrascendency472.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:27',NULL,NULL),('vn-database','10741','02-refactorCplusTrascendency477.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:27',NULL,NULL),('vn-database','10741','03-refactorCplusInvoiceType477.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:27',NULL,NULL),('vn-database','10741','04-refactorCplusInvoiceType472.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:27',NULL,NULL),('vn-database','10741','05-fixes.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:27',NULL,NULL),('vn-database','10744','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-13 09:23:19',NULL,NULL),('vn-database','10746','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-10-16 18:22:46',NULL,NULL),('vn-database','10747','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:32',NULL,NULL),('vn-database','10748','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:32',NULL,NULL),('vn-database','10748','01-SecondScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:34',NULL,NULL),('vn-database','10749','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-10-22 16:08:17',NULL,NULL),('vn-database','10750','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-23 13:04:17',NULL,NULL),('vn-database','10750','00-ticket_addGrants.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:34',NULL,NULL),('vn-database','10751','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:34',NULL,NULL),('vn-database','10752','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-24 14:07:54',NULL,NULL),('vn-database','10753','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-10-24 14:37:21',NULL,NULL),('vn-database','10754','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:34',NULL,NULL),('vn-database','10755','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:35',NULL,NULL),('vn-database','10756','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-03 07:14:38',NULL,NULL),('vn-database','10757','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:57',NULL,NULL),('vn-database','10761','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:58',NULL,NULL);
/*!40000 ALTER TABLE `versionLog` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -54,7 +54,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:14
+-- Dump completed on 2023-11-20 12:26:42
USE `account`;
-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
--
@@ -78,7 +78,7 @@ USE `account`;
LOCK TABLES `role` WRITE;
/*!40000 ALTER TABLE `role` DISABLE KEYS */;
-INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2023-06-08 16:47:57',NULL),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2023-06-02 20:33:28',NULL),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35',NULL),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30',NULL),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10',NULL),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27',NULL),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15',NULL),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52',NULL),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12',NULL),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36',NULL),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27',NULL),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20',NULL),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34',NULL),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53',NULL),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42',NULL),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08',NULL),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53',NULL),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09',NULL),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41',NULL),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12',NULL),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26',NULL),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59',NULL),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16',NULL),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12',NULL),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23',NULL),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18',NULL),(48,'coolerBoss','Jefe de cámara',1,'2018-02-23 13:12:01','2023-03-13 08:49:43',NULL),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35',NULL),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12',NULL),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39',NULL),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57',NULL),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57',NULL),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17',NULL),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31',NULL),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02',NULL),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19',NULL),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45',NULL),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10',NULL),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01',NULL),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07',NULL),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05',NULL),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08',NULL),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26',NULL),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56',NULL),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23',NULL),(69,'coolerAssist','Asistente de cámara con permiso compras',1,'2020-02-05 12:36:09','2023-03-13 08:50:07',NULL),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25',NULL),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07',NULL),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46',NULL),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27',NULL),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41',NULL),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07',NULL),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17',NULL),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37',NULL),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22',NULL),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49',NULL),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09',NULL),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16',NULL),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10',NULL),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51',NULL),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56',NULL),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30',NULL),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55',NULL),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35',NULL),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-05-17 11:07:21',NULL),(115,'itManagement','TI management',1,'2023-03-29 07:27:55','2023-03-29 07:28:04',NULL),(119,'palletizerBoss','Jefe de paletizadores',1,'2023-06-07 11:51:54','2023-06-07 11:51:54',NULL),(120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 07:07:21','2023-06-19 07:07:21',21709),(121,'buyerSalesAssistant','Rol para compradores que también son responsables de ventas',1,'2023-06-23 14:48:19','2023-06-23 14:48:19',NULL),(122,'logisticAssistant','Jefe auxiliar de logística',1,'2023-06-26 07:21:15','2023-06-26 07:21:15',NULL);
+INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2023-06-08 16:47:57',NULL),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2023-06-02 20:33:28',NULL),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35',NULL),(13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 07:04:58','2021-06-30 13:29:30',NULL),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10',NULL),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58',NULL),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27',NULL),(20,'manager','Gerencia',1,'2017-06-01 14:57:02','2022-07-29 07:36:15',NULL),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52',NULL),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12',NULL),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36',NULL),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27',NULL),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20',NULL),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34',NULL),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53',NULL),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42',NULL),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08',NULL),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53',NULL),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09',NULL),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41',NULL),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12',NULL),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26',NULL),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59',NULL),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16',NULL),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12',NULL),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23',NULL),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18',NULL),(48,'coolerBoss','Jefe de cámara',1,'2018-02-23 13:12:01','2023-03-13 08:49:43',NULL),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2021-02-12 09:42:35',NULL),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12',NULL),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39',NULL),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57',NULL),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57',NULL),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17',NULL),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31',NULL),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02',NULL),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19',NULL),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45',NULL),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10',NULL),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01',NULL),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07',NULL),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05',NULL),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08',NULL),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26',NULL),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56',NULL),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23',NULL),(69,'coolerAssist','Asistente de cámara con permiso compras',1,'2020-02-05 12:36:09','2023-03-13 08:50:07',NULL),(70,'trainee','Alumno de prácticas',1,'2020-03-04 11:00:25','2020-03-04 11:00:25',NULL),(71,'checker','Rol de revisor con privilegios de itemPicker',1,'2020-10-02 10:50:07','2020-10-02 10:50:07',NULL),(72,'claimManager','Personal de reclamaciones',1,'2020-10-13 10:01:32','2020-10-26 07:29:46',NULL),(73,'financial','Departamento de finanzas',1,'2020-11-16 09:30:27','2020-11-16 09:30:27',NULL),(74,'userPhotos','Privilegios para subir fotos de usuario',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(75,'catalogPhotos','Privilegios para subir fotos del catálogo',1,'2021-02-03 10:24:27','2021-02-03 10:24:27',NULL),(76,'chat','Rol para utilizar el rocket chat',1,'2020-11-27 13:06:50','2020-12-17 07:49:41',NULL),(100,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2020-11-12 06:50:07',NULL),(101,'buyerBoss','Jefe del departamento de compras',1,'2021-06-16 09:53:17','2021-06-16 09:53:17',NULL),(102,'preservedBoss','Responsable preservado',1,'2021-09-14 13:45:37','2021-09-14 13:45:37',NULL),(103,'it','Departamento de informática',1,'2021-11-11 09:48:22','2021-11-11 09:48:22',NULL),(104,'itBoss','Jefe de departamento de informática',1,'2021-11-11 09:48:49','2021-11-11 09:48:49',NULL),(105,'grant','Adjudicar roles a usuarios',1,'2021-11-11 12:41:09','2021-11-11 12:41:09',NULL),(106,'ext','Usuarios externos de la Base de datos',1,'2021-11-23 14:51:16','2021-11-23 14:51:16',NULL),(107,'productionPlus','Creado para pepe por orden de Juanvi',1,'2022-02-08 06:47:10','2022-02-08 06:47:10',NULL),(108,'system','System user',1,'2022-05-16 08:09:51','2022-05-16 08:09:51',NULL),(109,'salesTeamBoss','Jefe de equipo de comerciales',1,'2022-06-14 13:45:56','2022-06-14 13:45:56',NULL),(110,'palletizer','Paletizadores',1,'2022-12-02 12:56:22','2022-12-02 12:56:30',NULL),(111,'entryEditor','Entry editor',1,'2023-01-13 11:21:55','2023-01-13 11:21:55',NULL),(112,'maintenance','Personal de mantenimiento',1,'2023-01-19 06:23:35','2023-01-19 06:23:35',NULL),(114,'maintenanceBos','Jefe de mantenimiento',1,'2023-01-19 06:31:16','2023-05-17 11:07:21',NULL),(115,'itManagement','TI management',1,'2023-03-29 07:27:55','2023-03-29 07:28:04',NULL),(119,'palletizerBoss','Jefe de paletizadores',1,'2023-06-07 11:51:54','2023-06-07 11:51:54',NULL),(120,'developerBoss','Jefe de proyecto de desarrollo',1,'2023-06-19 07:07:21','2023-06-19 07:07:21',21709),(121,'buyerSalesAssistant','Rol para compradores que también son responsables de ventas',1,'2023-06-23 14:48:19','2023-06-23 14:48:19',NULL),(122,'logisticAssistant','Jefe auxiliar de logística',1,'2023-06-26 07:21:15','2023-06-26 07:21:15',NULL),(123,'deliveryAssistant','Jefe auxiliar repartos',1,'2023-10-05 06:47:48','2023-10-05 06:47:48',10578),(124,'hrBuyer','Recursos Humanos con Buyer',1,'2023-10-23 11:50:43','2023-10-23 11:50:43',NULL),(125,'claimViewer','Trabajadores que consulta las reclamaciones ',1,'2023-11-16 08:14:46','2023-11-16 08:14:46',10578),(126,'greenhouseBoss','Jefe de invernadero',1,'2023-11-16 13:32:13','2023-11-16 13:32:13',NULL);
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
UNLOCK TABLES;
@@ -88,7 +88,7 @@ UNLOCK TABLES;
LOCK TABLES `roleInherit` WRITE;
/*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */;
-INSERT INTO `roleInherit` VALUES (1,1,2,NULL),(2,1,3,NULL),(3,1,70,NULL),(4,2,11,NULL),(5,3,11,NULL),(6,5,1,NULL),(8,5,33,NULL),(10,11,6,NULL),(11,13,1,NULL),(12,15,35,NULL),(16,17,20,NULL),(17,17,37,NULL),(18,17,39,NULL),(19,17,64,NULL),(20,18,1,NULL),(21,19,21,NULL),(22,20,13,NULL),(23,20,16,NULL),(24,20,65,NULL),(25,21,13,NULL),(26,21,18,NULL),(27,21,53,NULL),(28,22,13,NULL),(29,22,21,NULL),(30,30,5,NULL),(31,30,20,NULL),(32,30,22,NULL),(33,30,53,NULL),(34,30,64,NULL),(35,31,1,NULL),(36,32,1,NULL),(37,34,1,NULL),(38,34,13,NULL),(39,34,33,NULL),(40,35,1,NULL),(41,36,44,NULL),(42,36,47,NULL),(43,37,1,NULL),(44,38,37,NULL),(45,38,64,NULL),(46,39,5,NULL),(47,39,21,NULL),(48,39,57,NULL),(49,40,1,NULL),(50,40,49,NULL),(51,41,13,NULL),(52,41,35,NULL),(53,41,40,NULL),(54,42,35,NULL),(55,42,49,NULL),(56,43,13,NULL),(57,43,42,NULL),(58,44,1,NULL),(59,45,13,NULL),(60,45,44,NULL),(61,47,1,NULL),(62,48,13,NULL),(63,48,47,NULL),(64,49,36,NULL),(65,49,58,NULL),(66,50,13,NULL),(67,50,21,NULL),(68,50,35,NULL),(69,50,49,NULL),(70,50,57,NULL),(72,51,1,NULL),(73,52,13,NULL),(74,52,19,NULL),(76,52,51,NULL),(77,53,1,NULL),(78,54,1,NULL),(79,55,13,NULL),(80,55,54,NULL),(81,56,1,NULL),(82,57,13,NULL),(83,57,56,NULL),(84,58,1,NULL),(85,59,13,NULL),(87,60,5,NULL),(91,61,13,NULL),(92,61,36,NULL),(94,65,35,NULL),(97,67,5,NULL),(98,67,37,NULL),(99,69,35,NULL),(101,70,11,NULL),(102,71,1,NULL),(103,71,58,NULL),(105,72,18,NULL),(106,73,5,NULL),(107,73,64,NULL),(108,73,19,NULL),(109,59,50,NULL),(115,39,76,NULL),(117,65,76,NULL),(118,30,76,NULL),(124,5,76,NULL),(125,37,76,NULL),(126,38,76,NULL),(128,42,76,NULL),(129,35,76,NULL),(130,60,76,NULL),(131,21,76,NULL),(132,18,76,NULL),(133,50,76,NULL),(134,20,76,NULL),(135,41,76,NULL),(136,17,76,NULL),(137,52,76,NULL),(138,57,76,NULL),(139,37,74,NULL),(140,51,74,NULL),(141,51,75,NULL),(142,35,75,NULL),(143,15,49,NULL),(145,17,67,NULL),(146,38,13,NULL),(147,101,35,NULL),(148,101,13,NULL),(150,15,56,NULL),(152,69,47,NULL),(153,48,35,NULL),(154,102,1,NULL),(167,9,103,NULL),(168,66,9,NULL),(169,104,100,NULL),(172,103,76,NULL),(173,103,1,NULL),(174,103,44,NULL),(175,103,45,NULL),(176,103,11,NULL),(177,103,39,NULL),(178,103,17,NULL),(179,103,5,NULL),(180,103,67,NULL),(181,103,3,NULL),(182,103,34,NULL),(183,103,42,NULL),(184,103,43,NULL),(185,103,64,NULL),(186,103,35,NULL),(187,103,101,NULL),(188,103,75,NULL),(189,103,71,NULL),(190,103,72,NULL),(191,103,47,NULL),(192,103,69,NULL),(193,103,48,NULL),(194,103,2,NULL),(195,103,56,NULL),(196,103,57,NULL),(197,103,32,NULL),(198,103,73,NULL),(199,103,30,NULL),(200,103,31,NULL),(201,103,6,NULL),(202,103,40,NULL),(203,103,41,NULL),(204,103,37,NULL),(205,103,38,NULL),(206,103,53,NULL),(207,103,33,NULL),(210,103,54,NULL),(211,103,55,NULL),(212,103,15,NULL),(213,103,16,NULL),(215,103,51,NULL),(216,103,52,NULL),(218,103,65,NULL),(219,103,58,NULL),(220,103,59,NULL),(221,103,102,NULL),(222,103,49,NULL),(223,103,60,NULL),(224,103,50,NULL),(225,103,36,NULL),(226,103,61,NULL),(228,103,21,NULL),(229,103,19,NULL),(230,103,18,NULL),(231,103,13,NULL),(232,103,22,NULL),(233,103,70,NULL),(234,103,74,NULL),(237,66,103,NULL),(238,103,20,NULL),(239,106,11,NULL),(240,107,60,NULL),(241,21,72,NULL),(242,20,9,NULL),(245,57,33,NULL),(246,102,35,NULL),(247,108,1,NULL),(248,102,13,NULL),(249,109,18,NULL),(250,109,13,NULL),(251,51,21,NULL),(253,48,49,NULL),(254,110,1,NULL),(255,110,76,NULL),(256,48,69,NULL),(257,47,111,NULL),(258,43,111,NULL),(259,72,111,NULL),(260,35,111,NULL),(261,5,111,NULL),(262,112,1,NULL),(263,114,112,NULL),(264,51,35,NULL),(265,72,49,NULL),(266,101,18,NULL),(268,65,57,NULL),(269,65,59,NULL),(270,65,49,NULL),(271,65,18,NULL),(272,65,13,NULL),(273,60,35,NULL),(275,50,59,NULL),(276,60,49,NULL),(280,5,53,NULL),(281,5,18,NULL),(282,50,60,NULL),(283,5,21,NULL),(284,60,57,NULL),(285,58,76,NULL),(287,69,58,NULL),(288,115,66,NULL),(290,104,115,NULL),(291,115,103,NULL),(297,21,33,NULL),(298,49,54,NULL),(299,112,49,NULL),(300,114,13,NULL),(302,5,35,NULL),(303,69,49,NULL),(306,119,110,NULL),(307,1,76,NULL),(309,120,9,NULL),(310,120,66,NULL),(311,120,13,25508),(312,115,120,NULL),(314,43,18,NULL),(315,121,35,NULL),(316,121,21,NULL),(317,122,15,NULL),(318,16,122,NULL),(319,37,49,NULL),(320,37,18,NULL);
+INSERT INTO `roleInherit` VALUES (1,1,2,NULL),(2,1,3,NULL),(3,1,70,NULL),(4,2,11,NULL),(5,3,11,NULL),(6,5,1,NULL),(8,5,33,NULL),(10,11,6,NULL),(11,13,1,NULL),(12,15,35,NULL),(16,17,20,NULL),(17,17,37,NULL),(18,17,39,NULL),(19,17,64,NULL),(20,18,1,NULL),(21,19,21,NULL),(22,20,13,NULL),(23,20,16,NULL),(24,20,65,NULL),(25,21,13,NULL),(26,21,18,NULL),(27,21,53,NULL),(28,22,13,NULL),(29,22,21,NULL),(30,30,5,NULL),(31,30,20,NULL),(32,30,22,NULL),(33,30,53,NULL),(34,30,64,NULL),(35,31,1,NULL),(36,32,1,NULL),(37,34,1,NULL),(38,34,13,NULL),(39,34,33,NULL),(40,35,1,NULL),(41,36,44,NULL),(42,36,47,NULL),(43,37,1,NULL),(44,38,37,NULL),(45,38,64,NULL),(46,39,5,NULL),(47,39,21,NULL),(48,39,57,NULL),(49,40,1,NULL),(50,40,49,NULL),(51,41,13,NULL),(52,41,35,NULL),(53,41,40,NULL),(54,42,35,NULL),(55,42,49,NULL),(56,43,13,NULL),(57,43,42,NULL),(58,44,1,NULL),(59,45,13,NULL),(60,45,44,NULL),(61,47,1,NULL),(62,48,13,NULL),(63,48,47,NULL),(64,49,36,NULL),(65,49,58,NULL),(66,50,13,NULL),(67,50,21,NULL),(70,50,57,NULL),(72,51,1,NULL),(73,52,13,NULL),(74,52,19,NULL),(76,52,51,NULL),(77,53,1,NULL),(78,54,1,NULL),(79,55,13,NULL),(80,55,54,NULL),(81,56,1,NULL),(84,58,1,NULL),(85,59,13,NULL),(87,60,5,NULL),(91,61,13,NULL),(92,61,36,NULL),(94,65,35,NULL),(97,67,5,NULL),(98,67,37,NULL),(99,69,35,NULL),(101,70,11,NULL),(102,71,1,NULL),(103,71,58,NULL),(105,72,18,NULL),(106,73,5,NULL),(107,73,64,NULL),(108,73,19,NULL),(109,59,50,NULL),(115,39,76,NULL),(117,65,76,NULL),(118,30,76,NULL),(124,5,76,NULL),(125,37,76,NULL),(126,38,76,NULL),(128,42,76,NULL),(129,35,76,NULL),(130,60,76,NULL),(131,21,76,NULL),(132,18,76,NULL),(133,50,76,NULL),(134,20,76,NULL),(135,41,76,NULL),(136,17,76,NULL),(137,52,76,NULL),(139,37,74,NULL),(140,51,74,NULL),(141,51,75,NULL),(142,35,75,NULL),(143,15,49,NULL),(145,17,67,NULL),(146,38,13,NULL),(147,101,35,NULL),(148,101,13,NULL),(150,15,56,NULL),(152,69,47,NULL),(153,48,35,NULL),(154,102,1,NULL),(167,9,103,NULL),(168,66,9,NULL),(169,104,100,NULL),(172,103,76,NULL),(173,103,1,NULL),(174,103,44,NULL),(175,103,45,NULL),(176,103,11,NULL),(177,103,39,NULL),(178,103,17,NULL),(179,103,5,NULL),(180,103,67,NULL),(181,103,3,NULL),(182,103,34,NULL),(183,103,42,NULL),(184,103,43,NULL),(185,103,64,NULL),(186,103,35,NULL),(187,103,101,NULL),(188,103,75,NULL),(189,103,71,NULL),(190,103,72,NULL),(191,103,47,NULL),(192,103,69,NULL),(193,103,48,NULL),(194,103,2,NULL),(195,103,56,NULL),(196,103,57,NULL),(197,103,32,NULL),(198,103,73,NULL),(199,103,30,NULL),(200,103,31,NULL),(201,103,6,NULL),(202,103,40,NULL),(203,103,41,NULL),(204,103,37,NULL),(205,103,38,NULL),(206,103,53,NULL),(207,103,33,NULL),(210,103,54,NULL),(211,103,55,NULL),(212,103,15,NULL),(213,103,16,NULL),(215,103,51,NULL),(216,103,52,NULL),(218,103,65,NULL),(219,103,58,NULL),(220,103,59,NULL),(221,103,102,NULL),(222,103,49,NULL),(223,103,60,NULL),(224,103,50,NULL),(225,103,36,NULL),(226,103,61,NULL),(228,103,21,NULL),(229,103,19,NULL),(230,103,18,NULL),(231,103,13,NULL),(232,103,22,NULL),(233,103,70,NULL),(234,103,74,NULL),(237,66,103,NULL),(238,103,20,NULL),(239,106,11,NULL),(240,107,60,NULL),(241,21,72,NULL),(242,20,9,NULL),(246,102,35,NULL),(247,108,1,NULL),(248,102,13,NULL),(249,109,18,NULL),(250,109,13,NULL),(251,51,21,NULL),(253,48,49,NULL),(254,110,1,NULL),(255,110,76,NULL),(256,48,69,NULL),(257,47,111,NULL),(258,43,111,NULL),(259,72,111,NULL),(260,35,111,NULL),(261,5,111,NULL),(262,112,1,NULL),(263,114,112,NULL),(264,51,35,NULL),(265,72,49,NULL),(266,101,18,NULL),(268,65,57,NULL),(269,65,59,NULL),(270,65,49,NULL),(271,65,18,NULL),(272,65,13,NULL),(273,60,35,NULL),(275,50,59,NULL),(276,60,49,NULL),(280,5,53,NULL),(281,5,18,NULL),(282,50,60,NULL),(283,5,21,NULL),(285,58,76,NULL),(287,69,58,NULL),(288,115,66,NULL),(290,104,115,NULL),(291,115,103,NULL),(297,21,33,NULL),(298,49,54,NULL),(299,112,49,NULL),(300,114,13,NULL),(302,5,35,NULL),(303,69,49,NULL),(306,119,110,NULL),(307,1,76,NULL),(309,120,9,NULL),(310,120,66,NULL),(311,120,13,25508),(312,115,120,NULL),(314,43,18,NULL),(315,121,35,NULL),(316,121,21,NULL),(317,122,15,NULL),(318,16,122,NULL),(319,37,49,NULL),(320,37,18,NULL),(328,57,123,10578),(329,123,33,NULL),(330,123,56,NULL),(332,103,112,NULL),(333,57,13,NULL),(334,60,123,NULL),(335,124,37,NULL),(336,124,35,NULL),(337,103,124,NULL),(338,35,125,10578),(339,57,125,10578),(340,41,125,10578),(341,18,125,10578),(346,126,15,NULL),(347,102,49,NULL);
/*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */;
UNLOCK TABLES;
@@ -98,7 +98,7 @@ UNLOCK TABLES;
LOCK TABLES `roleRole` WRITE;
/*!40000 ALTER TABLE `roleRole` DISABLE KEYS */;
-INSERT INTO `roleRole` VALUES (285864,1,1),(285865,1,2),(285866,1,3),(285870,1,6),(285869,1,11),(285867,1,70),(285868,1,76),(285871,2,2),(285873,2,6),(285872,2,11),(285874,3,3),(285876,3,6),(285875,3,11),(285878,5,1),(285891,5,2),(285890,5,3),(285877,5,5),(285897,5,6),(285893,5,11),(285888,5,13),(285879,5,18),(285880,5,21),(285881,5,33),(285882,5,35),(285896,5,36),(285899,5,44),(285898,5,47),(285892,5,49),(285883,5,53),(285895,5,54),(285894,5,58),(285889,5,70),(285887,5,72),(285886,5,75),(285884,5,76),(285885,5,111),(285900,6,6),(285903,9,1),(285904,9,2),(285905,9,3),(285906,9,5),(285907,9,6),(285901,9,9),(285908,9,11),(285909,9,13),(285910,9,15),(285911,9,16),(285912,9,17),(285913,9,18),(285914,9,19),(285915,9,20),(285916,9,21),(285917,9,22),(285918,9,30),(285919,9,31),(285920,9,32),(285921,9,33),(285922,9,34),(285923,9,35),(285924,9,36),(285925,9,37),(285926,9,38),(285927,9,39),(285928,9,40),(285929,9,41),(285930,9,42),(285931,9,43),(285932,9,44),(285933,9,45),(285934,9,47),(285935,9,48),(285936,9,49),(285937,9,50),(285938,9,51),(285939,9,52),(285940,9,53),(285941,9,54),(285942,9,55),(285943,9,56),(285944,9,57),(285945,9,58),(285946,9,59),(285947,9,60),(285948,9,61),(285949,9,64),(285950,9,65),(285951,9,67),(285952,9,69),(285953,9,70),(285954,9,71),(285955,9,72),(285956,9,73),(285957,9,74),(285958,9,75),(285959,9,76),(285960,9,101),(285961,9,102),(285902,9,103),(285963,9,111),(285962,9,122),(285965,11,6),(285964,11,11),(285967,13,1),(285968,13,2),(285969,13,3),(285973,13,6),(285972,13,11),(285966,13,13),(285970,13,70),(285971,13,76),(285980,15,1),(285989,15,2),(285988,15,3),(285991,15,6),(285990,15,11),(285974,15,15),(285975,15,35),(285982,15,36),(285986,15,44),(285985,15,47),(285976,15,49),(285983,15,54),(285977,15,56),(285984,15,58),(285987,15,70),(285979,15,75),(285978,15,76),(285981,15,111),(286000,16,1),(286009,16,2),(286008,16,3),(286011,16,6),(286010,16,11),(285994,16,15),(285992,16,16),(285995,16,35),(286002,16,36),(286006,16,44),(286005,16,47),(285996,16,49),(286003,16,54),(285997,16,56),(286004,16,58),(286007,16,70),(285999,16,75),(285998,16,76),(286001,16,111),(285993,16,122),(286020,17,1),(286036,17,2),(286035,17,3),(286027,17,5),(286059,17,6),(286024,17,9),(286058,17,11),(286023,17,13),(286057,17,15),(286022,17,16),(286012,17,17),(286019,17,18),(286056,17,19),(286013,17,20),(286028,17,21),(286055,17,22),(286054,17,30),(286053,17,31),(286052,17,32),(286030,17,33),(286051,17,34),(286038,17,35),(286033,17,36),(286014,17,37),(286050,17,38),(286015,17,39),(286049,17,40),(286048,17,41),(286047,17,42),(286046,17,43),(286045,17,44),(286060,17,45),(286061,17,47),(286062,17,48),(286025,17,49),(286063,17,50),(286064,17,51),(286065,17,52),(286041,17,53),(286032,17,54),(286066,17,55),(286044,17,56),(286029,17,57),(286031,17,58),(286037,17,59),(286067,17,60),(286068,17,61),(286016,17,64),(286021,17,65),(286017,17,67),(286069,17,69),(286034,17,70),(286070,17,71),(286043,17,72),(286071,17,73),(286026,17,74),(286072,17,75),(286018,17,76),(286073,17,101),(286074,17,102),(286040,17,103),(286042,17,111),(286039,17,122),(286076,18,1),(286079,18,2),(286078,18,3),(286082,18,6),(286081,18,11),(286075,18,18),(286080,18,70),(286077,18,76),(286093,19,1),(286099,19,2),(286098,19,3),(286103,19,6),(286102,19,11),(286085,19,13),(286086,19,18),(286083,19,19),(286084,19,21),(286087,19,33),(286096,19,36),(286101,19,44),(286100,19,47),(286092,19,49),(286088,19,53),(286095,19,54),(286094,19,58),(286097,19,70),(286089,19,72),(286090,19,76),(286091,19,111),(286113,20,1),(286125,20,2),(286124,20,3),(286123,20,5),(286122,20,6),(286105,20,9),(286121,20,11),(286106,20,13),(286120,20,15),(286107,20,16),(286119,20,17),(286111,20,18),(286118,20,19),(286104,20,20),(286126,20,21),(286127,20,22),(286128,20,30),(286129,20,31),(286130,20,32),(286131,20,33),(286132,20,34),(286110,20,35),(286133,20,36),(286134,20,37),(286135,20,38),(286136,20,39),(286137,20,40),(286138,20,41),(286139,20,42),(286140,20,43),(286141,20,44),(286142,20,45),(286143,20,47),(286144,20,48),(286115,20,49),(286145,20,50),(286146,20,51),(286147,20,52),(286148,20,53),(286149,20,54),(286150,20,55),(286151,20,56),(286116,20,57),(286152,20,58),(286117,20,59),(286153,20,60),(286154,20,61),(286155,20,64),(286108,20,65),(286156,20,67),(286157,20,69),(286158,20,70),(286159,20,71),(286160,20,72),(286161,20,73),(286162,20,74),(286163,20,75),(286109,20,76),(286164,20,101),(286165,20,102),(286114,20,103),(286166,20,111),(286112,20,122),(286176,21,1),(286182,21,2),(286181,21,3),(286186,21,6),(286185,21,11),(286168,21,13),(286169,21,18),(286167,21,21),(286170,21,33),(286179,21,36),(286184,21,44),(286183,21,47),(286175,21,49),(286171,21,53),(286178,21,54),(286177,21,58),(286180,21,70),(286172,21,72),(286173,21,76),(286174,21,111),(286191,22,1),(286200,22,2),(286199,22,3),(286207,22,6),(286204,22,11),(286188,22,13),(286190,22,18),(286189,22,21),(286187,22,22),(286192,22,33),(286203,22,36),(286206,22,44),(286205,22,47),(286197,22,49),(286193,22,53),(286202,22,54),(286201,22,58),(286198,22,70),(286194,22,72),(286195,22,76),(286196,22,111),(286220,30,1),(286234,30,2),(286233,30,3),(286209,30,5),(286243,30,6),(286221,30,9),(286244,30,11),(286222,30,13),(286242,30,15),(286223,30,16),(286241,30,17),(286219,30,18),(286240,30,19),(286210,30,20),(286218,30,21),(286211,30,22),(286208,30,30),(286239,30,31),(286238,30,32),(286217,30,33),(286237,30,34),(286216,30,35),(286236,30,36),(286235,30,37),(286245,30,38),(286246,30,39),(286247,30,40),(286248,30,41),(286249,30,42),(286250,30,43),(286251,30,44),(286252,30,45),(286253,30,47),(286254,30,48),(286227,30,49),(286255,30,50),(286256,30,51),(286257,30,52),(286212,30,53),(286258,30,54),(286259,30,55),(286260,30,56),(286226,30,57),(286261,30,58),(286225,30,59),(286262,30,60),(286263,30,61),(286213,30,64),(286224,30,65),(286264,30,67),(286265,30,69),(286232,30,70),(286266,30,71),(286231,30,72),(286267,30,73),(286268,30,74),(286230,30,75),(286214,30,76),(286269,30,101),(286270,30,102),(286229,30,103),(286215,30,111),(286228,30,122),(286272,31,1),(286273,31,2),(286274,31,3),(286278,31,6),(286277,31,11),(286271,31,31),(286275,31,70),(286276,31,76),(286280,32,1),(286281,32,2),(286282,32,3),(286286,32,6),(286285,32,11),(286279,32,32),(286283,32,70),(286284,32,76),(286287,33,33),(286289,34,1),(286294,34,2),(286293,34,3),(286297,34,6),(286296,34,11),(286290,34,13),(286291,34,33),(286288,34,34),(286292,34,70),(286295,34,76),(286299,35,1),(286305,35,2),(286304,35,3),(286307,35,6),(286306,35,11),(286298,35,35),(286303,35,70),(286300,35,75),(286301,35,76),(286302,35,111),(286312,36,1),(286314,36,2),(286313,36,3),(286318,36,6),(286317,36,11),(286308,36,36),(286309,36,44),(286310,36,47),(286315,36,70),(286316,36,76),(286311,36,111),(286320,37,1),(286329,37,2),(286328,37,3),(286335,37,6),(286333,37,11),(286321,37,18),(286326,37,36),(286319,37,37),(286332,37,44),(286331,37,47),(286322,37,49),(286325,37,54),(286330,37,58),(286327,37,70),(286323,37,74),(286324,37,76),(286334,37,111),(286344,38,1),(286348,38,2),(286347,38,3),(286355,38,6),(286353,38,11),(286337,38,13),(286343,38,18),(286345,38,36),(286338,38,37),(286336,38,38),(286352,38,44),(286351,38,47),(286342,38,49),(286349,38,54),(286350,38,58),(286339,38,64),(286346,38,70),(286341,38,74),(286340,38,76),(286354,38,111),(286364,39,1),(286374,39,2),(286373,39,3),(286357,39,5),(286381,39,6),(286378,39,11),(286367,39,13),(286363,39,18),(286358,39,21),(286362,39,33),(286361,39,35),(286377,39,36),(286356,39,39),(286380,39,44),(286379,39,47),(286370,39,49),(286365,39,53),(286376,39,54),(286369,39,56),(286359,39,57),(286375,39,58),(286372,39,70),(286368,39,72),(286371,39,75),(286360,39,76),(286366,39,111),(286383,40,1),(286386,40,2),(286385,40,3),(286396,40,6),(286394,40,11),(286389,40,36),(286382,40,40),(286393,40,44),(286392,40,47),(286384,40,49),(286390,40,54),(286391,40,58),(286387,40,70),(286388,40,76),(286395,40,111),(286405,41,1),(286409,41,2),(286408,41,3),(286415,41,6),(286414,41,11),(286398,41,13),(286399,41,35),(286406,41,36),(286400,41,40),(286397,41,41),(286413,41,44),(286412,41,47),(286402,41,49),(286410,41,54),(286411,41,58),(286407,41,70),(286404,41,75),(286401,41,76),(286403,41,111),(286422,42,1),(286430,42,2),(286429,42,3),(286432,42,6),(286431,42,11),(286417,42,35),(286423,42,36),(286416,42,42),(286427,42,44),(286426,42,47),(286418,42,49),(286424,42,54),(286425,42,58),(286428,42,70),(286421,42,75),(286419,42,76),(286420,42,111),(286441,43,1),(286445,43,2),(286444,43,3),(286452,43,6),(286451,43,11),(286434,43,13),(286435,43,18),(286439,43,35),(286446,43,36),(286436,43,42),(286433,43,43),(286450,43,44),(286449,43,47),(286438,43,49),(286447,43,54),(286448,43,58),(286443,43,70),(286442,43,75),(286440,43,76),(286437,43,111),(286454,44,1),(286455,44,2),(286456,44,3),(286460,44,6),(286459,44,11),(286453,44,44),(286457,44,70),(286458,44,76),(286464,45,1),(286466,45,2),(286465,45,3),(286470,45,6),(286469,45,11),(286462,45,13),(286463,45,44),(286461,45,45),(286467,45,70),(286468,45,76),(286472,47,1),(286475,47,2),(286474,47,3),(286479,47,6),(286478,47,11),(286471,47,47),(286476,47,70),(286477,47,76),(286473,47,111),(286490,48,1),(286496,48,2),(286495,48,3),(286498,48,6),(286497,48,11),(286481,48,13),(286482,48,35),(286486,48,36),(286493,48,44),(286483,48,47),(286480,48,48),(286484,48,49),(286491,48,54),(286492,48,58),(286485,48,69),(286494,48,70),(286489,48,75),(286488,48,76),(286487,48,111),(286503,49,1),(286509,49,2),(286508,49,3),(286512,49,6),(286511,49,11),(286500,49,36),(286505,49,44),(286504,49,47),(286499,49,49),(286501,49,54),(286502,49,58),(286507,49,70),(286506,49,76),(286510,49,111),(286529,50,1),(286538,50,2),(286537,50,3),(286533,50,5),(286540,50,6),(286539,50,11),(286514,50,13),(286528,50,18),(286515,50,21),(286527,50,33),(286516,50,35),(286522,50,36),(286535,50,44),(286534,50,47),(286517,50,49),(286513,50,50),(286526,50,53),(286530,50,54),(286532,50,56),(286518,50,57),(286531,50,58),(286519,50,59),(286520,50,60),(286536,50,70),(286525,50,72),(286524,50,75),(286521,50,76),(286523,50,111),(286542,51,1),(286551,51,2),(286550,51,3),(286562,51,6),(286558,51,11),(286547,51,13),(286552,51,18),(286543,51,21),(286553,51,33),(286544,51,35),(286561,51,36),(286564,51,44),(286563,51,47),(286557,51,49),(286541,51,51),(286554,51,53),(286560,51,54),(286559,51,58),(286549,51,70),(286555,51,72),(286545,51,74),(286546,51,75),(286548,51,76),(286556,51,111),(286573,52,1),(286579,52,2),(286578,52,3),(286588,52,6),(286584,52,11),(286566,52,13),(286576,52,18),(286567,52,19),(286572,52,21),(286575,52,33),(286571,52,35),(286587,52,36),(286590,52,44),(286589,52,47),(286583,52,49),(286568,52,51),(286565,52,52),(286580,52,53),(286586,52,54),(286585,52,58),(286577,52,70),(286581,52,72),(286570,52,74),(286574,52,75),(286569,52,76),(286582,52,111),(286592,53,1),(286593,53,2),(286594,53,3),(286598,53,6),(286597,53,11),(286591,53,53),(286595,53,70),(286596,53,76),(286600,54,1),(286601,54,2),(286602,54,3),(286606,54,6),(286605,54,11),(286599,54,54),(286603,54,70),(286604,54,76),(286610,55,1),(286612,55,2),(286611,55,3),(286616,55,6),(286615,55,11),(286608,55,13),(286609,55,54),(286607,55,55),(286613,55,70),(286614,55,76),(286618,56,1),(286619,56,2),(286620,56,3),(286624,56,6),(286623,56,11),(286617,56,56),(286621,56,70),(286622,56,76),(286630,57,1),(286633,57,2),(286632,57,3),(286635,57,6),(286634,57,11),(286626,57,13),(286627,57,33),(286628,57,56),(286625,57,57),(286631,57,70),(286629,57,76),(286637,58,1),(286640,58,2),(286639,58,3),(286643,58,6),(286642,58,11),(286636,58,58),(286641,58,70),(286638,58,76),(286648,59,1),(286660,59,2),(286659,59,3),(286667,59,5),(286671,59,6),(286670,59,11),(286645,59,13),(286657,59,18),(286647,59,21),(286656,59,33),(286649,59,35),(286663,59,36),(286669,59,44),(286668,59,47),(286650,59,49),(286646,59,50),(286655,59,53),(286664,59,54),(286666,59,56),(286651,59,57),(286665,59,58),(286644,59,59),(286652,59,60),(286658,59,70),(286654,59,72),(286661,59,75),(286653,59,76),(286662,59,111),(286682,60,1),(286695,60,2),(286694,60,3),(286673,60,5),(286697,60,6),(286696,60,11),(286688,60,13),(286681,60,18),(286680,60,21),(286679,60,33),(286674,60,35),(286685,60,36),(286691,60,44),(286690,60,47),(286675,60,49),(286678,60,53),(286686,60,54),(286689,60,56),(286676,60,57),(286687,60,58),(286672,60,60),(286693,60,70),(286692,60,72),(286684,60,75),(286677,60,76),(286683,60,111),(286702,61,1),(286706,61,2),(286705,61,3),(286710,61,6),(286709,61,11),(286699,61,13),(286700,61,36),(286701,61,44),(286703,61,47),(286698,61,61),(286704,61,70),(286707,61,76),(286708,61,111),(286711,62,62),(286712,64,64),(286727,65,1),(286736,65,2),(286735,65,3),(286737,65,5),(286741,65,6),(286740,65,11),(286714,65,13),(286715,65,18),(286731,65,21),(286721,65,33),(286716,65,35),(286724,65,36),(286733,65,44),(286732,65,47),(286717,65,49),(286729,65,50),(286739,65,53),(286723,65,54),(286728,65,56),(286718,65,57),(286722,65,58),(286719,65,59),(286730,65,60),(286713,65,65),(286734,65,70),(286738,65,72),(286726,65,75),(286720,65,76),(286725,65,111),(286746,66,1),(286745,66,2),(286747,66,3),(286748,66,5),(286749,66,6),(286743,66,9),(286750,66,11),(286751,66,13),(286752,66,15),(286753,66,16),(286754,66,17),(286755,66,18),(286756,66,19),(286757,66,20),(286758,66,21),(286759,66,22),(286760,66,30),(286761,66,31),(286762,66,32),(286763,66,33),(286764,66,34),(286765,66,35),(286766,66,36),(286767,66,37),(286768,66,38),(286769,66,39),(286770,66,40),(286771,66,41),(286772,66,42),(286773,66,43),(286774,66,44),(286775,66,45),(286776,66,47),(286777,66,48),(286778,66,49),(286779,66,50),(286780,66,51),(286781,66,52),(286782,66,53),(286783,66,54),(286784,66,55),(286785,66,56),(286786,66,57),(286787,66,58),(286788,66,59),(286789,66,60),(286790,66,61),(286791,66,64),(286792,66,65),(286742,66,66),(286793,66,67),(286794,66,69),(286795,66,70),(286796,66,71),(286797,66,72),(286798,66,73),(286799,66,74),(286800,66,75),(286801,66,76),(286802,66,101),(286803,66,102),(286744,66,103),(286805,66,111),(286804,66,122),(286810,67,1),(286827,67,2),(286826,67,3),(286807,67,5),(286831,67,6),(286830,67,11),(286824,67,13),(286809,67,18),(286811,67,21),(286812,67,33),(286813,67,35),(286821,67,36),(286808,67,37),(286829,67,44),(286828,67,47),(286817,67,49),(286814,67,53),(286820,67,54),(286819,67,58),(286806,67,67),(286825,67,70),(286823,67,72),(286818,67,74),(286822,67,75),(286815,67,76),(286816,67,111),(286840,69,1),(286846,69,2),(286845,69,3),(286848,69,6),(286847,69,11),(286833,69,35),(286841,69,36),(286843,69,44),(286834,69,47),(286835,69,49),(286842,69,54),(286836,69,58),(286832,69,69),(286844,69,70),(286839,69,75),(286838,69,76),(286837,69,111),(286851,70,6),(286850,70,11),(286849,70,70),(286853,71,1),(286856,71,2),(286855,71,3),(286860,71,6),(286859,71,11),(286854,71,58),(286857,71,70),(286852,71,71),(286858,71,76),(286867,72,1),(286874,72,2),(286873,72,3),(286876,72,6),(286875,72,11),(286862,72,18),(286865,72,36),(286871,72,44),(286870,72,47),(286863,72,49),(286868,72,54),(286869,72,58),(286872,72,70),(286861,72,72),(286866,72,76),(286864,72,111),(286883,73,1),(286894,73,2),(286893,73,3),(286878,73,5),(286900,73,6),(286896,73,11),(286891,73,13),(286882,73,18),(286879,73,19),(286881,73,21),(286884,73,33),(286885,73,35),(286899,73,36),(286902,73,44),(286901,73,47),(286895,73,49),(286886,73,53),(286898,73,54),(286897,73,58),(286880,73,64),(286892,73,70),(286890,73,72),(286877,73,73),(286889,73,75),(286887,73,76),(286888,73,111),(286903,74,74),(286904,75,75),(286905,76,76),(286907,100,1),(286908,100,2),(286909,100,3),(286910,100,5),(286911,100,6),(286912,100,9),(286913,100,11),(286914,100,13),(286915,100,15),(286916,100,16),(286917,100,17),(286918,100,18),(286919,100,19),(286920,100,20),(286921,100,21),(286922,100,22),(286923,100,30),(286924,100,31),(286925,100,32),(286926,100,33),(286927,100,34),(286928,100,35),(286929,100,36),(286930,100,37),(286931,100,38),(286932,100,39),(286933,100,40),(286934,100,41),(286935,100,42),(286936,100,43),(286937,100,44),(286938,100,45),(286939,100,47),(286940,100,48),(286941,100,49),(286942,100,50),(286943,100,51),(286944,100,52),(286945,100,53),(286946,100,54),(286947,100,55),(286948,100,56),(286949,100,57),(286950,100,58),(286951,100,59),(286952,100,60),(286953,100,61),(286954,100,62),(286955,100,64),(286956,100,65),(286957,100,66),(286958,100,67),(286959,100,69),(286960,100,70),(286961,100,71),(286962,100,72),(286963,100,73),(286964,100,74),(286965,100,75),(286966,100,76),(286906,100,100),(286967,100,101),(286968,100,102),(286969,100,103),(286970,100,104),(286971,100,105),(286972,100,106),(286973,100,107),(286974,100,108),(286975,100,109),(286976,100,110),(286977,100,111),(286978,100,112),(286979,100,114),(286980,100,115),(286981,100,119),(286984,100,120),(286982,100,121),(286983,100,122),(286991,101,1),(286995,101,2),(286994,101,3),(286997,101,6),(286996,101,11),(286986,101,13),(286987,101,18),(286988,101,35),(286993,101,70),(286989,101,75),(286990,101,76),(286985,101,101),(286992,101,111),(286999,102,1),(287004,102,2),(287003,102,3),(287009,102,6),(287008,102,11),(287000,102,13),(287001,102,35),(287002,102,70),(287006,102,75),(287005,102,76),(286998,102,102),(287007,102,111),(287011,103,1),(287012,103,2),(287013,103,3),(287014,103,5),(287015,103,6),(287070,103,9),(287016,103,11),(287017,103,13),(287018,103,15),(287019,103,16),(287020,103,17),(287021,103,18),(287022,103,19),(287023,103,20),(287024,103,21),(287025,103,22),(287026,103,30),(287027,103,31),(287028,103,32),(287029,103,33),(287030,103,34),(287031,103,35),(287032,103,36),(287033,103,37),(287034,103,38),(287035,103,39),(287036,103,40),(287037,103,41),(287038,103,42),(287039,103,43),(287040,103,44),(287041,103,45),(287042,103,47),(287043,103,48),(287044,103,49),(287045,103,50),(287046,103,51),(287047,103,52),(287048,103,53),(287049,103,54),(287050,103,55),(287051,103,56),(287052,103,57),(287053,103,58),(287054,103,59),(287055,103,60),(287056,103,61),(287057,103,64),(287058,103,65),(287059,103,67),(287060,103,69),(287061,103,70),(287062,103,71),(287063,103,72),(287064,103,73),(287065,103,74),(287066,103,75),(287067,103,76),(287068,103,101),(287069,103,102),(287010,103,103),(287072,103,111),(287071,103,122),(287080,104,1),(287079,104,2),(287082,104,3),(287083,104,5),(287084,104,6),(287081,104,9),(287085,104,11),(287086,104,13),(287087,104,15),(287088,104,16),(287089,104,17),(287090,104,18),(287091,104,19),(287092,104,20),(287093,104,21),(287094,104,22),(287095,104,30),(287096,104,31),(287097,104,32),(287098,104,33),(287099,104,34),(287100,104,35),(287101,104,36),(287102,104,37),(287103,104,38),(287104,104,39),(287105,104,40),(287106,104,41),(287107,104,42),(287108,104,43),(287109,104,44),(287110,104,45),(287111,104,47),(287112,104,48),(287113,104,49),(287114,104,50),(287115,104,51),(287116,104,52),(287117,104,53),(287118,104,54),(287119,104,55),(287120,104,56),(287121,104,57),(287122,104,58),(287123,104,59),(287124,104,60),(287125,104,61),(287146,104,62),(287126,104,64),(287127,104,65),(287077,104,66),(287128,104,67),(287129,104,69),(287130,104,70),(287131,104,71),(287132,104,72),(287133,104,73),(287134,104,74),(287135,104,75),(287136,104,76),(287074,104,100),(287137,104,101),(287138,104,102),(287076,104,103),(287073,104,104),(287143,104,105),(287142,104,106),(287149,104,107),(287151,104,108),(287150,104,109),(287147,104,110),(287140,104,111),(287144,104,112),(287145,104,114),(287075,104,115),(287148,104,119),(287078,104,120),(287141,104,121),(287139,104,122),(287152,105,105),(287155,106,6),(287154,106,11),(287153,106,106),(287167,107,1),(287180,107,2),(287179,107,3),(287158,107,5),(287182,107,6),(287181,107,11),(287173,107,13),(287166,107,18),(287165,107,21),(287164,107,33),(287159,107,35),(287170,107,36),(287176,107,44),(287175,107,47),(287160,107,49),(287163,107,53),(287171,107,54),(287174,107,56),(287161,107,57),(287172,107,58),(287157,107,60),(287178,107,70),(287177,107,72),(287169,107,75),(287162,107,76),(287156,107,107),(287168,107,111),(287184,108,1),(287185,108,2),(287186,108,3),(287190,108,6),(287189,108,11),(287187,108,70),(287188,108,76),(287183,108,108),(287195,109,1),(287197,109,2),(287196,109,3),(287200,109,6),(287199,109,11),(287192,109,13),(287193,109,18),(287198,109,70),(287194,109,76),(287191,109,109),(287202,110,1),(287205,110,2),(287204,110,3),(287208,110,6),(287207,110,11),(287206,110,70),(287203,110,76),(287201,110,110),(287209,111,111),(287211,112,1),(287214,112,2),(287213,112,3),(287224,112,6),(287222,112,11),(287217,112,36),(287221,112,44),(287220,112,47),(287212,112,49),(287218,112,54),(287219,112,58),(287215,112,70),(287216,112,76),(287223,112,111),(287210,112,112),(287229,114,1),(287231,114,2),(287230,114,3),(287241,114,6),(287239,114,11),(287226,114,13),(287234,114,36),(287238,114,44),(287237,114,47),(287228,114,49),(287235,114,54),(287236,114,58),(287232,114,70),(287233,114,76),(287240,114,111),(287227,114,112),(287225,114,114),(287247,115,1),(287246,115,2),(287249,115,3),(287250,115,5),(287251,115,6),(287248,115,9),(287252,115,11),(287253,115,13),(287254,115,15),(287255,115,16),(287256,115,17),(287257,115,18),(287258,115,19),(287259,115,20),(287260,115,21),(287261,115,22),(287262,115,30),(287263,115,31),(287264,115,32),(287265,115,33),(287266,115,34),(287267,115,35),(287268,115,36),(287269,115,37),(287270,115,38),(287271,115,39),(287272,115,40),(287273,115,41),(287274,115,42),(287275,115,43),(287276,115,44),(287277,115,45),(287278,115,47),(287279,115,48),(287280,115,49),(287281,115,50),(287282,115,51),(287283,115,52),(287284,115,53),(287285,115,54),(287286,115,55),(287287,115,56),(287288,115,57),(287289,115,58),(287290,115,59),(287291,115,60),(287292,115,61),(287293,115,64),(287294,115,65),(287243,115,66),(287295,115,67),(287296,115,69),(287297,115,70),(287298,115,71),(287299,115,72),(287300,115,73),(287301,115,74),(287302,115,75),(287303,115,76),(287304,115,101),(287305,115,102),(287244,115,103),(287307,115,111),(287242,115,115),(287245,115,120),(287306,115,122),(287310,119,1),(287313,119,2),(287312,119,3),(287316,119,6),(287315,119,11),(287314,119,70),(287311,119,76),(287309,119,110),(287308,119,119),(287363,120,1),(287367,120,2),(287366,120,3),(287365,120,5),(287368,120,6),(287360,120,9),(287369,120,11),(287361,120,13),(287370,120,15),(287371,120,16),(287372,120,17),(287373,120,18),(287374,120,19),(287375,120,20),(287376,120,21),(287377,120,22),(287378,120,30),(287379,120,31),(287380,120,32),(287381,120,33),(287382,120,34),(287383,120,35),(287384,120,36),(287385,120,37),(287386,120,38),(287387,120,39),(287388,120,40),(287389,120,41),(287390,120,42),(287391,120,43),(287392,120,44),(287393,120,45),(287394,120,47),(287395,120,48),(287396,120,49),(287397,120,50),(287398,120,51),(287399,120,52),(287400,120,53),(287401,120,54),(287402,120,55),(287403,120,56),(287404,120,57),(287405,120,58),(287406,120,59),(287407,120,60),(287408,120,61),(287409,120,64),(287410,120,65),(287362,120,66),(287411,120,67),(287412,120,69),(287413,120,70),(287414,120,71),(287415,120,72),(287416,120,73),(287417,120,74),(287418,120,75),(287419,120,76),(287420,120,101),(287421,120,102),(287364,120,103),(287423,120,111),(287359,120,120),(287422,120,122),(287326,121,1),(287331,121,2),(287330,121,3),(287337,121,6),(287333,121,11),(287321,121,13),(287320,121,18),(287318,121,21),(287322,121,33),(287319,121,35),(287336,121,36),(287339,121,44),(287338,121,47),(287332,121,49),(287323,121,53),(287335,121,54),(287334,121,58),(287329,121,70),(287324,121,72),(287327,121,75),(287325,121,76),(287328,121,111),(287317,121,121),(287347,122,1),(287356,122,2),(287355,122,3),(287358,122,6),(287357,122,11),(287341,122,15),(287342,122,35),(287349,122,36),(287353,122,44),(287352,122,47),(287343,122,49),(287350,122,54),(287344,122,56),(287351,122,58),(287354,122,70),(287346,122,75),(287345,122,76),(287348,122,111),(287340,122,122);
+INSERT INTO `roleRole` VALUES (326595,1,1),(326596,1,2),(326597,1,3),(326601,1,6),(326600,1,11),(326598,1,70),(326599,1,76),(326602,2,2),(326604,2,6),(326603,2,11),(326605,3,3),(326607,3,6),(326606,3,11),(326609,5,1),(326623,5,2),(326622,5,3),(326608,5,5),(326629,5,6),(326625,5,11),(326619,5,13),(326610,5,18),(326611,5,21),(326612,5,33),(326613,5,35),(326628,5,36),(326631,5,44),(326630,5,47),(326624,5,49),(326614,5,53),(326627,5,54),(326626,5,58),(326621,5,70),(326618,5,72),(326617,5,75),(326615,5,76),(326616,5,111),(326620,5,125),(326632,6,6),(326635,9,1),(326636,9,2),(326637,9,3),(326638,9,5),(326639,9,6),(326633,9,9),(326640,9,11),(326641,9,13),(326642,9,15),(326643,9,16),(326644,9,17),(326645,9,18),(326646,9,19),(326647,9,20),(326648,9,21),(326649,9,22),(326650,9,30),(326651,9,31),(326652,9,32),(326653,9,33),(326654,9,34),(326655,9,35),(326656,9,36),(326657,9,37),(326658,9,38),(326659,9,39),(326660,9,40),(326661,9,41),(326662,9,42),(326663,9,43),(326664,9,44),(326665,9,45),(326666,9,47),(326667,9,48),(326668,9,49),(326669,9,50),(326670,9,51),(326671,9,52),(326672,9,53),(326673,9,54),(326674,9,55),(326675,9,56),(326676,9,57),(326677,9,58),(326678,9,59),(326679,9,60),(326680,9,61),(326681,9,64),(326682,9,65),(326683,9,67),(326684,9,69),(326685,9,70),(326686,9,71),(326687,9,72),(326688,9,73),(326689,9,74),(326690,9,75),(326691,9,76),(326692,9,101),(326693,9,102),(326634,9,103),(326699,9,111),(326694,9,112),(326698,9,122),(326696,9,123),(326695,9,124),(326697,9,125),(326701,11,6),(326700,11,11),(326703,13,1),(326704,13,2),(326705,13,3),(326709,13,6),(326708,13,11),(326702,13,13),(326706,13,70),(326707,13,76),(326716,15,1),(326726,15,2),(326725,15,3),(326728,15,6),(326727,15,11),(326710,15,15),(326711,15,35),(326719,15,36),(326723,15,44),(326722,15,47),(326712,15,49),(326720,15,54),(326713,15,56),(326721,15,58),(326724,15,70),(326715,15,75),(326714,15,76),(326717,15,111),(326718,15,125),(326737,16,1),(326747,16,2),(326746,16,3),(326749,16,6),(326748,16,11),(326731,16,15),(326729,16,16),(326732,16,35),(326740,16,36),(326744,16,44),(326743,16,47),(326733,16,49),(326741,16,54),(326734,16,56),(326742,16,58),(326745,16,70),(326736,16,75),(326735,16,76),(326738,16,111),(326730,16,122),(326739,16,125),(326758,17,1),(326774,17,2),(326773,17,3),(326765,17,5),(326799,17,6),(326762,17,9),(326798,17,11),(326761,17,13),(326797,17,15),(326760,17,16),(326750,17,17),(326757,17,18),(326796,17,19),(326751,17,20),(326766,17,21),(326795,17,22),(326794,17,30),(326793,17,31),(326792,17,32),(326779,17,33),(326791,17,34),(326776,17,35),(326770,17,36),(326752,17,37),(326790,17,38),(326753,17,39),(326789,17,40),(326788,17,41),(326787,17,42),(326786,17,43),(326785,17,44),(326784,17,45),(326800,17,47),(326801,17,48),(326763,17,49),(326802,17,50),(326803,17,51),(326804,17,52),(326780,17,53),(326769,17,54),(326805,17,55),(326806,17,56),(326767,17,57),(326768,17,58),(326775,17,59),(326807,17,60),(326808,17,61),(326754,17,64),(326759,17,65),(326755,17,67),(326809,17,69),(326772,17,70),(326810,17,71),(326782,17,72),(326811,17,73),(326764,17,74),(326812,17,75),(326756,17,76),(326813,17,101),(326814,17,102),(326778,17,103),(326781,17,111),(326815,17,112),(326777,17,122),(326783,17,123),(326816,17,124),(326771,17,125),(326818,18,1),(326823,18,2),(326822,18,3),(326825,18,6),(326824,18,11),(326817,18,18),(326821,18,70),(326819,18,76),(326820,18,125),(326837,19,1),(326843,19,2),(326842,19,3),(326847,19,6),(326846,19,11),(326828,19,13),(326829,19,18),(326826,19,19),(326827,19,21),(326830,19,33),(326840,19,36),(326845,19,44),(326844,19,47),(326835,19,49),(326831,19,53),(326839,19,54),(326838,19,58),(326841,19,70),(326832,19,72),(326833,19,76),(326834,19,111),(326836,19,125),(326857,20,1),(326869,20,2),(326868,20,3),(326867,20,5),(326866,20,6),(326849,20,9),(326865,20,11),(326850,20,13),(326864,20,15),(326851,20,16),(326863,20,17),(326855,20,18),(326862,20,19),(326848,20,20),(326870,20,21),(326871,20,22),(326872,20,30),(326873,20,31),(326874,20,32),(326875,20,33),(326876,20,34),(326854,20,35),(326877,20,36),(326878,20,37),(326879,20,38),(326880,20,39),(326881,20,40),(326882,20,41),(326883,20,42),(326884,20,43),(326885,20,44),(326886,20,45),(326887,20,47),(326888,20,48),(326859,20,49),(326889,20,50),(326890,20,51),(326891,20,52),(326892,20,53),(326893,20,54),(326894,20,55),(326895,20,56),(326860,20,57),(326896,20,58),(326861,20,59),(326897,20,60),(326898,20,61),(326899,20,64),(326852,20,65),(326900,20,67),(326901,20,69),(326902,20,70),(326903,20,71),(326904,20,72),(326905,20,73),(326906,20,74),(326907,20,75),(326853,20,76),(326908,20,101),(326909,20,102),(326858,20,103),(326913,20,111),(326910,20,112),(326856,20,122),(326914,20,123),(326911,20,124),(326912,20,125),(326925,21,1),(326931,21,2),(326930,21,3),(326935,21,6),(326934,21,11),(326916,21,13),(326917,21,18),(326915,21,21),(326918,21,33),(326928,21,36),(326933,21,44),(326932,21,47),(326923,21,49),(326919,21,53),(326927,21,54),(326926,21,58),(326929,21,70),(326920,21,72),(326921,21,76),(326922,21,111),(326924,21,125),(326940,22,1),(326950,22,2),(326949,22,3),(326957,22,6),(326954,22,11),(326937,22,13),(326939,22,18),(326938,22,21),(326936,22,22),(326941,22,33),(326953,22,36),(326956,22,44),(326955,22,47),(326946,22,49),(326942,22,53),(326952,22,54),(326951,22,58),(326948,22,70),(326943,22,72),(326944,22,76),(326945,22,111),(326947,22,125),(326970,30,1),(326984,30,2),(326983,30,3),(326959,30,5),(326995,30,6),(326971,30,9),(326996,30,11),(326972,30,13),(326994,30,15),(326973,30,16),(326993,30,17),(326969,30,18),(326992,30,19),(326960,30,20),(326968,30,21),(326961,30,22),(326958,30,30),(326991,30,31),(326990,30,32),(326967,30,33),(326989,30,34),(326966,30,35),(326988,30,36),(326987,30,37),(326986,30,38),(326997,30,39),(326998,30,40),(326999,30,41),(327000,30,42),(327001,30,43),(327002,30,44),(327003,30,45),(327004,30,47),(327005,30,48),(326976,30,49),(327006,30,50),(327007,30,51),(327008,30,52),(326962,30,53),(327009,30,54),(327010,30,55),(327011,30,56),(326975,30,57),(327012,30,58),(326985,30,59),(327013,30,60),(327014,30,61),(326963,30,64),(326974,30,65),(327015,30,67),(327016,30,69),(326982,30,70),(327017,30,71),(326980,30,72),(327018,30,73),(327019,30,74),(326979,30,75),(326964,30,76),(327020,30,101),(327021,30,102),(326978,30,103),(326965,30,111),(327022,30,112),(326977,30,122),(327024,30,123),(327023,30,124),(326981,30,125),(327026,31,1),(327027,31,2),(327028,31,3),(327032,31,6),(327031,31,11),(327025,31,31),(327029,31,70),(327030,31,76),(327034,32,1),(327035,32,2),(327036,32,3),(327040,32,6),(327039,32,11),(327033,32,32),(327037,32,70),(327038,32,76),(327041,33,33),(327043,34,1),(327048,34,2),(327047,34,3),(327051,34,6),(327050,34,11),(327044,34,13),(327045,34,33),(327042,34,34),(327046,34,70),(327049,34,76),(327053,35,1),(327060,35,2),(327059,35,3),(327062,35,6),(327061,35,11),(327052,35,35),(327058,35,70),(327054,35,75),(327055,35,76),(327056,35,111),(327057,35,125),(327067,36,1),(327069,36,2),(327068,36,3),(327073,36,6),(327072,36,11),(327063,36,36),(327064,36,44),(327065,36,47),(327070,36,70),(327071,36,76),(327066,36,111),(327075,37,1),(327084,37,2),(327083,37,3),(327091,37,6),(327089,37,11),(327076,37,18),(327080,37,36),(327074,37,37),(327088,37,44),(327087,37,47),(327077,37,49),(327085,37,54),(327086,37,58),(327082,37,70),(327078,37,74),(327079,37,76),(327090,37,111),(327081,37,125),(327100,38,1),(327104,38,2),(327103,38,3),(327112,38,6),(327110,38,11),(327093,38,13),(327099,38,18),(327105,38,36),(327094,38,37),(327092,38,38),(327109,38,44),(327108,38,47),(327098,38,49),(327106,38,54),(327107,38,58),(327095,38,64),(327102,38,70),(327097,38,74),(327096,38,76),(327111,38,111),(327101,38,125),(327121,39,1),(327133,39,2),(327132,39,3),(327114,39,5),(327140,39,6),(327137,39,11),(327124,39,13),(327120,39,18),(327115,39,21),(327119,39,33),(327118,39,35),(327136,39,36),(327113,39,39),(327139,39,44),(327138,39,47),(327129,39,49),(327122,39,53),(327135,39,54),(327128,39,56),(327116,39,57),(327134,39,58),(327131,39,70),(327125,39,72),(327130,39,75),(327117,39,76),(327123,39,111),(327126,39,123),(327127,39,125),(327142,40,1),(327145,40,2),(327144,40,3),(327155,40,6),(327153,40,11),(327148,40,36),(327141,40,40),(327152,40,44),(327151,40,47),(327143,40,49),(327149,40,54),(327150,40,58),(327146,40,70),(327147,40,76),(327154,40,111),(327165,41,1),(327170,41,2),(327169,41,3),(327175,41,6),(327174,41,11),(327157,41,13),(327158,41,35),(327167,41,36),(327159,41,40),(327156,41,41),(327173,41,44),(327172,41,47),(327162,41,49),(327166,41,54),(327171,41,58),(327168,41,70),(327164,41,75),(327160,41,76),(327163,41,111),(327161,41,125),(327182,42,1),(327191,42,2),(327190,42,3),(327193,42,6),(327192,42,11),(327177,42,35),(327184,42,36),(327176,42,42),(327188,42,44),(327187,42,47),(327178,42,49),(327185,42,54),(327186,42,58),(327189,42,70),(327181,42,75),(327179,42,76),(327180,42,111),(327183,42,125),(327202,43,1),(327208,43,2),(327207,43,3),(327214,43,6),(327213,43,11),(327195,43,13),(327196,43,18),(327199,43,35),(327204,43,36),(327197,43,42),(327194,43,43),(327212,43,44),(327211,43,47),(327203,43,49),(327209,43,54),(327210,43,58),(327206,43,70),(327205,43,75),(327201,43,76),(327198,43,111),(327200,43,125),(327216,44,1),(327217,44,2),(327218,44,3),(327222,44,6),(327221,44,11),(327215,44,44),(327219,44,70),(327220,44,76),(327226,45,1),(327228,45,2),(327227,45,3),(327232,45,6),(327231,45,11),(327224,45,13),(327225,45,44),(327223,45,45),(327229,45,70),(327230,45,76),(327234,47,1),(327237,47,2),(327236,47,3),(327241,47,6),(327240,47,11),(327233,47,47),(327238,47,70),(327239,47,76),(327235,47,111),(327252,48,1),(327259,48,2),(327258,48,3),(327261,48,6),(327260,48,11),(327243,48,13),(327244,48,35),(327253,48,36),(327256,48,44),(327245,48,47),(327242,48,48),(327246,48,49),(327254,48,54),(327255,48,58),(327247,48,69),(327257,48,70),(327251,48,75),(327250,48,76),(327249,48,111),(327248,48,125),(327266,49,1),(327272,49,2),(327271,49,3),(327275,49,6),(327274,49,11),(327263,49,36),(327268,49,44),(327267,49,47),(327262,49,49),(327264,49,54),(327265,49,58),(327270,49,70),(327269,49,76),(327273,49,111),(327288,50,1),(327301,50,2),(327300,50,3),(327290,50,5),(327305,50,6),(327304,50,11),(327277,50,13),(327287,50,18),(327278,50,21),(327286,50,33),(327291,50,35),(327295,50,36),(327303,50,44),(327302,50,47),(327292,50,49),(327276,50,50),(327285,50,53),(327294,50,54),(327297,50,56),(327279,50,57),(327293,50,58),(327280,50,59),(327281,50,60),(327299,50,70),(327284,50,72),(327296,50,75),(327282,50,76),(327298,50,111),(327283,50,123),(327289,50,125),(327307,51,1),(327316,51,2),(327315,51,3),(327328,51,6),(327324,51,11),(327312,51,13),(327317,51,18),(327308,51,21),(327318,51,33),(327309,51,35),(327327,51,36),(327330,51,44),(327329,51,47),(327323,51,49),(327306,51,51),(327319,51,53),(327326,51,54),(327325,51,58),(327314,51,70),(327320,51,72),(327310,51,74),(327311,51,75),(327313,51,76),(327321,51,111),(327322,51,125),(327339,52,1),(327345,52,2),(327344,52,3),(327355,52,6),(327351,52,11),(327332,52,13),(327342,52,18),(327333,52,19),(327338,52,21),(327341,52,33),(327337,52,35),(327354,52,36),(327357,52,44),(327356,52,47),(327350,52,49),(327334,52,51),(327331,52,52),(327346,52,53),(327353,52,54),(327352,52,58),(327343,52,70),(327347,52,72),(327336,52,74),(327340,52,75),(327335,52,76),(327348,52,111),(327349,52,125),(327359,53,1),(327360,53,2),(327361,53,3),(327365,53,6),(327364,53,11),(327358,53,53),(327362,53,70),(327363,53,76),(327367,54,1),(327368,54,2),(327369,54,3),(327373,54,6),(327372,54,11),(327366,54,54),(327370,54,70),(327371,54,76),(327377,55,1),(327379,55,2),(327378,55,3),(327383,55,6),(327382,55,11),(327375,55,13),(327376,55,54),(327374,55,55),(327380,55,70),(327381,55,76),(327385,56,1),(327386,56,2),(327387,56,3),(327391,56,6),(327390,56,11),(327384,56,56),(327388,56,70),(327389,56,76),(327398,57,1),(327401,57,2),(327400,57,3),(327404,57,6),(327403,57,11),(327393,57,13),(327397,57,33),(327396,57,56),(327392,57,57),(327399,57,70),(327402,57,76),(327394,57,123),(327395,57,125),(327406,58,1),(327409,58,2),(327408,58,3),(327412,58,6),(327411,58,11),(327405,58,58),(327410,58,70),(327407,58,76),(327417,59,1),(327425,59,2),(327424,59,3),(327430,59,5),(327442,59,6),(327439,59,11),(327414,59,13),(327422,59,18),(327416,59,21),(327421,59,33),(327431,59,35),(327435,59,36),(327441,59,44),(327440,59,47),(327432,59,49),(327415,59,50),(327426,59,53),(327434,59,54),(327437,59,56),(327418,59,57),(327433,59,58),(327413,59,59),(327419,59,60),(327423,59,70),(327427,59,72),(327436,59,75),(327420,59,76),(327438,59,111),(327428,59,123),(327429,59,125),(327453,60,1),(327467,60,2),(327466,60,3),(327444,60,5),(327469,60,6),(327468,60,11),(327464,60,13),(327452,60,18),(327451,60,21),(327450,60,33),(327445,60,35),(327457,60,36),(327462,60,44),(327461,60,47),(327446,60,49),(327449,60,53),(327458,60,54),(327460,60,56),(327459,60,58),(327443,60,60),(327465,60,70),(327463,60,72),(327455,60,75),(327447,60,76),(327454,60,111),(327448,60,123),(327456,60,125),(327474,61,1),(327478,61,2),(327477,61,3),(327482,61,6),(327481,61,11),(327471,61,13),(327472,61,36),(327473,61,44),(327475,61,47),(327470,61,61),(327476,61,70),(327479,61,76),(327480,61,111),(327483,62,62),(327484,64,64),(327499,65,1),(327510,65,2),(327509,65,3),(327511,65,5),(327515,65,6),(327514,65,11),(327486,65,13),(327487,65,18),(327503,65,21),(327505,65,33),(327488,65,35),(327495,65,36),(327507,65,44),(327506,65,47),(327489,65,49),(327501,65,50),(327513,65,53),(327494,65,54),(327504,65,56),(327490,65,57),(327493,65,58),(327491,65,59),(327502,65,60),(327485,65,65),(327508,65,70),(327512,65,72),(327497,65,75),(327492,65,76),(327496,65,111),(327500,65,123),(327498,65,125),(327520,66,1),(327519,66,2),(327521,66,3),(327522,66,5),(327523,66,6),(327517,66,9),(327524,66,11),(327525,66,13),(327526,66,15),(327527,66,16),(327528,66,17),(327529,66,18),(327530,66,19),(327531,66,20),(327532,66,21),(327533,66,22),(327534,66,30),(327535,66,31),(327536,66,32),(327537,66,33),(327538,66,34),(327539,66,35),(327540,66,36),(327541,66,37),(327542,66,38),(327543,66,39),(327544,66,40),(327545,66,41),(327546,66,42),(327547,66,43),(327548,66,44),(327549,66,45),(327550,66,47),(327551,66,48),(327552,66,49),(327553,66,50),(327554,66,51),(327555,66,52),(327556,66,53),(327557,66,54),(327558,66,55),(327559,66,56),(327560,66,57),(327561,66,58),(327562,66,59),(327563,66,60),(327564,66,61),(327565,66,64),(327566,66,65),(327516,66,66),(327567,66,67),(327568,66,69),(327569,66,70),(327570,66,71),(327571,66,72),(327572,66,73),(327573,66,74),(327574,66,75),(327575,66,76),(327576,66,101),(327577,66,102),(327518,66,103),(327583,66,111),(327578,66,112),(327582,66,122),(327580,66,123),(327579,66,124),(327581,66,125),(327588,67,1),(327606,67,2),(327605,67,3),(327585,67,5),(327610,67,6),(327609,67,11),(327602,67,13),(327587,67,18),(327589,67,21),(327590,67,33),(327591,67,35),(327599,67,36),(327586,67,37),(327608,67,44),(327607,67,47),(327595,67,49),(327592,67,53),(327598,67,54),(327597,67,58),(327584,67,67),(327604,67,70),(327601,67,72),(327596,67,74),(327600,67,75),(327593,67,76),(327594,67,111),(327603,67,125),(327619,69,1),(327626,69,2),(327625,69,3),(327628,69,6),(327627,69,11),(327612,69,35),(327621,69,36),(327623,69,44),(327613,69,47),(327614,69,49),(327622,69,54),(327615,69,58),(327611,69,69),(327624,69,70),(327618,69,75),(327617,69,76),(327616,69,111),(327620,69,125),(327631,70,6),(327630,70,11),(327629,70,70),(327633,71,1),(327636,71,2),(327635,71,3),(327640,71,6),(327639,71,11),(327634,71,58),(327637,71,70),(327632,71,71),(327638,71,76),(327647,72,1),(327655,72,2),(327654,72,3),(327657,72,6),(327656,72,11),(327642,72,18),(327648,72,36),(327652,72,44),(327651,72,47),(327643,72,49),(327649,72,54),(327650,72,58),(327653,72,70),(327641,72,72),(327646,72,76),(327644,72,111),(327645,72,125),(327664,73,1),(327676,73,2),(327675,73,3),(327659,73,5),(327682,73,6),(327678,73,11),(327672,73,13),(327663,73,18),(327660,73,19),(327662,73,21),(327665,73,33),(327666,73,35),(327681,73,36),(327684,73,44),(327683,73,47),(327677,73,49),(327667,73,53),(327680,73,54),(327679,73,58),(327661,73,64),(327674,73,70),(327671,73,72),(327658,73,73),(327670,73,75),(327668,73,76),(327669,73,111),(327673,73,125),(327685,74,74),(327686,75,75),(327687,76,76),(327689,100,1),(327690,100,2),(327691,100,3),(327692,100,5),(327693,100,6),(327694,100,9),(327695,100,11),(327696,100,13),(327697,100,15),(327698,100,16),(327699,100,17),(327700,100,18),(327701,100,19),(327702,100,20),(327703,100,21),(327704,100,22),(327705,100,30),(327706,100,31),(327707,100,32),(327708,100,33),(327709,100,34),(327710,100,35),(327711,100,36),(327712,100,37),(327713,100,38),(327714,100,39),(327715,100,40),(327716,100,41),(327717,100,42),(327718,100,43),(327719,100,44),(327720,100,45),(327721,100,47),(327722,100,48),(327723,100,49),(327724,100,50),(327725,100,51),(327726,100,52),(327727,100,53),(327728,100,54),(327729,100,55),(327730,100,56),(327731,100,57),(327732,100,58),(327733,100,59),(327734,100,60),(327735,100,61),(327736,100,62),(327737,100,64),(327738,100,65),(327739,100,66),(327740,100,67),(327741,100,69),(327742,100,70),(327743,100,71),(327744,100,72),(327745,100,73),(327746,100,74),(327747,100,75),(327748,100,76),(327688,100,100),(327749,100,101),(327750,100,102),(327751,100,103),(327752,100,104),(327753,100,105),(327754,100,106),(327755,100,107),(327756,100,108),(327757,100,109),(327758,100,110),(327759,100,111),(327760,100,112),(327761,100,114),(327762,100,115),(327763,100,119),(327770,100,120),(327764,100,121),(327765,100,122),(327768,100,123),(327766,100,124),(327769,100,125),(327767,100,126),(327777,101,1),(327782,101,2),(327781,101,3),(327784,101,6),(327783,101,11),(327772,101,13),(327773,101,18),(327774,101,35),(327780,101,70),(327778,101,75),(327776,101,76),(327771,101,101),(327779,101,111),(327775,101,125),(327786,102,1),(327793,102,2),(327792,102,3),(327803,102,6),(327802,102,11),(327787,102,13),(327788,102,35),(327797,102,36),(327801,102,44),(327800,102,47),(327789,102,49),(327798,102,54),(327799,102,58),(327791,102,70),(327794,102,75),(327790,102,76),(327785,102,102),(327795,102,111),(327796,102,125),(327805,103,1),(327806,103,2),(327807,103,3),(327808,103,5),(327809,103,6),(327867,103,9),(327810,103,11),(327811,103,13),(327812,103,15),(327813,103,16),(327814,103,17),(327815,103,18),(327816,103,19),(327817,103,20),(327818,103,21),(327819,103,22),(327820,103,30),(327821,103,31),(327822,103,32),(327823,103,33),(327824,103,34),(327825,103,35),(327826,103,36),(327827,103,37),(327828,103,38),(327829,103,39),(327830,103,40),(327831,103,41),(327832,103,42),(327833,103,43),(327834,103,44),(327835,103,45),(327836,103,47),(327837,103,48),(327838,103,49),(327839,103,50),(327840,103,51),(327841,103,52),(327842,103,53),(327843,103,54),(327844,103,55),(327845,103,56),(327846,103,57),(327847,103,58),(327848,103,59),(327849,103,60),(327850,103,61),(327851,103,64),(327852,103,65),(327853,103,67),(327854,103,69),(327855,103,70),(327856,103,71),(327857,103,72),(327858,103,73),(327859,103,74),(327860,103,75),(327861,103,76),(327862,103,101),(327863,103,102),(327804,103,103),(327870,103,111),(327864,103,112),(327869,103,122),(327866,103,123),(327865,103,124),(327868,103,125),(327878,104,1),(327877,104,2),(327880,104,3),(327881,104,5),(327882,104,6),(327879,104,9),(327883,104,11),(327884,104,13),(327885,104,15),(327886,104,16),(327887,104,17),(327888,104,18),(327889,104,19),(327890,104,20),(327891,104,21),(327892,104,22),(327893,104,30),(327894,104,31),(327895,104,32),(327896,104,33),(327897,104,34),(327898,104,35),(327899,104,36),(327900,104,37),(327901,104,38),(327902,104,39),(327903,104,40),(327904,104,41),(327905,104,42),(327906,104,43),(327907,104,44),(327908,104,45),(327909,104,47),(327910,104,48),(327911,104,49),(327912,104,50),(327913,104,51),(327914,104,52),(327915,104,53),(327916,104,54),(327917,104,55),(327918,104,56),(327919,104,57),(327920,104,58),(327921,104,59),(327922,104,60),(327923,104,61),(327948,104,62),(327924,104,64),(327925,104,65),(327875,104,66),(327926,104,67),(327927,104,69),(327928,104,70),(327929,104,71),(327930,104,72),(327931,104,73),(327932,104,74),(327933,104,75),(327934,104,76),(327872,104,100),(327935,104,101),(327936,104,102),(327874,104,103),(327871,104,104),(327945,104,105),(327944,104,106),(327951,104,107),(327953,104,108),(327952,104,109),(327949,104,110),(327942,104,111),(327937,104,112),(327947,104,114),(327873,104,115),(327950,104,119),(327876,104,120),(327943,104,121),(327941,104,122),(327939,104,123),(327938,104,124),(327940,104,125),(327946,104,126),(327954,105,105),(327957,106,6),(327956,106,11),(327955,106,106),(327969,107,1),(327983,107,2),(327982,107,3),(327960,107,5),(327985,107,6),(327984,107,11),(327980,107,13),(327968,107,18),(327967,107,21),(327966,107,33),(327961,107,35),(327973,107,36),(327978,107,44),(327977,107,47),(327962,107,49),(327965,107,53),(327974,107,54),(327976,107,56),(327975,107,58),(327959,107,60),(327981,107,70),(327979,107,72),(327971,107,75),(327963,107,76),(327958,107,107),(327970,107,111),(327964,107,123),(327972,107,125),(327987,108,1),(327988,108,2),(327989,108,3),(327993,108,6),(327992,108,11),(327990,108,70),(327991,108,76),(327986,108,108),(327998,109,1),(328002,109,2),(328001,109,3),(328004,109,6),(328003,109,11),(327995,109,13),(327996,109,18),(328000,109,70),(327997,109,76),(327994,109,109),(327999,109,125),(328006,110,1),(328009,110,2),(328008,110,3),(328012,110,6),(328011,110,11),(328010,110,70),(328007,110,76),(328005,110,110),(328013,111,111),(328015,112,1),(328018,112,2),(328017,112,3),(328028,112,6),(328026,112,11),(328021,112,36),(328025,112,44),(328024,112,47),(328016,112,49),(328022,112,54),(328023,112,58),(328019,112,70),(328020,112,76),(328027,112,111),(328014,112,112),(328033,114,1),(328035,114,2),(328034,114,3),(328045,114,6),(328043,114,11),(328030,114,13),(328038,114,36),(328042,114,44),(328041,114,47),(328032,114,49),(328039,114,54),(328040,114,58),(328036,114,70),(328037,114,76),(328044,114,111),(328031,114,112),(328029,114,114),(328051,115,1),(328050,115,2),(328053,115,3),(328054,115,5),(328055,115,6),(328052,115,9),(328056,115,11),(328057,115,13),(328058,115,15),(328059,115,16),(328060,115,17),(328061,115,18),(328062,115,19),(328063,115,20),(328064,115,21),(328065,115,22),(328066,115,30),(328067,115,31),(328068,115,32),(328069,115,33),(328070,115,34),(328071,115,35),(328072,115,36),(328073,115,37),(328074,115,38),(328075,115,39),(328076,115,40),(328077,115,41),(328078,115,42),(328079,115,43),(328080,115,44),(328081,115,45),(328082,115,47),(328083,115,48),(328084,115,49),(328085,115,50),(328086,115,51),(328087,115,52),(328088,115,53),(328089,115,54),(328090,115,55),(328091,115,56),(328092,115,57),(328093,115,58),(328094,115,59),(328095,115,60),(328096,115,61),(328097,115,64),(328098,115,65),(328047,115,66),(328099,115,67),(328100,115,69),(328101,115,70),(328102,115,71),(328103,115,72),(328104,115,73),(328105,115,74),(328106,115,75),(328107,115,76),(328108,115,101),(328109,115,102),(328048,115,103),(328115,115,111),(328110,115,112),(328046,115,115),(328049,115,120),(328114,115,122),(328112,115,123),(328111,115,124),(328113,115,125),(328118,119,1),(328121,119,2),(328120,119,3),(328124,119,6),(328123,119,11),(328122,119,70),(328119,119,76),(328117,119,110),(328116,119,119),(328225,120,1),(328229,120,2),(328228,120,3),(328227,120,5),(328230,120,6),(328222,120,9),(328231,120,11),(328223,120,13),(328232,120,15),(328233,120,16),(328234,120,17),(328235,120,18),(328236,120,19),(328237,120,20),(328238,120,21),(328239,120,22),(328240,120,30),(328241,120,31),(328242,120,32),(328243,120,33),(328244,120,34),(328245,120,35),(328246,120,36),(328247,120,37),(328248,120,38),(328249,120,39),(328250,120,40),(328251,120,41),(328252,120,42),(328253,120,43),(328254,120,44),(328255,120,45),(328256,120,47),(328257,120,48),(328258,120,49),(328259,120,50),(328260,120,51),(328261,120,52),(328262,120,53),(328263,120,54),(328264,120,55),(328265,120,56),(328266,120,57),(328267,120,58),(328268,120,59),(328269,120,60),(328270,120,61),(328271,120,64),(328272,120,65),(328224,120,66),(328273,120,67),(328274,120,69),(328275,120,70),(328276,120,71),(328277,120,72),(328278,120,73),(328279,120,74),(328280,120,75),(328281,120,76),(328282,120,101),(328283,120,102),(328226,120,103),(328289,120,111),(328284,120,112),(328221,120,120),(328288,120,122),(328286,120,123),(328285,120,124),(328287,120,125),(328134,121,1),(328140,121,2),(328139,121,3),(328146,121,6),(328142,121,11),(328129,121,13),(328128,121,18),(328126,121,21),(328130,121,33),(328127,121,35),(328145,121,36),(328148,121,44),(328147,121,47),(328141,121,49),(328131,121,53),(328144,121,54),(328143,121,58),(328138,121,70),(328132,121,72),(328135,121,75),(328133,121,76),(328136,121,111),(328125,121,121),(328137,121,125),(328156,122,1),(328166,122,2),(328165,122,3),(328168,122,6),(328167,122,11),(328150,122,15),(328151,122,35),(328159,122,36),(328163,122,44),(328162,122,47),(328152,122,49),(328160,122,54),(328153,122,56),(328161,122,58),(328164,122,70),(328155,122,75),(328154,122,76),(328157,122,111),(328149,122,122),(328158,122,125),(328213,123,1),(328215,123,2),(328214,123,3),(328219,123,6),(328218,123,11),(328211,123,33),(328212,123,56),(328216,123,70),(328217,123,76),(328210,123,123),(328173,124,1),(328185,124,2),(328184,124,3),(328189,124,6),(328188,124,11),(328177,124,18),(328170,124,35),(328182,124,36),(328171,124,37),(328187,124,44),(328186,124,47),(328178,124,49),(328181,124,54),(328180,124,58),(328183,124,70),(328179,124,74),(328172,124,75),(328174,124,76),(328175,124,111),(328169,124,124),(328176,124,125),(328220,125,125),(328197,126,1),(328207,126,2),(328206,126,3),(328209,126,6),(328208,126,11),(328191,126,15),(328192,126,35),(328200,126,36),(328204,126,44),(328203,126,47),(328193,126,49),(328201,126,54),(328194,126,56),(328202,126,58),(328205,126,70),(328196,126,75),(328195,126,76),(328198,126,111),(328199,126,125),(328190,126,126);
/*!40000 ALTER TABLE `roleRole` ENABLE KEYS */;
UNLOCK TABLES;
@@ -140,7 +140,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:15
+-- Dump completed on 2023-11-20 12:26:42
USE `salix`;
-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
--
@@ -164,7 +164,7 @@ USE `salix`;
LOCK TABLES `ACL` WRITE;
/*!40000 ALTER TABLE `ACL` DISABLE KEYS */;
-INSERT INTO `ACL` VALUES (3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','logisticBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','find','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','READ','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryBoss'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','READ','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'),(439,'NotificationSubscription','*','*','ALLOW','ROLE','employee'),(440,'NotificationAcl','*','READ','ALLOW','ROLE','employee'),(441,'MdbApp','*','READ','ALLOW','ROLE','$everyone'),(442,'MdbApp','*','*','ALLOW','ROLE','developer'),(443,'ItemConfig','*','*','ALLOW','ROLE','employee'),(444,'DeviceProduction','*','*','ALLOW','ROLE','hr'),(445,'DeviceProductionModels','*','*','ALLOW','ROLE','hr'),(446,'DeviceProductionState','*','*','ALLOW','ROLE','hr'),(447,'DeviceProductionUser','*','*','ALLOW','ROLE','hr'),(448,'DeviceProduction','*','*','ALLOW','ROLE','productionAssi'),(449,'DeviceProductionModels','*','*','ALLOW','ROLE','productionAssi'),(450,'DeviceProductionState','*','*','ALLOW','ROLE','productionAssi'),(451,'DeviceProductionUser','*','*','ALLOW','ROLE','productionAssi'),(452,'Worker','deallocatePDA','*','ALLOW','ROLE','hr'),(453,'Worker','allocatePDA','*','ALLOW','ROLE','hr'),(454,'Worker','deallocatePDA','*','ALLOW','ROLE','productionAssi'),(455,'Worker','allocatePDA','*','ALLOW','ROLE','productionAssi'),(456,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(457,'Account','setPassword','WRITE','ALLOW','ROLE','itManagement'),(458,'Operator','*','READ','ALLOW','ROLE','employee'),(459,'Operator','*','WRITE','ALLOW','ROLE','employee'),(460,'InvoiceIn','getSerial','READ','ALLOW','ROLE','administrative'),(461,'Ticket','saveSign','WRITE','ALLOW','ROLE','employee'),(462,'InvoiceOut','negativeBases','READ','ALLOW','ROLE','administrative'),(463,'InvoiceOut','negativeBasesCsv','READ','ALLOW','ROLE','administrative'),(464,'WorkerObservation','*','*','ALLOW','ROLE','hr'),(465,'ClientInforma','*','READ','ALLOW','ROLE','employee'),(466,'ClientInforma','*','WRITE','ALLOW','ROLE','financial'),(467,'Receipt','receiptEmail','*','ALLOW','ROLE','salesAssistant'),(468,'Client','setRating','WRITE','ALLOW','ROLE','financial'),(469,'Client','*','READ','ALLOW','ROLE','employee'),(470,'Client','addressesPropagateRe','*','ALLOW','ROLE','employee'),(471,'Client','canBeInvoiced','*','ALLOW','ROLE','employee'),(472,'Client','canCreateTicket','*','ALLOW','ROLE','employee'),(473,'Client','consumption','*','ALLOW','ROLE','employee'),(474,'Client','createAddress','*','ALLOW','ROLE','employee'),(475,'Client','createWithUser','*','ALLOW','ROLE','employee'),(476,'Client','extendedListFilter','*','ALLOW','ROLE','employee'),(477,'Client','getAverageInvoiced','*','ALLOW','ROLE','employee'),(478,'Client','getCard','*','ALLOW','ROLE','employee'),(479,'Client','getDebt','*','ALLOW','ROLE','employee'),(480,'Client','getMana','*','ALLOW','ROLE','employee'),(481,'Client','transactions','*','ALLOW','ROLE','employee'),(482,'Client','hasCustomerRole','*','ALLOW','ROLE','employee'),(483,'Client','isValidClient','*','ALLOW','ROLE','employee'),(484,'Client','lastActiveTickets','*','ALLOW','ROLE','employee'),(485,'Client','sendSms','*','ALLOW','ROLE','employee'),(486,'Client','setPassword','*','ALLOW','ROLE','employee'),(487,'Client','summary','*','ALLOW','ROLE','employee'),(488,'Client','updateAddress','*','ALLOW','ROLE','employee'),(489,'Client','updateFiscalData','*','ALLOW','ROLE','employee'),(491,'Client','uploadFile','*','ALLOW','ROLE','employee'),(492,'Client','campaignMetricsPdf','*','ALLOW','ROLE','employee'),(493,'Client','campaignMetricsEmail','*','ALLOW','ROLE','employee'),(494,'Client','clientWelcomeHtml','*','ALLOW','ROLE','employee'),(495,'Client','clientWelcomeEmail','*','ALLOW','ROLE','employee'),(496,'Client','printerSetupHtml','*','ALLOW','ROLE','employee'),(497,'Client','printerSetupEmail','*','ALLOW','ROLE','employee'),(498,'Client','sepaCoreEmail','*','ALLOW','ROLE','employee'),(499,'Client','letterDebtorPdf','*','ALLOW','ROLE','employee'),(500,'Client','letterDebtorStHtml','*','ALLOW','ROLE','employee'),(501,'Client','letterDebtorStEmail','*','ALLOW','ROLE','employee'),(502,'Client','letterDebtorNdHtml','*','ALLOW','ROLE','employee'),(503,'Client','letterDebtorNdEmail','*','ALLOW','ROLE','employee'),(504,'Client','clientDebtStatementPdf','*','ALLOW','ROLE','employee'),(505,'Client','clientDebtStatementHtml','*','ALLOW','ROLE','employee'),(506,'Client','clientDebtStatementEmail','*','ALLOW','ROLE','employee'),(507,'Client','creditRequestPdf','*','ALLOW','ROLE','employee'),(508,'Client','creditRequestHtml','*','ALLOW','ROLE','employee'),(509,'Client','creditRequestEmail','*','ALLOW','ROLE','employee'),(510,'Client','incotermsAuthorizationPdf','*','ALLOW','ROLE','employee'),(511,'Client','incotermsAuthorizationHtml','*','ALLOW','ROLE','employee'),(512,'Client','incotermsAuthorizationEmail','*','ALLOW','ROLE','employee'),(513,'Client','consumptionSendQueued','*','ALLOW','ROLE','employee'),(514,'Client','filter','*','ALLOW','ROLE','employee'),(515,'Client','getClientOrSupplierReference','*','ALLOW','ROLE','employee'),(516,'Client','upsert','*','ALLOW','ROLE','employee'),(517,'Client','create','*','ALLOW','ROLE','employee'),(518,'Client','replaceById','*','ALLOW','ROLE','employee'),(519,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(520,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(521,'Client','deleteById','*','ALLOW','ROLE','employee'),(522,'Client','replaceOrCreate','*','ALLOW','ROLE','employee'),(523,'Client','updateAll','*','ALLOW','ROLE','employee'),(524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'),(525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'),(527,'VnUser','acl','READ','ALLOW','ROLE','account'),(528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'),(530,'Account','exists','READ','ALLOW','ROLE','account'),(531,'Account','exists','READ','ALLOW','ROLE','account'),(532,'UserLog','*','READ','ALLOW','ROLE','employee'),(533,'RoleLog','*','READ','ALLOW','ROLE','employee'),(534,'WagonType','*','*','ALLOW','ROLE','productionAssi'),(535,'WagonTypeColor','*','*','ALLOW','ROLE','productionAssi'),(536,'WagonTypeTray','*','*','ALLOW','ROLE','productionAssi'),(537,'WagonConfig','*','*','ALLOW','ROLE','productionAssi'),(538,'CollectionWagon','*','*','ALLOW','ROLE','productionAssi'),(539,'CollectionWagonTicket','*','*','ALLOW','ROLE','productionAssi'),(540,'Wagon','*','*','ALLOW','ROLE','productionAssi'),(541,'WagonType','createWagonType','*','ALLOW','ROLE','productionAssi'),(542,'WagonType','deleteWagonType','*','ALLOW','ROLE','productionAssi'),(543,'WagonType','editWagonType','*','ALLOW','ROLE','productionAssi'),(544,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(545,'Agency','find','READ','ALLOW','ROLE','employee'),(546,'Agency','seeExpired','READ','ALLOW','ROLE','coolerAssist'),(547,'WorkerLog','models','READ','ALLOW','ROLE','hr'),(548,'Ticket','editDiscount','WRITE','ALLOW','ROLE','claimManager'),(549,'Ticket','editDiscount','WRITE','ALLOW','ROLE','salesPerson'),(550,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','salesAssistant'),(551,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','deliveryBoss'),(552,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','buyer'),(553,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','claimManager'),(554,'Ticket','deleteTicketWithPartPrepared','WRITE','ALLOW','ROLE','salesAssistant'),(555,'Ticket','editZone','WRITE','ALLOW','ROLE','deliveryBoss'),(556,'State','editableStates','READ','ALLOW','ROLE','employee'),(557,'State','seeEditableStates','READ','ALLOW','ROLE','administrative'),(558,'State','seeEditableStates','READ','ALLOW','ROLE','production'),(559,'State','isSomeEditable','READ','ALLOW','ROLE','salesPerson'),(560,'State','isAllEditable','READ','ALLOW','ROLE','production'),(561,'State','isAllEditable','READ','ALLOW','ROLE','administrative'),(562,'Agency','seeExpired','READ','ALLOW','ROLE','administrative'),(563,'Agency','seeExpired','READ','ALLOW','ROLE','productionBoss'),(564,'Claim','createAfterDeadline','WRITE','ALLOW','ROLE','claimManager'),(565,'Client','editAddressLogifloraAllowed','WRITE','ALLOW','ROLE','salesAssistant'),(566,'Client','editFiscalDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(567,'Client','editVerifiedDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(568,'Client','editCredit','WRITE','ALLOW','ROLE','financialBoss'),(569,'Client','zeroCreditEditor','WRITE','ALLOW','ROLE','financialBoss'),(570,'InvoiceOut','canCreatePdf','WRITE','ALLOW','ROLE','invoicing'),(571,'Supplier','editPayMethodCheck','WRITE','ALLOW','ROLE','financial'),(572,'Worker','isTeamBoss','WRITE','ALLOW','ROLE','teamBoss'),(573,'Worker','forceIsSubordinate','READ','ALLOW','ROLE','hr'),(574,'Claim','editState','WRITE','ALLOW','ROLE','claimManager'),(575,'Claim','find','READ','ALLOW','ROLE','salesPerson'),(576,'Claim','findById','READ','ALLOW','ROLE','salesPerson'),(577,'Claim','findOne','READ','ALLOW','ROLE','salesPerson'),(578,'Claim','getSummary','READ','ALLOW','ROLE','salesPerson'),(579,'Claim','updateClaim','WRITE','ALLOW','ROLE','salesPerson'),(580,'Claim','regularizeClaim','WRITE','ALLOW','ROLE','claimManager'),(581,'Claim','updateClaimDestination','WRITE','ALLOW','ROLE','claimManager'),(582,'Claim','downloadFile','READ','ALLOW','ROLE','claimManager'),(583,'Claim','deleteById','WRITE','ALLOW','ROLE','claimManager'),(584,'Claim','filter','READ','ALLOW','ROLE','salesPerson'),(585,'Claim','logs','READ','ALLOW','ROLE','claimManager'),(586,'Ticket','find','READ','ALLOW','ROLE','employee'),(587,'Ticket','findById','READ','ALLOW','ROLE','employee'),(588,'Ticket','findOne','READ','ALLOW','ROLE','employee'),(589,'Ticket','getVolume','READ','ALLOW','ROLE','employee'),(590,'Ticket','getTotalVolume','READ','ALLOW','ROLE','employee'),(591,'Ticket','summary','READ','ALLOW','ROLE','employee'),(592,'Ticket','priceDifference','READ','ALLOW','ROLE','employee'),(593,'Ticket','componentUpdate','WRITE','ALLOW','ROLE','employee'),(594,'Ticket','new','WRITE','ALLOW','ROLE','employee'),(595,'Ticket','isEditable','READ','ALLOW','ROLE','employee'),(596,'Ticket','setDeleted','WRITE','ALLOW','ROLE','salesPerson'),(597,'Ticket','restore','WRITE','ALLOW','ROLE','employee'),(598,'Ticket','getSales','READ','ALLOW','ROLE','employee'),(599,'Ticket','getSalesPersonMana','READ','ALLOW','ROLE','employee'),(600,'Ticket','filter','READ','ALLOW','ROLE','employee'),(601,'Ticket','makeInvoice','WRITE','ALLOW','ROLE','employee'),(602,'Ticket','updateEditableTicket','WRITE','ALLOW','ROLE','employee'),(603,'Ticket','updateDiscount','WRITE','ALLOW','ROLE','employee'),(604,'Ticket','transferSales','WRITE','ALLOW','ROLE','employee'),(605,'Ticket','sendSms','WRITE','ALLOW','ROLE','employee'),(606,'Ticket','isLocked','READ','ALLOW','ROLE','employee'),(607,'Ticket','freightCost','READ','ALLOW','ROLE','employee'),(608,'Ticket','getComponentsSum','READ','ALLOW','ROLE','employee'),(609,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','delivery'),(610,'Ticket','deliveryNoteCsv','READ','ALLOW','ROLE','employee'),(611,'State','find','READ','ALLOW','ROLE','employee'),(612,'State','findById','READ','ALLOW','ROLE','employee'),(613,'State','findOne','READ','ALLOW','ROLE','employee'),(614,'Worker','find','READ','ALLOW','ROLE','employee'),(615,'Worker','findById','READ','ALLOW','ROLE','employee'),(616,'Worker','findOne','READ','ALLOW','ROLE','employee'),(617,'Worker','filter','READ','ALLOW','ROLE','employee'),(618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee'),(619,'Worker','active','READ','ALLOW','ROLE','employee'),(620,'Worker','activeWithRole','READ','ALLOW','ROLE','employee'),(621,'Worker','uploadFile','WRITE','ALLOW','ROLE','hr'),(622,'Worker','contracts','READ','ALLOW','ROLE','employee'),(623,'Worker','holidays','READ','ALLOW','ROLE','employee'),(624,'Worker','activeContract','READ','ALLOW','ROLE','employee'),(625,'Worker','activeWithInheritedRole','READ','ALLOW','ROLE','employee'),(626,'Ticket','collectionLabel','READ','ALLOW','ROLE','employee'),(628,'Ticket','expeditionPalletLabel','READ','ALLOW','ROLE','employee'),(629,'Ticket','editDiscount','WRITE','ALLOW','ROLE','artificialBoss'),(630,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesTeamBoss'),(635,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','administrative'),(636,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesPerson'),(637,'Claim','downloadFile','READ','ALLOW','ROLE','salesPerson'),(638,'Agency','seeExpired','READ','ALLOW','ROLE','artificialBoss'),(639,'Agency','seeExpired','READ','ALLOW','ROLE','logisticAssistant'),(640,'Claim','filter','READ','ALLOW','ROLE','buyer'),(641,'Claim','find','READ','ALLOW','ROLE','buyer'),(642,'Claim','findById','READ','ALLOW','ROLE','buyer'),(643,'Claim','getSummary','READ','ALLOW','ROLE','buyer'),(644,'Claim','filter','READ','ALLOW','ROLE','handmadeBoss'),(645,'Claim','find','READ','ALLOW','ROLE','handmadeBoss'),(646,'Claim','findById','READ','ALLOW','ROLE','handmadeBoss'),(647,'Claim','getSummary','READ','ALLOW','ROLE','handmadeBoss'),(648,'Claim','__get__lines','READ','ALLOW','ROLE','claimManager'),(649,'Claim','__get__lines','READ','ALLOW','ROLE','salesPerson'),(650,'Claim','getSummary','READ','ALLOW','ROLE','deliveryBoss'),(651,'Claim','findById','READ','ALLOW','ROLE','deliveryBoss'),(652,'Claim','find','READ','ALLOW','ROLE','deliveryBoss'),(653,'Claim','filter','READ','ALLOW','ROLE','deliveryBoss'),(654,'Ticket','editZone','WRITE','ALLOW','ROLE','logisticAssistant'),(655,'Entry','addFromPackaging','WRITE','ALLOW','ROLE','production'),(656,'Entry','addFromBuy','WRITE','ALLOW','ROLE','production'),(657,'Supplier','getItemsPackaging','READ','ALLOW','ROLE','production'),(658,'Ticket','closeAll','WRITE','ALLOW','ROLE','system'),(659,'Account','*','*','ALLOW','ROLE','itManagement'),(660,'Account','*','READ','ALLOW','ROLE','employee'),(664,'MailForward','*','*','ALLOW','ROLE','itManagement'),(665,'Role','*','READ','ALLOW','ROLE','employee'),(666,'Role','*','WRITE','ALLOW','ROLE','it'),(667,'VnUser','*','*','ALLOW','ROLE','itManagement'),(668,'VnUser','__get__preview','READ','ALLOW','ROLE','employee'),(669,'VnUser','preview','*','ALLOW','ROLE','employee'),(670,'VnUser','create','*','ALLOW','ROLE','itManagement'),(671,'VnUser','renewToken','WRITE','ALLOW','ROLE','employee'),(672,'PackingSiteAdvanced','*','*','ALLOW','ROLE','production'),(673,'InvoiceOut','makePdfAndNotify','WRITE','ALLOW','ROLE','invoicing'),(674,'InvoiceOutConfig','*','READ','ALLOW','ROLE','invoicing'),(676,'Ticket','invoiceTickets','WRITE','ALLOW','ROLE','employee'),(680,'MailAliasAccount','*','READ','ALLOW','ROLE','employee'),(681,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee'),(682,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee'),(683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','itManagement'),(684,'WorkerDisableExcluded','*','READ','ALLOW','ROLE','itManagement'),(685,'WorkerDisableExcluded','*','WRITE','ALLOW','ROLE','itManagement'),(686,'MailForward','*','*','ALLOW','ROLE','hr'),(687,'ClientSms','find','READ','ALLOW','ROLE','employee'),(688,'ClientSms','create','WRITE','ALLOW','ROLE','employee'),(689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee'),(690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss'),(691,'Roadmap','*','*','ALLOW','ROLE','productionBoss'),(692,'ExpeditionTruck','*','*','ALLOW','ROLE','palletizerBoss'),(693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss'),(694,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','marketingBoss'),(695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee'),(696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee'),(697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'),(698,'Ticket','canEditWeekly','WRITE','ALLOW','ROLE','buyer'),(699,'TicketSms','find','READ','ALLOW','ROLE','salesPerson'),(701,'Docuware','upload','WRITE','ALLOW','ROLE','deliveryBoss'),(702,'Ticket','docuwareDownload','READ','ALLOW','ROLE','salesPerson');
+INSERT INTO `ACL` VALUES (3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'Ticket','state','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','logisticBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryAssistant'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryAssistant'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','find','READ','ALLOW','ROLE','hr'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','READ','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(309,'Zone','getZoneClosing','*','ALLOW','ROLE','employee'),(310,'ExpeditionState','*','READ','ALLOW','ROLE','employee'),(311,'Expense','*','READ','ALLOW','ROLE','employee'),(312,'Expense','*','WRITE','ALLOW','ROLE','administrative'),(314,'SupplierActivity','*','READ','ALLOW','ROLE','employee'),(315,'SupplierActivity','*','WRITE','ALLOW','ROLE','administrative'),(316,'Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee'),(317,'ClientUnpaid','*','*','ALLOW','ROLE','administrative'),(318,'MdbVersion','*','*','ALLOW','ROLE','developer'),(319,'ItemType','*','READ','ALLOW','ROLE','employee'),(320,'ItemType','*','WRITE','ALLOW','ROLE','buyer'),(321,'InvoiceOut','refund','WRITE','ALLOW','ROLE','invoicing'),(322,'InvoiceOut','refund','WRITE','ALLOW','ROLE','salesAssistant'),(323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','claimManager'),(324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'),(325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'),(326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'),(327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'),(328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'),(329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'),(330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),(331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),(332,'Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),(333,'Client','updateUser','WRITE','ALLOW','ROLE','salesPerson'),(334,'ShelvingLog','*','READ','ALLOW','ROLE','employee'),(335,'ZoneExclusionGeo','*','READ','ALLOW','ROLE','employee'),(336,'ZoneExclusionGeo','*','WRITE','ALLOW','ROLE','deliveryAssistant'),(337,'Parking','*','*','ALLOW','ROLE','employee'),(338,'Shelving','*','*','ALLOW','ROLE','employee'),(339,'OsTicket','*','*','ALLOW','ROLE','employee'),(340,'OsTicketConfig','*','*','ALLOW','ROLE','it'),(341,'ClientConsumptionQueue','*','WRITE','ALLOW','ROLE','employee'),(342,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','employee'),(343,'Ticket','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(344,'Ticket','deliveryNoteCsvPdf','READ','ALLOW','ROLE','employee'),(345,'Ticket','deliveryNoteCsvEmail','READ','ALLOW','ROLE','employee'),(346,'Client','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(347,'Client','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(348,'Client','clientWelcomeHtml','READ','ALLOW','ROLE','employee'),(349,'Client','clientWelcomeEmail','WRITE','ALLOW','ROLE','employee'),(350,'Client','creditRequestPdf','READ','ALLOW','ROLE','employee'),(351,'Client','creditRequestHtml','READ','ALLOW','ROLE','employee'),(352,'Client','creditRequestEmail','WRITE','ALLOW','ROLE','employee'),(353,'Client','printerSetupHtml','READ','ALLOW','ROLE','employee'),(354,'Client','printerSetupEmail','WRITE','ALLOW','ROLE','employee'),(355,'Client','sepaCoreEmail','WRITE','ALLOW','ROLE','employee'),(356,'Client','letterDebtorPdf','READ','ALLOW','ROLE','employee'),(357,'Client','letterDebtorStHtml','READ','ALLOW','ROLE','employee'),(358,'Client','letterDebtorStEmail','WRITE','ALLOW','ROLE','employee'),(359,'Client','letterDebtorNdHtml','READ','ALLOW','ROLE','employee'),(360,'Client','letterDebtorNdEmail','WRITE','ALLOW','ROLE','employee'),(361,'Client','clientDebtStatementPdf','READ','ALLOW','ROLE','employee'),(362,'Client','clientDebtStatementHtml','READ','ALLOW','ROLE','employee'),(363,'Client','clientDebtStatementEmail','WRITE','ALLOW','ROLE','employee'),(364,'Client','incotermsAuthorizationPdf','READ','ALLOW','ROLE','employee'),(365,'Client','incotermsAuthorizationHtml','READ','ALLOW','ROLE','employee'),(366,'Client','incotermsAuthorizationEmail','WRITE','ALLOW','ROLE','employee'),(367,'Client','consumptionSendQueued','WRITE','ALLOW','ROLE','system'),(368,'InvoiceOut','invoiceEmail','WRITE','ALLOW','ROLE','employee'),(369,'InvoiceOut','exportationPdf','READ','ALLOW','ROLE','employee'),(370,'InvoiceOut','sendQueued','WRITE','ALLOW','ROLE','system'),(371,'Ticket','invoiceCsvPdf','READ','ALLOW','ROLE','employee'),(372,'Ticket','invoiceCsvEmail','WRITE','ALLOW','ROLE','employee'),(373,'Supplier','campaignMetricsPdf','READ','ALLOW','ROLE','employee'),(374,'Supplier','campaignMetricsEmail','WRITE','ALLOW','ROLE','employee'),(375,'Travel','extraCommunityPdf','READ','ALLOW','ROLE','employee'),(376,'Travel','extraCommunityEmail','WRITE','ALLOW','ROLE','employee'),(377,'Entry','entryOrderPdf','READ','ALLOW','ROLE','employee'),(378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','ROLE','system'),(379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system'),(380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee'),(381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager'),(382,'Item','labelPdf','READ','ALLOW','ROLE','employee'),(383,'Sector','*','READ','ALLOW','ROLE','employee'),(384,'Sector','*','WRITE','ALLOW','ROLE','employee'),(385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee'),(386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'),(387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'),(388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'),(389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'),(390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'),(391,'Notification','*','WRITE','ALLOW','ROLE','system'),(392,'Boxing','*','*','ALLOW','ROLE','employee'),(393,'Url','*','READ','ALLOW','ROLE','employee'),(394,'Url','*','WRITE','ALLOW','ROLE','it'),(395,'ItemShelving','*','READ','ALLOW','ROLE','employee'),(396,'ItemShelving','*','WRITE','ALLOW','ROLE','production'),(397,'ItemShelvingPlacementSupplyStock','*','READ','ALLOW','ROLE','employee'),(398,'NotificationQueue','*','*','ALLOW','ROLE','employee'),(399,'InvoiceOut','clientsToInvoice','WRITE','ALLOW','ROLE','invoicing'),(400,'InvoiceOut','invoiceClient','WRITE','ALLOW','ROLE','invoicing'),(401,'Sale','editTracked','WRITE','ALLOW','ROLE','production'),(402,'Sale','editFloramondo','WRITE','ALLOW','ROLE','salesAssistant'),(403,'Receipt','balanceCompensationEmail','WRITE','ALLOW','ROLE','employee'),(404,'Receipt','balanceCompensationPdf','READ','ALLOW','ROLE','employee'),(405,'Ticket','getTicketsFuture','READ','ALLOW','ROLE','employee'),(406,'Ticket','merge','WRITE','ALLOW','ROLE','employee'),(407,'Sale','editFloramondo','WRITE','ALLOW','ROLE','logistic'),(408,'ZipConfig','*','*','ALLOW','ROLE','employee'),(409,'Item','*','WRITE','ALLOW','ROLE','administrative'),(410,'Sale','editCloned','WRITE','ALLOW','ROLE','buyer'),(411,'Sale','editCloned','WRITE','ALLOW','ROLE','salesAssistant'),(414,'MdbVersion','*','READ','ALLOW','ROLE','$everyone'),(416,'TicketLog','getChanges','READ','ALLOW','ROLE','employee'),(417,'Ticket','getTicketsAdvance','READ','ALLOW','ROLE','employee'),(418,'EntryLog','*','READ','ALLOW','ROLE','administrative'),(419,'Sale','editTracked','WRITE','ALLOW','ROLE','buyer'),(420,'MdbBranch','*','READ','ALLOW','ROLE','$everyone'),(421,'ItemShelvingSale','*','*','ALLOW','ROLE','employee'),(422,'Docuware','checkFile','READ','ALLOW','ROLE','employee'),(423,'Docuware','download','READ','ALLOW','ROLE','salesPerson'),(424,'Docuware','upload','WRITE','ALLOW','ROLE','productionAssi'),(425,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','salesPerson'),(426,'TpvTransaction','confirm','WRITE','ALLOW','ROLE','$everyone'),(427,'TpvTransaction','start','WRITE','ALLOW','ROLE','$authenticated'),(428,'TpvTransaction','end','WRITE','ALLOW','ROLE','$authenticated'),(429,'ItemConfig','*','READ','ALLOW','ROLE','employee'),(431,'Tag','onSubmit','WRITE','ALLOW','ROLE','employee'),(432,'Worker','updateAttributes','WRITE','ALLOW','ROLE','hr'),(433,'Worker','createAbsence','*','ALLOW','ROLE','employee'),(434,'Worker','updateAbsence','WRITE','ALLOW','ROLE','employee'),(435,'Worker','deleteAbsence','*','ALLOW','ROLE','employee'),(436,'Worker','new','WRITE','ALLOW','ROLE','hr'),(438,'Client','getClientOrSupplierReference','READ','ALLOW','ROLE','employee'),(439,'NotificationSubscription','*','*','ALLOW','ROLE','employee'),(440,'NotificationAcl','*','READ','ALLOW','ROLE','employee'),(441,'MdbApp','*','READ','ALLOW','ROLE','$everyone'),(442,'MdbApp','*','*','ALLOW','ROLE','developer'),(443,'ItemConfig','*','*','ALLOW','ROLE','employee'),(444,'DeviceProduction','*','*','ALLOW','ROLE','hr'),(445,'DeviceProductionModels','*','*','ALLOW','ROLE','hr'),(446,'DeviceProductionState','*','*','ALLOW','ROLE','hr'),(447,'DeviceProductionUser','*','*','ALLOW','ROLE','hr'),(448,'DeviceProduction','*','*','ALLOW','ROLE','productionAssi'),(449,'DeviceProductionModels','*','*','ALLOW','ROLE','productionAssi'),(450,'DeviceProductionState','*','*','ALLOW','ROLE','productionAssi'),(451,'DeviceProductionUser','*','*','ALLOW','ROLE','productionAssi'),(452,'Worker','deallocatePDA','*','ALLOW','ROLE','hr'),(453,'Worker','allocatePDA','*','ALLOW','ROLE','hr'),(454,'Worker','deallocatePDA','*','ALLOW','ROLE','productionAssi'),(455,'Worker','allocatePDA','*','ALLOW','ROLE','productionAssi'),(456,'Zone','*','*','ALLOW','ROLE','deliveryAssistant'),(458,'Operator','*','READ','ALLOW','ROLE','employee'),(459,'Operator','*','WRITE','ALLOW','ROLE','employee'),(460,'InvoiceIn','getSerial','READ','ALLOW','ROLE','administrative'),(461,'Ticket','saveSign','WRITE','ALLOW','ROLE','employee'),(462,'InvoiceOut','negativeBases','READ','ALLOW','ROLE','administrative'),(463,'InvoiceOut','negativeBasesCsv','READ','ALLOW','ROLE','administrative'),(464,'WorkerObservation','*','*','ALLOW','ROLE','hr'),(465,'ClientInforma','*','READ','ALLOW','ROLE','employee'),(466,'ClientInforma','*','WRITE','ALLOW','ROLE','financial'),(467,'Receipt','receiptEmail','*','ALLOW','ROLE','salesAssistant'),(468,'Client','setRating','WRITE','ALLOW','ROLE','financial'),(470,'Client','addressesPropagateRe','*','ALLOW','ROLE','employee'),(471,'Client','canBeInvoiced','*','ALLOW','ROLE','employee'),(472,'Client','canCreateTicket','*','ALLOW','ROLE','employee'),(473,'Client','consumption','*','ALLOW','ROLE','employee'),(474,'Client','createAddress','*','ALLOW','ROLE','employee'),(475,'Client','createWithUser','*','ALLOW','ROLE','employee'),(476,'Client','extendedListFilter','*','ALLOW','ROLE','employee'),(477,'Client','getAverageInvoiced','*','ALLOW','ROLE','employee'),(478,'Client','getCard','*','ALLOW','ROLE','employee'),(479,'Client','getDebt','*','ALLOW','ROLE','employee'),(480,'Client','getMana','*','ALLOW','ROLE','employee'),(481,'Client','transactions','*','ALLOW','ROLE','employee'),(482,'Client','hasCustomerRole','*','ALLOW','ROLE','employee'),(483,'Client','isValidClient','*','ALLOW','ROLE','employee'),(484,'Client','lastActiveTickets','*','ALLOW','ROLE','employee'),(485,'Client','sendSms','*','ALLOW','ROLE','employee'),(486,'Client','setPassword','*','ALLOW','ROLE','employee'),(487,'Client','summary','*','ALLOW','ROLE','employee'),(488,'Client','updateAddress','*','ALLOW','ROLE','employee'),(489,'Client','updateFiscalData','*','ALLOW','ROLE','employee'),(491,'Client','uploadFile','*','ALLOW','ROLE','employee'),(492,'Client','campaignMetricsPdf','*','ALLOW','ROLE','employee'),(493,'Client','campaignMetricsEmail','*','ALLOW','ROLE','employee'),(494,'Client','clientWelcomeHtml','*','ALLOW','ROLE','employee'),(495,'Client','clientWelcomeEmail','*','ALLOW','ROLE','employee'),(496,'Client','printerSetupHtml','*','ALLOW','ROLE','employee'),(497,'Client','printerSetupEmail','*','ALLOW','ROLE','employee'),(498,'Client','sepaCoreEmail','*','ALLOW','ROLE','employee'),(499,'Client','letterDebtorPdf','*','ALLOW','ROLE','employee'),(500,'Client','letterDebtorStHtml','*','ALLOW','ROLE','employee'),(501,'Client','letterDebtorStEmail','*','ALLOW','ROLE','employee'),(502,'Client','letterDebtorNdHtml','*','ALLOW','ROLE','employee'),(503,'Client','letterDebtorNdEmail','*','ALLOW','ROLE','employee'),(504,'Client','clientDebtStatementPdf','*','ALLOW','ROLE','employee'),(505,'Client','clientDebtStatementHtml','*','ALLOW','ROLE','employee'),(506,'Client','clientDebtStatementEmail','*','ALLOW','ROLE','employee'),(507,'Client','creditRequestPdf','*','ALLOW','ROLE','employee'),(508,'Client','creditRequestHtml','*','ALLOW','ROLE','employee'),(509,'Client','creditRequestEmail','*','ALLOW','ROLE','employee'),(510,'Client','incotermsAuthorizationPdf','*','ALLOW','ROLE','employee'),(511,'Client','incotermsAuthorizationHtml','*','ALLOW','ROLE','employee'),(512,'Client','incotermsAuthorizationEmail','*','ALLOW','ROLE','employee'),(513,'Client','consumptionSendQueued','*','ALLOW','ROLE','employee'),(514,'Client','filter','*','ALLOW','ROLE','employee'),(515,'Client','getClientOrSupplierReference','*','ALLOW','ROLE','employee'),(516,'Client','upsert','*','ALLOW','ROLE','employee'),(518,'Client','replaceById','*','ALLOW','ROLE','employee'),(519,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(520,'Client','updateAttributes','*','ALLOW','ROLE','employee'),(521,'Client','deleteById','*','ALLOW','ROLE','employee'),(522,'Client','replaceOrCreate','*','ALLOW','ROLE','employee'),(523,'Client','updateAll','*','ALLOW','ROLE','employee'),(524,'Client','upsertWithWhere','*','ALLOW','ROLE','employee'),(525,'Defaulter','observationEmail','WRITE','ALLOW','ROLE','employee'),(527,'VnUser','acl','READ','ALLOW','ROLE','account'),(528,'VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'),(530,'Account','exists','READ','ALLOW','ROLE','account'),(531,'Account','exists','READ','ALLOW','ROLE','account'),(532,'UserLog','*','READ','ALLOW','ROLE','employee'),(533,'RoleLog','*','READ','ALLOW','ROLE','employee'),(534,'WagonType','*','*','ALLOW','ROLE','productionAssi'),(535,'WagonTypeColor','*','*','ALLOW','ROLE','productionAssi'),(536,'WagonTypeTray','*','*','ALLOW','ROLE','productionAssi'),(537,'WagonConfig','*','*','ALLOW','ROLE','productionAssi'),(538,'CollectionWagon','*','*','ALLOW','ROLE','productionAssi'),(539,'CollectionWagonTicket','*','*','ALLOW','ROLE','productionAssi'),(540,'Wagon','*','*','ALLOW','ROLE','productionAssi'),(541,'WagonType','createWagonType','*','ALLOW','ROLE','productionAssi'),(542,'WagonType','deleteWagonType','*','ALLOW','ROLE','productionAssi'),(543,'WagonType','editWagonType','*','ALLOW','ROLE','productionAssi'),(544,'Docuware','deliveryNoteEmail','WRITE','ALLOW','ROLE','employee'),(545,'Agency','find','READ','ALLOW','ROLE','employee'),(546,'Agency','seeExpired','READ','ALLOW','ROLE','coolerAssist'),(547,'WorkerLog','models','READ','ALLOW','ROLE','hr'),(548,'Ticket','editDiscount','WRITE','ALLOW','ROLE','claimManager'),(549,'Ticket','editDiscount','WRITE','ALLOW','ROLE','salesPerson'),(550,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','salesAssistant'),(551,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','deliveryAssistant'),(552,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','buyer'),(553,'Ticket','isRoleAdvanced','*','ALLOW','ROLE','claimManager'),(554,'Ticket','deleteTicketWithPartPrepared','WRITE','ALLOW','ROLE','salesAssistant'),(555,'Ticket','editZone','WRITE','ALLOW','ROLE','deliveryAssistant'),(556,'State','editableStates','READ','ALLOW','ROLE','employee'),(557,'State','seeEditableStates','READ','ALLOW','ROLE','administrative'),(558,'State','seeEditableStates','READ','ALLOW','ROLE','production'),(559,'State','isSomeEditable','READ','ALLOW','ROLE','salesPerson'),(560,'State','isAllEditable','READ','ALLOW','ROLE','production'),(561,'State','isAllEditable','READ','ALLOW','ROLE','administrative'),(562,'Agency','seeExpired','READ','ALLOW','ROLE','administrative'),(563,'Agency','seeExpired','READ','ALLOW','ROLE','productionBoss'),(564,'Claim','createAfterDeadline','WRITE','ALLOW','ROLE','claimManager'),(565,'Client','editAddressLogifloraAllowed','WRITE','ALLOW','ROLE','salesAssistant'),(566,'Client','editFiscalDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(567,'Client','editVerifiedDataWithoutTaxDataCheck','WRITE','ALLOW','ROLE','salesAssistant'),(568,'Client','editCredit','WRITE','ALLOW','ROLE','financialBoss'),(569,'Client','zeroCreditEditor','WRITE','ALLOW','ROLE','financialBoss'),(570,'InvoiceOut','canCreatePdf','WRITE','ALLOW','ROLE','invoicing'),(571,'Supplier','editPayMethodCheck','WRITE','ALLOW','ROLE','financial'),(572,'Worker','isTeamBoss','WRITE','ALLOW','ROLE','teamBoss'),(573,'Worker','forceIsSubordinate','READ','ALLOW','ROLE','hr'),(574,'Claim','editState','WRITE','ALLOW','ROLE','claimManager'),(577,'Claim','findOne','READ','ALLOW','ROLE','salesPerson'),(579,'Claim','updateClaim','WRITE','ALLOW','ROLE','salesPerson'),(580,'Claim','regularizeClaim','WRITE','ALLOW','ROLE','claimManager'),(581,'Claim','updateClaimDestination','WRITE','ALLOW','ROLE','claimManager'),(582,'Claim','downloadFile','READ','ALLOW','ROLE','claimManager'),(583,'Claim','deleteById','WRITE','ALLOW','ROLE','claimManager'),(585,'Claim','logs','READ','ALLOW','ROLE','claimManager'),(586,'Ticket','find','READ','ALLOW','ROLE','employee'),(587,'Ticket','findById','READ','ALLOW','ROLE','employee'),(588,'Ticket','findOne','READ','ALLOW','ROLE','employee'),(589,'Ticket','getVolume','READ','ALLOW','ROLE','employee'),(590,'Ticket','getTotalVolume','READ','ALLOW','ROLE','employee'),(591,'Ticket','summary','READ','ALLOW','ROLE','employee'),(592,'Ticket','priceDifference','READ','ALLOW','ROLE','employee'),(593,'Ticket','componentUpdate','WRITE','ALLOW','ROLE','employee'),(594,'Ticket','new','WRITE','ALLOW','ROLE','employee'),(595,'Ticket','isEditable','READ','ALLOW','ROLE','employee'),(596,'Ticket','setDeleted','WRITE','ALLOW','ROLE','salesPerson'),(597,'Ticket','restore','WRITE','ALLOW','ROLE','employee'),(598,'Ticket','getSales','READ','ALLOW','ROLE','employee'),(599,'Ticket','getSalesPersonMana','READ','ALLOW','ROLE','employee'),(600,'Ticket','filter','READ','ALLOW','ROLE','employee'),(601,'Ticket','makeInvoice','WRITE','ALLOW','ROLE','employee'),(602,'Ticket','updateEditableTicket','WRITE','ALLOW','ROLE','employee'),(603,'Ticket','updateDiscount','WRITE','ALLOW','ROLE','employee'),(604,'Ticket','transferSales','WRITE','ALLOW','ROLE','employee'),(605,'Ticket','sendSms','WRITE','ALLOW','ROLE','employee'),(606,'Ticket','isLocked','READ','ALLOW','ROLE','employee'),(607,'Ticket','freightCost','READ','ALLOW','ROLE','employee'),(608,'Ticket','getComponentsSum','READ','ALLOW','ROLE','employee'),(609,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','delivery'),(610,'Ticket','deliveryNoteCsv','READ','ALLOW','ROLE','employee'),(611,'State','find','READ','ALLOW','ROLE','employee'),(612,'State','findById','READ','ALLOW','ROLE','employee'),(613,'State','findOne','READ','ALLOW','ROLE','employee'),(614,'Worker','find','READ','ALLOW','ROLE','employee'),(615,'Worker','findById','READ','ALLOW','ROLE','employee'),(616,'Worker','findOne','READ','ALLOW','ROLE','employee'),(617,'Worker','filter','READ','ALLOW','ROLE','employee'),(618,'Worker','getWorkedHours','READ','ALLOW','ROLE','employee'),(619,'Worker','active','READ','ALLOW','ROLE','employee'),(620,'Worker','activeWithRole','READ','ALLOW','ROLE','employee'),(621,'Worker','uploadFile','WRITE','ALLOW','ROLE','hr'),(622,'Worker','contracts','READ','ALLOW','ROLE','employee'),(623,'Worker','holidays','READ','ALLOW','ROLE','employee'),(624,'Worker','activeContract','READ','ALLOW','ROLE','employee'),(625,'Worker','activeWithInheritedRole','READ','ALLOW','ROLE','employee'),(626,'Ticket','collectionLabel','READ','ALLOW','ROLE','employee'),(628,'Ticket','expeditionPalletLabel','READ','ALLOW','ROLE','employee'),(629,'Ticket','editDiscount','WRITE','ALLOW','ROLE','artificialBoss'),(630,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesTeamBoss'),(635,'Ticket','updateAttributes','WRITE','ALLOW','ROLE','administrative'),(636,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','salesPerson'),(637,'Claim','downloadFile','READ','ALLOW','ROLE','salesPerson'),(638,'Agency','seeExpired','READ','ALLOW','ROLE','artificialBoss'),(639,'Agency','seeExpired','READ','ALLOW','ROLE','logisticAssistant'),(654,'Ticket','editZone','WRITE','ALLOW','ROLE','logisticAssistant'),(655,'Entry','addFromPackaging','WRITE','ALLOW','ROLE','production'),(656,'Entry','addFromBuy','WRITE','ALLOW','ROLE','production'),(657,'Supplier','getItemsPackaging','READ','ALLOW','ROLE','production'),(658,'Ticket','closeAll','WRITE','ALLOW','ROLE','system'),(659,'Account','*','*','ALLOW','ROLE','developerBoss'),(664,'MailForward','*','*','ALLOW','ROLE','itManagement'),(665,'Role','*','READ','ALLOW','ROLE','employee'),(666,'Role','*','WRITE','ALLOW','ROLE','it'),(667,'VnUser','*','*','ALLOW','ROLE','itManagement'),(668,'VnUser','__get__preview','READ','ALLOW','ROLE','employee'),(669,'VnUser','preview','*','ALLOW','ROLE','employee'),(670,'VnUser','create','*','ALLOW','ROLE','itManagement'),(671,'VnUser','renewToken','WRITE','ALLOW','ROLE','employee'),(672,'PackingSiteAdvanced','*','*','ALLOW','ROLE','production'),(673,'InvoiceOut','makePdfAndNotify','WRITE','ALLOW','ROLE','invoicing'),(674,'InvoiceOutConfig','*','READ','ALLOW','ROLE','invoicing'),(676,'Ticket','invoiceTickets','WRITE','ALLOW','ROLE','employee'),(680,'MailAliasAccount','*','READ','ALLOW','ROLE','employee'),(681,'MailAliasAccount','create','WRITE','ALLOW','ROLE','employee'),(682,'MailAliasAccount','deleteById','WRITE','ALLOW','ROLE','employee'),(683,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','itManagement'),(684,'WorkerDisableExcluded','*','READ','ALLOW','ROLE','itManagement'),(685,'WorkerDisableExcluded','*','WRITE','ALLOW','ROLE','itManagement'),(686,'MailForward','*','*','ALLOW','ROLE','hr'),(687,'ClientSms','find','READ','ALLOW','ROLE','employee'),(688,'ClientSms','create','WRITE','ALLOW','ROLE','employee'),(689,'Vehicle','sorted','WRITE','ALLOW','ROLE','employee'),(690,'Roadmap','*','*','ALLOW','ROLE','palletizerBoss'),(691,'Roadmap','*','*','ALLOW','ROLE','productionBoss'),(692,'ExpeditionTruck','*','*','ALLOW','ROLE','palletizerBoss'),(693,'ExpeditionTruck','*','*','ALLOW','ROLE','productionBoss'),(694,'MailAliasAccount','canEditAlias','WRITE','ALLOW','ROLE','marketingBoss'),(695,'ViaexpressConfig','internationalExpedition','WRITE','ALLOW','ROLE','employee'),(696,'ViaexpressConfig','renderer','READ','ALLOW','ROLE','employee'),(697,'Ticket','transferClient','WRITE','ALLOW','ROLE','administrative'),(698,'Ticket','canEditWeekly','WRITE','ALLOW','ROLE','buyer'),(699,'TicketSms','find','READ','ALLOW','ROLE','salesPerson'),(701,'Docuware','upload','WRITE','ALLOW','ROLE','deliveryAssistant'),(702,'Ticket','docuwareDownload','READ','ALLOW','ROLE','salesPerson'),(703,'Worker','search','READ','ALLOW','ROLE','employee'),(704,'ExpeditionState','addExpeditionState','WRITE','ALLOW','ROLE','delivery'),(705,'SaleGroupDetail','deleteById','WRITE','ALLOW','ROLE','employee'),(706,'Ticket','setDeleted','WRITE','ALLOW','ROLE','buyer'),(707,'DeviceLog','create','WRITE','ALLOW','ROLE','employee'),(708,'Collection','getTickets','WRITE','ALLOW','ROLE','employee'),(709,'Client','findOne','READ','ALLOW','ROLE','employee'),(710,'Client','findById','READ','ALLOW','ROLE','employee'),(711,'Client','find','READ','ALLOW','ROLE','employee'),(712,'Client','exists','READ','ALLOW','ROLE','employee'),(713,'Client','__get__addresses','READ','ALLOW','ROLE','employee'),(714,'ExpeditionMistakeType','*','READ','ALLOW','ROLE','employee'),(715,'WorkerMistakeType','*','READ','ALLOW','ROLE','employee'),(716,'ExpeditionMistake','*','WRITE','ALLOW','ROLE','employee'),(717,'WorkerMistake','*','WRITE','ALLOW','ROLE','coolerBoss'),(718,'MistakesTypes','*','WRITE','ALLOW','ROLE','coolerBoss'),(719,'MistakeType','*','READ','ALLOW','ROLE','employee'),(720,'MachineWorker','*','READ','ALLOW','ROLE','coolerAssist'),(721,'Printer','*','READ','ALLOW','ROLE','employee'),(722,'SaleMistake','*','WRITE','ALLOW','ROLE','production'),(723,'Item','setVisibleDiscard','WRITE','ALLOW','ROLE','employee'),(724,'Address','getAddress','READ','ALLOW','ROLE','employee'),(725,'Account','findOne','READ','ALLOW','ROLE','employee'),(726,'Account','findById','READ','ALLOW','ROLE','employee'),(727,'Account','find','READ','ALLOW','ROLE','employee'),(728,'Account','exists','READ','ALLOW','ROLE','employee'),(729,'Sale','refund','WRITE','ALLOW','ROLE','buyer'),(730,'Ticket','setDeleted','WRITE','ALLOW','ROLE','deliveryAssistant'),(732,'Sale','isInPreparing','*','ALLOW','ROLE','production'),(733,'Train','*','READ','ALLOW','ROLE','production'),(734,'WorkerDepartment','*','*','ALLOW','ROLE','employee'),(735,'VnUser','higherPrivileges','*','ALLOW','ROLE','itManagement'),(736,'VnUser','mediumPrivileges','*','ALLOW','ROLE','hr'),(737,'VnUser','updateUser','*','ALLOW','ROLE','employee'),(738,'TicketCollection','*','WRITE','ALLOW','ROLE','production'),(739,'Worker','setPassword','*','ALLOW','ROLE','employee'),(740,'Url','getByUser','READ','ALLOW','ROLE','$everyone'),(741,'Claim','__get__lines','READ','ALLOW','ROLE','claimViewer'),(742,'AddressShortage','*','READ','ALLOW','ROLE','production'),(743,'Claim','filter','READ','ALLOW','ROLE','claimViewer'),(744,'Claim','find','READ','ALLOW','ROLE','claimViewer'),(745,'Claim','findById','READ','ALLOW','ROLE','claimViewer'),(746,'Claim','getSummary','READ','ALLOW','ROLE','claimViewer'),(747,'CplusRectificationType','*','READ','ALLOW','ROLE','administrative'),(748,'SiiTypeInvoiceOut','*','READ','ALLOW','ROLE','administrative'),(749,'InvoiceCorrectionType','*','READ','ALLOW','ROLE','administrative'),(750,'InvoiceOut','transferInvoice','WRITE','ALLOW','ROLE','administrative');
/*!40000 ALTER TABLE `ACL` ENABLE KEYS */;
UNLOCK TABLES;
@@ -206,7 +206,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:15
+-- Dump completed on 2023-11-20 12:26:42
USE `vn`;
-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
--
@@ -265,23 +265,23 @@ INSERT INTO `businessType` VALUES ('decoration','Decoración'),('events','Evento
UNLOCK TABLES;
--
--- Dumping data for table `cplusInvoiceType472`
+-- Dumping data for table `siiTypeInvoiceIn`
--
-LOCK TABLES `cplusInvoiceType472` WRITE;
-/*!40000 ALTER TABLE `cplusInvoiceType472` DISABLE KEYS */;
-INSERT INTO `cplusInvoiceType472` VALUES (1,'F1 - Factura'),(2,'F2 - Factura simplificada (ticket)'),(3,'F3 - Factura emitida en sustitución de facturas simplificadas facturadas y declaradas'),(4,'F4 - Asiento resumen de facturas'),(5,'F5 - Importaciones (DUA)'),(6,'F6 - Otros justificantes contables'),(7,'R1 - Factura rectificativa (Art. 80.1, 80.2 y error fundado en derecho)'),(8,'R2 - Factura rectificativa (Art. 80.3)'),(9,'R3 - Factura rectificativa (Art. 80.4)'),(10,'R4 - Factura rectificativa (Resto)'),(11,'R5 - Factura rectificativa en facturas simplificadas');
-/*!40000 ALTER TABLE `cplusInvoiceType472` ENABLE KEYS */;
+LOCK TABLES `siiTypeInvoiceIn` WRITE;
+/*!40000 ALTER TABLE `siiTypeInvoiceIn` DISABLE KEYS */;
+INSERT INTO `siiTypeInvoiceIn` VALUES (1,'F1','Factura'),(2,'F2','Factura simplificada (ticket)'),(3,'F3','Factura emitida en sustitución de facturas simplificadas facturadas y declaradas'),(4,'F4','Asiento resumen de facturas'),(5,'F5','Importaciones (DUA)'),(6,'F6','Otros justificantes contables'),(7,'R1','Factura rectificativa (Art. 80.1, 80.2 y error fundado en derecho)'),(8,'R2','Factura rectificativa (Art. 80.3)'),(9,'R3','Factura rectificativa (Art. 80.4)'),(10,'R4','Factura rectificativa (Resto)'),(11,'R5','Factura rectificativa en facturas simplificadas');
+/*!40000 ALTER TABLE `siiTypeInvoiceIn` ENABLE KEYS */;
UNLOCK TABLES;
--
--- Dumping data for table `cplusInvoiceType477`
+-- Dumping data for table `siiTypeInvoiceOut`
--
-LOCK TABLES `cplusInvoiceType477` WRITE;
-/*!40000 ALTER TABLE `cplusInvoiceType477` DISABLE KEYS */;
-INSERT INTO `cplusInvoiceType477` VALUES (1,'F1 - Factura'),(2,'F2 - Factura simplificada (ticket)'),(3,'F3 - Factura emitida en sustitución de facturas simplificadas facturadas y declaradas'),(4,'F4 - Asiento resumen de facturas'),(5,'R1 - Factura rectificativa (Art. 80.1, 80.2 y error fundado en derecho)'),(6,'R2 - Factura rectificativa (Art. 80.3)'),(7,'R3 - Factura rectificativa (Art. 80.4)'),(8,'R4 - Factura rectificativa (Resto)'),(9,'R5 - Factura rectificativa en facturas simplificadas');
-/*!40000 ALTER TABLE `cplusInvoiceType477` ENABLE KEYS */;
+LOCK TABLES `siiTypeInvoiceOut` WRITE;
+/*!40000 ALTER TABLE `siiTypeInvoiceOut` DISABLE KEYS */;
+INSERT INTO `siiTypeInvoiceOut` VALUES (1,'F1','Factura'),(2,'F2','Factura simplificada (ticket)'),(3,'F3','Factura emitida en sustitución de facturas simplificadas facturadas y declaradas'),(4,'F4','Asiento resumen de facturas'),(5,'R1','Factura rectificativa (Art. 80.1, 80.2 y error fundado en derecho)'),(6,'R2','Factura rectificativa (Art. 80.3)'),(7,'R3','Factura rectificativa (Art. 80.4)'),(8,'R4','Factura rectificativa (Resto)'),(9,'R5','Factura rectificativa en facturas simplificadas');
+/*!40000 ALTER TABLE `siiTypeInvoiceOut` ENABLE KEYS */;
UNLOCK TABLES;
--
@@ -315,13 +315,13 @@ INSERT INTO `cplusTaxBreak` VALUES (1,'Campo vacio'),(2,'E1 - Exenta por el art
UNLOCK TABLES;
--
--- Dumping data for table `cplusTrascendency472`
+-- Dumping data for table `siiTrascendencyInvoiceIn`
--
-LOCK TABLES `cplusTrascendency472` WRITE;
-/*!40000 ALTER TABLE `cplusTrascendency472` DISABLE KEYS */;
-INSERT INTO `cplusTrascendency472` VALUES (1,'01 - Operación de régimen general'),(2,'02 - Operaciones por las que los empresarios satisfacen compensaciones REAGYP'),(3,'03 - Operaciones a las que se aplique el régimen especial de bienes usados, objetos de arte, antigüedades y objetos de colección (135 - 139 de LIVA)'),(4,'04 - Régimen especial oro de inversión'),(5,'05 - Régimen especial agencias de viajes'),(6,'06 - Régimen especial grupo de entidades en IVA (Nivel Avanzado)'),(7,'07 - Régimen especial criterio de caja'),(8,'08 - Operaciones sujetas al IPSI / IGIC'),(9,'09 - Adquisiciones intracomunitarias de bienes y prestaciones de servicios'),(10,'12 - Operaciones de arrendamiento de local de negocio'),(11,'13 - Factura correspondiente a una importación (informada sin asociar a un DUA)'),(12,'14 - Primer semestre 2017');
-/*!40000 ALTER TABLE `cplusTrascendency472` ENABLE KEYS */;
+LOCK TABLES `siiTrascendencyInvoiceIn` WRITE;
+/*!40000 ALTER TABLE `siiTrascendencyInvoiceIn` DISABLE KEYS */;
+INSERT INTO `siiTrascendencyInvoiceIn` VALUES (1,'Operación de régimen general'),(2,'Operaciones por las que los empresarios satisfacen compensaciones REAGYP'),(3,'Operaciones a las que se aplique el régimen especial de bienes usados, objetos de arte, antigüedades y objetos de colección (135 - 139 de LIVA)'),(4,'Régimen especial oro de inversión'),(5,'Régimen especial agencias de viajes'),(6,'Régimen especial grupo de entidades en IVA (Nivel Avanzado)'),(7,'Régimen especial criterio de caja'),(8,'Operaciones sujetas al IPSI / IGIC'),(9,'Adquisiciones intracomunitarias de bienes y prestaciones de servicios'),(12,'Operaciones de arrendamiento de local de negocio'),(13,'Factura correspondiente a una importación (informada sin asociar a un DUA)'),(14,'Primer semestre 2017');
+/*!40000 ALTER TABLE `siiTrascendencyInvoiceIn` ENABLE KEYS */;
UNLOCK TABLES;
--
@@ -330,7 +330,7 @@ UNLOCK TABLES;
LOCK TABLES `claimResponsible` WRITE;
/*!40000 ALTER TABLE `claimResponsible` DISABLE KEYS */;
-INSERT INTO `claimResponsible` VALUES (1,'Compradores',0),(2,'Proveedor',0),(3,'Entradores',0),(4,'Camareros',0),(6,'Sacadores',0),(7,'Revisadores',0),(8,'Calidad general',0),(9,'Encajadores',0),(10,'Clima',0),(11,'Comerciales',1),(12,'Clientes',1),(13,'Administración',0),(14,'Agencia',0),(15,'Repartidores',0),(16,'Informatica',0),(17,'Transp.origen',0),(18,'Confeccion',0),(19,'OTROS',0),(21,'Gerencia',0),(22,'Paletizadores',0),(23,'Preparación Previa',0),(24,'Almacén PCA',0),(25,'Huelga',0);
+INSERT INTO `claimResponsible` VALUES (1,'Compradores',0,'buy'),(2,'Proveedor',0,'sup'),(3,'Entradores',0,'ent'),(4,'Camareros',0,'bar'),(6,'Sacadores',0,'pic'),(7,'Revisadores',0,'chk'),(8,'Calidad general',0,'qas'),(9,'Encajadores',0,'pck'),(10,'Clima',0,'wea'),(11,'Comerciales',1,'com'),(12,'Clientes',1,'cli'),(13,'Administración',0,'adm'),(14,'Agencia',0,'age'),(15,'Repartidores',0,'del'),(16,'Informatica',0,'ite'),(17,'Transp.origen',0,'tra'),(18,'Confeccion',0,'con'),(19,'OTROS',0,'oth'),(21,'Gerencia',0,'man'),(22,'Paletizadores',0,'pal'),(23,'Preparación Previa',0,'pre'),(24,'Almacén PCA',0,'war'),(25,'Huelga',0,'str');
/*!40000 ALTER TABLE `claimResponsible` ENABLE KEYS */;
UNLOCK TABLES;
@@ -400,7 +400,7 @@ UNLOCK TABLES;
LOCK TABLES `department` WRITE;
/*!40000 ALTER TABLE `department` DISABLE KEYS */;
-INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,104,763,0,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL),(22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL),(31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(43,'VT','VENTAS',30,53,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL),(44,'management','GERENCIA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(45,NULL,'LOGISTICA',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(46,'delivery','REPARTO',58,59,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL),(48,NULL,'ALMACENAJE',60,61,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(49,NULL,'PROPIEDAD',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(52,NULL,'CARGA AEREA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(54,NULL,'ORNAMENTALES',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(55,NULL,'TALLER NATURAL',70,73,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118,NULL),(56,NULL,'TALLER ARTIFICIAL',71,72,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927,NULL),(58,'CMP','CAMPOS',74,77,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(59,NULL,'MANTENIMIENTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL),(60,NULL,'RECLAMACIONES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL),(61,NULL,'VNH',82,85,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(66,NULL,'VERDNAMADRID',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL),(69,NULL,'VERDNABARNA',88,89,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(86,NULL,'LIMPIEZA',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(89,NULL,'COORDINACION',92,93,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(90,NULL,'TRAILER',83,84,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(93,NULL,'CONFECCION',94,95,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(126,NULL,'PRESERVADO',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,NULL,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(131,NULL,'INVERNADERO',75,76,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(133,'franceTeam','EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(134,NULL,'EQUIPO RODRI',51,52,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL),(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 (1,'VN','VERDNATURA',1,106,763,0,0,0,0,31,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL),(22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL),(31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL),(36,NULL,'LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(37,'PROD','PRODUCCION',12,27,NULL,72,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL),(38,NULL,'SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(43,'VT','VENTAS',30,53,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL),(44,'management','GERENCIA',54,55,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(45,'logistic','LOGISTICA',56,57,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(46,'delivery','REPARTO',58,59,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL),(48,NULL,'ALMACENAJE',60,61,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(49,NULL,'PROPIEDAD',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(52,NULL,'CARGA AEREA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL),(54,NULL,'ORNAMENTALES',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(55,NULL,'TALLER NATURAL',70,73,14548,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,1,1,0,1118,NULL),(56,NULL,'TALLER ARTIFICIAL',71,72,8470,72,0,0,2,0,55,'/1/55/',NULL,0,NULL,0,1,1,0,1927,NULL),(58,'CMP','CAMPOS',74,77,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(59,NULL,'MANTENIMIENTO',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL),(60,NULL,'RECLAMACIONES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL),(61,NULL,'VNH',82,85,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(66,NULL,'VERDNAMADRID',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL),(69,NULL,'VERDNABARNA',88,89,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(80,NULL,'EQUIPO J VALLES',31,32,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(86,NULL,'LIMPIEZA',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(89,NULL,'COORDINACION',92,93,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(90,NULL,'TRAILER',83,84,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(92,NULL,'EQUIPO SILVERIO',33,34,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(93,NULL,'CONFECCION',94,95,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL,NULL),(94,NULL,'EQUIPO J BROCAL',35,36,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(95,NULL,'EQUIPO C ZAMBRANO',37,38,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(96,NULL,'EQUIPO C LOPEZ',39,40,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(115,NULL,'EQUIPO CLAUDI',41,42,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',43,44,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL),(125,NULL,'EQUIPO MIRIAM MAR',45,46,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(126,NULL,'PRESERVADO',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,NULL,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(130,NULL,'REVISION',25,26,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL),(131,NULL,'INVERNADERO',75,76,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL),(132,NULL,'EQUIPO DC',47,48,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(133,'franceTeam','EQUIPO FRANCIA',49,50,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(134,NULL,'EQUIPO RODRI',51,52,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL),(135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL),(137,'sorter','SORTER',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
/*!40000 ALTER TABLE `department` ENABLE KEYS */;
UNLOCK TABLES;
@@ -450,7 +450,7 @@ UNLOCK TABLES;
LOCK TABLES `state` WRITE;
/*!40000 ALTER TABLE `state` DISABLE KEYS */;
-INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0,0,0,4,1,'alert'),(2,'Libre',2,0,'FREE',NULL,2,0,0,0,0,0,0,4,1,'notice'),(3,'OK',3,0,'OK',3,28,1,0,0,0,1,1,3,0,'success'),(4,'Impreso',4,0,'PRINTED',2,29,1,0,1,0,0,1,2,0,'success'),(5,'Preparación',6,1,'ON_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning'),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0,'warning'),(7,'Sin Acabar',1,0,'NOT_READY',NULL,7,0,0,0,0,0,0,4,1,'alert'),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3,0,0,1,0,'warning'),(9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0,0,0,1,0,NULL),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0,0,0,0,0,NULL),(11,'Facturado',0,3,'INVOICED',NULL,11,0,1,0,0,0,0,0,0,NULL),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0,0,0,4,1,'alert'),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0,NULL),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2,0,0,1,0,'warning'),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0,NULL),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL),(20,'Asignado',4,0,'PICKER_DESIGNED',NULL,20,1,0,0,0,0,0,2,0,'success'),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0,'success'),(22,'Pte. Ampliar',2,0,'EXPANDABLE',NULL,22,0,0,0,0,0,0,4,1,'alert'),(23,'URGENTE',5,1,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1,'success'),(24,'Encadenado',4,0,'CHAINED',4,24,0,0,0,0,0,0,3,1,'success'),(25,'Embarcando',3,0,'BOARDING',5,25,1,0,0,0,0,0,3,0,'alert'),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,28,1,0,0,1,0,0,2,0,'warning'),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0,'success'),(28,'Previa OK',3,0,'OK PREVIOUS',3,28,1,0,1,1,1,1,3,0,'warning'),(29,'Previa Impreso',4,0,'PRINTED PREVIOUS',2,29,1,0,1,0,0,1,2,0,'success'),(30,'Embarcado',4,1,'BOARD',5,30,0,0,0,2,0,0,3,0,'success'),(31,'Polizon Impreso',4,1,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,2,0,'success'),(32,'Polizon OK',3,1,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0,'warning'),(33,'Auto_Impreso',4,0,'PRINTED_AUTO',2,29,1,0,1,0,0,1,2,0,'success'),(34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',NULL,34,0,0,0,0,0,0,4,1,'alert'),(35,'Semi-Encajado',9,2,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0,NULL),(36,'Previa Revisando',3,0,'PREVIOUS_CONTROL',2,37,1,0,0,4,0,1,2,0,'warning'),(37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',2,29,1,0,1,0,0,1,2,0,'warning'),(38,'Prep Cámara',6,1,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning'),(41,'Prep Parcial',6,1,'PARTIAL_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
+INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0,0,0,4,1,'alert'),(2,'Libre',2,0,'FREE',NULL,2,0,0,0,0,0,0,4,1,'notice'),(3,'OK',3,0,'OK',3,28,1,0,0,0,1,1,3,0,'success'),(4,'Impreso',4,0,'PRINTED',2,29,1,0,1,0,0,1,2,0,'success'),(5,'Preparación',6,1,'ON_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning'),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0,'warning'),(7,'Sin Acabar',1,0,'NOT_READY',NULL,7,0,0,0,0,0,0,4,1,'alert'),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3,0,0,1,0,'warning'),(9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0,0,0,1,0,NULL),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0,0,0,0,0,NULL),(11,'Facturado',0,3,'INVOICED',NULL,11,0,1,0,0,0,0,0,0,NULL),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0,0,0,4,1,'alert'),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0,NULL),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2,0,0,1,0,'warning'),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0,NULL),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL),(20,'Asignado',4,0,'PICKER_DESIGNED',NULL,20,1,0,0,0,0,0,2,0,'success'),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0,'success'),(22,'Pte. Ampliar',2,0,'EXPANDABLE',NULL,22,0,0,0,0,0,0,4,1,'alert'),(23,'URGENTE',5,1,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1,'success'),(24,'Encadenado',4,0,'CHAINED',4,24,0,0,0,0,0,0,3,1,'success'),(25,'Embarcando',3,0,'BOARDING',5,25,1,0,0,0,0,0,3,0,'alert'),(26,'Prep Previa',5,0,'PREVIOUS_PREPARATION',1,28,1,0,0,1,0,0,2,0,'warning'),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0,'success'),(28,'Previa OK',3,0,'OK PREVIOUS',3,28,1,0,1,1,1,1,3,0,'warning'),(29,'Previa Impreso',4,0,'PRINTED PREVIOUS',2,29,1,0,1,0,0,1,2,0,'success'),(30,'Embarcado',4,1,'BOARD',5,30,0,0,0,2,0,0,3,0,'success'),(31,'Polizon Impreso',4,1,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,2,0,'success'),(32,'Polizon OK',3,1,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0,'warning'),(33,'Auto_Impreso',4,0,'PRINTED_AUTO',2,29,1,0,1,0,0,1,2,0,'success'),(34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',NULL,34,0,0,0,0,0,0,4,1,'alert'),(35,'Semi-Encajado',9,2,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0,NULL),(36,'Previa Revisando',3,0,'PREVIOUS_CONTROL',2,37,1,0,0,4,0,1,2,0,'warning'),(37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',2,29,1,0,1,0,0,1,2,0,'warning'),(38,'Prep Cámara',6,1,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning'),(41,'Prep Parcial',6,1,'PARTIAL_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
/*!40000 ALTER TABLE `state` ENABLE KEYS */;
UNLOCK TABLES;
@@ -470,7 +470,7 @@ UNLOCK TABLES;
LOCK TABLES `volumeConfig` WRITE;
/*!40000 ALTER TABLE `volumeConfig` DISABLE KEYS */;
-INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,0,200,0,167.0);
+INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,50,200,10,167.0);
/*!40000 ALTER TABLE `volumeConfig` ENABLE KEYS */;
UNLOCK TABLES;
@@ -480,7 +480,7 @@ UNLOCK TABLES;
LOCK TABLES `workCenter` WRITE;
/*!40000 ALTER TABLE `workCenter` DISABLE KEYS */;
-INSERT INTO `workCenter` VALUES (1,'Silla',20,859,1,'Av espioca 100',552703,NULL),(2,'Mercaflor',19,NULL,NULL,NULL,NULL,NULL),(3,'Marjales',26,20008,NULL,NULL,NULL,NULL),(4,'VNH',NULL,NULL,NULL,NULL,NULL,NULL),(5,'Madrid',28,2869,5,'Av constitución 3',554145,0.50),(6,'Vilassar',88,88038,NULL,'Cami del Crist, 33',556412,NULL),(7,'Tenerife',NULL,NULL,NULL,NULL,NULL,NULL),(8,'Silla-Agrario',26,NULL,NULL,NULL,NULL,NULL),(9,'Algemesi',20,1354,60,'Fenollars, 2',523549,NULL);
+INSERT INTO `workCenter` VALUES (1,'Silla',20,859,1,'Av espioca 100',552703,NULL),(2,'Mercaflor',19,NULL,NULL,NULL,NULL,NULL),(3,'Marjales',26,20008,NULL,NULL,NULL,NULL),(4,'VNH',NULL,NULL,NULL,NULL,NULL,NULL),(5,'Madrid',28,2869,5,'Av constitución 3',554145,0.50),(6,'Vilassar',88,88038,NULL,'Cami del Crist, 33',556412,NULL),(7,'Tenerife',NULL,NULL,NULL,NULL,NULL,NULL),(8,'Silla-Agrario',26,NULL,NULL,NULL,NULL,NULL),(9,'Algemesi',20,1354,60,'Fenollars, 2',523549,NULL),(10,'Rubi',88,NULL,84,'Av. de la Llana, 131',549722,0.50);
/*!40000 ALTER TABLE `workCenter` ENABLE KEYS */;
UNLOCK TABLES;
@@ -493,6 +493,26 @@ LOCK TABLES `companyI18n` WRITE;
INSERT INTO `companyI18n` VALUES (442,'en','In compliance with the provisions of Organic Law 15/1999, on the Protection of Personal Data, we inform you that the personal data you provide will be included in automated files of VERDNATURA LEVANTE SL, being able at all times to exercise the rights of access, rectification, cancellation and opposition, communicating it in writing to the registered office of the entity. The purpose of the file is administrative management, accounting, and billing.'),(442,'fr','Conformément aux dispositions de la loi organique 15/1999 sur la protection des données personnelles, nous vous informons que les données personnelles que vous fournissez seront incluses dans des dossiers. VERDNATURA LEVANTE S.L., vous pouvez à tout moment, exercer les droits d``accès, de rectification, d``annulation et d``opposition, en communiquant par écrit au siège social de la société. Le dossier a pour objet la gestion administrative, la comptabilité et la facturation.'),(442,'pt','Em cumprimento do disposto na lei Orgânica 15/1999, de Protecção de Dados de Carácter Pessoal, comunicamos que os dados pessoais que facilite se incluirão nos ficheiros automatizados de VERDNATURA LEVANTE S.L., podendo em todo momento exercer os direitos de acesso, rectificação, cancelação e oposição, comunicando por escrito ao domicílio social da entidade. A finalidade do ficheiro é a gestão administrativa, contabilidade e facturação.');
/*!40000 ALTER TABLE `companyI18n` ENABLE KEYS */;
UNLOCK TABLES;
+
+--
+-- Dumping data for table `workerTimeControlError`
+--
+
+LOCK TABLES `workerTimeControlError` WRITE;
+/*!40000 ALTER TABLE `workerTimeControlError` DISABLE KEYS */;
+INSERT INTO `workerTimeControlError` VALUES (1,'IS_NOT_ALLOWED_FUTURE','No se permite fichar a futuro'),(2,'INACTIVE_BUSINESS','No hay un contrato en vigor'),(3,'IS_NOT_ALLOWED_WORK','No está permitido trabajar'),(4,'ODD_WORKERTIMECONTROL','Fichadas impares'),(5,'DAY_MAX_TIME','Superado el tiempo máximo entre entrada y salida'),(6,'BREAK_DAY','Descanso diario'),(7,'BREAK_WEEK','Descanso semanal'),(8,'WRONG_DIRECTION','Dirección incorrecta'),(9,'UNDEFINED_ERROR','Error sin definir');
+/*!40000 ALTER TABLE `workerTimeControlError` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Dumping data for table `silexACL`
+--
+
+LOCK TABLES `silexACL` WRITE;
+/*!40000 ALTER TABLE `silexACL` DISABLE KEYS */;
+INSERT INTO `silexACL` VALUES (1,'workerTimeControl','clockIn','$everyone'),(2,'workerTimeControl','getClockIn','$everyone'),(3,'workerTimeControl','login','$everyone'),(4,'security','device_checkLogin','employee'),(5,'security','getVersion','employee'),(6,'security','login','employee'),(7,'delivery','addNote','employee'),(8,'delivery','expeditionState_add','employee'),(9,'delivery','expeditionState_addByExpedition','employee'),(10,'delivery','expeditionState_addByExpeditionMulti','employee'),(11,'delivery','expeditionState_addByRoute','employee'),(12,'delivery','expedition_getLog','employee'),(13,'delivery','getExpeditionFromRoute','employee'),(14,'delivery','getInfo','employee'),(15,'delivery','getInfoCompany','employee'),(16,'delivery','getInfoFreelance','employee'),(17,'delivery','getWorkers','employee'),(18,'delivery','get_routes','employee'),(19,'delivery','get_tickets','employee'),(20,'delivery','get_version','employee'),(21,'delivery','saveLoadersWorkers','employee'),(22,'delivery','save_sign','employee'),(23,'delivery','setRouteOk','employee'),(24,'delivery','updateExpeditionChecked','employee'),(25,'delivery','update_routes','employee'),(26,'almacennew','barcodes_edit','employee'),(27,'almacennew','barcodeToItem','employee'),(28,'almacennew','buffer_setTypeByName','employee'),(29,'almacennew','buy_updateGrouping','employee'),(30,'almacennew','buy_updatePacking','employee'),(31,'almacennew','checkRouteExpeditionScanPut','employee'),(32,'almacennew','clearShelvingList','employee'),(33,'almacennew','collectionAddItem','employee'),(34,'almacennew','collectionGet','employee'),(35,'almacennew','collectionIncreaseQuantity','employee'),(36,'almacennew','collectionMissingTrash','employee'),(37,'almacennew','collectionNew','employee'),(38,'almacennew','collectionStickerPrint','employee'),(39,'almacennew','collection_getTickets','employee'),(40,'almacennew','collection_printSticker','employee'),(41,'almacennew','department_getHasMistake','employee'),(42,'almacennew','deviceLog_add','employee'),(43,'almacennew','deviceProductionUser_getWorker','employee'),(44,'almacennew','deviceProduction_getnameDevice','employee'),(45,'almacennew','expeditionLoading_add','employee'),(46,'almacennew','expeditionPalletDel','employee'),(47,'almacennew','expeditionPalletList','employee'),(48,'almacennew','expeditionPalletPrintSet','employee'),(49,'almacennew','expeditionPalletView','employee'),(50,'almacennew','expeditionScanAdd','employee'),(51,'almacennew','expeditionScanDel','employee'),(52,'almacennew','expeditionScanList','employee'),(53,'almacennew','expeditionScanPut','employee'),(54,'almacennew','expeditionState_addByPallet','employee'),(55,'almacennew','expeditionTruckAdd','employee'),(56,'almacennew','expeditionTruckList','employee'),(57,'almacennew','expedition_getState','employee'),(58,'almacennew','expedition_scan','employee'),(59,'almacennew','faultsReview','employee'),(60,'almacennew','faultsReview_isChecked','employee'),(61,'almacennew','getItemUbication','employee'),(62,'almacennew','get_ItemPackingType','employee'),(63,'almacennew','itemDiary','employee'),(64,'almacennew','itemPlacementSupplyAiming','employee'),(65,'almacennew','itemPlacementSupplyCloseOrder','employee'),(66,'almacennew','itemPlacementSupplyGetOrder','employee'),(68,'almacennew','itemShelvingBuyerGet','employee'),(69,'almacennew','itemShelvingBuyerTask','employee'),(70,'almacennew','itemShelvingDelete','employee'),(71,'almacennew','itemShelvingList','employee'),(72,'almacennew','itemShelvingLog_get','employee'),(73,'almacennew','itemShelvingMake','employee'),(74,'almacennew','itemShelvingMakeEdit','employee'),(75,'almacennew','itemShelvingMake_multi','employee'),(76,'almacennew','itemShelvingPlacementSupplyAdd','employee'),(77,'almacennew','itemShelvingSaleSupplyAdd','employee'),(78,'almacennew','itemShelvingStarsUpdate','employee'),(79,'almacennew','itemShelvingTransfer','employee'),(80,'almacennew','itemShelving_addByClaim','employee'),(81,'almacennew','itemShelving_filterBuyer','employee'),(82,'almacennew','itemShelving_getSaleDate','employee'),(83,'almacennew','itemTrash','employee'),(84,'almacennew','item_card','employee'),(85,'almacennew','item_getSimilar','employee'),(86,'almacennew','item_placement_save','employee'),(87,'almacennew','item_saveReference','employee'),(88,'almacennew','item_updatePackingShelve','employee'),(89,'almacennew','machineWorker_add','employee'),(90,'almacennew','machineWorker_getHistorical','employee'),(91,'almacennew','machineWorker_update','employee'),(92,'almacennew','machineWorker_Worker','employee'),(93,'almacennew','machine_checkPlate','employee'),(94,'almacennew','machine_getWorkerPlate','employee'),(95,'almacennew','mistakeType','employee'),(96,'almacennew','printer_get','employee'),(97,'almacennew','qr_getCall','developer'),(98,'almacennew','saleMistakeAdd','employee'),(99,'almacennew','saleMove','employee'),(100,'almacennew','saleParking_add','employee'),(101,'almacennew','saleTrackingDel','employee'),(102,'almacennew','saleTrackingReplace','employee'),(103,'almacennew','saleTracking_add','employee'),(104,'almacennew','saleTracking_addPrevOK','employee'),(105,'almacennew','saleTracking_updateIsChecked','employee'),(106,'almacennew','sectorCollectionSaleGroup_add','employee'),(107,'almacennew','sectorCollection_get','employee'),(108,'almacennew','sectorCollection_getSale','employee'),(109,'almacennew','sectorCollection_new','employee'),(110,'almacennew','sector_get','employee'),(111,'almacennew','shelvingChange','employee'),(112,'almacennew','shelvingLog_get','employee'),(113,'almacennew','shelvingPark','employee'),(114,'almacennew','shelvingParking_get','employee'),(115,'almacennew','shelvingPriorityUpdate','employee'),(116,'almacennew','sip_getExtension','employee'),(117,'almacennew','ticketCollection_setUsedShelves','employee'),(118,'almacennew','ticketOrCollection_checkFullyControlled','employee'),(119,'almacennew','ticketToPrePrepare','employee'),(120,'almacennew','ticket_checkFullyControlled','employee'),(121,'almacennew','ticket_setState','employee'),(122,'almacennew','update_ItemPackingType','employee'),(123,'almacennew','workerMachinery_isRegistered','employee'),(124,'almacennew','workerMistakeType_get','employee'),(125,'almacennew','workerMistake_Add','coolerBoss'),(126,'almacennew','workerShelving_add','employee'),(127,'almacennew','workerShelving_delete','employee'),(128,'almacennew','worker_getFromHasMistake','employee'),(129,'almacennew','worker_getId','employee'),(130,'almacennew','worker_getPrinter','employee'),(131,'almacennew','worker_getSector','employee'),(132,'almacennew','worker_updatePrinter','employee'),(133,'almacennew','worker_updateSector','employee'),(134,'almacennew','itemShelving_updateFromSale','employee'),(135,'almacennew','collection_getUncheckedTicket','employee'),(136,'almacennew','itemShelving_return','employee'),(137,'almacennew','itemShelving_merge','employee'),(139,'delivery','get_expeditionsSummary','employee'),(140,'almacennew','cmrExpeditionPallet_add','employee'),(141,'delivery','route_getExpeditionSummary','employee'),(142,'almacennew','item_saveStems','employee'),(143,'almacennew','debug_add','employee'),(144,'almacennew','operator_getNumberOfWagons','employee'),(145,'almacennew','operator_add','employee'),(146,'almacennew','expeditionPallet_get','employee'),(147,'almacennew','worker_isF11Allowed','employee'),(148,'almacennew','train_get','employee'),(149,'almacennew','saleTracking_mark','employee'),(150,'almacennew','operator_updateItemPackingType','employee'),(151,'almacennew','operator_updateTrain','employee'),(152,'almacennew','operator_getTrain','employee'),(153,'almacennew','operator_getItemPackingType','employee'),(154,'almacennew','collection_assign','employee'),(155,'almacennew','itemPacking_get','employee'),(156,'almacennew','shelvingLog_add','employee'),(157,'almacennew','collection_get','employee'),(158,'delivery','get_routesFromExpedition','employee'),(160,'almacennew','expeditionMistakeType_get','employee'),(161,'almacennew','expeditionMistake_add','employee'),(162,'almacennew','itemShelving_addList','employee'),(163,'almacennew','cmrPallet_add','employee'),(164,'almacennew','ticket_isOutClosureZone','employee'),(165,'almacennew','itemShelving_selfConsumption','employee'),(166,'almacennew','ticket_printLabelPrevious','employee'),(167,'almacennew','travel_updatePacking','employee'),(168,'app','status','$everyone');
+/*!40000 ALTER TABLE `silexACL` ENABLE KEYS */;
+UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -502,7 +522,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:19
+-- Dump completed on 2023-11-20 12:26:42
USE `cache`;
-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
--
@@ -538,7 +558,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:20
+-- Dump completed on 2023-11-20 12:26:42
USE `hedera`;
-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
--
@@ -602,7 +622,7 @@ UNLOCK TABLES;
LOCK TABLES `link` WRITE;
/*!40000 ALTER TABLE `link` DISABLE KEYS */;
-INSERT INTO `link` VALUES (16,'Printing server','Manage the CUPS printing server','http://printnatura.verdnatura.es','printer'),(20,'Webmail','Verdnatura webmail','https://webmail.verdnatura.es/','mail'),(23,'Verdnatura Beta','Trial version of the web page','https://test-shop.verdnatura.es/','vn'),(25,'Shared folder','Shared folder','https://cdn.verdnatura.es/share','backup'),(29,'phpMyAdmin','Manage MySQL database','https://pma.verdnatura.es/','pma'),(30,'Nagios','Monitoring system','https://nagios.verdnatura.es/','nagios'),(33,'Gitea','Version control system','https://gitea.verdnatura.es/','git'),(34,'Wiknatura','Verdnatura wiki page','https://wiki.verdnatura.es/','wiki'),(35,'phpLDAPadmin','Manage the LDAP database','https://pla.verdnatura.es/','pla'),(36,'Applications','Access applications repository','https://cdn.verdnatura.es/vn-access','access'),(37,'Jenkins','CI and CD system','https://jenkins.verdnatura.es','jenkins'),(38,'osTicket','User service center','https://cau.verdnatura.es','osticket'),(39,'Redmine','Flexible project management','https://redmine.verdnatura.es','redmine'),(40,'Grafana','Analytics & monitoring solution','https://grafana.verdnatura.es','grafana'),(41,'Rocket.Chat','Communications platform','https://chat.verdnatura.es','rocketchat'),(42,'Salix','ERP software','https://salix.verdnatura.es','salix'),(43,'Docker','Container management','https://docker.verdnatura.es','docker'),(44,'Proxmox','Virtual environment','https://proxmox.verdnatura.es','proxmox'),(45,'Shinobi','Network video recorder','https://shinobi.verdnatura.es','shinobi'),(46,'DokuWiki','Internal documentation','https://doku.verdnatura.es','dokuwiki');
+INSERT INTO `link` VALUES (16,'Printing server','Manage the CUPS printing server','http://printnatura.verdnatura.es','printer'),(20,'Webmail','Verdnatura webmail','https://webmail.verdnatura.es/','mail'),(23,'Verdnatura Beta','Trial version of the web page','https://test-shop.verdnatura.es/','vn'),(25,'Shared folder','Shared folder','https://cdn.verdnatura.es/share','backup'),(29,'phpMyAdmin','Manage MySQL database','https://pma.verdnatura.es/','pma'),(30,'Nagios','Monitoring system','https://nagios.verdnatura.es/','nagios'),(33,'Gitea','Version control system','https://gitea.verdnatura.es/','git'),(34,'Wiknatura','Verdnatura wiki page','https://wiki.verdnatura.es/','wiki'),(35,'phpLDAPadmin','Manage the LDAP database','https://pla.verdnatura.es/','pla'),(36,'Applications','Access applications repository','https://cdn.verdnatura.es/vn-access','access'),(37,'Jenkins','CI and CD system','https://jenkins.verdnatura.es','jenkins'),(38,'osTicket','User service center','https://cau.verdnatura.es','osticket'),(39,'Redmine','Flexible project management','https://redmine.verdnatura.es','redmine'),(40,'Grafana','Analytics & monitoring solution','https://grafana.verdnatura.es','grafana'),(41,'Rocket.Chat','Communications platform','https://chat.verdnatura.es','rocketchat'),(42,'Salix','ERP software','https://salix.verdnatura.es','salix'),(43,'Docker','Container management','https://docker.verdnatura.es','docker'),(44,'Proxmox','Virtual environment','https://mox.verdnatura.es','proxmox'),(45,'Shinobi','Network video recorder','https://shinobi.verdnatura.es','shinobi'),(46,'DokuWiki','Internal documentation','https://doku.verdnatura.es','dokuwiki');
/*!40000 ALTER TABLE `link` ENABLE KEYS */;
UNLOCK TABLES;
@@ -632,7 +652,7 @@ UNLOCK TABLES;
LOCK TABLES `message` WRITE;
/*!40000 ALTER TABLE `message` DISABLE KEYS */;
-INSERT INTO `message` VALUES (1,'ORDER_DATE_HOLIDAY','No es posible realizar pedidos para días festivos'),(2,'ORDER_EMPTY','El pedido esta vacío'),(3,'ORDER_UNAVAILABLE','Algunos artículos ya no están disponibles, verifica las cantidades resaltadas en rojo'),(4,'SURVEY_MAX_ONE_VOTE','Solo es posible realizar un voto por encuesta'),(5,'ORDER_MAX_EXCEEDED','Has excedido el número máximo de pedidos por confirmar, por favor elimina o confirma los pedidos iniciados'),(6,'LOGIN_INCORRECT','Usuario o contraseña incorrectos. Recuerda que se hace distinción entre mayúsculas y minúsculas.'),(7,'ORDER_DATE_PAST','La fecha de su pedido debe ser mayor o igual al día de hoy'),(8,'ORDER_DATE_LAST','No es posible realizar más para hoy, por favor atrasa la fecha de tu pedido a mañana o días posteriores'),(9,'ORDER_DATE_SUNDAY','No es posible confirmar pedidos para Domingo'),(10,'ORDER_DATE_SATURATED','Estamos saturados de pedidos, por favor selecciona otra fecha de envío o recogida '),(11,'USER_DISCONNECTED','Has sido desconectado del servidor, por favor vuelve a iniciar sesión'),(12,'UNAUTH_ACTION','Acción no permitida'),(13,'ORDER_INVALID_AGENCY','La agencia de envío no es válida'),(14,'ORDER_EMPTY_ADDRESS','Selecciona una dirección de envío'),(15,'ORDER_AMOUNT_ROUNDED','Este artículo se vende agrupado y la cantidad ha sido redondeada'),(17,'orderOutdated','La configuración del pedido es incorrecta, por favor vuelve a configurarlo para continuar comprando'),(18,'orderNotOwnedByUser','El pedido pertenece a otro usuario'),(19,'orderConfirmed','El pedido ya ha sido confirmado y no puede modificarse'),(20,'clientNotVerified','Datos fiscales incompletos, por favor contacte con su comercial');
+INSERT INTO `message` VALUES (1,'ORDER_DATE_HOLIDAY','Orders for holidays are not possible'),(2,'ORDER_EMPTY','The order is empty'),(3,'ORDER_UNAVAILABLE','Some items are no longer available, please check the quantities highlighted in red'),(4,'SURVEY_MAX_ONE_VOTE','Only one vote per survey is possible'),(5,'ORDER_MAX_EXCEEDED','You have exceeded the maximum number of unconfirmed orders, please delete or confirm started orders'),(6,'LOGIN_INCORRECT','Incorrect username or password. Case-sensitive.'),(7,'ORDER_DATE_PAST','The order date must be today or later'),(8,'ORDER_DATE_LAST','No more orders can be made for today, please postpone your order for tomorrow or later'),(9,'ORDER_DATE_SUNDAY','Orders for Sunday cannot be confirmed'),(10,'ORDER_DATE_SATURATED','We are overwhelmed with orders, please select another delivery or pick-up date'),(11,'USER_DISCONNECTED','You have been disconnected from the server, please log in again'),(12,'UNAUTH_ACTION','Action not allowed'),(13,'ORDER_INVALID_AGENCY','The shipping agency is not valid'),(14,'ORDER_EMPTY_ADDRESS','Please select a shipping address'),(15,'ORDER_AMOUNT_ROUNDED','This item is sold in bundles, the quantity has been rounded'),(17,'orderOutdated','The order configuration is incorrect, please reconfigure it to continue shopping'),(18,'orderNotOwnedByUser','The order belongs to another user'),(19,'orderConfirmed','The order has already been confirmed and cannot be modified'),(20,'clientNotVerified','Incomplete tax data, please contact your sales representative'),(21,'quantityLessThanMin','The quantity cannot be less than the minimum');
/*!40000 ALTER TABLE `message` ENABLE KEYS */;
UNLOCK TABLES;
@@ -704,7 +724,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:22
+-- Dump completed on 2023-11-20 12:26:42
USE `sage`;
-- MariaDB dump 10.19 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64)
--
@@ -770,4 +790,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:53:22
+-- Dump completed on 2023-11-20 12:26:42
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 499336243..b243692bb 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -1,3 +1,7 @@
+CREATE ROLE 'salix';
+GRANT 'salix' TO 'root'@'%';
+SET DEFAULT ROLE 'salix' FOR 'root'@'%';
+
CREATE SCHEMA IF NOT EXISTS `vn2008`;
CREATE SCHEMA IF NOT EXISTS `tmp`;
@@ -59,10 +63,6 @@ INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`)
VALUES
('1', '11');
-INSERT INTO `vn`.`packagingConfig`(`upperGap`)
- VALUES
- ('10');
-
UPDATE `account`.`role` SET id = 100 WHERE id = 0;
INSERT INTO `account`.`roleConfig`(`id`, `mysqlPassword`, `rolePrefix`, `userPrefix`, `userHost`, `tplUser`)
@@ -73,7 +73,7 @@ CALL `account`.`role_sync`;
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `role`,`active`,`email`, `lang`, `image`, `password`)
SELECT id, name, CONCAT(name, 'Nick'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2'
- FROM `account`.`role` WHERE id <> 20
+ FROM `account`.`role`
ORDER BY id;
INSERT INTO `account`.`account`(`id`)
@@ -87,9 +87,15 @@ INSERT INTO `vn`.`educationLevel` (`id`, `name`)
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
(2, 'ENSEÑANZAS DE BACHILLERATO');
+INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
+ SELECT id,UPPER(LPAD(role, 3, '0')), name, name, NULL
+ FROM `account`.`user`
+ WHERE `id` = 9;
+
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, 9
- FROM `account`.`user`;
+ FROM `account`.`user`
+ WHERE `id` <> 9;
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
@@ -360,18 +366,18 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
VALUES
- (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','loses'),
+ (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
- (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
+ (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
- (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','normal'),
- (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','normal');
+ (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
+ (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
@@ -405,7 +411,7 @@ INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `pr
(5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 1),
(6, 'DavidCharlesHaller', 'Evil hideout', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 1),
(7, 'Hank Pym', 'Anthill', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 1),
- (8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1),
+ (8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1),
(9, 'Bruce Banner', 'Somewhere in New York', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 1),
(10, 'Jessica Jones', 'NYCC 2015 Poster', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 1),
(11, 'Missing', 'The space', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1111, 10, NULL, NULL, 0, 1),
@@ -437,7 +443,7 @@ INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `pr
(125, 'The plastic cell', 'address 25', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 0),
(126, 'Many places', 'address 26', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 0),
(127, 'Your pocket', 'address 27', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 0),
- (128, 'Cerebro', 'address 28', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0),
+ (128, 'Cerebro', 'address 28', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0),
(129, 'Luke Cages Bar', 'address 29', 'Gotham', 'EC170150', 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 0),
(130, 'Non valid address', 'address 30', 'Gotham', 46460, 1, 1111111111, 222222222, 0, 1101, 2, NULL, NULL, 0, 0);
@@ -487,7 +493,7 @@ INSERT INTO `vn`.`clientCredit`(`clientFk`, `workerFk`, `amount`, `created`)
(1104, 9, 90 , util.VN_CURDATE()),
(1105, 9, 90 , util.VN_CURDATE());
-INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`)
+INSERT INTO `vn`.`roleCreditLimit`(`id`, `maxAmount`, `roleFk`)
VALUES
(1, 9999999, 20),
(2, 10000, 21),
@@ -549,15 +555,6 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
('flowerPlants', 'Wholesale of flowers and plants'),
('vegetablesFruits', 'Fruit and vegetable trade');
-INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
- VALUES
- (1, 1, 'Ace Chemicals', 'The Midtown', 1, '46000', 'Gotham', '111111111', '222222222'),
- (2, 1, 'Arkham Asylum', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'),
- (3, 2, 'Wayne Tower', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'),
- (4, 2, 'Bank of Gotham', 'Founders Island', 1, '46000', 'Gotham', '111111111', '222222222'),
- (5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
- (6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
-
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
VALUES
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
@@ -568,6 +565,15 @@ INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`
(791, 'Bros SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(1381, 'Ornamentales', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
+INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
+ VALUES
+ (1, 1, 'Ace Chemicals', 'The Midtown', 1, '46000', 'Gotham', '111111111', '222222222'),
+ (2, 1, 'Arkham Asylum', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'),
+ (3, 2, 'Wayne Tower', 'Grand Avenue', 1, '46000', 'Gotham', '111111111', '222222222'),
+ (4, 2, 'Bank of Gotham', 'Founders Island', 1, '46000', 'Gotham', '111111111', '222222222'),
+ (5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
+ (6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
+
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
VALUES
(1, 1, 123121212, 654789123, 'supplier1@email.es', 'observation1', 'the boss'),
@@ -594,20 +600,24 @@ INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`
('NATIONAL', 0, 1),
('WORLD', 2, 15);
+INSERT INTO vn.invoiceOutConfig
+ SET parallelism = 8;
+
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
VALUES
- ('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
- ('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
- ('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
- ('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
- ('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
+ ('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
+ ('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
+ ('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
+ ('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
+ ('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
+ ('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
VALUES
(1, 'T', 1026.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
- (4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
+ (4, 'T', 8.88, util.VN_CURDATE(), 1104, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
@@ -616,9 +626,6 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T3333333' WHERE id = 3;
UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4;
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
-INSERT INTO vn.invoiceOutConfig
- SET parallelism = 8;
-
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
VALUES
(1, 895.76, 89.58, 4722000010),
@@ -628,7 +635,7 @@ INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
(4, 8.07, 0.81, 4770000010),
(5, 8.07, 0.81, 4770000010);
-INSERT INTO `vn`.`expence`(`id`, `name`, `isWithheld`)
+INSERT INTO `vn`.`expense`(`id`, `name`, `isWithheld`)
VALUES
(2000000000, 'Inmovilizado pendiente', 0),
(2000000001, 'Compra de bienes de inmovilizado', 0),
@@ -640,7 +647,7 @@ INSERT INTO `vn`.`expence`(`id`, `name`, `isWithheld`)
(7050000000, 'Prestacion de servicios', 1);
-INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`)
+INSERT INTO `vn`.`invoiceOutExpense`(`id`, `invoiceOutFk`, `amount`, `expenseFk`, `created`)
VALUES
(1, 1, 813.06, 2000000000, util.VN_CURDATE()),
(2, 1, 33.80, 4751000000, util.VN_CURDATE()),
@@ -713,7 +720,7 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`)
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), 1104, 'Stark tower', 124, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
+ (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),
@@ -765,7 +772,7 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des
-- FIX for state hours on local, inter_afterInsert
-- UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND);
-INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
+INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `userFk`, `created`)
VALUES
(1, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)),
(2, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)),
@@ -809,6 +816,7 @@ INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`,
VALUES
(1, 'beta-server', 'nightmare@mydomain.com', '200', DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH));
+
INSERT INTO `vn`.`greugeType`(`id`, `name`, `code`)
VALUES
(1, 'Diff', 'diff'),
@@ -920,26 +928,26 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
('SER', 'Services'),
('VT', 'Sales');
-INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
- `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
+INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
+ `comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
VALUES
- (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3),
- (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
- (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
- (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
- (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
- (13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
- (14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
- (15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
- (16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
- (71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
+ (1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 15,3),
+ (2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 10,2),
+ (3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5,5),
+ (4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
+ (10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
+ (13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL,NULL),
+ (14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
+ (15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
+ (16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
+ (71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
-- Update the taxClass after insert of the items
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
@@ -966,6 +974,10 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, util.VN_CURDATE(), 15, 90.00),
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, util.VN_CURDATE(), 16, 0.00);
+INSERT INTO `vn`.`packagingConfig`(`upperGap`, `defaultSmallPackageFk`, `defaultBigPackageFk`)
+ VALUES
+ ('10', 1, 'pallet 100');
+
INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
VALUES
(1, 'En reparto', 'ON DELIVERY'),
@@ -1933,7 +1945,7 @@ INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `attenderFk
(4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, util.VN_CURDATE()),
(5, 'Melee weapon combat first 15cm', 18, 35, 15, 4, 1.30, 0, NULL, 18, util.VN_CURDATE());
-INSERT INTO `vn`.`ticketServiceType`(`id`, `name`, `expenceFk`)
+INSERT INTO `vn`.`ticketServiceType`(`id`, `name`, `expenseFk`)
VALUES
(1, 'Porte Agencia', 7001000000),
(2, 'Portes Retorno', 7001000000),
@@ -2337,9 +2349,11 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`)
(8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'),
(10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun');
-INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`)
+INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`, `weekDays`)
VALUES
- (9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR));
+ (9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR), 'mon'),
+ (9, 'range', util.VN_CURDATE(), NULL, 'tue'),
+ (9, 'range', NULL, util.VN_CURDATE(), 'wed');
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `isSendMail`)
VALUES
@@ -2555,7 +2569,7 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`)
(9, 9, 9),
(10, 10, 10);
-INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
+INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenseFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
VALUES
(1, 99.99, '2000000000', NULL, NULL, NULL),
(2, 999.99, '2000000000', NULL, NULL, NULL),
@@ -2887,7 +2901,9 @@ INSERT INTO `vn`.`report` (`id`, `name`, `paperSizeFk`, `method`)
INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
VALUES
- (1, 1);
+ (1, 1),
+ (2, 20),
+ (7, 1);
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk`, `businessTypeFk`)
VALUES
@@ -2895,8 +2911,7 @@ INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
VALUES
- (1, 12),
- (8, 10);
+ (24, 7);
INSERT INTO `vn`.`deviceProductionModels` (`code`)
VALUES
@@ -2952,9 +2967,9 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
(2, 1, 50, 2),
(3, 1, 0, 3);
-INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
+INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
VALUES
- (1, 21600, 300);
+ (1, 21600, 60, 300);
INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`)
VALUES
@@ -2994,3 +3009,37 @@ INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`)
(1, 'Error in VAT calculation'),
(2, 'Error in sales details'),
(3, 'Error in customer data');
+
+UPDATE `vn`.`client`
+ SET fi='65004204V'
+ WHERE id=1;
+
+UPDATE `vn`.`worker`
+ SET fi='59328808D'
+ WHERE id=1106;
+
+
+INSERT INTO `account`.`mailAliasAcl` (`mailAliasFk`, `roleFk`)
+ VALUES
+ (1, 1),
+ (2, 9),
+ (3, 15);
+
+INSERT INTO `vn`.`docuwareTablet` (`tablet`,`description`)
+ VALUES
+ ('Tablet1','Jarvis tablet'),
+ ('Tablet2','Avengers tablet');
+
+INSERT INTO `vn`.`sms` (`id`, `senderFk`, `sender`, `destination`, `message`, `statusCode`, `status`, `created`)
+ VALUES (1, 66, '111111111', '0001111111111', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE()),
+ (2, 66, '222222222', '0002222222222', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'PENDING', util.VN_CURDATE()),
+ (3, 66, '333333333', '0003333333333', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'ERROR', util.VN_CURDATE()),
+ (4, 66, '444444444', '0004444444444', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE());
+
+INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`)
+ VALUES(1, 1103, 1, NULL),
+ (2, 1103, 2, NULL),
+ (3, 1103, 3, 32),
+ (4, 1103, 4, 32),
+ (13, 1101, 1, NULL),
+ (14, 1101, 4, 27);
diff --git a/db/dump/structure.sql b/db/dump/structure.sql
index b242821fc..694f745ef 100644
--- a/db/dump/structure.sql
+++ b/db/dump/structure.sql
@@ -315,20 +315,20 @@ CREATE TABLE `mailAliasAccount` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
--- Table structure for table `mailClientAccess`
+-- Table structure for table `mailClientAccess__`
--
-DROP TABLE IF EXISTS `mailClientAccess`;
+DROP TABLE IF EXISTS `mailClientAccess__`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `mailClientAccess` (
+CREATE TABLE `mailClientAccess__` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`client` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
`action` set('OK','REJECT') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT 'REJECT',
`description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `mailFrom` (`client`)
-) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-09-03';
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -428,20 +428,20 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
--- Table structure for table `mailSenderAccess`
+-- Table structure for table `mailSenderAccess__`
--
-DROP TABLE IF EXISTS `mailSenderAccess`;
+DROP TABLE IF EXISTS `mailSenderAccess__`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `mailSenderAccess` (
+CREATE TABLE `mailSenderAccess__` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`sender` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
`action` set('OK','REJECT') NOT NULL DEFAULT 'REJECT',
`description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `mailFrom` (`sender`)
-) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='@deprecated 2023-09-03';
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -727,10 +727,30 @@ CREATE TABLE `sambaConfig` (
`adUser` varchar(255) DEFAULT NULL COMMENT 'Active directory user',
`adPassword` varchar(255) DEFAULT NULL COMMENT 'Active directory password',
`verifyCert` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Whether to verify server certificate',
+ `userDn` varchar(255) NOT NULL COMMENT 'Base DN for users without domain DN part',
PRIMARY KEY (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts';
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `signInLog`
+--
+
+DROP TABLE IF EXISTS `signInLog`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `signInLog` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `token` varchar(255) NOT NULL,
+ `userFk` int(10) unsigned DEFAULT NULL,
+ `creationDate` timestamp NULL DEFAULT current_timestamp(),
+ `ip` varchar(100) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `userFk` (`userFk`),
+ CONSTRAINT `signInLog_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `user`
--
@@ -743,7 +763,7 @@ CREATE TABLE `user` (
`realm` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`name` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`nickname` varchar(127) NOT NULL,
- `password` varchar(512) DEFAULT NULL,
+ `password` varchar(512) NOT NULL,
`role` int(10) unsigned NOT NULL DEFAULT 2,
`active` tinyint(1) NOT NULL DEFAULT 1,
`email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
@@ -761,6 +781,7 @@ CREATE TABLE `user` (
`editorFk` int(10) unsigned DEFAULT NULL,
`passExpired` date DEFAULT NULL,
`twoFactor` enum('email') DEFAULT NULL COMMENT 'Two-factor auth type',
+ `username` varchar(30) GENERATED ALWAYS AS (`name`) VIRTUAL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `mail` (`email`),
@@ -984,6 +1005,27 @@ CREATE TABLE `userSync` (
--
-- Dumping events for database 'account'
--
+/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
+/*!50106 DROP EVENT IF EXISTS `role_sync` */;
+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 @saved_sql_mode = @@sql_mode */ ;;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
+/*!50003 SET @saved_time_zone = @@time_zone */ ;;
+/*!50003 SET time_zone = 'SYSTEM' */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`salix`@`10.0.%.%`*/ /*!50106 EVENT `role_sync` ON SCHEDULE AT '2023-11-16 14:32:48' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL role_sync */ ;;
+/*!50003 SET time_zone = @saved_time_zone */ ;;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;;
+/*!50003 SET character_set_client = @saved_cs_client */ ;;
+/*!50003 SET character_set_results = @saved_cs_results */ ;;
+/*!50003 SET collation_connection = @saved_col_connection */ ;;
+DELIMITER ;
+/*!50106 SET TIME_ZONE= @save_time_zone */ ;
--
-- Dumping routines for database 'account'
@@ -1100,6 +1142,35 @@ 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 `myUser_hasPriv` */;
+/*!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 `myUser_hasPriv`(vChain VARCHAR(100),
+ vPrivilege ENUM('SELECT','INSERT','UPDATE','DELETE')
+) RETURNS tinyint(1)
+ READS SQL DATA
+BEGIN
+/**
+ * Search if my user has privileges on table or column
+ *
+ * @param vChain string passed with this syntax dbName.tableName[.columnName]
+ * @param vPrivilege privileges to check ('SELECT','INSERT','UPDATE','DELETE')
+ * @return vHasPrivilege
+ */
+ RETURN user_hasPriv(vChain, vPrivilege, 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_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `myUser_hasRole` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -1152,6 +1223,35 @@ 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 `myUser_hasRoutinePriv` */;
+/*!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 `myUser_hasRoutinePriv`(vType ENUM('PROCEDURE', 'FUNCTION'),
+ vChain VARCHAR(100)
+) RETURNS tinyint(1)
+ READS SQL DATA
+BEGIN
+/**
+ * Search if my user has privileges on routines
+ *
+ * @param vType procedure or function
+ * @param vChain string passed with this syntax dbName.tableName
+ * @return vHasPrivilege
+ */
+ RETURN user_hasRoutinePriv(vType, vChain, 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_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `passwordGenerate` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -1309,6 +1409,122 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP FUNCTION IF EXISTS `user_hasPriv` */;
+/*!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 `user_hasPriv`(vChain VARCHAR(100),
+ vPrivilege ENUM('SELECT','INSERT','UPDATE','DELETE'),
+ vUserFk INT
+) RETURNS tinyint(1)
+ READS SQL DATA
+BEGIN
+/**
+ * Search if the user has privileges on table or column
+ *
+ * @param vChain string passed with this syntax dbName.tableName[.columnName]
+ * @param vPrivilege privileges to check('SELECT','INSERT','UPDATE','DELETE')
+ * @param vUserFk user to check
+ * @return vHasPrivilege
+ */
+ DECLARE vHasPrivilege BOOL DEFAULT FALSE;
+ DECLARE vDb VARCHAR(50);
+ DECLARE vTableName VARCHAR(50);
+ DECLARE vColumnName VARCHAR(50);
+ DECLARE vPrivilegeFlag INT;
+ DECLARE vChainExists BOOL;
+
+ SET vDb = SUBSTRING_INDEX(vChain, '.', 1);
+ SET vChain = SUBSTRING(vChain, LENGTH(vDb) + 2);
+ SET vTableName = SUBSTRING_INDEX(vChain, '.', 1);
+ SET vColumnName = SUBSTRING(vChain, LENGTH(vTableName) + 2);
+
+ SELECT COUNT(*) INTO vChainExists
+ FROM information_schema.COLUMNS
+ WHERE TABLE_SCHEMA = vDb
+ AND TABLE_NAME = vTableName
+ AND COLUMN_NAME = vColumnName
+ LIMIT 1;
+
+ IF NOT vChainExists THEN
+ RETURN FALSE;
+ END IF;
+
+ CASE vPrivilege
+ WHEN 'Select' THEN SET vPrivilegeFlag = 1;
+ WHEN 'Insert' THEN SET vPrivilegeFlag = 2;
+ WHEN 'Update' THEN SET vPrivilegeFlag = 4;
+ WHEN 'Delete' THEN SET vPrivilegeFlag = 8;
+ ELSE BEGIN END;
+ END CASE;
+
+ DROP TEMPORARY TABLE IF EXISTS tRole;
+ CREATE TEMPORARY TABLE tRole
+ (INDEX (`name`))
+ ENGINE = MEMORY
+ SELECT r.`name`
+ FROM user u
+ JOIN roleRole rr ON rr.role = u.role
+ JOIN `role` r ON r.id = rr.inheritsFrom
+ WHERE u.id = vUserFk;
+
+ SELECT hasPrivilege INTO vHasPrivilege
+ FROM (SELECT JSON_VALUE(Priv, '$.access') & vPrivilegeFlag hasPrivilege
+ FROM mysql.global_priv gp
+ JOIN tRole tr ON CONCAT(tr.name) = gp.User
+ HAVING hasPrivilege
+ LIMIT 1)sub;
+
+ IF NOT vHasPrivilege THEN
+
+ SELECT sub.privilege = 'Y' INTO vHasPrivilege
+ FROM
+ (SELECT CASE vPrivilege
+ WHEN 'SELECT' THEN Select_priv
+ WHEN 'INSERT' THEN Insert_priv
+ WHEN 'UPDATE' THEN Update_priv
+ WHEN 'DELETE' THEN Delete_priv
+ END privilege
+ FROM mysql.db db
+ JOIN tRole tr ON tr.name = db.User
+ WHERE db.Db = vDb)sub;
+
+ END IF;
+
+ IF NOT vHasPrivilege THEN
+
+ SELECT TRUE INTO vHasPrivilege
+ FROM tRole tr
+ LEFT JOIN (
+ SELECT User, Table_priv privilege
+ FROM mysql.tables_priv
+ WHERE Db = vDb
+ AND Table_name = vTableName
+ UNION
+ SELECT User, Column_priv
+ FROM mysql.columns_priv
+ WHERE Db = vDb
+ AND Table_name = vTableName
+ AND Column_name = vColumnName
+ )sub ON sub.`User` = tr.name
+ WHERE sub.privilege = vPrivilege;
+ END IF;
+
+ DROP TEMPORARY TABLE tRole;
+
+ RETURN vHasPrivilege;
+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 `user_hasRole` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -1381,6 +1597,135 @@ 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 `user_hasRoutinePriv` */;
+/*!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 `user_hasRoutinePriv`(vType ENUM('PROCEDURE', 'FUNCTION'),
+ vChain VARCHAR(100),
+ vUserFk INT
+) RETURNS tinyint(1)
+ READS SQL DATA
+BEGIN
+/**
+ * Search if the user has privileges on routines.
+ *
+ * @param vType procedure or function
+ * @param vChain string passed with this syntax dbName.tableName
+ * @param vUserFk user to ckeck
+ * @return vHasPrivilege
+ */
+ DECLARE vHasPrivilege BOOL DEFAULT FALSE;
+ DECLARE vDb VARCHAR(50);
+ DECLARE vObject VARCHAR(50);
+ DECLARE vChainExists BOOL;
+ DECLARE vExecutePriv INT DEFAULT 262144;
+ -- 262144 = CONV(1000000000000000000, 2, 10)
+ -- 1000000000000000000 execution permission expressed in binary base
+
+ SET vDb = SUBSTRING_INDEX(vChain, '.', 1);
+ SET vChain = SUBSTRING(vChain, LENGTH(vDb) + 2);
+ SET vObject = SUBSTRING_INDEX(vChain, '.', 1);
+
+ SELECT COUNT(*) INTO vChainExists
+ FROM mysql.proc
+ WHERE db = vDb
+ AND `name` = vObject
+ AND `type` = vType
+ LIMIT 1;
+
+ IF NOT vChainExists THEN
+ RETURN FALSE;
+ END IF;
+
+ DROP TEMPORARY TABLE IF EXISTS tRole;
+ CREATE TEMPORARY TABLE tRole
+ (INDEX (`name`))
+ ENGINE = MEMORY
+ SELECT r.`name`
+ FROM user u
+ JOIN roleRole rr ON rr.role = u.role
+ JOIN `role` r ON r.id = rr.inheritsFrom
+ WHERE u.id = vUserFk;
+
+ SELECT TRUE INTO vHasPrivilege
+ FROM mysql.global_priv gp
+ JOIN tRole tr ON tr.name = gp.`User`
+ OR CONCAT('$', tr.name) = gp.`User`
+ WHERE JSON_VALUE(gp.Priv, '$.access') >= vExecutePriv
+ AND gp.Host = ''
+ LIMIT 1;
+
+ IF NOT vHasPrivilege THEN
+ SELECT TRUE INTO vHasPrivilege
+ FROM mysql.db db
+ JOIN tRole tr ON tr.name = db.`User`
+ WHERE db.Db = vDb
+ AND db.Execute_priv = 'Y';
+ END IF;
+
+ IF NOT vHasPrivilege THEN
+ SELECT TRUE INTO vHasPrivilege
+ FROM mysql.procs_priv pp
+ JOIN tRole tr ON tr.name = pp.`User`
+ WHERE pp.Db = vDb
+ AND pp.Routine_name = vObject
+ AND pp.Routine_type = vType
+ AND pp.Proc_priv = 'Execute'
+ LIMIT 1;
+ END IF;
+
+ DROP TEMPORARY TABLE tRole;
+ RETURN vHasPrivilege;
+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 `account_enable` */;
+/*!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 `account_enable`(vSelf INT)
+BEGIN
+/**
+ * Enables an account and sets up email configuration.
+ */
+ UPDATE user
+ SET active = TRUE
+ WHERE id = vSelf;
+
+ INSERT IGNORE INTO account
+ SET id = vSelf;
+
+ INSERT IGNORE INTO mailAliasAccount (mailAlias, account)
+ SELECT id, vSelf
+ FROM mailAlias
+ WHERE alias = 'general';
+
+ INSERT IGNORE INTO mailForward (account, forwardTo)
+ SELECT vSelf, email
+ FROM user
+ WHERE 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 `myUser_login` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -2445,13 +2790,13 @@ DROP TABLE IF EXISTS `clientDied`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clientDied` (
- `id` int(11) NOT NULL DEFAULT 0,
- `clientName` varchar(50) NOT NULL,
+ `clientFk` int(11) NOT NULL DEFAULT 0,
+ `clientName__` varchar(50) NOT NULL COMMENT '@deprecated 2023-10-15',
`lastInvoiced` date DEFAULT NULL,
- `workerCode` varchar(3) NOT NULL,
- `Boss` varchar(3) NOT NULL,
- `Aviso` varchar(13) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
- PRIMARY KEY (`id`)
+ `workerCode__` varchar(3) NOT NULL COMMENT '@deprecated 2023-10-15',
+ `Boss__` varchar(3) NOT NULL COMMENT '@deprecated 2023-10-15',
+ `warning` enum('first','second','third') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ PRIMARY KEY (`clientFk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Clientes que no han comprado en los ultimos 3 meses, se actualiza con proceso nocturno el 3 de cada mes';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -2514,13 +2859,13 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
--- Table structure for table `compradores`
+-- Table structure for table `compradores__`
--
-DROP TABLE IF EXISTS `compradores`;
+DROP TABLE IF EXISTS `compradores__`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `compradores` (
+CREATE TABLE `compradores__` (
`Id_Trabajador` int(10) unsigned NOT NULL,
`año` int(4) NOT NULL,
`semana` int(2) NOT NULL,
@@ -2974,17 +3319,17 @@ DROP TABLE IF EXISTS `salesByItemTypeDay`;
CREATE TABLE `salesByItemTypeDay` (
`itemTypeFk` smallint(5) unsigned NOT NULL,
`dated` date NOT NULL,
- `netSale` int(11) NOT NULL DEFAULT 0,
- `stems` int(11) NOT NULL DEFAULT 0,
- `references` int(11) NOT NULL DEFAULT 0,
- `trash` int(11) NOT NULL DEFAULT 0,
- `faults` int(11) NOT NULL DEFAULT 0,
- `claimed` decimal(10,2) NOT NULL DEFAULT 0.00,
- `accepted` decimal(10,2) NOT NULL DEFAULT 0.00,
- `sale` decimal(10,2) NOT NULL DEFAULT 0.00,
- `buy` decimal(10,2) NOT NULL DEFAULT 0.00,
- `costComponent` decimal(10,2) NOT NULL DEFAULT 0.00,
- `marginComponent` decimal(10,2) NOT NULL DEFAULT 0.00,
+ `netSale__` int(11) NOT NULL DEFAULT 0 COMMENT '@deprecated 2023-08-31, Mismo valor que campo sale',
+ `stems` int(11) NOT NULL DEFAULT 0 COMMENT 'Número de tallos vendidos',
+ `references` int(11) NOT NULL DEFAULT 0 COMMENT 'Número de artículos distintos por tipo vendidos',
+ `trash` int(11) NOT NULL DEFAULT 0 COMMENT 'Tallos basura',
+ `faults` int(11) NOT NULL DEFAULT 0 COMMENT 'Tallos faltas',
+ `claimed` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Valor total de reclamaciones',
+ `accepted` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Valor total de reclamaciones aceptadas',
+ `sale` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Ventas totales',
+ `buy` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Valor de compras totales',
+ `costComponent` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Suma de componentes que son valor de compra',
+ `marginComponent` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Suma de componentes que son márgen',
PRIMARY KEY (`itemTypeFk`,`dated`),
KEY `itemTypeSalesByweek_period_idx` (`dated`),
CONSTRAINT `itemTypeSalesByweek_itemTypeFk` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn`.`itemType` (`id`)
@@ -3650,18 +3995,15 @@ BEGIN
SELECT c.id FROM vn.client c
JOIN vn.country co ON co.id = c.countryFk
WHERE co.code = vCountryCode
- ) sub ON sub.id = cd.id;
+ ) sub ON sub.id = cd.clientFk;
- INSERT INTO clientDied (id, clientName, lastInvoiced, workerCode, Boss, Aviso)
+ INSERT INTO clientDied (clientFk, lastInvoiced, warning)
SELECT c.id,
- c.name,
sub.lastShipped,
- w.code,
- b.code,
CASE
- WHEN lastShipped < vThridPeriod OR lastShipped IS NULL THEN 'Tercer Aviso'
- WHEN lastShipped < vSecondPeriod THEN 'Segundo Aviso'
- WHEN lastShipped < vFirstPeriod THEN 'Primer Aviso'
+ WHEN lastShipped < vThridPeriod OR lastShipped IS NULL THEN 'third'
+ WHEN lastShipped < vSecondPeriod THEN 'second'
+ WHEN lastShipped < vFirstPeriod THEN 'first'
END
FROM vn.client c
JOIN vn.country co ON co .id = c.countryFk
@@ -3922,95 +4264,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 `compradores_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 `compradores_add`(IN vYear INT, IN vWeekFrom INT, IN vWeekTo INT)
-BEGIN
-/**
- * Sustituye los registros de "bs.compradores".
- *
- * @param vYear: año ventas
- * @param vWeekFrom: semana desde
- * @param vWeekTo: semana hasta
- */
- REPLACE bs.compradores
- SELECT it.workerFk AS Id_Trabajador, vYear AS año, tm.week AS semana, SUM(importe) AS importe, 0 AS comision
- FROM bs.ventas v
- JOIN vn.time tm ON tm.dated = v.fecha
- JOIN vn.itemType it ON it.id = v.tipo_id
- WHERE tm.year = vYear
- AND tm.week BETWEEN vWeekFrom AND vWeekTo
- AND it.categoryFk != 6
- GROUP BY it.workerFk, tm.week;
-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 `compradores_add_launcher` */;
-/*!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 `compradores_add_launcher`()
-BEGIN
-
- DECLARE vYear INT;
- DECLARE vWeek INT;
- DECLARE done BOOL DEFAULT FALSE;
-
- DECLARE rs CURSOR FOR
- SELECT year, week
- FROM vn.time
- WHERE dated <= util.VN_CURDATE()
- AND year = vYear
- AND week >= vWeek;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-
- SELECT MAX(año) INTO vYear
- FROM compradores;
-
- SELECT MAX(semana) INTO vWeek
- FROM compradores
- WHERE año = vYear;
-
- OPEN rs;
-
- FETCH rs INTO vYear, vWeek;
-
- WHILE NOT done DO
-
- CALL compradores_add(vYear, vWeek, vWeek);
-
- FETCH rs INTO vYear, vWeek;
-
- END WHILE;
-
- CLOSE rs;
-
- CALL compradores_evolution_add;
-
-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 `compradores_evolution_add` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -4564,6 +4817,8 @@ BEGIN
DECLARE vClaimManaId INT;
DECLARE vManaBankId INT;
DECLARE vManaGreugeTypeId INT;
+ DECLARE vManaFromDays INT;
+ DECLARE vManaToDays INT;
SELECT id INTO vManaId
FROM vn.component WHERE code = 'mana';
@@ -4580,23 +4835,32 @@ BEGIN
SELECT id INTO vManaGreugeTypeId
FROM vn.greugeType WHERE code = 'mana';
- SELECT IFNULL(MAX(dated), '2016-01-01')
- INTO vFromDated
+ SELECT manaFromDays, manaToDays
+ INTO vManaFromDays, vManaToDays
+ FROM vn.salespersonConfig;
+
+ SELECT MAX(dated)
+ INTO vFromDated
FROM vn.clientManaCache;
- DELETE
- FROM vn.clientManaCache
- WHERE dated = vFromDated;
+ DELETE
+ FROM vn.clientManaCache
+ WHERE dated = vFromDated;
- SELECT IFNULL(MAX(dated), '2016-01-01')
- INTO vFromDated
+ SELECT MAX(dated)
+ INTO vFromDated
FROM vn.clientManaCache;
- WHILE timestampadd(DAY,30,vFromDated) < util.VN_CURDATE() DO
+ IF ISNULL(vFromDated) THEN
+ SELECT manaDateFrom
+ INTO vFromDated
+ FROM vn.salespersonConfig;
+ END IF;
+ WHILE vFromDated + INTERVAL vManaToDays DAY < util.VN_CURDATE() DO
SELECT
- timestampadd(DAY,30,vFromDated),
- timestampadd(DAY,-90,vFromDated)
+ vFromDated + INTERVAL vManaToDays DAY,
+ vFromDated - INTERVAL vManaFromDays DAY
INTO
vToDated,
vForDeleteDated;
@@ -4607,8 +4871,8 @@ BEGIN
INSERT INTO vn.clientManaCache(clientFk, mana, dated)
SELECT
Id_Cliente,
- cast(sum(mana) as decimal(10,2)) as mana,
- vToDated as dated
+ SUM(mana),
+ vToDated
FROM
(
SELECT cs.Id_Cliente, Cantidad * Valor as mana
@@ -4625,7 +4889,6 @@ BEGIN
WHERE Id_Banco = vManaBankId
AND Fechacobro > vFromDated
AND Fechacobro <= vToDated
-
UNION ALL
SELECT g.Id_Cliente, g.Importe
FROM vn2008.Greuges g
@@ -4641,9 +4904,7 @@ BEGIN
HAVING Id_Cliente;
SET vFromDated = vToDated;
-
END WHILE;
-
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -4676,9 +4937,16 @@ BEGIN
GROUP BY c.lastSalesPersonFk
)avgPortfolioWeight ON avgPortfolioWeight.lastSalesPersonFk = wm.workerFk
JOIN vn.salespersonConfig spc
- SET wm.pricesModifierRate = GREATEST(
- spc.manaMinRate,
- LEAST(spc.manaMaxRate, ROUND( - wm.amount / avgPortfolioWeight.amount)));
+ SET wm.pricesModifierRate =
+ IFNULL(
+ GREATEST(
+ spc.manaMinRate,
+ LEAST(
+ spc.manaMaxRate,
+ ROUND( - wm.amount / avgPortfolioWeight.amount, 3)
+ )
+ )
+ ,0);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -4703,13 +4971,12 @@ BEGIN
DECLARE vDone BOOL;
DECLARE vError VARCHAR(255);
DECLARE vErrorCode VARCHAR(255);
- DECLARE vNErrors INT DEFAULT 0;
DECLARE vSchema VARCHAR(255);
DECLARE vProcedure VARCHAR(255);
DECLARE vLogMail VARCHAR(255);
- DECLARE vId INT;
+ DECLARE vNightTaskFk INT;
- DECLARE rs CURSOR FOR
+ DECLARE vQueue CURSOR FOR
SELECT id, `schema`, `procedure`
FROM nightTask
WHERE finished <= util.VN_CURDATE()
@@ -4720,14 +4987,17 @@ BEGIN
SET vDone = TRUE;
SET max_sp_recursion_depth = 3;
- OPEN rs;
- myLoop: LOOP
+ SELECT logMail INTO vLogMail
+ FROM nightTaskConfig LIMIT 1;
+
+ OPEN vQueue;
+ l: LOOP
SET vDone = FALSE;
- FETCH rs INTO vId, vSchema, vProcedure;
+ FETCH vQueue INTO vNightTaskFk, vSchema, vProcedure;
IF vDone THEN
- LEAVE myLoop;
+ LEAVE l;
END IF;
UPDATE nightTask
@@ -4735,7 +5005,7 @@ BEGIN
`finished` = NULL,
`error` = NULL,
`errorCode` = NULL
- WHERE id = vId;
+ WHERE id = vNightTaskFk;
SET vError = NULL;
CALL nightTask_launchTask(
@@ -4746,36 +5016,30 @@ BEGIN
);
IF vError IS NOT NULL THEN
- SET vNErrors = vNErrors + 1;
+ IF vLogMail IS NOT NULL THEN
+ CALL vn.mail_insert(
+ vLogMail,
+ NULL,
+ CONCAT('Nightly task failed (', vSchema, '.', vProcedure, ')'),
+ CONCAT(
+ '[', vErrorCode, '] ', vError, CHAR(13, 10), -- Line break
+ 'See ', SCHEMA(), '.nightTask table for more info.'
+ )
+ );
+ END IF;
UPDATE nightTask
SET `error` = vError,
`errorCode` = vErrorCode
- WHERE id = vId;
+ WHERE id = vNightTaskFk;
ELSE
UPDATE nightTask
SET finished = util.VN_NOW(),
lastFinished = util.VN_NOW()
- WHERE id = vId;
+ WHERE id = vNightTaskFk;
END IF;
END LOOP;
-
- CLOSE rs;
-
- SELECT logMail INTO vLogMail
- FROM nightTaskConfig LIMIT 1;
-
- IF vNErrors > 0 AND vLogMail IS NOT NULL THEN
- CALL vn.mail_insert(
- vLogMail,
- NULL,
- 'Nightly task failed',
- CONCAT(
- vNErrors, ' procedures of nightly tasks have failed. ',
- 'Please, see `', SCHEMA() ,'`.`nightTask` table for more info.'
- )
- );
- END IF;
+ CLOSE vQueue;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -5024,11 +5288,10 @@ BEGIN
DELETE FROM salesByItemTypeDay
WHERE dated BETWEEN vDateStart AND vDateEnd;
- INSERT INTO salesByItemTypeDay (itemTypeFk, dated, `references`, netSale, stems)
+ INSERT INTO salesByItemTypeDay (itemTypeFk, dated, `references`, stems)
SELECT it.id itemTypeFk,
bs.dated,
COUNT(DISTINCT(i.id)) `references`,
- SUM(bs.amount) netSale,
SUM(i.stems * s.quantity) stems
FROM sale bs
JOIN vn.itemType it ON it.id = bs.typeFk
@@ -8446,9 +8709,9 @@ DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8mb3 */ ;;
-/*!50003 SET character_set_results = utf8mb3 */ ;;
-/*!50003 SET collation_connection = utf8mb3_general_ci */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
@@ -8651,14 +8914,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ekt_load` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_load`(IN `vSelf` INT)
proc:BEGIN
@@ -8805,7 +9068,7 @@ proc:BEGIN
,`grouping`
,quantity
,groupingMode
- ,packageFk
+ ,packagingFk
,weight
)
SELECT
@@ -8818,7 +9081,7 @@ proc:BEGIN
,IFNULL(b.`grouping`, e.pac)
,@pac * e.qty
,vForceToPacking
- ,IF(vHasToChangePackagingFk OR ISNULL(b.packageFk), vPackage, b.packageFk)
+ ,IF(vHasToChangePackagingFk OR ISNULL(b.packagingFk), vPackage, b.packagingFk)
,(IFNULL(i.weightByPiece,0) * @pac)/1000
FROM edi.ekt e
LEFT JOIN vn.buy b ON b.id = vBuy
@@ -9429,7 +9692,7 @@ proc: BEGIN
`name`,
longName,
subName,
- expenceFk,
+ expenseFk,
typeFk,
intrastatFk,
originFk,
@@ -9817,7 +10080,7 @@ BEGIN
`name`,
longName,
subName,
- expenceFk,
+ expenseFk,
typeFk,
intrastatFk,
originFk,
@@ -11407,6 +11670,7 @@ CREATE TABLE `tpvTransaction` (
KEY `user_id` (`clientFk`),
KEY `response` (`response`),
KEY `error_code` (`errorCode`),
+ KEY `tpvTransaction_status_IDX` (`status`,`receiptFk`) USING BTREE,
CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn`.`receipt` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `tpvTransaction_ibfk_2` FOREIGN KEY (`merchantFk`) REFERENCES `tpvMerchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -11821,14 +12085,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `item_getVisible` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getVisible`(
vWarehouse TINYINT,
@@ -11918,14 +12182,14 @@ BEGIN
ENGINE = MEMORY
SELECT *
FROM (
- SELECT b.itemFk, b.packageFk, b.packing
+ SELECT b.itemFk, b.packagingFk, b.packing
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel t ON t.id = e.travelFk
WHERE t.landed BETWEEN vDateInv AND vDate
AND NOT b.isIgnored
AND b.price2 >= 0
- AND b.packageFk IS NOT NULL
+ AND b.packagingFk IS NOT NULL
ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC
LIMIT 10000000000000000000
) t GROUP BY itemFk;
@@ -11942,10 +12206,10 @@ BEGIN
JOIN `filter` f ON f.itemFk = i.id
JOIN currentStock s ON s.itemFk = i.id
LEFT JOIN tmp t ON t.itemFk = i.id
- LEFT JOIN vn.packaging p ON p.id = t.packageFk
+ LEFT JOIN vn.packaging p ON p.id = t.packagingFk
WHERE CEIL(s.quantity / t.packing) > 0
-- FIXME: Column Cubos.box not included in view vn.packaging
- /* AND p.box */;
+ /* AND p.box */ ;
DROP TEMPORARY TABLE
`filter`,
@@ -12837,6 +13101,7 @@ BEGIN
DECLARE vRow INT;
DECLARE vAdd INT;
DECLARE vAvailable INT;
+ DECLARE vMinQuantity INT;
DECLARE vDone BOOL;
DECLARE vGrouping INT;
DECLARE vRate INT;
@@ -12867,15 +13132,23 @@ BEGIN
FROM tmp.zoneGetShipped
WHERE warehouseFk = vWarehouse;
- SELECT available INTO vAvailable
+ SELECT IFNULL(available, 0) INTO vAvailable
FROM tmp.ticketLot
WHERE warehouseFk = vWarehouse
AND itemFk = vItem;
- IF vAmount > IFNULL(vAvailable, 0) THEN
+ IF vAmount > vAvailable THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
+ SELECT IFNULL(minQuantity, 0) INTO vMinQuantity
+ FROM vn.item
+ WHERE id = vItem;
+
+ IF vAmount < LEAST(vMinQuantity, vAvailable) THEN
+ CALL util.throw ('quantityLessThanMin');
+ END IF;
+
OPEN cur;
l: LOOP
@@ -13390,18 +13663,25 @@ BEGIN
END IF;
-- Busca un ticket existente que coincida con los parametros
-
+ WITH tPrevia AS
+ (SELECT DISTINCT s.ticketFk
+ FROM vn.sale s
+ JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN vn.ticket t ON t.id = s.ticketFk
+ WHERE t.shipped BETWEEN vShipment AND util.dayend(vShipment)
+ )
SELECT t.id INTO vTicket
FROM vn.ticket t
+ LEFT JOIN tPrevia tp ON tp.ticketFk = t.id
LEFT JOIN vn.ticketState tls on tls.ticket = t.id
- JOIN `order` o
+ JOIN hedera.`order` o
ON o.address_id = t.addressFk
AND vWarehouse = t.warehouseFk
- -- AND o.agency_id = t.agencyModeFk
AND o.date_send = t.landed
- AND vShipment = DATE(t.shipped)
+ AND DATE(t.shipped) = vShipment
WHERE o.id = vSelf
AND t.refFk IS NULL
+ AND tp.ticketFk IS NULL
AND IFNULL(tls.alertLevel,0) = 0
LIMIT 1;
@@ -13472,7 +13752,8 @@ BEGIN
IF vSale THEN
UPDATE vn.sale
- SET quantity = quantity + vAmount
+ SET quantity = quantity + vAmount,
+ originalQuantity = quantity
WHERE id = vSale;
SELECT s.quantity INTO vNewQuantity
@@ -15204,6 +15485,7 @@ SET character_set_client = utf8;
/*!50001 CREATE VIEW `sipConf` AS SELECT
1 AS `id`,
1 AS `name`,
+ 1 AS `regexten`,
1 AS `callbackextension`,
1 AS `md5secret`,
1 AS `callerid`,
@@ -15214,10 +15496,12 @@ SET character_set_client = utf8;
1 AS `context`,
1 AS `incominglimit`,
1 AS `pickupgroup`,
- 1 AS `careinvite`,
+ 1 AS `directmedia`,
1 AS `insecure`,
1 AS `transport`,
1 AS `nat`,
+ 1 AS `disallow`,
+ 1 AS `allow`,
1 AS `ipaddr`,
1 AS `regseconds`,
1 AS `port`,
@@ -15244,11 +15528,9 @@ CREATE TABLE `sipConfig` (
`context` varchar(80) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`incomingLimit` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`pickupGroup` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- `careInvite` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `directMedia` enum('yes','no') DEFAULT NULL,
`insecure` varchar(45) NOT NULL,
`transport` varchar(255) DEFAULT NULL,
- `avpf` varchar(255) DEFAULT NULL,
- `icesupport` varchar(255) DEFAULT NULL,
`encryption` varchar(255) DEFAULT NULL,
`dtlsenable` varchar(255) DEFAULT NULL,
`dtlverify` varchar(255) DEFAULT NULL,
@@ -15256,6 +15538,9 @@ CREATE TABLE `sipConfig` (
`dtlsprivatekey` varchar(255) DEFAULT NULL,
`dtlssetup` varchar(255) DEFAULT NULL,
`nat` varchar(255) DEFAULT NULL,
+ `disallow` varchar(100) DEFAULT 'all',
+ `allow` varchar(100) DEFAULT 'g729;ilbc;gsm;ulaw;alaw',
+ `qualify` enum('yes','no') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Default values for SIP accounts';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -17053,7 +17338,7 @@ BEGIN
JOIN vn.XDiario x ON x.id = mci.id
JOIN vn.supplier s ON s.id = supplierFk
JOIN vn.invoiceInTax iit ON iit.invoiceInFk = ii.id
- JOIN vn.expence e ON e.id = iit.expenceFk
+ JOIN vn.expense e ON e.id = iit.expenseFk
JOIN TiposRetencion t ON t.CodigoRetencion = ii.withholdingSageFk
LEFT JOIN tmp.invoiceDua id ON id.id = mci.id
JOIN (SELECT SUM(x2.BASEEURO) taxableBase, SUM(x2.EURODEBE) taxBase
@@ -17156,7 +17441,7 @@ BEGIN
i.serial COLLATE utf8mb3_unicode_ci serial,
i.supplierFk,
i.issued,
- IF(expenceFkDeductible, FALSE, i.isVatDeductible) isVatDeductible,
+ IF(expenseFkDeductible, FALSE, i.isVatDeductible) isVatDeductible,
IF(c.code = 'EUR', '',c.`code`) currencyFk
FROM vn.invoiceIn i
JOIN vn.currency c ON c.id = i.currencyFk
@@ -17664,7 +17949,7 @@ BEGIN
e.id accountFk,
UCASE(e.name),
''
- FROM vn.expence e
+ FROM vn.expense e
UNION
SELECT company_getCode(vCompanyFk),
b.account,
@@ -19415,6 +19700,20 @@ CREATE TABLE `version` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `versionConfig`
+--
+
+DROP TABLE IF EXISTS `versionConfig`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `versionConfig` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `realm` varchar(16) DEFAULT NULL COMMENT 'Data set on which the project runs',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `versionLog`
--
@@ -21551,6 +21850,20 @@ CREATE TABLE `addressObservation` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Observaciones de los consignatarios';
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `addressShortage`
+--
+
+DROP TABLE IF EXISTS `addressShortage`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `addressShortage` (
+ `addressFk` int(11) NOT NULL,
+ PRIMARY KEY (`addressFk`),
+ CONSTRAINT `addressShortage_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `agency`
--
@@ -21697,7 +22010,7 @@ DROP TABLE IF EXISTS `agencyTermConfig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `agencyTermConfig` (
- `expenceFk` varchar(10) DEFAULT NULL,
+ `expenseFk` varchar(10) DEFAULT NULL,
`vatAccountSupported` varchar(15) DEFAULT NULL,
`vatPercentage` decimal(28,10) DEFAULT NULL,
`transaction` varchar(50) DEFAULT NULL
@@ -22217,52 +22530,6 @@ CREATE TABLE `bookingPlanner` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Table structure for table `botanicExport`
---
-
-DROP TABLE IF EXISTS `botanicExport`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `botanicExport` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `ediGenusFk` mediumint(8) unsigned NOT NULL,
- `ediSpecieFk` mediumint(8) unsigned DEFAULT NULL,
- `countryFk__` mediumint(8) unsigned DEFAULT NULL,
- `restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- `description` varchar(45) DEFAULT NULL,
- `isProtectedZone` tinyint(1) NOT NULL DEFAULT 0,
- `code` enum('importProhibited','phytosanitaryPassport','individualPassport') DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `Id_Paises` (`countryFk__`),
- KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`),
- KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`),
- CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk__`) REFERENCES `country` (`id`)
-) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises';
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!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`.`botanicExport_beforeInsert`
- BEFORE INSERT ON `botanicExport`
- FOR EACH ROW
-BEGIN
- IF (SELECT botanicExport_isUpdatable (NEW.ediGenusFk, NEW.ediSpecieFk, NEW.restriction) ) > 0 THEN
- CALL util.throw ('Datos duplicados');
- 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 */ ;
-
--
-- Table structure for table `budget`
--
@@ -22422,7 +22689,7 @@ CREATE TABLE `business` (
`workerBusinessProfessionalCategoryFk` int(11) DEFAULT NULL,
`calendarTypeFk` int(11) DEFAULT 1,
`isHourlyLabor` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Contrato por horas',
- `workcenterFk` int(11) DEFAULT NULL,
+ `workcenterFk` int(11) NOT NULL DEFAULT 9,
`rate` int(11) DEFAULT NULL,
`workerBusinessCategoryFk` int(11) DEFAULT NULL,
`workerBusinessTypeFk` int(11) DEFAULT NULL,
@@ -22682,7 +22949,7 @@ CREATE TABLE `buy` (
`comissionValue` decimal(10,3) NOT NULL DEFAULT 0.000,
`packageValue` decimal(10,3) NOT NULL DEFAULT 0.000,
`location` varchar(5) DEFAULT NULL,
- `packageFk` varchar(10) DEFAULT '--',
+ `packagingFk` varchar(10) DEFAULT '--',
`price1` decimal(10,2) DEFAULT 0.00,
`price2` decimal(10,2) DEFAULT 0.00,
`price3` decimal(10,2) DEFAULT 0.00,
@@ -22698,9 +22965,10 @@ CREATE TABLE `buy` (
`deliveryFk` int(11) DEFAULT NULL,
`itemOriginalFk` int(11) DEFAULT NULL COMMENT 'Item original de la entrada',
`editorFk` int(10) unsigned DEFAULT NULL,
+ `packageFk` varchar(10) GENERATED ALWAYS AS (`packagingFk`) VIRTUAL,
PRIMARY KEY (`id`),
KEY `CompresId_Trabajador` (`workerFk`),
- KEY `Id_Cubo` (`packageFk`),
+ KEY `Id_Cubo` (`packagingFk`),
KEY `Id_Entrada` (`entryFk`),
KEY `container_id` (`containerFk`),
KEY `buy_edi_id` (`ektFk`),
@@ -22715,7 +22983,7 @@ CREATE TABLE `buy` (
CONSTRAINT `buy_fk_4` FOREIGN KEY (`deliveryFk`) REFERENCES `edi`.`deliveryInformation` (`ID`) ON DELETE SET NULL ON UPDATE SET NULL,
CONSTRAINT `buy_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `buy_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `buy_ibfk_2` FOREIGN KEY (`packageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `buy_ibfk_2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE,
CONSTRAINT `buy_id` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `buy_itemfk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=DYNAMIC;
@@ -22910,11 +23178,11 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_afterUpdate`
AFTER UPDATE ON `buy`
@@ -22960,7 +23228,7 @@ trig: BEGIN
!(NEW.quantity <=> OLD.quantity) OR
!(NEW.packing <=> OLD.packing) OR
!(NEW.grouping <=> OLD.grouping) OR
- !(NEW.packageFk <=> OLD.packageFk) OR
+ !(NEW.packagingFk <=> OLD.packagingFk) OR
!(NEW.weight <=> OLD.weight) THEN
CALL vn.mail_insert(
CONCAT(account.user_getNameFromId(vBuyerFk),'@verdnatura.es'),
@@ -23945,7 +24213,9 @@ CREATE TABLE `claimResponsible` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`description` varchar(45) NOT NULL,
`responsability` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'if=1 >sensib >culpa',
- PRIMARY KEY (`id`)
+ `code` varchar(3) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `claimResponsible_UN` (`code`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Responsables de las causas';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -24094,7 +24364,7 @@ CREATE TABLE `client` (
`hasToInvoice` tinyint(1) NOT NULL DEFAULT 1,
`isFreezed` tinyint(1) NOT NULL DEFAULT 0,
`salesPersonFk` int(10) unsigned DEFAULT NULL,
- `credit` decimal(10,2) NOT NULL DEFAULT 0.00,
+ `credit` decimal(10,2) unsigned NOT NULL DEFAULT 0.00,
`countryFk` mediumint(8) unsigned NOT NULL DEFAULT 1,
`isActive` tinyint(1) NOT NULL DEFAULT 1,
`gestdocFk` int(11) DEFAULT NULL,
@@ -24150,6 +24420,7 @@ CREATE TABLE `client` (
KEY `client_FK_3` (`transferorFk`),
KEY `codpos` (`postcode`),
KEY `client_fk_editor` (`editorFk`),
+ KEY `client_isTaxDataChecked_IDX` (`isTaxDataChecked`) USING BTREE,
CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`contactChannelFk`) REFERENCES `contactChannel` (`id`) ON UPDATE CASCADE,
CONSTRAINT `client_FK` FOREIGN KEY (`businessTypeFk`) REFERENCES `businessType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `client_FK_1` FOREIGN KEY (`bankEntityFk`) REFERENCES `bankEntity` (`id`) ON UPDATE CASCADE,
@@ -24203,6 +24474,31 @@ 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 @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`client_AfterInsert`
+ AFTER INSERT ON `client`
+ FOR EACH ROW
+BEGIN
+ IF NEW.credit IS NOT NULL AND NEW.credit THEN
+ INSERT INTO clientCredit
+ SET clientFk = NEW.id,
+ workerFk = NEW.editorFk,
+ amount = NEW.credit;
+ 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 */ ;
@@ -24214,17 +24510,23 @@ DELIMITER ;;
FOR EACH ROW
BEGIN
DECLARE vText VARCHAR(255) DEFAULT NULL;
- DECLARE vPayMethodFk INT;
+ DECLARE vPayMethodFk INT;
SET NEW.editorFk = account.myUser_getId();
+ IF NOT(NEW.credit <=> OLD.credit) THEN
+ INSERT INTO clientCredit
+ SET clientFk = NEW.id,
+ amount = NEW.credit,
+ workerFk = NEW.editorFk;
+ END IF;
-- Comprueba que el formato de los teléfonos es válido
IF !(NEW.phone <=> OLD.phone) AND (NEW.phone <> '') THEN
CALL pbx.phone_isValid(NEW.phone);
END IF;
- IF !(NEW.mobile <=> OLD.mobile) AND (NEW.mobile <> '')THEN
+ IF !(NEW.mobile <=> OLD.mobile) AND (NEW.mobile <> '')THEN
CALL pbx.phone_isValid(NEW.mobile);
END IF;
@@ -24234,7 +24536,7 @@ BEGIN
IF NEW.payMethodFk = vPayMethodFk AND NEW.dueDay = 0 THEN
SET NEW.dueDay = 5;
- END IF;
+ END IF;
-- Avisar al comercial si ha llegado la documentación sepa/core
@@ -24247,12 +24549,12 @@ BEGIN
END IF;
IF vText IS NOT NULL
- THEN
+ THEN
INSERT INTO mail(receiver, replyTo, `subject`, body)
SELECT
CONCAT(IF(ac.id,u.name, 'jgallego'), '@verdnatura.es'),
- 'administracion@verdnatura.es',
- CONCAT('Cliente ', NEW.id),
+ 'administracion@verdnatura.es',
+ CONCAT('Cliente ', NEW.id),
CONCAT('Recibida la documentación: ', vText)
FROM worker w
LEFT JOIN account.user u ON w.id = u.id AND u.active
@@ -24260,10 +24562,10 @@ BEGIN
WHERE w.id = NEW.salesPersonFk;
END IF;
- IF NEW.salespersonFk IS NULL AND OLD.salespersonFk IS NOT NULL THEN
+ IF NEW.salespersonFk IS NULL AND OLD.salespersonFk IS NOT NULL THEN
IF (SELECT COUNT(clientFk)
FROM clientProtected
- WHERE clientFk = NEW.id
+ WHERE clientFk = NEW.id
) > 0 THEN
CALL util.throw("HAS_CLIENT_PROTECTED");
END IF;
@@ -24276,7 +24578,6 @@ BEGIN
IF !(NEW.businessTypeFk <=> OLD.businessTypeFk) AND (NEW.businessTypeFk = 'individual' OR OLD.businessTypeFk = 'individual') THEN
SET NEW.isTaxDataChecked = 0;
END IF;
-
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -24425,6 +24726,8 @@ CREATE TABLE `clientContact` (
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `clientContact_fk_editor` (`editorFk`),
+ KEY `clientContact_FK` (`clientFk`),
+ CONSTRAINT `clientContact_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `clientContact_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -24896,7 +25199,7 @@ DROP TABLE IF EXISTS `clientSample`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clientSample` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `clientFk` int(10) unsigned NOT NULL,
+ `clientFk` int(11) NOT NULL,
`typeFk` int(10) unsigned NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
`workerFk` int(10) unsigned NOT NULL,
@@ -24907,7 +25210,9 @@ CREATE TABLE `clientSample` (
PRIMARY KEY (`id`),
KEY `empresa_id` (`companyFk`),
KEY `clientSample_fk_editor` (`editorFk`),
+ KEY `clientSample_FK` (`clientFk`),
CONSTRAINT `clientSampleCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `clientSample_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `clientSample_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -25054,7 +25359,7 @@ DROP TABLE IF EXISTS `cmr`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cmr` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `ticketFk` int(11) DEFAULT NULL COMMENT 'refs #6092 @toDeprecate 2023-08-02',
+ `ticketFk__` int(11) DEFAULT NULL COMMENT '@deprecated 2023-10-20 refs #6092',
`truckPlate` varchar(30) DEFAULT NULL,
`observations` varchar(255) DEFAULT NULL,
`senderInstruccions` varchar(255) DEFAULT NULL,
@@ -25071,14 +25376,14 @@ CREATE TABLE `cmr` (
`landed` datetime DEFAULT NULL COMMENT 'Hora de llegada a destino',
`ead` datetime DEFAULT NULL COMMENT 'Estimated Arriving Date',
PRIMARY KEY (`id`),
- KEY `cmr_fk1_idx` (`ticketFk`),
+ KEY `cmr_fk1_idx` (`ticketFk__`),
KEY `cmr_fk2_idx` (`companyFk`),
KEY `cmr_fk3_idx` (`addressToFk`),
KEY `cm_fk4_idx` (`supplierFk`),
KEY `cmr_FK` (`addressFromFk`),
CONSTRAINT `cmrCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `cmr_FK` FOREIGN KEY (`addressFromFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`),
+ CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk__`) REFERENCES `ticket` (`id`),
CONSTRAINT `cmr_fk3` FOREIGN KEY (`addressToFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `cmr_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
@@ -25139,51 +25444,6 @@ CREATE TABLE `cmrPallet` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='relaciona los cmr con los pallets de expediciones';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `cmr_list`
---
-
-DROP TABLE IF EXISTS `cmr_list`;
-/*!50001 DROP VIEW IF EXISTS `cmr_list`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `cmr_list` AS SELECT
- 1 AS `cmrFk`,
- 1 AS `ticketFk`,
- 1 AS `truckPlate`,
- 1 AS `observations`,
- 1 AS `senderInstruccions`,
- 1 AS `paymentInstruccions`,
- 1 AS `specialAgreements`,
- 1 AS `created`,
- 1 AS `packagesList`,
- 1 AS `clientName`,
- 1 AS `clientPostalCode`,
- 1 AS `clientStreet`,
- 1 AS `clientCity`,
- 1 AS `clientProvince`,
- 1 AS `clientCountry`,
- 1 AS `companyName`,
- 1 AS `companyStreet`,
- 1 AS `companyPostCode`,
- 1 AS `companyCity`,
- 1 AS `companyCountry`,
- 1 AS `warehouseAddress`,
- 1 AS `shipped`,
- 1 AS `clientOficialName`,
- 1 AS `supplierFk`,
- 1 AS `carrierName`,
- 1 AS `carrierStreet`,
- 1 AS `carrierPostCode`,
- 1 AS `carrierCity`,
- 1 AS `carrierCountry`,
- 1 AS `phone`,
- 1 AS `mobile`,
- 1 AS `addressFk`,
- 1 AS `stamp`,
- 1 AS `merchandiseDetail` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `collection`
--
@@ -25364,6 +25624,140 @@ CREATE TABLE `collectionVolumetry` (
CONSTRAINT `collectionVolumetry_FK_1` FOREIGN KEY (`trainFk`) REFERENCES `train` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
+/*!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`.`collectionVolumetry_afterInsert`
+ AFTER INSERT ON `collectionVolumetry`
+ FOR EACH ROW
+BEGIN
+ DECLARE vJSON JSON DEFAULT JSON_OBJECT();
+ DECLARE vUserFk INT DEFAULT account.myUser_getId();
+
+ SET vJSON = JSON_MERGE(JSON_OBJECT('id', NEW.id), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('level', NEW.level), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('lines', NEW.lines), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('liters', NEW.liters), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('height', NEW.height), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('itemPackingTypeFk', NEW.itemPackingTypeFk), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('trainFk', NEW.trainFk), vJSON);
+
+ SET vJSON = JSON_MERGE(JSON_OBJECT('userFk', vUserFk), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('action', 'insert'), vJSON);
+
+ SET vJSON = util.notification_send(
+ 'modified-collection-volumetry',
+ JSON_OBJECT('data', JSON_EXTRACT(vJSON, '$')),
+ vUserFk
+ );
+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`.`collectionVolumetry_afterUpdate`
+ AFTER UPDATE ON `collectionVolumetry`
+ FOR EACH ROW
+BEGIN
+ DECLARE vJSON JSON DEFAULT JSON_OBJECT();
+ DECLARE vUserFk INT DEFAULT account.myUser_getId();
+
+ IF NOT (NEW.id <=> OLD.id) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('id', NEW.id), vJSON);
+ END IF;
+
+ IF NOT (NEW.`level` <=> OLD.`level`) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('level', NEW.`level`), vJSON);
+ END IF;
+
+ IF NOT (NEW.`lines` <=> OLD.`lines`) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('lines', NEW.`lines`), vJSON);
+ END IF;
+
+ IF NOT (NEW.liters <=> OLD.liters) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('liters', NEW.liters), vJSON);
+ END IF;
+
+ IF NOT (NEW.height <=> OLD.height) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('height', NEW.height), vJSON);
+ END IF;
+
+ IF NOT (NEW.itemPackingTypeFk <=> OLD.itemPackingTypeFk) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('itemPackingTypeFk', NEW.itemPackingTypeFk), vJSON);
+ END IF;
+
+ IF NOT (NEW.trainFk <=> OLD.trainFk) THEN
+ SET vJSON = JSON_MERGE(JSON_OBJECT('trainFk', NEW.trainFk), vJSON);
+ END IF;
+
+ SET vJSON = JSON_MERGE(JSON_OBJECT('userFk', vUserFk), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('action', 'update'), vJSON);
+
+ SET vJSON = util.notification_send(
+ 'modified-collection-volumetry',
+ JSON_OBJECT('data', JSON_EXTRACT(vJSON, '$')),
+ vUserFk
+ );
+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`.`collectionVolumetry_afterDelete`
+ AFTER DELETE ON `collectionVolumetry`
+ FOR EACH ROW
+BEGIN
+ DECLARE vJSON JSON DEFAULT JSON_OBJECT();
+ DECLARE vUserFk INT DEFAULT account.myUser_getId();
+
+ SET vJSON = JSON_MERGE(JSON_OBJECT('id', OLD.id), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('level', OLD.level), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('lines', OLD.lines), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('liters', OLD.liters), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('height', OLD.height), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('itemPackingTypeFk', OLD.itemPackingTypeFk), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('trainFk', OLD.trainFk), vJSON);
+
+ SET vJSON = JSON_MERGE(JSON_OBJECT('userFk', vUserFk), vJSON);
+ SET vJSON = JSON_MERGE(JSON_OBJECT('action', 'delete'), vJSON);
+
+ SET vJSON = util.notification_send(
+ 'modified-collection-volumetry',
+ JSON_OBJECT('data', JSON_EXTRACT(vJSON, '$')),
+ vUserFk
+ );
+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 */ ;
--
-- Table structure for table `collectionWagon`
@@ -25374,14 +25768,14 @@ DROP TABLE IF EXISTS `collectionWagon`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `collectionWagon` (
`collectionFk` int(11) NOT NULL,
- `wagonFk` int(11) NOT NULL,
+ `wagonFk` varchar(6) NOT NULL,
`position` int(11) unsigned NOT NULL,
PRIMARY KEY (`collectionFk`,`position`),
UNIQUE KEY `collectionWagon_unique` (`collectionFk`,`wagonFk`),
- KEY `collectionWagon_wagon` (`wagonFk`),
- CONSTRAINT `collectionWagon_collection` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `collectionWagon_wagon` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
+ KEY `collectionWagon_FK_1` (`wagonFk`),
+ CONSTRAINT `collectionWagon_FK_1` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `collectionWagon_collection` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -25393,16 +25787,18 @@ DROP TABLE IF EXISTS `collectionWagonTicket`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `collectionWagonTicket` (
`ticketFk` int(11) NOT NULL,
- `wagonFk` int(11) NOT NULL,
+ `wagonFk` varchar(6) NOT NULL,
`trayFk` int(11) unsigned NOT NULL,
- `side` set('L','R') DEFAULT NULL,
- PRIMARY KEY (`ticketFk`),
- KEY `collectionWagonTicket_wagon` (`wagonFk`),
+ `side` set('L','R') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `rgb` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'Color de la balda',
+ `height` int(11) DEFAULT NULL COMMENT 'altura de la balda',
+ PRIMARY KEY (`ticketFk`,`trayFk`),
KEY `collectionWagonTicket_tray` (`trayFk`),
- CONSTRAINT `collectionWagonTicket_ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `collectionWagonTicket_tray` FOREIGN KEY (`trayFk`) REFERENCES `wagonTypeTray` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `collectionWagonTicket_wagon` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
+ KEY `collectionWagonTicket_FK_1` (`wagonFk`),
+ CONSTRAINT `collectionWagonTicket_FK` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `collectionWagonTicket_FK_1` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `collectionWagonTicket_tray` FOREIGN KEY (`trayFk`) REFERENCES `wagonTypeTray` (`id`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -25525,6 +25921,23 @@ SET character_set_client = utf8;
1 AS `footnotes` */;
SET character_set_client = @saved_cs_client;
+--
+-- Table structure for table `comparativeConfig`
+--
+
+DROP TABLE IF EXISTS `comparativeConfig`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `comparativeConfig` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `defaultDayRange` int(10) unsigned DEFAULT NULL COMMENT 'Rango de días predeterminado si no se especifica',
+ `weekRange` int(10) unsigned DEFAULT NULL COMMENT 'La cantidad de semanas que se restarán y sumarán',
+ `maxDayRange` int(10) unsigned DEFAULT NULL COMMENT 'El rango máximo de días antes de utilizar el rango de días predeterminado',
+ `minDayRange` int(10) unsigned DEFAULT NULL COMMENT 'El rango mínimo de días antes de utilizar el rango de días predeterminado',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `comparativeFilterType`
--
@@ -25978,33 +26391,6 @@ CREATE TABLE `cplusCorrectingType` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Table structure for table `cplusInvoiceType472`
---
-
-DROP TABLE IF EXISTS `cplusInvoiceType472`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `cplusInvoiceType472` (
- `id` int(10) unsigned NOT NULL,
- `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*18) TIPO FACTURA (Asientos)SOPORTADO – DEDUCIBLE (472)';
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `cplusInvoiceType477`
---
-
-DROP TABLE IF EXISTS `cplusInvoiceType477`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `cplusInvoiceType477` (
- `id` int(10) unsigned NOT NULL,
- `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*18) TIPO FACTURA (Asientos)REPERCUTIDO - DEVENGADO (477)';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cplusRectificationType`
@@ -26062,34 +26448,6 @@ CREATE TABLE `cplusTerIdNif` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Table structure for table `cplusTrascendency472`
---
-
-DROP TABLE IF EXISTS `cplusTrascendency472`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `cplusTrascendency472` (
- `id` int(10) unsigned NOT NULL,
- `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*15) CLAVE DE RÉGIMEN ESPECIAL O TRASCENDENCIA(Asientos)SOPORTADO – DEDUCIBLE (472)';
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `cplusTrascendency477`
---
-
-DROP TABLE IF EXISTS `cplusTrascendency477`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `cplusTrascendency477` (
- `id` int(10) unsigned NOT NULL,
- `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='(*15) CLAVE DE RÉGIMEN ESPECIAL O TRASCENDENCIA(Asientos) REPERCUTIDO - DEVENGADO (477)';
-/*!40101 SET character_set_client = @saved_cs_client */;
-
--
-- Table structure for table `creditClassification`
--
@@ -27256,18 +27614,15 @@ DROP TABLE IF EXISTS `duaTax`;
CREATE TABLE `duaTax` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`duaFk` int(11) NOT NULL,
- `supplierFk` int(10) unsigned NOT NULL,
`taxClassFk` tinyint(3) unsigned NOT NULL,
`base` decimal(10,2) NOT NULL,
`rate` decimal(5,2) NOT NULL,
`tax` decimal(10,2) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_dua_tax_awb_dua1_idx` (`duaFk`),
- KEY `duaTax_fk2_idx` (`supplierFk`),
KEY `duaTax_fk3_idx` (`taxClassFk`),
CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `duaTax_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -27965,31 +28320,6 @@ CREATE TABLE `errorLogApp` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Guarda un registro de errores e la app de almacén';
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Table structure for table `errorProduction`
---
-
-DROP TABLE IF EXISTS `errorProduction`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `errorProduction` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `userFk` int(11) DEFAULT NULL,
- `firstname` varchar(100) DEFAULT NULL,
- `lastname` varchar(100) DEFAULT NULL,
- `rol` varchar(100) DEFAULT NULL,
- `ticketNumber` int(11) DEFAULT NULL,
- `lineNumber` int(11) DEFAULT NULL,
- `error` int(11) DEFAULT NULL,
- `volume` double DEFAULT NULL,
- `hourStart` varchar(100) DEFAULT NULL,
- `hourEnd` varchar(100) DEFAULT NULL,
- `hourWorked` varchar(100) DEFAULT NULL,
- `dated` date DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
--
-- Table structure for table `erte`
--
@@ -28113,6 +28443,10 @@ CREATE TABLE `expedition` (
`hasNewRoute` tinyint(1) NOT NULL DEFAULT 0,
`isBox` int(11) GENERATED ALWAYS AS (`freightItemFk`) VIRTUAL COMMENT 'Columna virtual provisional para Salix',
`editorFk` int(10) unsigned DEFAULT NULL,
+ `packingSiteFk` int(11) DEFAULT NULL,
+ `monitorId` varchar(255) DEFAULT NULL,
+ `started` timestamp NOT NULL,
+ `ended` timestamp NOT NULL,
PRIMARY KEY (`id`),
KEY `index1` (`agencyModeFk`),
KEY `index2` (`freightItemFk`),
@@ -28123,7 +28457,9 @@ CREATE TABLE `expedition` (
KEY `workerFk` (`workerFk`),
KEY `expedition_FK` (`stateTypeFk`),
KEY `expedition_fk_editor` (`editorFk`),
+ KEY `expedition_FK_1` (`packingSiteFk`),
CONSTRAINT `expedition_FK` FOREIGN KEY (`stateTypeFk`) REFERENCES `expeditionStateType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `expedition_FK_1` FOREIGN KEY (`packingSiteFk`) REFERENCES `packingSite` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `expedition_fk1` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE,
CONSTRAINT `expedition_fk2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `expedition_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE,
@@ -28512,19 +28848,17 @@ CREATE TABLE `expeditionState` (
/*!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_BeforeInsert
-BEFORE INSERT
-ON expeditionState FOR EACH ROW
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionState_BeforeInsert`
+ BEFORE INSERT ON `expeditionState`
+ FOR EACH ROW
BEGIN
-
- SET NEW.userFk = account.myUser_getId();
-
+ SET NEW.userFk = IFNULL(NEW.userFk, account.myUser_getId());
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -28764,19 +29098,19 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client;
--
--- Table structure for table `expence`
+-- Table structure for table `expense`
--
-DROP TABLE IF EXISTS `expence`;
+DROP TABLE IF EXISTS `expense`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `expence` (
+CREATE TABLE `expense` (
`id` varchar(10) NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`isWithheld` tinyint(4) NOT NULL DEFAULT 0,
`code` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`),
- UNIQUE KEY `expence_UN` (`code`)
+ UNIQUE KEY `expense_UN` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -29081,7 +29415,7 @@ DROP TABLE IF EXISTS `greuge`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `greuge` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `clientFk` int(10) unsigned NOT NULL,
+ `clientFk` int(11) NOT NULL,
`description` varchar(45) NOT NULL,
`amount` decimal(10,2) NOT NULL,
`shipped` datetime NOT NULL DEFAULT current_timestamp(),
@@ -29099,6 +29433,7 @@ CREATE TABLE `greuge` (
KEY `greuge_fk_editor` (`editorFk`),
CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `greuge_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `greuge_FK_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `greuge_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `greuges_type_fk` FOREIGN KEY (`greugeTypeFk`) REFERENCES `greugeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=COMPACT;
@@ -29450,16 +29785,16 @@ CREATE TABLE `invoiceCorrection` (
`correctingFk` int(10) unsigned NOT NULL COMMENT 'Factura rectificativa',
`correctedFk` int(10) unsigned NOT NULL COMMENT 'Factura rectificada',
`cplusRectificationTypeFk` int(10) unsigned NOT NULL,
- `cplusInvoiceType477Fk` int(10) unsigned NOT NULL,
+ `siiTypeInvoiceOutFk` int(10) unsigned NOT NULL,
`invoiceCorrectionTypeFk` int(11) NOT NULL DEFAULT 3,
PRIMARY KEY (`correctingFk`),
KEY `correctedFk_idx` (`correctedFk`),
KEY `invoiceCorrection_ibfk_1_idx` (`cplusRectificationTypeFk`),
- KEY `cplusInvoiceTyoeFk_idx` (`cplusInvoiceType477Fk`),
+ KEY `cplusInvoiceTyoeFk_idx` (`siiTypeInvoiceOutFk`),
KEY `invoiceCorrectionTypeFk_idx` (`invoiceCorrectionTypeFk`),
CONSTRAINT `corrected_fk` FOREIGN KEY (`correctedFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `correcting_fk` FOREIGN KEY (`correctingFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `cplusInvoiceTyoeFk` FOREIGN KEY (`cplusInvoiceType477Fk`) REFERENCES `cplusInvoiceType477` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `cplusInvoiceTyoeFk` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `siiTypeInvoiceOut` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceCorrectionType_Fk33` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `invoiceCorrectionType` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceCorrection_ibfk_1` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacion entre las facturas rectificativas y las rectificadas.';
@@ -29520,15 +29855,15 @@ CREATE TABLE `invoiceIn` (
`docFk` int(11) DEFAULT NULL,
`booked` date DEFAULT NULL COMMENT 'Fecha de contabilizacion',
`operated` date DEFAULT NULL COMMENT 'Fecha de entrega de la mercancia o el suministro',
- `cplusInvoiceType472Fk` int(10) unsigned DEFAULT 1,
+ `siiTypeInvoiceInFk` int(10) unsigned DEFAULT 1,
`cplusRectificationTypeFk` int(10) unsigned DEFAULT 1,
`cplusSubjectOpFk` int(10) unsigned DEFAULT 1,
`cplusTaxBreakFk` int(10) unsigned DEFAULT 1,
- `cplusTrascendency472Fk` int(10) unsigned DEFAULT 1,
+ `siiTrascendencyInvoiceInFk` int(10) unsigned DEFAULT 1,
`bookEntried` date DEFAULT NULL COMMENT 'Fecha Asiento',
`isVatDeductible` tinyint(1) NOT NULL DEFAULT 1,
`withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE',
- `expenceFkDeductible` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `expenseFkDeductible` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `proveedor_id` (`supplierFk`),
@@ -29539,22 +29874,22 @@ CREATE TABLE `invoiceIn` (
KEY `fecha` (`issued`),
KEY `recibida_ibfk_3_idx` (`cplusSubjectOpFk`),
KEY `recibida_ibfk_4_idx` (`cplusTaxBreakFk`),
- KEY `recibida_ibfk_5_idx` (`cplusInvoiceType472Fk`),
+ KEY `recibida_ibfk_5_idx` (`siiTypeInvoiceInFk`),
KEY `recibida_ibfk_6` (`cplusRectificationTypeFk`),
- KEY `recibida_ibfk_7` (`cplusTrascendency472Fk`),
+ KEY `recibida_ibfk_7` (`siiTrascendencyInvoiceInFk`),
KEY `invoiceIn_withholdingFk_idx` (`withholdingSageFk`),
- KEY `invoiceIn_expenceFkDeductible_idx` (`expenceFkDeductible`),
+ KEY `invoiceIn_expenseFkDeductible_idx` (`expenseFkDeductible`),
KEY `invoiceIn_fk_editor` (`editorFk`),
KEY `invoiceIn_FK` (`currencyFk`),
CONSTRAINT `invoiceInCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceIn_FK` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `invoiceIn_expenceFkDeductible` FOREIGN KEY (`expenceFkDeductible`) REFERENCES `expence` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `invoiceIn_expenseFkDeductible` FOREIGN KEY (`expenseFkDeductible`) REFERENCES `expense` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceIn_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `invoiceIn_ibfk_3` FOREIGN KEY (`cplusSubjectOpFk`) REFERENCES `cplusSubjectOp` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceIn_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `invoiceIn_ibfk_5` FOREIGN KEY (`cplusInvoiceType472Fk`) REFERENCES `cplusInvoiceType472` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `invoiceIn_ibfk_5` FOREIGN KEY (`siiTypeInvoiceInFk`) REFERENCES `siiTypeInvoiceIn` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceIn_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `invoiceIn_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `cplusTrascendency472` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `invoiceIn_ibfk_7` FOREIGN KEY (`siiTrascendencyInvoiceInFk`) REFERENCES `siiTrascendencyInvoiceIn` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceIn_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceIn_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
@@ -29741,6 +30076,7 @@ CREATE TABLE `invoiceInConfig` (
`retentionName` varchar(25) NOT NULL,
`sageWithholdingFk` smallint(6) NOT NULL,
`daysAgo` int(10) unsigned DEFAULT 45 COMMENT 'Días en el pasado para mostrar facturas en invoiceIn series en salix',
+ `taxRowLimit` int(11) DEFAULT 4 COMMENT 'Número máximo de líneas de IVA que puede tener una factura',
PRIMARY KEY (`id`),
KEY `invoiceInConfig_sageWithholdingFk` (`sageWithholdingFk`),
CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -29948,7 +30284,7 @@ CREATE TABLE `invoiceInSage` (
`taxTypeSageFk` smallint(6) NOT NULL,
`transactionTypeSageFk` tinyint(4) NOT NULL,
`isService` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para diferenciar producto de servicio',
- `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `expenseFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`withholdingSageFk` smallint(6) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `invoiceInSafe_unique` (`taxClassFk`,`invoiceInSerialFk`,`isService`,`withholdingSageFk`),
@@ -29957,8 +30293,8 @@ CREATE TABLE `invoiceInSage` (
KEY `invoiceInSage_invoiceInSerialFk` (`invoiceInSerialFk`),
KEY `invoiceInSage_taxTypeSageFk` (`taxTypeSageFk`),
KEY `invoiceInSage_transactionTypeSageFk` (`transactionTypeSageFk`),
- KEY `invoiceInSage_idx` (`expenceFk`),
- CONSTRAINT `invoiceInSage_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE,
+ KEY `invoiceInSage_idx` (`expenseFk`),
+ CONSTRAINT `invoiceInSage_expenseFk` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceInSage_invoiceInSerialFk` FOREIGN KEY (`invoiceInSerialFk`) REFERENCES `invoiceInSerial` (`code`) ON UPDATE CASCADE,
CONSTRAINT `invoiceInSage_taxClassFk` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`code`) ON UPDATE CASCADE,
CONSTRAINT `invoiceInSage_taxTypeSageFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE,
@@ -29999,7 +30335,7 @@ CREATE TABLE `invoiceInTax` (
`invoiceInFk` mediumint(8) unsigned NOT NULL,
`taxCodeFk` int(10) DEFAULT NULL,
`taxableBase` decimal(10,2) NOT NULL,
- `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `expenseFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`foreignValue` decimal(10,2) DEFAULT NULL,
`taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de IVA SAGE',
`transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Tipo de transacción SAGE',
@@ -30010,9 +30346,9 @@ CREATE TABLE `invoiceInTax` (
KEY `recibida_iva_ibfk_2` (`taxCodeFk`),
KEY `recibida_iva_taxTypeSageFk` (`taxTypeSageFk`),
KEY `invoiceInTax_transactionTypeSageFk_idx` (`transactionTypeSageFk`),
- KEY `invoiceInTax_idx` (`expenceFk`),
+ KEY `invoiceInTax_idx` (`expenseFk`),
KEY `invoiceInTax_fk_editor` (`editorFk`),
- CONSTRAINT `invoiceInTax_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `invoiceInTax_expenseFk` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceInTax_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `invoiceInTax_ibfk_5` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `invoiceInTax_transactionTypeSageFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE,
@@ -30032,6 +30368,7 @@ DELIMITER ;;
BEFORE INSERT ON `invoiceInTax`
FOR EACH ROW
BEGIN
+ CALL invoiceInTax_afterUpsert(NEW.invoiceInFk);
SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
@@ -30052,6 +30389,10 @@ DELIMITER ;;
BEFORE UPDATE ON `invoiceInTax`
FOR EACH ROW
BEGIN
+ IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) THEN
+ CALL invoiceInTax_afterUpsert(NEW.invoiceInFk);
+ END IF;
+
SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
@@ -30130,23 +30471,23 @@ CREATE TABLE `invoiceOut` (
`companyFk` int(10) unsigned NOT NULL DEFAULT 442,
`hasPdf` tinyint(3) unsigned NOT NULL DEFAULT 0,
`booked` date DEFAULT NULL,
- `cplusInvoiceType477Fk` int(10) unsigned NOT NULL DEFAULT 1,
+ `siiTypeInvoiceOutFk` int(10) unsigned NOT NULL DEFAULT 1,
`cplusTaxBreakFk` int(10) unsigned NOT NULL DEFAULT 1,
`cplusSubjectOpFk` int(10) unsigned NOT NULL DEFAULT 1,
- `cplusTrascendency477Fk` int(10) unsigned NOT NULL DEFAULT 1,
+ `siiTrascendencyInvoiceOutFk` int(10) unsigned NOT NULL DEFAULT 1,
PRIMARY KEY (`id`,`ref`),
UNIQUE KEY `Id_Factura` (`ref`),
KEY `Id_Banco` (`bankFk`),
KEY `Id_Cliente` (`clientFk`),
KEY `empresa_id` (`companyFk`),
KEY `Fecha` (`issued`),
- KEY `Facturas_ibfk_2_idx` (`cplusInvoiceType477Fk`),
+ KEY `Facturas_ibfk_2_idx` (`siiTypeInvoiceOutFk`),
KEY `Facturas_ibfk_3_idx` (`cplusSubjectOpFk`),
KEY `Facturas_ibfk_4_idx` (`cplusTaxBreakFk`),
- KEY `Facturas_ibfk_5_idx` (`cplusTrascendency477Fk`),
+ KEY `Facturas_ibfk_5_idx` (`siiTrascendencyInvoiceOutFk`),
KEY `Facturas_idx_Vencimiento` (`dued`),
KEY `invoiceOut_serial` (`serial`),
- CONSTRAINT `invoiceOut_ibfk_2` FOREIGN KEY (`cplusInvoiceType477Fk`) REFERENCES `cplusInvoiceType477` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `invoiceOut_ibfk_2` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `siiTypeInvoiceOut` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceOut_ibfk_3` FOREIGN KEY (`cplusSubjectOpFk`) REFERENCES `cplusSubjectOp` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceOut_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE,
CONSTRAINT `invoiceOut_serial` FOREIGN KEY (`serial`) REFERENCES `invoiceOutSerial` (`code`),
@@ -30275,23 +30616,23 @@ CREATE TABLE `invoiceOutConfig` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
--- Table structure for table `invoiceOutExpence`
+-- Table structure for table `invoiceOutExpense`
--
-DROP TABLE IF EXISTS `invoiceOutExpence`;
+DROP TABLE IF EXISTS `invoiceOutExpense`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `invoiceOutExpence` (
+CREATE TABLE `invoiceOutExpense` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`invoiceOutFk` int(10) unsigned NOT NULL,
`amount` decimal(10,2) NOT NULL DEFAULT 0.00,
- `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ `expenseFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`created` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
- KEY `invoiceOutExpence_FK_1_idx` (`invoiceOutFk`),
- KEY `invoiceOutExpence_expenceFk_idx` (`expenceFk`),
- CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `invoiceOutExpence_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE
+ KEY `invoiceOutExpense_FK_1_idx` (`invoiceOutFk`),
+ KEY `invoiceOutExpense_expenseFk_idx` (`expenseFk`),
+ CONSTRAINT `invoiceOutExpense_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `invoiceOutExpense_expenseFk` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -30354,7 +30695,7 @@ CREATE TABLE `invoiceOutTaxConfig` (
`taxTypeSageFk` smallint(6) DEFAULT NULL,
`transactionTypeSageFk` tinyint(4) DEFAULT NULL,
`isService` tinyint(1) DEFAULT 0,
- `expenceFk` varchar(10) DEFAULT NULL,
+ `expenseFk` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `invoiceOutTaxConfig_FK` (`taxClassCodeFk`),
KEY `invoiceOutTaxConfig_FK_1` (`taxTypeSageFk`),
@@ -30397,7 +30738,7 @@ CREATE TABLE `item` (
`description` varchar(1000) DEFAULT NULL,
`density` int(11) NOT NULL DEFAULT 167 COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes, si no se especifica se pone por defecto la del tipo en un trigger',
`relevancy` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos',
- `expenceFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '7001000000',
+ `expenseFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '7001000000',
`isActive` tinyint(1) NOT NULL DEFAULT 1,
`longName` varchar(50) DEFAULT NULL,
`subName` varchar(50) DEFAULT NULL,
@@ -30452,11 +30793,11 @@ CREATE TABLE `item` (
KEY `item_size_IDX` (`size`) USING BTREE,
KEY `item_size_IDX2` (`longName`) USING BTREE,
KEY `item_lastUsed_IDX` (`lastUsed`) USING BTREE,
- KEY `item_expenceFk_idx` (`expenceFk`),
+ KEY `item_expenseFk_idx` (`expenseFk`),
KEY `item_fk_editor` (`editorFk`),
CONSTRAINT `item_FK` FOREIGN KEY (`genericFk`) REFERENCES `item` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `item_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `itemType` (`id`),
- CONSTRAINT `item_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `item_expenseFk` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON UPDATE CASCADE,
CONSTRAINT `item_family` FOREIGN KEY (`family`) REFERENCES `itemFamily` (`code`) ON UPDATE CASCADE,
CONSTRAINT `item_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `item_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `origin` (`id`) ON UPDATE CASCADE,
@@ -30915,6 +31256,7 @@ CREATE TABLE `itemConfig` (
`validPriorities` varchar(50) NOT NULL DEFAULT '[1,2,3]',
`defaultPriority` int(11) NOT NULL DEFAULT 2,
`warehouseFk` smallint(6) unsigned DEFAULT NULL,
+ `downloadMaxAttempts` tinyint(3) DEFAULT NULL COMMENT 'Intentos máximos para que se borre',
PRIMARY KEY (`id`),
KEY `itemConfig_FK` (`defaultTag`),
CONSTRAINT `itemConfig_FK` FOREIGN KEY (`defaultTag`) REFERENCES `tag` (`id`)
@@ -31291,11 +31633,14 @@ CREATE TABLE `itemShelving` (
`packagingFk` varchar(10) DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`isChecked` tinyint(1) DEFAULT NULL COMMENT 'Este valor cambia al escanear un carro. True: Existe. False: Nuevo. Null: No escaneado',
+ `buyFk` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
+ UNIQUE KEY `itemShelving_UN` (`buyFk`,`shelvingFk`),
KEY `itemShelving_fk1_idx` (`itemFk`),
KEY `itemShelving_fk2_idx` (`shelvingFk`),
KEY `itemShelving_fk3_idx` (`packagingFk`),
KEY `itemShelving_fk3_idx1` (`userFk`),
+ CONSTRAINT `itemShelvingBuy_FK` FOREIGN KEY (`buyFk`) REFERENCES `buy` (`id`),
CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `itemShelving_fk2` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `itemShelving_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE
@@ -31392,23 +31737,16 @@ DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_UPDATE`
AFTER UPDATE ON `itemShelving`
FOR EACH ROW
-INSERT INTO vn.itemShelvingLog( itemShelvingFk,
- workerFk,
- accion,
- itemFk,
- shelvingFk,
- visible,
- `grouping`,
- packing)
- VALUES( NEW.id,
- account.myUser_getId(),
- 'CAMBIO',
- NEW.itemFk,
- NEW.shelvingFk,
- NEW.visible,
- NEW.`grouping`,
- NEW.packing
- ) */;;
+
+ INSERT INTO itemShelvingLog
+ SET itemShelvingFk = NEW.id,
+ workerFk = account.myUser_getId(),
+ accion = 'CAMBIO',
+ itemFk = NEW.itemFk,
+ shelvingFk = NEW.shelvingFk,
+ visible = NEW.visible,
+ `grouping` = NEW.`grouping`,
+ packing = NEW.packing */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -31587,6 +31925,7 @@ CREATE TABLE `itemShelvingSale` (
`quantity` decimal(10,0) NOT NULL DEFAULT 0,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
`userFk` int(11) unsigned NOT NULL,
+ `isPicked` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `itemShelvingSale_fk1_idx` (`itemShelvingFk`),
KEY `itemShelvingSale_fk2_idx` (`saleFk`),
@@ -31599,11 +31938,11 @@ CREATE TABLE `itemShelvingSale` (
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT`
AFTER INSERT ON `itemShelvingSale`
@@ -33301,7 +33640,13 @@ CREATE TABLE `packagingConfig` (
`palletPackaging` varchar(10) DEFAULT 'pallet USA',
`carryPackaging` varchar(10) DEFAULT 'cc',
`freightItemPackaging` int(11) DEFAULT 71,
- PRIMARY KEY (`id`)
+ `defaultSmallPackageFk` varchar(10) NOT NULL DEFAULT '94p' COMMENT 'bulto pequeño',
+ `defaultBigPackageFk` varchar(10) NOT NULL DEFAULT '94m' COMMENT 'bulto grande',
+ PRIMARY KEY (`id`),
+ KEY `packagingConfig_FK` (`defaultSmallPackageFk`),
+ KEY `packagingConfig_FK_1` (`defaultBigPackageFk`),
+ CONSTRAINT `packagingConfig_FK` FOREIGN KEY (`defaultSmallPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `packagingConfig_FK_1` FOREIGN KEY (`defaultBigPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -33374,19 +33719,96 @@ CREATE TABLE `packingSite` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(10) DEFAULT NULL,
`hostFk` int(11) DEFAULT NULL,
+ `printerRfidFk` tinyint(3) unsigned DEFAULT NULL,
`printerFk` tinyint(3) unsigned DEFAULT NULL,
`collectionFk` int(11) DEFAULT NULL COMMENT 'Last collection packed on this site',
`monitorId` varchar(255) DEFAULT NULL,
+ `parkingFk` int(11) DEFAULT NULL,
+ `scannerFk` int(11) DEFAULT NULL,
+ `screenFk` int(11) DEFAULT NULL,
+ `editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `packingSite_UN` (`code`),
+ UNIQUE KEY `printerRfidFk` (`printerRfidFk`),
+ UNIQUE KEY `scannerFk` (`scannerFk`),
+ UNIQUE KEY `screenFk` (`screenFk`),
+ UNIQUE KEY `packingSite_UNI` (`hostFk`),
KEY `packingSite_FK_1` (`printerFk`),
- KEY `packingSite_FK` (`hostFk`),
KEY `packingSite_FK_2` (`collectionFk`),
+ KEY `packingSite_FK_3` (`parkingFk`),
CONSTRAINT `packingSite_FK` FOREIGN KEY (`hostFk`) REFERENCES `host` (`id`),
CONSTRAINT `packingSite_FK_1` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`),
- CONSTRAINT `packingSite_FK_2` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+ CONSTRAINT `packingSite_FK_2` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `packingSite_FK_3` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE SET NULL,
+ CONSTRAINT `packingSite_FK_4` FOREIGN KEY (`printerRfidFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `packingSite_FK_5` FOREIGN KEY (`scannerFk`) REFERENCES `scanner` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `packingSite_FK_6` FOREIGN KEY (`screenFk`) REFERENCES `screen` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
+/*!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`.`packingSite_beforeInsert`
+ BEFORE INSERT ON `packingSite`
+ 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`.`packingSite_beforeUpdate`
+ BEFORE UPDATE ON `packingSite`
+ 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`.`packingSite_afterDelete`
+ AFTER DELETE ON `packingSite`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO packingSiteDeviceLog
+ SET `action` = 'delete',
+ `changedModel` = 'PackingSite',
+ `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 */ ;
--
-- Table structure for table `packingSiteAdvanced`
@@ -33422,6 +33844,34 @@ CREATE TABLE `packingSiteConfig` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `packingSiteDeviceLog`
+--
+
+DROP TABLE IF EXISTS `packingSiteDeviceLog`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `packingSiteDeviceLog` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `originFk` int(11) DEFAULT NULL,
+ `userFk` int(10) unsigned DEFAULT NULL,
+ `action` set('insert','update','delete') NOT NULL,
+ `creationDate` timestamp NULL DEFAULT current_timestamp(),
+ `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `changedModel` enum('PackingSite') NOT NULL DEFAULT 'PackingSite',
+ `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
+ `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
+ `changedModelId` int(11) NOT NULL,
+ `changedModelValue` varchar(45) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `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 */;
+
--
-- Table structure for table `packingSiteLog`
--
@@ -33930,13 +34380,13 @@ CREATE TABLE `pgc` (
`cplusTaxBreakFk` int(10) unsigned DEFAULT 1,
`mod340` tinyint(1) NOT NULL DEFAULT 0,
`mod347` tinyint(1) NOT NULL DEFAULT 0,
- `cplusTrascendency477Fk` int(10) unsigned DEFAULT 1,
+ `siiTrascendencyInvoiceOutFk` int(10) unsigned DEFAULT 1,
`isEqualizated` tinyint(1) DEFAULT 0,
PRIMARY KEY (`code`),
KEY `pgc_fk1_idx` (`cplusTaxBreakFk`),
- KEY `pgc_fk2_idx` (`cplusTrascendency477Fk`),
+ KEY `pgc_fk2_idx` (`siiTrascendencyInvoiceOutFk`),
CONSTRAINT `pgc_fk1` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `pgc_fk2` FOREIGN KEY (`cplusTrascendency477Fk`) REFERENCES `cplusTrascendency477` (`id`) ON UPDATE CASCADE
+ CONSTRAINT `pgc_fk2` FOREIGN KEY (`siiTrascendencyInvoiceOutFk`) REFERENCES `siiTrascendencyInvoiceOut` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Plan General Contable';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -34427,6 +34877,7 @@ CREATE TABLE `printer` (
`isLabeler` tinyint(1) DEFAULT 0 COMMENT 'Indica si es impresora de etiquetas',
`sectorFk` int(11) DEFAULT NULL,
`paperSizeFk` varchar(100) DEFAULT NULL,
+ `isRfid` tinyint(4) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `printer_UN` (`reference`),
UNIQUE KEY `printer_UN1` (`macWifi`),
@@ -34512,10 +34963,40 @@ CREATE TABLE `productionConfig` (
`pendingCollectionsAge` tinyint(3) unsigned DEFAULT 6,
`maxNotAssignedCollectionLifeTime` time NOT NULL DEFAULT '00:10:00' COMMENT 'Tiempo de vida de las colecciones sin asignar. Cuando se supera son eliminadas',
`maxProductionScopeDays` int(11) NOT NULL DEFAULT 1 COMMENT 'maximo numero de dias en F11',
- PRIMARY KEY (`id`)
+ `orderMode` enum('Location','Age') NOT NULL DEFAULT 'Location',
+ `stockScopeDays` int(11) DEFAULT 1 COMMENT 'Días a futuro al revisar el stock',
+ `shortageAddressFk` int(11) DEFAULT NULL COMMENT 'Consignatario por defecto para añadir un item de alta',
+ PRIMARY KEY (`id`),
+ KEY `productionConfig_FK` (`shortageAddressFk`),
+ CONSTRAINT `productionConfig_FK` FOREIGN KEY (`shortageAddressFk`) 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 */;
+--
+-- Table structure for table `productionError`
+--
+
+DROP TABLE IF EXISTS `productionError`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `productionError` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `userFk` int(11) DEFAULT NULL,
+ `firstname` varchar(100) DEFAULT NULL,
+ `lastname` varchar(100) DEFAULT NULL,
+ `rol` varchar(100) DEFAULT NULL,
+ `ticketNumber` int(11) DEFAULT NULL,
+ `lineNumber` int(11) DEFAULT NULL,
+ `error` int(11) DEFAULT NULL,
+ `volume` double DEFAULT NULL,
+ `hourStart` varchar(100) DEFAULT NULL,
+ `hourEnd` varchar(100) DEFAULT NULL,
+ `hourWorked` varchar(100) DEFAULT NULL,
+ `dated` date DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Temporary table structure for view `productionVolume`
--
@@ -34783,6 +35264,7 @@ CREATE TABLE `province` (
`geoFk` int(11) DEFAULT NULL,
`autonomyFk` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
+ UNIQUE KEY `countryName_UN` (`countryFk`,`name`),
KEY `Paises_Id` (`countryFk`),
KEY `warehouse_Id` (`warehouseFk`),
KEY `provicne_zone_fk_idx` (`zoneFk`),
@@ -35066,7 +35548,7 @@ CREATE TABLE `rateLog` (
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;
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -35758,8 +36240,6 @@ DROP TABLE IF EXISTS `routeConfig`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `routeConfig` (
`id` int(10) unsigned NOT NULL,
- `kmRate` decimal(10,4) DEFAULT NULL,
- `kmTruckRate` decimal(10,4) DEFAULT NULL,
`m3Distribution` decimal(10,4) DEFAULT NULL,
`m3Management` decimal(10,2) DEFAULT NULL,
`m3Palletization` decimal(10,2) DEFAULT NULL,
@@ -35966,24 +36446,6 @@ CREATE TABLE `routesMonitor` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
---
--- Temporary table structure for view `routesReduced`
---
-
-DROP TABLE IF EXISTS `routesReduced`;
-/*!50001 DROP VIEW IF EXISTS `routesReduced`*/;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-/*!50001 CREATE VIEW `routesReduced` AS SELECT
- 1 AS `description`,
- 1 AS `name`,
- 1 AS `routeFk`,
- 1 AS `eta`,
- 1 AS `bufferFk`,
- 1 AS `beachFk`,
- 1 AS `itempackingTypeFk` */;
-SET character_set_client = @saved_cs_client;
-
--
-- Table structure for table `sale`
--
@@ -35997,7 +36459,7 @@ CREATE TABLE `sale` (
`ticketFk` int(11) NOT NULL,
`concept` varchar(50) DEFAULT NULL,
`quantity` decimal(10,2) NOT NULL DEFAULT 0.00,
- `originalQuantity` double(9,1) DEFAULT NULL,
+ `originalQuantity` double(9,1) DEFAULT NULL COMMENT 'Se utiliza para notificar a través de rocket los cambios de quantity',
`price` decimal(10,2) NOT NULL DEFAULT 0.00,
`discount` tinyint(2) unsigned NOT NULL DEFAULT 0,
`priceFixed` decimal(10,2) NOT NULL DEFAULT 0.00,
@@ -36012,6 +36474,7 @@ CREATE TABLE `sale` (
KEY `Id_Ticket` (`ticketFk`),
KEY `itemFk_ticketFk` (`itemFk`,`ticketFk`),
KEY `sale_fk_editor` (`editorFk`),
+ KEY `sale_created_IDX` (`created`) USING BTREE,
CONSTRAINT `movement_ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `sale_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `sale_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE
@@ -36031,6 +36494,7 @@ DELIMITER ;;
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+ SET NEW.originalQuantity = NEW.quantity;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -36494,8 +36958,8 @@ CREATE TABLE `saleGroupDetail` (
`saleFk` int(11) NOT NULL,
`saleGroupFk` int(11) NOT NULL,
PRIMARY KEY (`id`),
+ UNIQUE KEY `saleGroupDetail_UN` (`saleFk`),
KEY `saleGroupDetail_FK_1` (`saleGroupFk`),
- KEY `saleFk` (`saleFk`),
CONSTRAINT `saleGroupDetail_ibfk_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='relaciona sale y saleGroup';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -36832,6 +37296,9 @@ CREATE TABLE `salespersonConfig` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`manaMaxRate` decimal(3,2) DEFAULT 0.05 COMMENT 'Valor máximo a recficar en una línea por el maná de un comercial',
`manaMinRate` decimal(3,2) DEFAULT -0.05 COMMENT 'Valor mínimo a recficar en una línea por el maná de un comercial',
+ `manaDateFrom` date NOT NULL DEFAULT '2023-01-01' COMMENT 'first date to count mana',
+ `manaFromDays` int(11) NOT NULL DEFAULT 90 COMMENT 'Range of days from mana calculation',
+ `manaToDays` int(11) NOT NULL DEFAULT 30 COMMENT 'Range of days to mana calculation',
PRIMARY KEY (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -36856,6 +37323,66 @@ CREATE TABLE `sample` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `scanner`
+--
+
+DROP TABLE IF EXISTS `scanner`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `scanner` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `modelFk` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `scanner_FK` (`modelFk`),
+ CONSTRAINT `scanner_FK` FOREIGN KEY (`modelFk`) REFERENCES `scannerModel` (`code`) ON UPDATE CASCADE
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `scannerModel`
+--
+
+DROP TABLE IF EXISTS `scannerModel`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `scannerModel` (
+ `code` varchar(50) NOT NULL,
+ PRIMARY KEY (`code`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `screen`
+--
+
+DROP TABLE IF EXISTS `screen`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `screen` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `modelFk` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `screen_FK` (`modelFk`),
+ CONSTRAINT `screen_FK` FOREIGN KEY (`modelFk`) REFERENCES `screenModel` (`code`) ON UPDATE CASCADE
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `screenModel`
+--
+
+DROP TABLE IF EXISTS `screenModel`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `screenModel` (
+ `code` varchar(50) NOT NULL,
+ PRIMARY KEY (`code`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `sector`
--
@@ -36879,13 +37406,12 @@ CREATE TABLE `sector` (
`isHideForPickers` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'sector a ocultar a los sacadores',
`isReserve` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Sectores de reserva, como Albenfruit o Fuentes',
`mainPrinterFk` tinyint(3) unsigned DEFAULT NULL,
- PRIMARY KEY (`id`,`warehouseFk`),
+ PRIMARY KEY (`id`),
UNIQUE KEY `code_UNIQUE` (`code`),
KEY `sector_fk1_idx` (`warehouseFk`),
KEY `sector_report` (`reportFk`),
KEY `sector_FK` (`sonFk`,`warehouseFk`),
KEY `sector_FK_1` (`mainPrinterFk`),
- CONSTRAINT `sector_FK` FOREIGN KEY (`sonFk`, `warehouseFk`) REFERENCES `sector` (`id`, `warehouseFk`) ON UPDATE CASCADE,
CONSTRAINT `sector_FK_1` FOREIGN KEY (`mainPrinterFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `sector_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `sector_report` FOREIGN KEY (`reportFk`) REFERENCES `report` (`id`)
@@ -37209,6 +37735,7 @@ CREATE TABLE `shelving` (
`isSpam` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'señala las matrículas con producto que se puede llevar a la reserva',
`isRecyclable` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'las matrículas marcadas como reciclables se liberan cada noche desde vn.shelving_clean para poder volver a utilizarlas',
`editorFk` int(10) unsigned DEFAULT NULL,
+ `isMoving` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `shelving_UN` (`code`),
KEY `shelving_fk1_idx` (`parkingFk`),
@@ -37263,6 +37790,9 @@ BEGIN
CALL util.throw('NOT_EMPTY_CODE_ALLOWED');
END IF;
+ IF NOT(OLD.parkingFk <=> NEW.parkingFK) THEN
+ SET NEW.isMoving = FALSE;
+ END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -37322,6 +37852,66 @@ CREATE TABLE `shelvingLog` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `siiTrascendencyInvoiceIn`
+--
+
+DROP TABLE IF EXISTS `siiTrascendencyInvoiceIn`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `siiTrascendencyInvoiceIn` (
+ `id` int(10) unsigned NOT NULL,
+ `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Clave de régimen especial o trascendencia en facturas recibidas en el suministro de inmediato';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `siiTrascendencyInvoiceOut`
+--
+
+DROP TABLE IF EXISTS `siiTrascendencyInvoiceOut`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `siiTrascendencyInvoiceOut` (
+ `id` int(10) unsigned NOT NULL,
+ `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Clave de régimen especial o trascendencia en facturas expedidas del suministro de inmediato';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `siiTypeInvoiceIn`
+--
+
+DROP TABLE IF EXISTS `siiTypeInvoiceIn`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `siiTypeInvoiceIn` (
+ `id` int(10) unsigned NOT NULL,
+ `code` varchar(2) NOT NULL,
+ `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `code_UNIQUE` (`code`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tipo de Factura Recibidas en el suministro de inmediato';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `siiTypeInvoiceOut`
+--
+
+DROP TABLE IF EXISTS `siiTypeInvoiceOut`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `siiTypeInvoiceOut` (
+ `id` int(10) unsigned NOT NULL,
+ `code` varchar(2) NOT NULL,
+ `description` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `code_UNIQUE` (`code`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tipo de Factura Emitidas en el suministro de inmediato';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `silexACL`
--
@@ -37825,7 +38415,7 @@ DROP TABLE IF EXISTS `supplier`;
CREATE TABLE `supplier` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
- `account` varchar(10) DEFAULT NULL,
+ `account` varchar(10) NOT NULL DEFAULT '4100000000' COMMENT 'Default accounting code for suppliers.',
`street` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`city` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`provinceFk` smallint(5) unsigned DEFAULT NULL,
@@ -37880,7 +38470,8 @@ CREATE TABLE `supplier` (
CONSTRAINT `supplier_transactionFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE,
CONSTRAINT `supplier_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE,
CONSTRAINT `supplier_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE,
- CONSTRAINT `suppplier_supplierActivityFk` FOREIGN KEY (`supplierActivityFk`) REFERENCES `supplierActivity` (`code`) ON UPDATE CASCADE
+ CONSTRAINT `suppplier_supplierActivityFk` FOREIGN KEY (`supplierActivityFk`) REFERENCES `supplierActivity` (`code`) ON UPDATE CASCADE,
+ CONSTRAINT `supplierAccountTooShort` CHECK (octet_length(`account`) = 10)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -38101,7 +38692,7 @@ DROP TABLE IF EXISTS `supplierAddress`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supplierAddress` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `supplierFk` int(11) DEFAULT NULL,
+ `supplierFk` int(10) unsigned DEFAULT NULL,
`nickname` varchar(40) DEFAULT NULL,
`street` varchar(255) DEFAULT NULL,
`provinceFk` smallint(6) unsigned DEFAULT NULL,
@@ -38113,6 +38704,8 @@ CREATE TABLE `supplierAddress` (
PRIMARY KEY (`id`),
KEY `supplierAddress_province_fk` (`provinceFk`),
KEY `supplierAddress_fk_editor` (`editorFk`),
+ KEY `supplierAddress_FK` (`supplierFk`),
+ CONSTRAINT `supplierAddress_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `supplierAddress_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `supplierAddress_province_fk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
@@ -38799,7 +39392,7 @@ BEGIN
SET NEW.editorFk = account.myUser_getId();
- IF !(NEW.routeFk <=> OLD.routeFk) THEN
+ IF NOT (NEW.routeFk <=> OLD.routeFk) THEN
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`)
SELECT r.id
FROM vn.route r
@@ -38809,7 +39402,7 @@ BEGIN
GROUP BY r.id;
END IF;
- IF !(DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN
+ IF NOT (DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN
IF YEAR(NEW.shipped) < 2000 THEN
SIGNAL SQLSTATE '46000'
SET MESSAGE_TEXT = 'Year cannot be lesser than 2000';
@@ -38821,7 +39414,7 @@ BEGIN
END IF;
- IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN
+ IF NOT (NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`)
SELECT r.id
FROM vn.ticket t
@@ -38840,7 +39433,7 @@ BEGIN
CALL util.throw ('This ticket is deleted');
END IF;
- IF !(NEW.routeFk <=> OLD.routeFk) AND NEW.routeFk IS NOT NULL THEN
+ IF NOT (NEW.routeFk <=> OLD.routeFk) AND NEW.routeFk IS NOT NULL THEN
SELECT MAX(TIME(shipped)) INTO vNewTime
FROM vn.ticket
WHERE routeFk = NEW.routeFk
@@ -40014,10 +40607,10 @@ DROP TABLE IF EXISTS `ticketServiceType`;
CREATE TABLE `ticketServiceType` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL,
- `expenceFk` varchar(10) NOT NULL DEFAULT '7050000000',
+ `expenseFk` varchar(10) NOT NULL DEFAULT '7050000000',
PRIMARY KEY (`id`),
- KEY `ticketServiceType_expenceFk_idx` (`expenceFk`),
- CONSTRAINT `ticketServiceType_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE
+ KEY `ticketServiceType_expenseFk_idx` (`expenseFk`),
+ CONSTRAINT `ticketServiceType_expenseFk` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Lista de los posibles servicios a elegir';
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -40094,7 +40687,7 @@ CREATE TABLE `ticketTracking` (
`notes` varchar(255) DEFAULT NULL,
`created` timestamp NULL DEFAULT current_timestamp(),
`ticketFk` int(11) DEFAULT NULL,
- `workerFk` int(11) DEFAULT NULL,
+ `workerFk` int(10) unsigned DEFAULT NULL,
`supervisorFk` int(10) unsigned DEFAULT NULL,
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
@@ -40107,6 +40700,7 @@ CREATE TABLE `ticketTracking` (
KEY `ticketTracking_created_IDX` (`created`) USING BTREE,
CONSTRAINT `inter_state` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE,
CONSTRAINT `responsable` FOREIGN KEY (`supervisorFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `ticketTracking_FK3` FOREIGN KEY (`workerFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE,
CONSTRAINT `ticketTracking_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `ticketTracking_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
@@ -40415,7 +41009,7 @@ CREATE TABLE `till` (
`isAccountable` tinyint(1) NOT NULL DEFAULT 0,
`serie` varchar(2) DEFAULT NULL,
`number` int(11) DEFAULT NULL,
- `concept` varchar(50) NOT NULL,
+ `concept` varchar(50) DEFAULT NULL,
`in` decimal(10,2) DEFAULT NULL,
`out` decimal(10,2) DEFAULT NULL,
`bankFk` int(11) DEFAULT 1,
@@ -40442,28 +41036,6 @@ CREATE TABLE `till` (
CONSTRAINT `till_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-/*!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`.`till_beforeInsert`
- BEFORE INSERT ON `till`
- FOR EACH ROW
-BEGIN
- IF NEW.concept IS NULL OR NEW.concept REGEXP '^[[:space:]]*$' THEN
- SET NEW.concept = 'SIN DETALLE';
- 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 */ ;
--
-- Table structure for table `tillConfig`
@@ -40789,6 +41361,22 @@ CREATE TABLE `trainingCourseType` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lista de las formaciones';
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `transitoryDuaUnified`
+--
+
+DROP TABLE IF EXISTS `transitoryDuaUnified`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `transitoryDuaUnified` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `supplierFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `transitoryDuaUnified_FK` (`supplierFk`),
+ CONSTRAINT `transitoryDuaUnified_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Transitarios que al contabilizar sus entradas sólo generan un único DUA para todos los proveedores';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `travel`
--
@@ -40881,6 +41469,14 @@ DELIMITER ;;
BEGIN
SET NEW.editorFk = account.myUser_getId();
+ IF ((NOT NEW.shipped <=> OLD.shipped )
+ OR (NOT NEW.landed <=> OLD.landed )
+ OR (NOT NEW.warehouseInFk <=> OLD.warehouseInFk )
+ OR (NOT NEW.warehouseOutFk <=> OLD.warehouseOutFk ))
+ AND (OLD.totalEntries AND OLD.landed < CURDATE()) THEN
+ CALL util.throw("Cannot past travels with entries");
+ END IF;
+
IF NOT (NEW.landed <=> OLD.landed)
OR NOT (NEW.shipped <=> OLD.shipped) THEN
CALL travel_checkDates(NEW.shipped, NEW.landed);
@@ -40899,7 +41495,9 @@ BEGIN
CALL travel_checkPackaging(NEW.id);
END IF;
- CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
+ IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN
+ CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
+ END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -41522,7 +42120,7 @@ DROP TABLE IF EXISTS `wagon`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wagon` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` varchar(6) NOT NULL COMMENT '26 letras de alfabeto inglés',
`volume` int(11) NOT NULL DEFAULT 150 COMMENT 'Volumen en litros',
`plate` varchar(10) NOT NULL COMMENT 'Matrícula',
`typeFk` int(11) unsigned NOT NULL,
@@ -41530,7 +42128,7 @@ CREATE TABLE `wagon` (
PRIMARY KEY (`id`),
KEY `wagon_type` (`typeFk`),
CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE
-) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -41617,10 +42215,10 @@ CREATE TABLE `wagonVolumetry` (
`lines` int(10) unsigned NOT NULL DEFAULT 1,
`liters` int(10) unsigned NOT NULL DEFAULT 0,
`height` int(10) unsigned NOT NULL DEFAULT 20,
- `wagonFk` int(11) NOT NULL,
+ `wagonFk` varchar(6) NOT NULL,
PRIMARY KEY (`id`),
- KEY `wagonVolumetry_FK` (`wagonFk`),
- CONSTRAINT `wagonVolumetry_FK` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+ KEY `wagonVolumetry_FK_1` (`wagonFk`),
+ CONSTRAINT `wagonVolumetry_FK_1` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -41791,14 +42389,12 @@ CREATE TABLE `worker` (
`photo` blob DEFAULT NULL,
`phone` varchar(9) DEFAULT NULL,
`mobileExtension` int(4) DEFAULT NULL,
- `userFk` int(10) unsigned DEFAULT NULL,
- `bossFk` int(11) NOT NULL DEFAULT 103,
+ `bossFk` int(10) unsigned DEFAULT 103,
`fiDueDate` datetime DEFAULT NULL,
`hasMachineryAuthorized` tinyint(2) DEFAULT 0,
`seniority` date DEFAULT NULL,
`isTodayRelative` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual',
`isF11Allowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Usuario autorizado para abrir el F11',
- `sectorFk__` int(11) DEFAULT NULL COMMENT '@deprecated 2023-06-26',
`maritalStatus` enum('S','M') NOT NULL,
`labelerFk__` tinyint(3) unsigned DEFAULT NULL COMMENT '@deprecated 2023-06-26',
`originCountryFk` mediumint(8) unsigned DEFAULT NULL COMMENT 'País de origen',
@@ -41816,7 +42412,6 @@ CREATE TABLE `worker` (
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `CodigoTrabajador_UNIQUE` (`code`),
- UNIQUE KEY `user_id_UNIQUE` (`userFk`),
UNIQUE KEY `worker_business` (`businessFk`),
UNIQUE KEY `locker` (`locker`),
KEY `sub` (`sub`),
@@ -41828,6 +42423,7 @@ CREATE TABLE `worker` (
CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk__`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE,
CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `educationLevel` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `worker_FK_3` FOREIGN KEY (`bossFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE,
CONSTRAINT `worker_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `business` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `worker_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`id`) REFERENCES `account`.`user` (`id`)
@@ -42678,10 +43274,29 @@ CREATE TABLE `workerTimeControlConfig` (
`longWeekDays` int(11) DEFAULT NULL COMMENT 'Días a tener en cuenta para calcular el descanso largo',
`teleworkingStart` int(11) DEFAULT NULL COMMENT 'Hora comienzo jornada de los teletrabajdores expresada en segundos',
`teleworkingStartBreakTime` int(11) DEFAULT NULL COMMENT 'Hora comienzo descanso de los teletrabjadores expresada en segundos',
+ `maxTimeToBreak` int(11) DEFAULT 3600,
+ `maxWorkShortCycle` int(10) unsigned DEFAULT 561600 COMMENT 'Máximo tiempo que un trabajador puede estar trabajando con el que adquirirá el derecho a un descanso semanal corto',
+ `maxWorkLongCycle` int(10) unsigned DEFAULT 950400 COMMENT 'Máximo tiempo que un trabajador puede estar trabajando con el que adquirirá el derecho a un descanso semanal largo',
PRIMARY KEY (`id`)
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='All values in seconds';
/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Table structure for table `workerTimeControlError`
+--
+
+DROP TABLE IF EXISTS `workerTimeControlError`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `workerTimeControlError` (
+ `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `code` char(35) NOT NULL,
+ `description` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `code` (`code`)
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
--
-- Table structure for table `workerTimeControlLog`
--
@@ -43355,17 +43970,19 @@ DROP TABLE IF EXISTS `zoneIncluded`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zoneIncluded` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`zoneFk` int(11) NOT NULL,
`geoFk` int(11) NOT NULL,
`isIncluded` tinyint(1) DEFAULT NULL,
`editorFk` int(10) unsigned DEFAULT NULL,
- PRIMARY KEY (`zoneFk`,`geoFk`),
- KEY `geoFk_idx` (`geoFk`),
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_zone_geo` (`zoneFk`,`geoFk`),
KEY `zoneIncluded_fk_editor` (`editorFk`),
- CONSTRAINT `zoneFk2` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `zoneGeoFk2` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ KEY `zoneIncluded_FK_2` (`geoFk`),
+ CONSTRAINT `zoneIncluded_FK_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `zoneIncluded_FK_2` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `zoneIncluded_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -43410,11 +44027,11 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete`
AFTER DELETE ON `zoneIncluded`
@@ -43719,6 +44336,27 @@ DELIMITER ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
+/*!50106 DROP EVENT IF EXISTS `itemImageQueue_check` */;;
+DELIMITER ;;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
+/*!50003 SET character_set_client = utf8mb4 */ ;;
+/*!50003 SET character_set_results = utf8mb4 */ ;;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
+/*!50003 SET @saved_time_zone = @@time_zone */ ;;
+/*!50003 SET time_zone = 'SYSTEM' */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `itemImageQueue_check` ON SCHEDULE EVERY 1 HOUR STARTS '2023-07-28 00:00:00' ON COMPLETION PRESERVE DISABLE ON SLAVE DO BEGIN
+ DELETE FROM itemImageQueue
+ WHERE attempts >= (SELECT downloadMaxAttempts FROM itemConfig);
+END */ ;;
+/*!50003 SET time_zone = @saved_time_zone */ ;;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;;
+/*!50003 SET character_set_client = @saved_cs_client */ ;;
+/*!50003 SET character_set_results = @saved_cs_results */ ;;
+/*!50003 SET collation_connection = @saved_col_connection */ ;;
/*!50106 DROP EVENT IF EXISTS `mysqlConnectionsSorter_kill` */;;
DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
@@ -43972,6 +44610,24 @@ DELIMITER ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
+/*!50106 DROP EVENT IF EXISTS `zoneClosure_doRecalc` */;;
+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 @saved_sql_mode = @@sql_mode */ ;;
+/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;;
+/*!50003 SET @saved_time_zone = @@time_zone */ ;;
+/*!50003 SET time_zone = 'SYSTEM' */ ;;
+/*!50106 CREATE*/ /*!50117 DEFINER=`salix`@`10.0.%.%`*/ /*!50106 EVENT `zoneClosure_doRecalc` ON SCHEDULE AT '2023-11-13 07:15:54' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO CALL zoneClosure_recalc */ ;;
+/*!50003 SET time_zone = @saved_time_zone */ ;;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;;
+/*!50003 SET character_set_client = @saved_cs_client */ ;;
+/*!50003 SET character_set_results = @saved_cs_results */ ;;
+/*!50003 SET collation_connection = @saved_col_connection */ ;;
/*!50106 DROP EVENT IF EXISTS `zoneGeo_doCalc` */;;
DELIMITER ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
@@ -44137,42 +44793,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
-/*!50003 DROP FUNCTION IF EXISTS `botanicExport_isUpdatable` */;
-/*!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 `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,
- vEdiSpecieFk MEDIUMINT,
- vRestriction MEDIUMINT) RETURNS int(11)
- DETERMINISTIC
-BEGIN
- DECLARE vIsUpdatable INTEGER;
- SELECT COUNT(*) INTO vIsUpdatable
- FROM botanicExport
- WHERE ediGenusFk = vEdiGenusFk
- AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL)
- AND vRestriction = restriction;
-RETURN vIsUpdatable;
-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 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP FUNCTION IF EXISTS `buy_getUnitVolume` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getUnitVolume`(vSelf INT) RETURNS int(11)
DETERMINISTIC
@@ -44187,7 +44815,7 @@ BEGIN
DECLARE vPackaging VARCHAR(10);
DECLARE vPacking INT;
- SELECT itemFk, packageFk, packing
+ SELECT itemFk, packagingFk, packing
INTO vItem, vPackaging, vPacking
FROM buy
WHERE id = vSelf;
@@ -44359,63 +44987,19 @@ BEGIN
* @return Mana del cliente
*/
DECLARE vMana DECIMAL(10,2);
- DECLARE vFromDated DATE;
- DECLARE vHasMana BOOLEAN;
- DECLARE vManaComponent INT;
- DECLARE vAutoManaComponent INT;
- DECLARE vManaBank INT;
- DECLARE vManaGreugeType INT;
- SELECT id INTO vManaGreugeType FROM greugeType WHERE code = 'mana';
- SELECT id INTO vManaBank FROM bank WHERE code = 'mana';
- SELECT id INTO vManaComponent FROM component WHERE code = 'mana';
- SELECT id INTO vAutoManaComponent FROM component WHERE code = 'autoMana';
+ CREATE OR REPLACE TEMPORARY TABLE tmp.client
+ SELECT vClient id;
- SELECT COUNT(*) INTO vHasMana
- FROM `client` c
- WHERE c.id = vClient AND c.typeFk = 'normal';
+ CALL client_getMana();
- IF NOT vHasMana THEN
- RETURN 0;
- END IF;
+ SET vMana = (SELECT mana
+ FROM tmp.clientMana);
- SELECT max(dated) INTO vFromDated
- FROM clientManaCache;
+ DROP TEMPORARY TABLE
+ tmp.client,
+ tmp.clientMana;
- SELECT sum(mana) INTO vMana
- FROM
- (
- SELECT mana
- FROM clientManaCache
- WHERE clientFk = vClient
- AND dated = vFromDated
- UNION ALL
- SELECT s.quantity * value
- FROM ticket t
- JOIN address a ON a.id = t.addressFk
- JOIN sale s on s.ticketFk = t.id
- JOIN saleComponent sc on sc.saleFk = s.id
- WHERE sc.componentFk IN (vManaComponent, vAutoManaComponent)
- AND t.shipped > vFromDated
- AND t.shipped < TIMESTAMPADD(DAY,1,util.VN_CURDATE())
- AND a.clientFk = vClient
- UNION ALL
- SELECT - amountPaid
- FROM receipt r
- JOIN `client` c ON c.id = r.clientFk
- WHERE r.bankFk = vManaBank
- AND r.payed > vFromDated
- AND r.payed <= util.VN_CURDATE()
- AND c.id = vClient
- UNION ALL
- SELECT g.amount
- FROM greuge g
- JOIN `client` c ON c.id = g.clientFk
- WHERE g.greugeTypeFk = vManaGreugeType
- AND g.shipped > vFromDated
- AND g.shipped <= util.VN_CURDATE()
- AND c.id = vClient
- ) sub;
RETURN IFNULL(vMana,0);
END ;;
DELIMITER ;
@@ -44499,7 +45083,7 @@ BEGIN
*
* @param vClient client id
* @param vDate date to check the risk
- * @return client risk
+ * @return Client risk
*/
DECLARE vDebt DECIMAL(10,2);
DECLARE vHasDebt BOOLEAN;
@@ -44519,6 +45103,10 @@ BEGIN
SELECT risk INTO vDebt FROM tmp.risk;
+ DROP TEMPORARY TABLE
+ tmp.clientGetDebt,
+ tmp.risk;
+
RETURN vDebt;
END ;;
DELIMITER ;
@@ -44926,27 +45514,25 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDua INT, vTaxClass INT) RETURNS decimal(5,2)
+CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDuaFk INT, vTaxClassFk INT) RETURNS decimal(5,2)
DETERMINISTIC
BEGIN
- DECLARE vCountryFk INTEGER;
-
- SELECT s.countryFk INTO vCountryFk
- FROM dua d
- JOIN supplier s ON s.id = d.companyFk
- WHERE d.id = vDua;
-
- RETURN (SELECT rate
- FROM
- (SELECT taxClassFk, rate
- FROM invoiceInTaxBookingAccount
- WHERE effectived <= util.VN_CURDATE()
- AND countryFk = vCountryFk
- AND taxClassFk = vTaxClass
- ORDER BY effectived DESC
- LIMIT 10000000000000000000
- ) ba1
- GROUP BY taxClassFk);
+/**
+ * Devuelve el rate para un Dua teniendo en cuenta la fecha de opreción del DUA
+ *
+ * @param vDuaFk Identificador de la tabla dua
+ * @param vTaxClassFk Identificador del IVA de la tabla invoiceInTaxBookingAccount
+ */
+ RETURN (
+ SELECT rate
+ FROM dua d
+ JOIN supplier s ON s.id = d.companyFk
+ JOIN invoiceInTaxBookingAccount iit ON iit.countryFk = s.countryFk
+ AND iit.taxClassFk = vTaxClassFk
+ AND iit.effectived <= IFNULL( d.operated, util.VN_CURDATE())
+ WHERE d.id = vDuaFk
+ ORDER BY effectived DESC
+ LIMIT 1);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -45948,7 +46534,7 @@ BEGIN
WHERE io.ref = vInvoiceRef
UNION ALL
SELECT ioe.amount
- FROM invoiceOutExpence ioe
+ FROM invoiceOutExpense ioe
JOIN invoiceOut io ON io.id = ioe.invoiceOutFk
WHERE io.ref = vInvoiceRef
) t1;
@@ -46809,61 +47395,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 `phytoPassport` */;
-/*!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 `phytoPassport`(vRef VARCHAR(15)) RETURNS text CHARSET utf8mb3 COLLATE utf8mb3_general_ci
- DETERMINISTIC
-BEGIN
-DECLARE vPhyto TEXT CHARSET utf8 COLLATE utf8_unicode_ci;
-SELECT
- GROUP_CONCAT(i.id,
- ':',
- ppa.denomination,
- ' ',
- pp.number,
- CHAR(13,10)
- SEPARATOR '') fitosanitario
- INTO vPhyto
-FROM
- sale s
- JOIN
- ticket t ON t.id = s.ticketFk
- JOIN
- item i ON i.id = s.itemFk
- JOIN
- plantpassport pp ON pp.producerFk = i.producerFk
- JOIN
- plantpassportAuthority ppa ON ppa.id = pp.plantpassportAuthorityFk
- JOIN
- itemBotanicalWithGenus ib ON ib.itemFk = i.id
- JOIN
- botanicExport be ON be.`code` = 'phytosanitaryPassport'
- LEFT JOIN
- ediGenus eg ON eg.id = be.ediGenusFk
- LEFT JOIN
- ediSpecie es ON es.id = be.ediSpecieFk
-WHERE
- t.refFk = vRef
- AND ib.ediBotanic LIKE CONCAT(IFNULL(eg.latinGenusName, ''),
- IF(latinSpeciesName > '',
- CONCAT(' ', latinSpeciesName),
- ''),
- '%');
-RETURN vPhyto;
-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 `priceFixed_getRate2` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -49229,14 +49760,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `buy_afterUpsert` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT)
BEGIN
@@ -49275,7 +49806,7 @@ BEGIN
LEFT JOIN item i ON i.id = b.itemFk
LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox
+ LEFT JOIN packaging p ON p.id = b.packagingFk AND NOT p.isBox
JOIN volumeConfig vc ON TRUE
WHERE b.id = vSelf;
@@ -49489,14 +50020,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `buy_getVolume` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolume`()
BEGIN
@@ -49506,9 +50037,9 @@ BEGIN
*/
SELECT t.name Temp,
CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) *
- item_getVolume(b.itemFk, b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) carros ,
+ item_getVolume(b.itemFk, b.packagingFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) carros ,
CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) *
- item_getVolume(b.itemFk, b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) espais
+ item_getVolume(b.itemFk, b.packagingFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) espais
FROM buy b
JOIN tmp.buy tb ON tb.buyFk = b.id
JOIN volumeConfig vc
@@ -49587,14 +50118,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `buy_recalcPrices` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPrices`()
BEGIN
@@ -49607,7 +50138,7 @@ BEGIN
DECLARE vWarehouseFk INT;
DECLARE vHasNotPrice BOOL;
DECLARE vBuyingValue DECIMAL(10,3);
- DECLARE vPackageFk VARCHAR(10);
+ DECLARE vPackagingFk VARCHAR(10);
DECLARE vIsWarehouseFloramondo BOOL;
SELECT t.landed, t.warehouseInFk, (w.`name` = 'Floramondo')
@@ -49623,7 +50154,7 @@ BEGIN
UPDATE buy b
JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id)
- LEFT JOIN packaging p ON p.id = b.packageFk
+ LEFT JOIN packaging p ON p.id = b.packagingFk
JOIN item i ON i.id = b.itemFk
JOIN entry e ON e.id = b.entryFk
JOIN itemType it ON it.id = i.typeFk
@@ -49631,7 +50162,7 @@ BEGIN
JOIN agencyMode am ON am.id = tr.agencyModeFk
JOIN tmp.rate r
JOIN volumeConfig vc
- SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packageFk) / 1000000)
+ SET b.freightValue = @PF:= IFNULL(((am.m3 * @m3:= item_getVolume(b.itemFk, b.packagingFk) / 1000000)
/ b.packing) * IF(am.hasWeightVolumetric, GREATEST(b.weight / @m3 / vc.aerealVolumetricDensity, 1), 1), 0),
b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3),
b.packageValue = @EF:= IF(vIsWarehouseFloramondo, 0, IFNULL(ROUND(IF(p.isPackageReturnable, p.returnCost / b.packing , p.`value` / b.packing), 3),0)),
@@ -49639,8 +50170,8 @@ BEGIN
b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2),
b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2);
- SELECT (b.buyingValue = b.price2), b.buyingValue, b.packageFk
- INTO vHasNotPrice, vBuyingValue, vPackageFk
+ SELECT (b.buyingValue = b.price2), b.buyingValue, b.packagingFk
+ INTO vHasNotPrice, vBuyingValue, vPackagingFk
FROM vn.buy b
WHERE b.id = @buyId AND b.buyingValue <> 0.01;
@@ -50248,7 +50779,7 @@ BEGIN
SELECT tcb.warehouseFk,
tcb.itemFk,
c2.id,
- ROUND(base * (0.01 + wm.pricesModifierRate), 3) manaAuto
+ ROUND(base * wm.pricesModifierRate, 3) manaAuto
FROM tmp.ticketComponentBase tcb
JOIN `client` c on c.id = vClientFk
JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
@@ -50531,7 +51062,12 @@ BEGIN
DELETE FROM sharingCart where ended < vDateShort;
DELETE FROM sharingClient where ended < vDateShort;
DELETE tw.* FROM ticketWeekly tw
- LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL;
+ LEFT JOIN sale s ON s.ticketFk = tw.ticketFk
+ LEFT JOIN ticketRequest tr ON tr.ticketFk = tw.ticketFk
+ LEFT JOIN ticketService ts ON ts.ticketFk = tw.ticketFk
+ WHERE s.id IS NULL
+ AND tr.id IS NULL
+ AND ts.id IS NULL;
DELETE FROM claim WHERE ticketCreated < vFourYearsAgo;
DELETE FROM message WHERE sendDate < vDateShort;
-- Robert ubicacion anterior de trevelLog comentario para debug
@@ -50857,6 +51393,7 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
CREATE TEMPORARY TABLE tmp.clientGetDebt
+ (INDEX (clientFk))
SELECT clientFk
FROM bs.defaulter
WHERE created = util.VN_CURDATE()
@@ -51284,14 +51821,14 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
CREATE TEMPORARY TABLE tmp.clientGetDebt
- SELECT cd.id as clientFk
+ SELECT cd.clientFk
FROM bs.clientDied cd
- LEFT JOIN clientProtected cp ON cp.clientFk = cd.id
- JOIN client c ON c.id = cd.id
+ LEFT JOIN clientProtected cp ON cp.clientFk = cd.clientFk
+ JOIN client c ON c.id = cd.clientFk
JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk
JOIN country co ON co.id = p.countryFk
- WHERE cd.Aviso = 'TERCER AVISO'
+ WHERE cd.warning = 'third'
AND cp.clientFk IS NULL
AND co.code NOT IN ('PT')
AND a.name <> 'Canarias'
@@ -51537,18 +52074,19 @@ BEGIN
* Calculates the risk for active clients
*
* @table tmp.clientGetDebt(clientFk)
- * @param vDate maximum date of records
+ * @param vDate Maximum date of records
* @return tmp.risk
*/
DECLARE vStarted DATETIME;
DECLARE vEnded DATETIME;
- SELECT TIMESTAMPADD(MONTH, -riskScope, util.VN_CURDATE()) INTO vStarted FROM clientConfig;
- SET vEnded = TIMESTAMP(IFNULL(vDate, util.VN_CURDATE()), '23:59:59');
+ SELECT util.VN_CURDATE() - INTERVAL riskScope MONTH INTO vStarted
+ FROM clientConfig;
- DROP TEMPORARY TABLE IF EXISTS tClientRisk;
- CREATE TEMPORARY TABLE tClientRisk
+ SET vEnded = util.dayEnd(IFNULL(vDate, util.VN_CURDATE()));
+
+ CREATE OR REPLACE TEMPORARY TABLE tClientRisk
ENGINE = MEMORY
SELECT cr.clientFk, SUM(cr.amount) amount
FROM clientRisk cr
@@ -51571,12 +52109,14 @@ BEGIN
GROUP BY t.clientFk;
INSERT INTO tClientRisk
- SELECT t.clientFk, totalWithVat
+ SELECT t.clientFk, SUM(totalWithVat)
FROM ticket t
JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk
WHERE refFk IS NULL
- AND shipped BETWEEN vStarted AND vEnded;
+ AND shipped BETWEEN vStarted AND vEnded
+ GROUP BY t.clientFk;
+ -- refs #6351 BUG: No cambiar a CREATE OR REPLACE
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
CREATE TEMPORARY TABLE tmp.risk
(PRIMARY KEY (clientFk))
@@ -51595,6 +52135,75 @@ 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 `client_getMana` */;
+/*!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 `client_getMana`()
+BEGIN
+/**
+ * Devuelve el mana de los clientes de la tabla tmp.client(id)
+ * @return tmp.clientMana(id, mana)
+ *
+ */
+ DECLARE vFromDated DATE;
+
+ DELETE tc FROM tmp.client tc
+ JOIN client c ON c.id = tc.id
+ WHERE c.typeFk <> 'normal';
+
+ SELECT MAX(dated) INTO vFromDated
+ FROM clientManaCache;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.clientMana
+ SELECT id, SUM(mana) mana
+ FROM
+ (
+ SELECT tc.id, cmc.mana
+ FROM clientManaCache cmc
+ JOIN tmp.client tc ON tc.id = cmc.clientFk
+ WHERE cmc.dated = vFromDated
+ UNION ALL
+ SELECT tc.id, s.quantity * value
+ FROM ticket t
+ JOIN address a ON a.id = t.addressFk
+ JOIN tmp.client tc ON tc.id = a.clientFk
+ JOIN sale s on s.ticketFk = t.id
+ JOIN saleComponent sc on sc.saleFk = s.id
+ JOIN component comp ON sc.componentFk = comp.id
+ JOIN componentType ct ON ct.id = comp.typeFk AND ct.code = 'mana'
+ WHERE t.shipped > vFromDated
+ AND t.shipped < util.tomorrow()
+ UNION ALL
+ SELECT tc.id, -amountPaid
+ FROM receipt r
+ JOIN `client` c ON c.id = r.clientFk
+ JOIN tmp.client tc ON tc.id = c.id
+ JOIN bank b ON r.bankFk = b.id AND b.code = 'mana'
+ WHERE r.payed > vFromDated
+ AND r.payed <= util.VN_CURDATE()
+ UNION ALL
+ SELECT tc.id, g.amount
+ FROM greuge g
+ JOIN `client` c ON c.id = g.clientFk
+ JOIN tmp.client tc ON tc.id = c.id
+ JOIN greugeType gt ON gt.id = g.greugeTypeFk AND gt.code = 'mana'
+ WHERE g.shipped > vFromDated
+ AND g.shipped <= util.VN_CURDATE()
+ ) sub
+ GROUP BY id;
+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 `client_RandomList` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -51694,7 +52303,7 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
CREATE OR REPLACE TEMPORARY TABLE tClientList
- SELECT c.id clientFk
+ SELECT c.clientFk
FROM bs.clientDied cd
JOIN client c ON c.id = cd.id
LEFT JOIN clientProtected cp ON cp.clientFk = c.id
@@ -51702,7 +52311,7 @@ BEGIN
JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk
JOIN country co ON co.id = p.countryFk
- WHERE cd.Aviso = 'TERCER AVISO'
+ WHERE cd.warning = 'third'
AND cp.clientFk IS NULL
AND sp.salesPersonFk IS NULL
AND a.name <> 'Canarias'
@@ -51781,127 +52390,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 `cmr_getByTicket` */;
-/*!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 `cmr_getByTicket`(vTicketFk INT)
-BEGIN
-
- DECLARE vLanded DATE;
-
- SELECT DATE_ADD(util.VN_CURDATE(), INTERVAL landingDays DAY) INTO vLanded
- FROM vn.cmrConfig;
-
- IF vTicketFk THEN
-
- IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN
-
- SELECT id FROM vn.cmr WHERE ticketFk = vTicketFk;
-
- ELSE
-
- INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, ead)
- SELECT vTicketFk, t.companyFk, a.id, t.addressFk, vLanded
- FROM vn.ticket t
- JOIN vn.warehouse w ON w.id = t.warehouseFk
- JOIN vn.address a ON a.id = w.addressFk
- WHERE t.id = vTicketFk;
-
- SELECT LAST_INSERT_ID();
-
- END IF;
-
- ELSE
-
- INSERT INTO vn.cmr(ead) VALUES(vLanded);
-
- SELECT LAST_INSERT_ID();
-
- 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 `cmr_sendOverview` */;
-/*!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 `cmr_sendOverview`()
-BEGIN
-/**
- * Insert the monthly CMR summary in vn.mail on the 5th of each month.
- */
-
- SET SESSION group_concat_max_len = 1000000;
--- IF (DAY(util.VN_CURDATE()) = 5) THEN
- INSERT INTO
- vn.mail (receiver,
- replyTo,
- subject,
- body)
- SELECT
- c2.email,
- 'cmr@verdnatura.es',
- 'Resumen CMR',
- CONCAT('
-
Resumen Mensual CMR
-
-
-
- Estimado cliente,
- A continuación le enviamos el resumen menual de CMR ',UPPER(MONTHNAME(util.VN_CURDATE() - INTERVAL 1 MONTH)),' ', YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH), '.
- Le rogamos que nos devuelva el resumen firmado a cmr@verdnatura.es
-
-
-
-
-
CMR
-
Ticket
-
'
- , GROUP_CONCAT('
', c.id, '
', c.ticketFk, '
' ORDER BY c.id SEPARATOR '' ),
- '
-
-
- Saludos cordiales, Dpto administración.
-
')
- FROM vn.cmr c
- JOIN vn.address a ON c.addressToFk = a.id
- JOIN vn.client c2 ON a.clientFk = c2.id
- WHERE c.state = 'Pending'
- AND MONTH(c.created) = MONTH(util.VN_CURDATE() - INTERVAL 1 MONTH)
- AND YEAR(c.created) = YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH)
- AND c2.email IS NOT NULL -- No cogemos los CMRs dirigidos a 'Verdnatura'
- GROUP BY c2.id;
-
- -- Actualizamos el estado a 'Enviado'
- UPDATE vn.cmr c
- SET c.state = 'Sent'
- WHERE c.state = 'Pending'
- AND MONTH(c.created) = MONTH(util.VN_CURDATE() - INTERVAL 1 MONTH)
- AND YEAR(c.created) = YEAR(util.VN_CURDATE() - INTERVAL 1 MONTH);
--- 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 `collectionPlacement_get` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -54191,46 +54679,51 @@ BEGIN
* Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry
*
* @param vDuaFk Id del dua a recalcular
-**/
+ */
DELETE FROM duaTax
WHERE duaFk = vDuaFk;
- INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base)
- SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base
+ INSERT INTO duaTax(duaFk, taxClassFk, base)
+ SELECT vDuaFk, taxClassFk, SUM(sub.totalBase)
FROM intrastat ist
JOIN
- (SELECT
- e.supplierFk,
- i.intrastatFk,
- CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base
+ (SELECT i.intrastatFk,
+ CAST(SUM(b.quantity *
+ b.buyingValue *
+ de.customsValue /
+ de.value)
+ * di.totalAmount /
+ bi.totalAmount AS DECIMAL(10,2)
+ ) totalBase
FROM buy b
JOIN item i ON i.id = b.itemFk
JOIN entry e ON e.id = b.entryFk
JOIN duaEntry de ON de.entryFk = e.id
- JOIN
- (
- SELECT i.intrastatFk,
- CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base
- FROM buy b
- JOIN item i ON i.id = b.itemFk
- JOIN entry e ON e.id = b.entryFk
- JOIN duaEntry de ON de.entryFk = e.id
- WHERE de.duaFk = vDuaFk
- GROUP BY i.intrastatFk
-
- ) tei ON tei.intrastatFk = i.intrastatFk
- JOIN
- (
- SELECT intrastatFk, sum(amount) as amount
- FROM duaIntrastat
- WHERE duaFk = vDuaFk
- GROUP BY intrastatFK
- ) di ON di.intrastatFk = i.intrastatFk
+ JOIN(
+ SELECT i.intrastatFk,
+ CAST(SUM(b.quantity *
+ b.buyingValue *
+ de.customsValue /
+ de.value) AS DECIMAL(10,2)
+ ) totalAmount
+ FROM buy b
+ JOIN item i ON i.id = b.itemFk
+ JOIN entry e ON e.id = b.entryFk
+ JOIN duaEntry de ON de.entryFk = e.id
+ WHERE de.duaFk = vDuaFk
+ GROUP BY i.intrastatFk
+ ) bi ON bi.intrastatFk = i.intrastatFk
+ JOIN(
+ SELECT intrastatFk, SUM(amount) totalAmount
+ FROM duaIntrastat
+ WHERE duaFk = vDuaFk
+ GROUP BY intrastatFK
+ ) di ON di.intrastatFk = i.intrastatFk
WHERE de.duaFk = vDuaFk
- GROUP BY e.supplierFk, i.intrastatFk
- HAVING Base
- ) sub ON ist.id = sub.intrastatFk
- GROUP BY ist.taxClassFk, sub.supplierFk;
+ GROUP BY i.intrastatFk
+ HAVING totalBase
+ )sub ON ist.id = sub.intrastatFk
+ GROUP BY ist.taxClassFk;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -54533,14 +55026,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `entry_checkPackaging` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_checkPackaging`(vEntryFk INT)
BEGIN
@@ -54554,7 +55047,7 @@ BEGIN
SELECT count(*) INTO vpackageOrPackingNull
FROM buy b
WHERE b.entryFk = vEntryFk
- AND (b.packing IS NULL OR b.packageFk IS NULL);
+ AND (b.packing IS NULL OR b.packagingFk IS NULL);
IF vpackageOrPackingNull THEN
CALL util.throw("packageOrPackingNull");
@@ -54630,7 +55123,8 @@ BEGIN
commission,
currencyFk,
companyFk,
- clonedFrom
+ clonedFrom,
+ typeFk
)
SELECT IFNULL(vTravelFk, travelFk),
supplierFk,
@@ -54640,7 +55134,8 @@ BEGIN
commission,
currencyFk,
companyFk,
- vSelf
+ vSelf,
+ typeFk
FROM entry
WHERE id = vSelf;
@@ -54717,7 +55212,7 @@ BEGIN
containerFk,
comissionValue,
packageValue,
- packageFk,
+ packagingFk,
price1,
price2,
price3,
@@ -54740,7 +55235,7 @@ BEGIN
containerFk,
comissionValue,
packageValue,
- packageFk,
+ packagingFk,
price1,
price2,
price3,
@@ -54916,6 +55411,7 @@ BEGIN
*
* @param vSelf Identificador de entry
* @param vDays Número de dias a futuro que se quiere la nueva entrada
+ * @param vChangeEntry Si se modifica la entrada original
*
* @return vNewEntryFk Identificador de la nueva entrada
*/
@@ -54923,8 +55419,12 @@ BEGIN
DECLARE vTravelFk INT;
DECLARE vInvoiceAmountOldEntryFk DECIMAL(10,2);
DECLARE vInvoiceAmountNewEntry DECIMAL(10,2);
+ DECLARE vIsOrdered BOOL;
+ DECLARE vIsConfirmed BOOL;
+ DECLARE vInvoiceNumber VARCHAR(50);
+ DECLARE vTypeFk VARCHAR(100);
- SELECT travelFk INTO vTravelFk
+ SELECT travelFk, isOrdered, isConfirmed, invoiceNumber, typeFk INTO vTravelFk, vIsOrdered, vIsConfirmed, vInvoiceNumber, vTypeFk
FROM entry
WHERE id = vSelf;
@@ -54933,7 +55433,11 @@ BEGIN
UPDATE entry e
SET e.travelFk = vNewTravelFk,
- e.evaNotes = CONCAT('No impresas de: ', vSelf, ' ', IFNULL(e.evaNotes,''))
+ e.evaNotes = CONCAT('No impresas de: ', vSelf, ' ', IFNULL(e.evaNotes,'')),
+ e.isOrdered = vIsOrdered,
+ e.isConfirmed = vIsConfirmed,
+ e.invoiceNumber = vInvoiceNumber,
+ e.typeFk = vTypeFk
WHERE e.id = vNewEntryFk;
IF vChangeEntry THEN
@@ -55439,246 +55943,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 `errorProduction_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 `errorProduction_add`(
- vAction VARCHAR(25),
- vDatedFrom DATETIME,
- vDatedTo DATETIME)
-BEGIN
-/**
- * Rellena la tabla vn.errorProduction
- *
- * @param vAction Accion que se quiere añadir
- * @param vDatedFrom Fecha desde
- * @param vDatedTo Fecha hasta
- */
- DECLARE vDepartment VARCHAR(255);
-
- CASE
- WHEN vAction = 'SACAR' THEN
- SET vDepartment = 'Sacadores';
- WHEN vAction = 'ENCAJAR' THEN
- SET vDepartment = 'Encajadores';
- WHEN vAction = 'CONTROLAR' THEN
- SET vDepartment = 'Revisadores';
- END CASE;
-
- IF (vDepartment = 'Encajadores') THEN
- CREATE OR REPLACE TEMPORARY TABLE total
- ENGINE = MEMORY
- SELECT e.workerFk,
- COUNT(DISTINCT t.id) ticketCount,
- COUNT(s.id) lineCount
- FROM expedition e
- JOIN ticket t ON e.ticketFk = t.id
- JOIN sale s ON s.ticketFk = t.id
- WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
- GROUP BY e.workerFk;
- ELSE
- CREATE OR REPLACE TEMPORARY TABLE total
- ENGINE = MEMORY
- SELECT st.workerFk,
- COUNT(DISTINCT t.id) ticketCount,
- COUNT(s.id) lineCount
- FROM saleTracking st
- JOIN `state` s2 ON s2.id = st.stateFk
- JOIN sale s ON s.id = st.saleFk
- JOIN ticket t ON s.ticketFk = t.id
- WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
- AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
- GROUP BY st.workerFk;
- END IF;
-
- CALL timeControl_calculateAll(vDatedFrom, vDatedTo);
-
- CREATE OR REPLACE TEMPORARY TABLE errorsByClaim
- ENGINE = MEMORY
- SELECT COUNT(c.ticketFk) errors,
- cd.workerFk
- FROM claimDevelopment cd
- JOIN claim c ON cd.claimFk = c.id
- JOIN ticket t ON c.ticketFk = t.id
- JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
- WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
- AND cr.description = vDepartment
- GROUP BY cd.workerFk;
-
- CREATE OR REPLACE TEMPORARY TABLE volume
- ENGINE = MEMORY
- SELECT SUM(w.volume) volume,
- w.workerFk
- FROM bs.workerProductivity w
- WHERE w.dated BETWEEN vDatedFrom AND vDatedTo
- GROUP BY w.workerFk;
-
- CREATE OR REPLACE TEMPORARY TABLE errorsByChecker
- ENGINE = MEMORY
- SELECT sub1.workerFk, COUNT(id) errors
- FROM (
- SELECT st.workerFk,
- t.id
- FROM saleMistake sm
- JOIN saleTracking st ON sm.saleFk = st.saleFk
- JOIN `state` s2 ON s2.id = st.stateFk
- JOIN sale s ON s.id = sm.saleFk
- JOIN ticket t on t.id = s.ticketFk
- WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
- AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
- ) sub1
- GROUP BY sub1.workerFk;
-
- CREATE OR REPLACE TEMPORARY TABLE expeditionErrors
- ENGINE = MEMORY
- SELECT COUNT(t.id) errors,
- e.workerFk
- FROM vn.expeditionMistake pm
- JOIN vn.expedition e ON e.id = pm.expeditionFk
- JOIN vn.ticket t ON t.id = e.ticketFk
- WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
- GROUP BY e.workerFk;
-
- IF (vDepartment = 'Sacadores') THEN
-
- INSERT INTO errorProduction(userFk,
- firstname,
- lastname,
- rol,
- ticketNumber,
- lineNumber,
- error,
- volume,
- hourStart,
- hourEnd,
- hourWorked,
- dated)
- SELECT w.id,
- w.firstName,
- w.lastName,
- vDepartment,
- t.ticketCount totalTickets,
- t.lineCount,
- IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) errors,
- IF(vDepartment = 'Revisadores', NULL, v.volume) volume,
- SUBSTRING(tc.timed, 1, 5) hourStart,
- SUBSTRING(tc.timed, LENGTH(tc.timed)-4, 5) hourEnd,
- IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked,
- vDatedFrom dated
- FROM total t
- LEFT JOIN worker w ON w.id = t.workerFk
- LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk
- LEFT JOIN errorsByClaim ec ON ec.workerFk = t.workerFk
- LEFT JOIN volume v ON v.workerFk = t.workerFk
- LEFT JOIN errorsByChecker ec2 ON ec2.workerFk = t.workerFk
- JOIN (SELECT DISTINCT w.id -- Verificamos que son sacadores
- FROM vn.collection c
- JOIN vn.state s ON s.id = c.stateFk
- JOIN vn.train tn ON tn.id = c.trainFk
- JOIN vn.worker w ON w.id = c.workerFk
- WHERE c.created BETWEEN vDatedFrom AND vDatedTo) sub ON sub.id = w.id
- GROUP BY w.id;
-
- CREATE OR REPLACE TEMPORARY TABLE itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores
- ENGINE = MEMORY
- SELECT COUNT(c.ticketFk) errors,
- tt.workerFk
- FROM claimDevelopment cd
- JOIN claim c ON cd.claimFk = c.id
- JOIN ticket t ON c.ticketFk = t.id
- JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
- JOIN ticketTracking tt ON tt.ticketFk = t.id
- JOIN `state` s ON s.id = tt.stateFk
- WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
- AND cr.description = 'Revisadores'
- AND s.code = 'ON_PREPARATION'
- GROUP BY workerFk;
-
- UPDATE errorProduction ep
- JOIN itemPickerErrors ipe ON ipe.workerFk = ep.userFk
- SET ep.error = ep.error + ipe.errors
- WHERE vDatedFrom = ep.dated AND ep.rol = 'Sacadores';
-
- DROP TEMPORARY TABLE itemPickerErrors;
- ELSE
- INSERT INTO errorProduction(userFk,
- firstname,
- lastname,
- rol,
- ticketNumber,
- lineNumber,
- error,
- volume,
- hourStart,
- hourEnd,
- hourWorked,
- dated)
- SELECT w.id,
- w.firstName,
- w.lastName,
- vDepartment,
- t.ticketCount totalTickets,
- t.lineCount,
- IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) + IFNULL(pe.errors,0) errors,
- IF(vDepartment = 'Revisadores', NULL, v.volume) volume,
- SUBSTRING(tc.timed, 1, 5) hourStart,
- SUBSTRING(tc.timed, LENGTH(tc.timed)-4, 5) hourEnd,
- IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked,
- vDatedFrom dated
- FROM total t
- LEFT JOIN worker w ON w.id = t.workerFk
- LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk
- LEFT JOIN errorsByClaim ec ON ec.workerFk = t.workerFk
- LEFT JOIN volume v ON v.workerFk = t.workerFk
- LEFT JOIN errorsByChecker ec2 ON ec2.workerFk = t.workerFk
- LEFT JOIN expeditionErrors pe ON pe.workerFk = t.workerFk
- GROUP BY w.id;
- END IF;
-
- DROP TEMPORARY TABLE total,
- errorsByClaim,
- volume,
- errorsByChecker,
- expeditionErrors;
-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 `errorProduction_addLauncher` */;
-/*!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 `errorProduction_addLauncher`()
-BEGIN
- DECLARE vDatedFrom DATETIME;
- DECLARE vDatedTo DATETIME;
-
- SELECT DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(util.VN_CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo;
-
- CALL vn.errorProduction_add('SACAR', vDatedFrom, vDatedTo);
- CALL vn.errorProduction_add('ENCAJAR', vDatedFrom, vDatedTo);
- CALL vn.errorProduction_add('CONTROLAR', vDatedFrom, vDatedTo);
-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 `expeditionGetFromRoute` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -56543,14 +56807,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `fustControl` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE)
BEGIN
@@ -56572,14 +56836,14 @@ BEGIN
LEFT JOIN (
SELECT FustCode, sum(fustQuantity) stucks
FROM (
- SELECT IFNULL(pe.equivalentFk ,b.packageFk) FustCode, s.quantity / b.packing AS fustQuantity
+ SELECT IFNULL(pe.equivalentFk ,b.packagingFk) FustCode, s.quantity / b.packing AS fustQuantity
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.warehouse w ON w.id = t.warehouseFk
JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk
JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk
JOIN vn.buy b ON b.id = lb.buy_id
- JOIN vn.packaging p ON p.id = b.packageFk
+ JOIN vn.packaging p ON p.id = b.packagingFk
LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p2 ON p2.id = a.provinceFk
@@ -57248,7 +57512,7 @@ proc: BEGIN
inv.groupingMode = b.groupingMode,
inv.comissionValue = b.comissionValue,
inv.packageValue = b.packageValue,
- inv.packageFk = b.packageFk,
+ inv.packageFk = b.packagingFk,
inv.price1 = b.price1,
inv.price2 = b.price2,
inv.price3 = b.price3,
@@ -57264,28 +57528,28 @@ proc: BEGIN
groupingMode,
comissionValue,
packageValue,
- packageFk,
+ packagingFk,
price1,
price2,
price3,
minPrice,
entryFk)
SELECT itemFk,
- GREATEST(quantity, 0),
- buyingValue,
- freightValue,
- packing,
- `grouping`,
- groupingMode,
- comissionValue,
- packageValue,
- packageFk,
- price1,
- price2,
- price3,
- minPrice,
- vEntryFk
- FROM tmp.inventory;
+ GREATEST(quantity, 0),
+ buyingValue,
+ freightValue,
+ packing,
+ `grouping`,
+ groupingMode,
+ comissionValue,
+ packageValue,
+ packageFk,
+ price1,
+ price2,
+ price3,
+ minPrice,
+ vEntryFk
+ FROM tmp.inventory;
SELECT vWh, COUNT(*), util.VN_NOW() FROM tmp.inventory;
@@ -57353,14 +57617,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `inventory_repair` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `inventory_repair`()
BEGIN
@@ -57386,7 +57650,7 @@ BEGIN
i.stems,
b.quantity,
b.buyingValue,
- b.packageFk ,
+ b.packagingFk ,
s.id AS supplierFk,
s.name AS supplier
FROM itemType it
@@ -57400,7 +57664,7 @@ BEGIN
LEFT JOIN origin o ON o.id = i.originFk
) ON it.id = i.typeFk
LEFT JOIN edi.ekt ek ON b.ektFk = ek.id
- WHERE (b.packageFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO';
+ WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO';
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk;
CREATE TEMPORARY TABLE tmp.lastEntryOk
@@ -57423,7 +57687,7 @@ BEGIN
i.stems,
b.quantity,
b.buyingValue,
- b.packageFk ,
+ b.packagingFk,
s.id AS supplierFk,
s.name AS supplier
FROM itemType it
@@ -57437,7 +57701,7 @@ BEGIN
LEFT JOIN origin o ON o.id = i.originFk
) ON it.id = i.typeFk
LEFT JOIN edi.ekt ek ON b.ektFk = ek.id
- WHERE b.packageFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,util.VN_CURDATE()))
+ WHERE b.packagingFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,util.VN_CURDATE()))
ORDER BY tr.landed DESC;
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOkGroup;
@@ -57450,7 +57714,7 @@ BEGIN
UPDATE buy b
JOIN tmp.lastEntry lt ON lt.buyFk = b.id
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
- SET b.packageFk = eo.packageFk WHERE b.packageFk = "--";
+ SET b.packagingFk = eo.packagingFk WHERE b.packagingFk = "--";
UPDATE buy b
JOIN tmp.lastEntry lt ON lt.buyFk = b.id
@@ -57478,7 +57742,7 @@ 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 `invoiceExpenceMake` */;
+/*!50003 DROP PROCEDURE IF EXISTS `invoiceExpenseMake` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -57486,28 +57750,28 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenceMake`(IN vInvoice INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenseMake`(IN vInvoice INT)
BEGIN
/* Inserta las partidas de gasto correspondientes a la factura
* REQUIERE tabla tmp.ticketToInvoice
* @param vInvoice Numero de factura
*/
- DELETE FROM invoiceOutExpence
+ DELETE FROM invoiceOutExpense
WHERE invoiceOutFk = vInvoice;
- INSERT INTO invoiceOutExpence(invoiceOutFk, expenceFk, amount)
+ INSERT INTO invoiceOutExpense(invoiceOutFk, expenseFk, amount)
SELECT vInvoice,
- expenceFk,
+ expenseFk,
SUM(ROUND(quantity * price * (100 - discount)/100,2)) amount
FROM tmp.ticketToInvoice t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
- GROUP BY i.expenceFk
+ GROUP BY i.expenseFk
HAVING amount != 0;
- INSERT INTO invoiceOutExpence(invoiceOutFk, expenceFk, amount)
+ INSERT INTO invoiceOutExpense(invoiceOutFk, expenseFk, amount)
SELECT vInvoice,
- tst.expenceFk,
+ tst.expenseFk,
SUM(ROUND(ts.quantity * ts.price ,2)) amount
FROM tmp.ticketToInvoice t
JOIN ticketService ts ON ts.ticketFk = t.id
@@ -57770,6 +58034,41 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `invoiceInTax_afterUpsert` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_afterUpsert`(vInvoiceInFk INT)
+BEGIN
+/**
+ * Triggered actions when a invoiceInTax is updated or inserted.
+ *
+ * @param vInvoiceInFk The invoiceIn id
+ */
+ DECLARE vTaxRowLimit INT;
+ DECLARE vLines INT;
+
+ SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
+
+ SELECT COUNT(*) INTO vLines
+ FROM invoiceInTax
+ WHERE invoiceInFk = vInvoiceInFk;
+
+ IF vLines >= vTaxRowLimit THEN
+ CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
+ 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 `invoiceInTax_getFromDua` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -57827,7 +58126,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId
BEGIN
DECLARE vRate DOUBLE DEFAULT 1;
DECLARE vDated DATE;
- DECLARE vExpenceFk VARCHAR(10);
+ DECLARE vExpenseFk VARCHAR(10);
SELECT MAX(rr.dated) INTO vDated
FROM referenceRate rr
@@ -57841,8 +58140,8 @@ BEGIN
WHERE dated = vDated;
END IF;
- SELECT id INTO vExpenceFk
- FROM vn.expence
+ SELECT id INTO vExpenseFk
+ FROM vn.expense
WHERE `name` = 'Adquisición mercancia Extracomunitaria'
GROUP BY id
LIMIT 1;
@@ -57850,10 +58149,10 @@ BEGIN
DELETE FROM invoiceInTax
WHERE invoiceInFk = vId;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, foreignValue, taxTypeSageFk, transactionTypeSageFk)
SELECT ii.id,
SUM(b.buyingValue * b.quantity) / IFNULL(vRate,1) taxableBase,
- vExpenceFk,
+ vExpenseFk,
IF(ii.currencyFk = 1,NULL,SUM(b.buyingValue * b.quantity )) divisa,
taxTypeSageFk,
transactionTypeSageFk
@@ -57890,17 +58189,17 @@ BEGIN
SELECT ii.bookEntried,
iit.foreignValue,
ii.companyFk,
- ii.expenceFkDeductible,
+ ii.expenseFkDeductible,
iit.taxableBase,
iit.transactionTypeSageFk,
ii.serial,
ii.issued,
ii.operated,
ii.supplierRef,
- ii.cplusTrascendency472Fk,
+ ii.siiTrascendencyInvoiceInFk,
ii.cplusTaxBreakFk,
ii.cplusSubjectOpFk,
- ii.cplusInvoiceType472Fk,
+ ii.siiTypeInvoiceInFk,
ii.cplusRectificationTypeFk,
ii.booked,
IFNULL(a.isUeeMember, c.isUeeMember) isUeeMember,
@@ -57920,8 +58219,8 @@ BEGIN
cit.id invoicesCount,
e.code,
e.isWithheld,
- e.id expenceFk,
- e.name expenceName
+ e.id expenseFk,
+ e.name expenseName
FROM invoiceIn ii
JOIN supplier s ON s.id = ii.supplierFk
LEFT JOIN province p ON p.id = s.provinceFk
@@ -57930,10 +58229,10 @@ BEGIN
JOIN supplier sc ON sc.id = ii.companyFk
JOIN country cc ON cc.id = sc.countryFk
JOIN invoiceInSerial iis ON iis.code = ii.serial
- JOIN cplusInvoiceType472 cit ON cit.id = ii.cplusInvoiceType472Fk
+ JOIN siiTypeInvoiceIn cit ON cit.id = ii.siiTypeInvoiceInFk
LEFT JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
LEFT JOIN sage.TiposTransacciones ttr ON ttr.CodigoTransaccion = iit.transactionTypeSageFk
- LEFT JOIN expence e ON e.id = iit.expenceFk
+ LEFT JOIN expense e ON e.id = iit.expenseFk
LEFT JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk
LEFT JOIN sage.taxType tt ON tt.id = ti.CodigoIva
WHERE ii.id = vSelf;
@@ -57988,7 +58287,7 @@ BEGIN
empresa_id)
SELECT vBookNumber ASIEN,
tii.bookEntried FECHA,
- IF(tii.isWithheld, LPAD(RIGHT(tii.supplierAccount, 5), 10, tii.expenceFk),tii.expenceFk) SUBCTA,
+ IF(tii.isWithheld, LPAD(RIGHT(tii.supplierAccount, 5), 10, tii.expenseFk),tii.expenseFk) SUBCTA,
tii.supplierAccount CONTRA,
IF(tii.isWithheld AND tii.taxableBase < 0, NULL, ROUND(SUM(tii.taxableBase),2)) EURODEBE,
IF(tii.isWithheld AND tii.taxableBase < 0, ROUND(SUM(-tii.taxableBase), 2), NULL) EUROHABER,
@@ -58003,7 +58302,7 @@ BEGIN
tii.companyFk empresa_id
FROM tInvoiceIn tii
WHERE tii.code IS NULL OR tii.code <> 'suplido'
- GROUP BY tii.expenceFk;
+ GROUP BY tii.expenseFk;
-- Líneas de IVA
INSERT INTO XDiario(
@@ -58037,11 +58336,11 @@ BEGIN
empresa_id)
SELECT vBookNumber ASIEN,
tii.bookEntried FECHA,
- IF(tii.expenceFkDeductible>0, tii.expenceFkDeductible, tii.CuentaIvaSoportado) SUBCTA,
+ IF(tii.expenseFkDeductible>0, tii.expenseFkDeductible, tii.CuentaIvaSoportado) SUBCTA,
tii.supplierAccount CONTRA,
SUM(ROUND(tii.PorcentajeIva * tii.taxableBase / 100, 2)) EURODEBE,
SUM(tii.taxableBase) BASEEURO,
- GROUP_CONCAT(DISTINCT tii.expenceName SEPARATOR ', ') CONCEPTO,
+ GROUP_CONCAT(DISTINCT tii.expenseName SEPARATOR ', ') CONCEPTO,
vSelf FACTURA,
tii.PorcentajeIva IVA,
IF(tii.isUeeMember AND eWithheld.id IS NULL, '', '*') AUXILIAR,
@@ -58053,10 +58352,10 @@ BEGIN
tii.supplierRef FACTURAEX,
TRUE L340,
(tii.isSameCountry OR NOT tii.isUeeMember) LRECT349,
- tii.cplusTrascendency472Fk TIPOCLAVE,
+ tii.siiTrascendencyInvoiceInFk TIPOCLAVE,
tii.cplusTaxBreakFk TIPOEXENCI,
tii.cplusSubjectOpFk TIPONOSUJE,
- tii.cplusInvoiceType472Fk TIPOFACT,
+ tii.siiTypeInvoiceInFk TIPOFACT,
tii.cplusRectificationTypeFk TIPORECTIF,
tii.cplusTerIdNifFk TERIDNIF,
tii.nif TERNIF,
@@ -58067,13 +58366,13 @@ BEGIN
LEFT JOIN (
SELECT e.id
FROM tInvoiceIn tii
- JOIN expence e ON e.id = tii.expenceFk
+ JOIN expense e ON e.id = tii.expenseFk
WHERE e.isWithheld
LIMIT 1
) eWithheld ON TRUE
WHERE tii.taxTypeSageFk IS NOT NULL
AND (tii.taxCode IS NULL OR tii.taxCode NOT IN ('import10', 'import21'))
- GROUP BY tii.PorcentajeIva, tii.expenceFk;
+ GROUP BY tii.PorcentajeIva, tii.expenseFk;
-- Línea iva inversor sujeto pasivo
INSERT INTO XDiario(
@@ -58110,7 +58409,7 @@ BEGIN
tii.supplierAccount CONTRA,
SUM(ROUND(tii.PorcentajeIva * tii.taxableBase / 100,2)) EUROHABER,
ROUND(SUM(tii.taxableBase),2) BASEEURO,
- GROUP_CONCAT(DISTINCT tii.expenceName SEPARATOR ', ') CONCEPTO,
+ GROUP_CONCAT(DISTINCT tii.expenseName SEPARATOR ', ') CONCEPTO,
vSelf FACTURA,
tii.PorcentajeIva IVA,
'*' AUXILIAR,
@@ -58125,7 +58424,7 @@ BEGIN
1 TIPOCLAVE,
tii.cplusTaxBreakFk TIPOEXENCI,
tii.cplusSubjectOpFk TIPONOSUJE,
- tii.cplusInvoiceType472Fk TIPOFACT,
+ tii.siiTypeInvoiceInFk TIPOFACT,
tii.cplusRectificationTypeFk TIPORECTIF,
tii.cplusTerIdNifFk TERIDNIF,
tii.nif TERNIF,
@@ -58138,7 +58437,7 @@ BEGIN
AND NOT(tii.isVies
AND c.nontaxableTransactionTypeFk = tii.transactionTypeSageFk
AND tii.taxCode = 'nonTaxable')
- GROUP BY tii.PorcentajeIva, tii.expenceFk;
+ GROUP BY tii.PorcentajeIva, tii.expenseFk;
-- Actualización del registro original
UPDATE invoiceIn ii
@@ -58211,14 +58510,14 @@ BEGIN
FROM ticket
WHERE refFk = vInvoiceRef;
- CALL invoiceExpenceMake(vInvoiceFk);
+ CALL invoiceExpenseMake(vInvoiceFk);
CALL invoiceTaxMake(vInvoiceFk,vTaxArea);
UPDATE invoiceOut io
JOIN (
SELECT SUM(amount) AS total
- FROM invoiceOutExpence
+ FROM invoiceOutExpense
WHERE invoiceOutFk = vInvoiceFk
) base
JOIN (
@@ -58254,7 +58553,7 @@ BEGIN
* param vInvoice factura_id
*/
DECLARE vBookNumber INT;
- DECLARE vExpenceConcept VARCHAR(50);
+ DECLARE vExpenseConcept VARCHAR(50);
DECLARE vSpainCountryFk INT;
DECLARE vOldBookNumber INT;
@@ -58285,10 +58584,10 @@ BEGIN
io.issued AS FECHA,
1 AS NFACTICK,
IF(ic.correctingFk,'D','') AS TIPOOPE,
- io.cplusTrascendency477Fk AS TIPOCLAVE,
+ io.siiTrascendencyInvoiceOutFk AS TIPOCLAVE,
io.cplusTaxBreakFk AS TIPOEXENCI,
io.cplusSubjectOpFk AS TIPONOSUJE,
- io.cplusInvoiceType477Fk AS TIPOFACT,
+ io.siiTypeInvoiceOutFk AS TIPOFACT,
ic.cplusRectificationTypeFk AS TIPORECTIF,
io.companyFk,
RIGHT(io.ref, LENGTH(io.ref) - 1) AS invoiceNum,
@@ -58346,7 +58645,7 @@ BEGIN
SELECT
vBookNumber AS ASIEN,
rs.FECHA,
- ioe.expenceFk AS SUBCTA,
+ ioe.expenseFk AS SUBCTA,
rs.clientBookingAccount AS CONTRA,
ioe.amount AS EUROHABER,
rs.Concept AS CONCEPTO,
@@ -58354,13 +58653,13 @@ BEGIN
rs.FECHA_OP,
rs.companyFk AS empresa_id
FROM rs
- JOIN invoiceOutExpence ioe
+ JOIN invoiceOutExpense ioe
WHERE ioe.invoiceOutFk = vInvoice;
SELECT GROUP_CONCAT(`name` SEPARATOR ',')
- INTO vExpenceConcept
- FROM expence e
- JOIN invoiceOutExpence ioe ON ioe.expenceFk = e.id
+ INTO vExpenseConcept
+ FROM expense e
+ JOIN invoiceOutExpense ioe ON ioe.expenseFk = e.id
WHERE ioe.invoiceOutFk = vInvoice;
-- Lineas de IVA
@@ -58403,7 +58702,7 @@ BEGIN
rs.clientBookingAccount AS CONTRA,
iot.vat AS EUROHABER,
iot.taxableBase AS BASEEURO,
- CONCAT(vExpenceConcept,' : ',rs.Concept) AS CONCEPTO,
+ CONCAT(vExpenseConcept,' : ',rs.Concept) AS CONCEPTO,
rs.invoiceNum AS FACTURA,
IF(pe2.equFk,0,pgc.rate) AS IVA,
IF(pe2.equFk,0,pgce.rate) AS RECEQUIV,
@@ -58421,7 +58720,7 @@ BEGIN
rs.TERNIF,
rs.TERNOM,
pgc.mod340 AS L340,
- pgc.cplusTrascendency477Fk AS TIPOCLAVE,
+ pgc.siiTrascendencyInvoiceOutFk AS TIPOCLAVE,
pgc.cplusTaxBreakFk as TIPOEXENCI,
rs.TIPONOSUJE,
rs.TIPOFACT,
@@ -58498,85 +58797,6 @@ BEGIN
SELECT CONCAT(vContador, ' total') AS FACTURAS_ASENTADAS;
-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 `invoiceOutDelete` */;
-/*!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 `invoiceOutDelete`(vRef VARCHAR(15))
-BEGIN
- DECLARE vAsien INTEGER;
- DECLARE vSendMail BOOL;
- DECLARE vBody TEXT;
-
- SELECT ASIEN INTO vAsien
- FROM XDiario
- WHERE SERIE = SUBSTRING(vRef, 1, 1)
- AND FACTURA = SUBSTRING(vRef, 2, LENGTH(vRef)-1)
- LIMIT 1;
-
- SELECT IF(enlazado OR enlazadoSage, TRUE, FALSE),
- CONCAT(
- '
-
FECHA
-
SUBCTA
-
CONTRA
-
CONCEPTO
-
EURODEBE
-
EUROHABER
-
',
- GROUP_CONCAT(
- CONCAT('
-
', IFNULL(FECHA,''), '
-
', IFNULL(SUBCTA,''), '
-
', IFNULL(CONTRA,''), '
-
', IFNULL(CONCEPTO,''), '
-
', IFNULL(EURODEBE,''), '
-
', IFNULL(EUROHABER,''), '
-
'
- ) SEPARATOR ' '
- ),
- '
'
- )
- INTO vSendMail, vBody
- FROM XDiario
- WHERE ASIEN = vAsien;
-
- DELETE FROM XDiario
- WHERE ASIEN = vAsien;
-
- IF vSendMail THEN
- CALL mail_insert(
- 'administracion@verdnatura.es',
- 'noreply@verdnatura.es',
- CONCAT('Eliminada factura ' ,vRef),
- CONCAT(
- '
-
Se ha eliminado el asiento ', vAsien, ' que estaba enlazado en SAGE/CONTAPLUS, vinculado a la factura ', vRef ,'
- ', vBody, '
'
- )
- );
- END IF;
-
- UPDATE ticket
- SET refFk = NULL
- WHERE refFk = vRef;
-
- DELETE
- FROM invoiceOut
- WHERE ref = vRef;
-
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -58625,7 +58845,7 @@ 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 `invoiceOutTaxAndExpence` */;
+/*!50003 DROP PROCEDURE IF EXISTS `invoiceOutTaxAndExpense` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -58633,7 +58853,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutTaxAndExpence`()
+CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutTaxAndExpense`()
BEGIN
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
@@ -58687,7 +58907,7 @@ BEGIN
FROM ticket
WHERE refFk = vInvoiceRef;
- CALL invoiceExpenceMake(vInvoice);
+ CALL invoiceExpenseMake(vInvoice);
CALL invoiceTaxMake(vInvoice,vCountry,vTaxArea);
FETCH rs INTO vInvoice ,vInvoiceRef;
@@ -58868,7 +59088,7 @@ BEGIN
clientFk,
dued,
companyFk,
- cplusInvoiceType477Fk
+ siiTypeInvoiceOutFk
)
SELECT
1,
@@ -58921,13 +59141,13 @@ BEGIN
INSERT INTO ticketTracking(stateFk,ticketFk,workerFk)
SELECT * FROM tmp.updateInter;
- CALL invoiceExpenceMake(vNewInvoiceId);
+ CALL invoiceExpenseMake(vNewInvoiceId);
CALL invoiceTaxMake(vNewInvoiceId,vTaxArea);
UPDATE invoiceOut io
JOIN (
SELECT SUM(amount) total
- FROM invoiceOutExpence
+ FROM invoiceOutExpense
WHERE invoiceOutFk = vNewInvoiceId
) base
JOIN (
@@ -58964,15 +59184,15 @@ BEGIN
SET @vTaxableBaseServices := 0.00;
SET @vTaxCodeGeneral := NULL;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
@vTaxableBaseServices,
- sub.expenceFk,
+ sub.expenseFk,
sub.taxTypeSageFk,
sub.transactionTypeSageFk
FROM (
SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase,
- i.expenceFk,
+ i.expenseFk,
i.taxTypeSageFk,
i.transactionTypeSageFk,
@vTaxCodeGeneral := i.taxClassCodeFk
@@ -58982,11 +59202,11 @@ BEGIN
HAVING taxableBase
) sub;
- INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk)
+ INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenseFk, taxTypeSageFk, transactionTypeSageFk)
SELECT vNewInvoiceInFk,
SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral,
@vTaxableBaseServices, 0) taxableBase,
- i.expenceFk,
+ i.expenseFk,
i.taxTypeSageFk ,
i.transactionTypeSageFk
FROM tmp.ticketTax tt
@@ -59233,46 +59453,6 @@ ELSE
INSERT INTO vn.itemBarcode(itemFk,code) VALUES (vItemFk,vCode);
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 `itemFreight_Show` */;
-/*!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 `itemFreight_Show`(vItemFk INT, vWarehouseFk INT)
-BEGIN
-
- SELECT cm3 Volumen_Entrada,
- cm3delivery Volumen_Salida,
- p.volume Volumen_del_embalaje,
- p.width Ancho_del_embalaje,
- p.`depth` Largo_del_embalaje,
- b.packageFk ,
- IFNULL(p.height, i.`size`) + 10 Altura,
- b.packing Packing_Entrada,
- i.packingOut Packing_Salida,
- i.id itemFk,
- b.id buyFk,
- b.entryFk,
- w.name warehouseFk
- FROM vn.itemCost ic
- JOIN vn.item i ON i.id = ic.itemFk
- LEFT JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk
- LEFT JOIN vn.buy b ON b.id = lb.buy_id
- LEFT JOIN vn.packaging p ON p.id = b.packageFk
- LEFT JOIN vn.warehouse w ON w.id = ic.warehouseFk
- WHERE ic.itemFk = vItemFk
- AND ic.warehouseFk = vWarehouseFk;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -59565,7 +59745,7 @@ BEGIN
AND ish.visible > 0
AND ish.itemFk = vItemFk
GROUP BY ish.id
- ORDER BY (sc.id = vSectorFk) DESC, sh.priority DESC;
+ ORDER BY (sc.id = vSectorFk) DESC, sh.priority DESC, ish.created, p.pickingOrder;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -59593,78 +59773,78 @@ BEGIN
* @param vShowType mostrar tipos
*/
- DECLARE vWarehouseFk INT;
- DECLARE vShipped DATE;
- DECLARE vCalcFk INT;
- DECLARE vTypeFk INT;
+ DECLARE vWarehouseFk INT;
+ DECLARE vShipped DATE;
+ DECLARE vCalcFk INT;
+ DECLARE vTypeFk INT;
+ DECLARE vTag1 VARCHAR(25);
+ DECLARE vTag5 VARCHAR(25);
+ DECLARE vTag6 VARCHAR(25);
+ DECLARE vTag7 VARCHAR(25);
+ DECLARE vTag8 VARCHAR(25);
- DECLARE vTag1 VARCHAR(25);
- DECLARE vTag5 VARCHAR(25);
- DECLARE vTag6 VARCHAR(25);
- DECLARE vTag7 VARCHAR(25);
- DECLARE vTag8 VARCHAR(25);
+ DECLARE vValue1 VARCHAR(50);
+ DECLARE vValue5 VARCHAR(50);
+ DECLARE vValue6 VARCHAR(50);
+ DECLARE vValue7 VARCHAR(50);
+ DECLARE vValue8 VARCHAR(50);
- DECLARE vValue1 VARCHAR(50);
- DECLARE vValue5 VARCHAR(50);
- DECLARE vValue6 VARCHAR(50);
- DECLARE vValue7 VARCHAR(50);
- DECLARE vValue8 VARCHAR(50);
+ SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped
+ FROM vn.ticket
+ WHERE id = vTicketFk;
- SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped
- FROM vn.ticket
- WHERE id = vTicketFk;
+ SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
+ INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
+ FROM vn.item i
+ LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
+ LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
+ WHERE i.id = vItemFk;
- SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
- INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
- FROM vn.item i
- LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
- LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
- WHERE i.id = vItemFk;
+ CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
- CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
-
- SELECT i.id itemFk,
- i.longName,
- i.subName,
- i.tag5,
- i.value5,
- (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5,
- i.tag6,
- i.value6,
- (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6,
- i.tag7,
- i.value7,
- (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7,
- i.tag8,
- i.value8,
- (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8,
- a.available,
- IFNULL(ip.counter,0) counter,
- IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity
- FROM vn.item i
- JOIN cache.available a ON a.item_id = i.id
- LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
- LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
- LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
+ SELECT i.id itemFk,
+ i.longName,
+ i.subName,
+ i.tag5,
+ i.value5,
+ (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5,
+ i.tag6,
+ i.value6,
+ (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6,
+ i.tag7,
+ i.value7,
+ (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7,
+ i.tag8,
+ i.value8,
+ (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8,
+ a.available,
+ IFNULL(ip.counter,0) counter,
+ IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity,
+ iss.visible located
+ FROM item i
+ JOIN cache.available a ON a.item_id = i.id
+ LEFT JOIN itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
+ LEFT JOIN itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
+ LEFT JOIN tag t1 ON t1.id = it1.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
- LEFT JOIN vn.buy b ON b.id = lb.buy_id
- WHERE a.calc_id = vCalcFk
- AND available > 0
- AND IF(vShowType,i.typeFk = vTypeFk,true)
- AND i.id != vItemFk
- ORDER BY counter DESC,
- (t1.name = vTag1 COLLATE utf8_general_ci) DESC,
- (it1.value = vValue1 COLLATE utf8_general_ci) DESC,
- (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC,
- (i.value6 = vValue6 COLLATE utf8_general_ci) DESC,
- (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC,
- (i.value5 = vValue5 COLLATE utf8_general_ci) DESC,
- (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC,
- (i.value7 = vValue7 COLLATE utf8_general_ci) DESC,
- (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC,
- (i.value8 = vValue8 COLLATE utf8_general_ci) DESC;
-
+ LEFT JOIN buy b ON b.id = lb.buy_id
+ LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id AND iss.warehouseFk = vWarehouseFk
+ WHERE a.calc_id = vCalcFk
+ AND available > 0
+ AND IF(vShowType,i.typeFk = vTypeFk,true)
+ AND i.id != vItemFk
+ ORDER BY counter DESC,
+ (t1.name = vTag1 COLLATE utf8_general_ci) DESC,
+ (it1.value = vValue1 COLLATE utf8_general_ci) DESC,
+ (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC,
+ (i.value5 = vValue5 COLLATE utf8_general_ci) DESC,
+ (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC,
+ (i.value6 = vValue6 COLLATE utf8_general_ci) DESC,
+ (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC,
+ (i.value7 = vValue7 COLLATE utf8_general_ci) DESC,
+ (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC,
+ (i.value8 = vValue8 COLLATE utf8_general_ci) DESC;
END ;;
DELIMITER ;
@@ -60042,14 +60222,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingMakeFromDate` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22))
BEGIN
@@ -60099,7 +60279,7 @@ BEGIN
vCreated,
IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) `grouping`,
IF(vPacking = 0, b.packing, vPacking) packing,
- IF(vPackagingFk = '', b.packageFk, vPackagingFk) packaging
+ IF(vPackagingFk = '', b.packagingFk, vPackagingFk) packaging
FROM vn.item i
LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
@@ -60287,7 +60467,6 @@ proc:BEGIN
WHERE s.warehouseFk = vWarehouseFk
AND s.isMain;
-
SELECT COUNT(*) INTO hasFatherSector
FROM vn.sector
WHERE sonFk = vSectorFk;
@@ -60302,52 +60481,49 @@ proc:BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar;
IF hasFatherSector THEN
-
CREATE TEMPORARY TABLE tmp.itemShelvingRadar
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
- SELECT * FROM (
- SELECT iss.itemFk,
- i.longName,
- i.size,
- i.subName producer,
- IFNULL(a.available,0) available,
- SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs,
- SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs,
- IF(it.isPackaging, null, IFNULL(v.visible,0)) as visible,
- vSectorFk as sectorFk
+ SELECT *
+ FROM (
+ SELECT iss.itemFk,
+ i.longName,
+ i.size,
+ i.subName producer,
+ IFNULL(a.available,0) available,
+ SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs,
+ SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs,
+ IF(it.isPackaging, NULL, IFNULL(v.visible,0)) as visible,
+ vSectorFk sectorFk
+ FROM vn.itemShelvingStock iss
+ JOIN vn.sector s ON s.id = iss.sectorFk
+ JOIN vn.item i on i.id = iss.itemFk
+ JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
+ LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
+ LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
+ WHERE vSectorFk IN (iss.sectorFk, s.sonFk)
+ GROUP BY iss.itemFk
- FROM vn.itemShelvingStock iss
- JOIN vn.sector s ON s.id = iss.sectorFk
- JOIN vn.item i on i.id = iss.itemFk
- JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
- LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
- LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
- WHERE vSectorFk IN (iss.sectorFk, s.sonFk)
- AND it.workerFk != 3366
+ UNION ALL
- GROUP BY iss.itemFk
-
- UNION ALL
-
- SELECT v.item_id,
- i.longName,
- i.size,
- i.subName producer,
- IFNULL(a.available,0) as available,
- 0 upstairs,
- 0 downstairs,
- IF(it.isPackaging, NULL, v.visible) visible,
- vSectorFk as sectorFk
- FROM cache.visible v
- JOIN vn.item i on i.id = v.item_id
- JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
- LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk
- LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk
- WHERE v.calc_id = vCalcVisibleFk
- AND iss.itemFk IS NULL
- AND it.isInventory
- ) sub GROUP BY itemFk;
+ SELECT v.item_id,
+ i.longName,
+ i.size,
+ i.subName producer,
+ IFNULL(a.available,0) as available,
+ 0 upstairs,
+ 0 downstairs,
+ IF(it.isPackaging, NULL, v.visible) visible,
+ vSectorFk as sectorFk
+ FROM cache.visible v
+ JOIN vn.item i on i.id = v.item_id
+ JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk)
+ LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk
+ LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk
+ WHERE v.calc_id = vCalcVisibleFk
+ AND iss.itemFk IS NULL
+ AND it.isInventory
+ ) sub GROUP BY itemFk;
SELECT ishr.*,
CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho,
@@ -60362,12 +60538,8 @@ proc:BEGIN
AND tst.alertLevel = 0
GROUP BY s.itemFk
) sub ON sub.itemFk = ishr.itemFk
- ORDER BY i.typeFk, i.longName
- ;
-
-
+ ORDER BY i.typeFk, i.longName;
ELSE
-
CREATE TEMPORARY TABLE tmp.itemShelvingRadar
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
@@ -60389,32 +60561,25 @@ proc:BEGIN
IFNULL(v.visible,0) visible,
b.isPickedOff,
iss.sectorFk
- FROM vn.itemShelvingStock iss
- JOIN vn.item i on i.id = iss.itemFk
- LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk
- LEFT JOIN vn.buy b ON b.id = lb.buy_id
- LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
- LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
- LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay
- FROM vn.itemPlacementSupplyList
- WHERE saldo > 0
- GROUP BY itemFk
- ) ips ON ips.itemFk = i.id
- WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk)
- OR iss.sectorFk = vSectorFk;
- /*
- UPDATE tmp.itemShelvingRadar isr
- JOIN vn.itemShelvingStock iss ON iss.itemFk = isr.itemFk
- SET isr.dayEndVisible = isr.dayEndVisible + iss.visible,
- isr.firstNegative = isr.firstNegative + iss.visible,
- isr.itemPlacementVisible = isr.itemPlacementVisible + iss.visible
- WHERE iss.sectorFk = vSonSectorFk;
- */
+ FROM vn.itemShelvingStock iss
+ JOIN vn.item i on i.id = iss.itemFk
+ LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk
+ LEFT JOIN vn.buy b ON b.id = lb.buy_id
+ LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk
+ LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk
+ LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay
+ FROM vn.itemPlacementSupplyList
+ WHERE saldo > 0
+ GROUP BY itemFk
+ ) ips ON ips.itemFk = i.id
+ WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk)
+ OR iss.sectorFk = vSectorFk;
+
DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime;
CREATE TEMPORARY TABLE tmp.itemOutTime
SELECT *,SUM(amount) quantity
FROM
- (SELECT item_id itemFk,
+ (SELECT item_id itemFk,
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
@@ -60444,15 +60609,19 @@ proc:BEGIN
firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity),
`hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0),
`minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0);
-/*
- UPDATE tmp.itemShelvingRadar
- SET itemPlacementVisible = 0,
- dayEndVisible = 0,
- firstNegative = 0
- WHERE itemPlacementVisible = - itemShelvingStock;
-*/
- SELECT * FROM tmp.itemShelvingRadar;
+ UPDATE tmp.itemShelvingRadar isr
+ JOIN (SELECT s.itemFk, sum(s.quantity) amount
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN ticketLastState tls ON tls.ticketFk = t.id
+ WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
+ AND tls.name = 'Prep Camara'
+ GROUP BY s.itemFk) sub ON sub.itemFk = isr.itemFk
+ SET isr.dayEndVisible = dayEndVisible + sub.amount,
+ firstNegative = firstNegative + sub.amount;
+
+ SELECT * FROM tmp.itemShelvingRadar;
END IF;
DROP TEMPORARY TABLE tmp.itemShelvingRadar;
@@ -60623,6 +60792,318 @@ 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 `itemShelvingSale_reserve` */;
+/*!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 `itemShelvingSale_reserve`()
+BEGIN
+/**
+ * Reserva cantidades con ubicaciones para un conjunto de sales del mismo
+ * almacen.
+ *
+ * @table tmp.sale(saleFk, userFk)
+ */
+ DECLARE vCalcFk INT;
+ DECLARE vWarehouseFk INT;
+ DECLARE vCurrentYear INT DEFAULT YEAR(util.VN_NOW());
+ DECLARE vLastPickingOrder INT;
+
+ SELECT t.warehouseFk, MAX(p.pickingOrder)
+ INTO vWarehouseFk, vLastPickingOrder
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN tmp.sale ts ON ts.saleFk = s.id
+ LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
+ LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
+ LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
+ LEFT JOIN parking p ON p.id = sh.parkingFk
+ WHERE t.warehouseFk IS NOT NULL;
+
+ IF vWarehouseFk IS NULL THEN
+ CALL util.throw('Warehouse not set');
+ END IF;
+
+ CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
+
+ SET @outstanding = 0;
+ SET @oldsaleFk = 0;
+
+ CREATE OR REPLACE TEMPORARY TABLE tSalePlacementQuantity
+ (INDEX(saleFk))
+ ENGINE = MEMORY
+ SELECT saleFk, userFk, quantityToReserve, itemShelvingFk
+ FROM( SELECT saleFk,
+ sub.userFk,
+ itemShelvingFk ,
+ IF(saleFk <> @oldsaleFk, @outstanding := quantity, @outstanding),
+ @qtr := LEAST(@outstanding, available) quantityToReserve,
+ @outStanding := @outStanding - @qtr,
+ @oldsaleFk := saleFk
+ FROM(
+ SELECT ts.saleFk,
+ ts.userFk,
+ s.quantity,
+ ish.id itemShelvingFk,
+ ish.visible - IFNULL(ishr.reservedQuantity, 0) available
+ FROM tmp.sale ts
+ JOIN sale s ON s.id = ts.saleFk
+ JOIN itemShelving ish ON ish.itemFk = s.itemFk
+ LEFT JOIN (
+ SELECT itemShelvingFk, SUM(quantity) reservedQuantity
+ FROM itemShelvingSale
+ WHERE NOT isPicked
+ GROUP BY itemShelvingFk) ishr ON ishr.itemShelvingFk = ish.id
+ JOIN shelving sh ON sh.code = ish.shelvingFk
+ JOIN parking p ON p.id = sh.parkingFk
+ JOIN sector sc ON sc.id = p.sectorFk
+ JOIN warehouse w ON w.id = sc.warehouseFk
+ JOIN productionConfig pc
+ WHERE w.id = vWarehouseFk
+ AND NOT sc.isHideForPickers
+ ORDER BY
+ s.id,
+ p.pickingOrder >= vLastPickingOrder,
+ sh.priority DESC,
+ ish.visible >= s.quantity DESC,
+ s.quantity MOD ish.grouping = 0 DESC,
+ ish.grouping DESC,
+ IF(pc.orderMode = 'Location', p.pickingOrder, ish.created)
+ )sub
+ )sub2
+ WHERE quantityToReserve > 0;
+
+ INSERT INTO itemShelvingSale(
+ itemShelvingFk,
+ saleFk,
+ quantity,
+ userFk)
+ SELECT itemShelvingFk,
+ saleFk,
+ quantityToReserve,
+ IFNULL(userFk, getUser())
+ FROM tSalePlacementQuantity spl;
+
+ DROP TEMPORARY TABLE tmp.sale;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSale_reserveByCollection` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_reserveByCollection`(
+ vCollectionFk INT(11)
+)
+BEGIN
+/**
+ * Reserva cantidades con ubicaciones para el contenido de una colección
+ *
+ * @param vCollectionFk Identificador de collection
+ */
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale
+ (INDEX(saleFk))
+ ENGINE = MEMORY
+ SELECT s.id saleFk, NULL userFk
+ FROM ticketCollection tc
+ JOIN sale s ON s.ticketFk = tc.ticketFk
+ LEFT JOIN (
+ SELECT DISTINCT saleFk
+ FROM saleTracking st
+ JOIN state s ON s.id = st.stateFk
+ WHERE st.isChecked
+ AND s.semaphore = 1)st ON st.saleFk = s.id
+ WHERE tc.collectionFk = vCollectionFk
+ AND st.saleFk IS NULL
+ AND NOT s.isPicked;
+
+ CALL itemShelvingSale_reserve();
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSale_reserveBySale` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_reserveBySale`(
+ vSelf INT ,
+ vQuantity INT,
+ vUserFk INT
+)
+BEGIN
+/**
+ * Reserva cantida y ubicación para una saleFk
+ *
+ * @param vSelf Identificador de la venta
+ * @param vQuantity Cantidad a reservar
+ * @param vUserFk Id de usuario que realiza la reserva
+ */
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale
+ ENGINE = MEMORY
+ SELECT vSelf saleFk, vUserFk userFk;
+
+ CALL itemShelvingSale_reserve();
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSale_setQuantity` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSale_setQuantity`(
+ vItemShelvingSaleFk INT(10),
+ vQuantity DECIMAL(10,0),
+ vIsItemShelvingSaleEmpty BOOLEAN
+)
+BEGIN
+/**
+ * Gestiona la reserva de un itemShelvingFk, actualizando isPicked y quantity
+ * en vn.itemShelvingSale y vn.sale.isPicked en caso necesario.
+ * Si la reserva de la ubicación es fallida, se regulariza la situación
+ *
+ * @param vItemShelvingSaleFk Id itemShelvingSaleFK
+ * @param vQuantity Cantidad real que se ha cogido de la ubicación
+ * @param vIsItemShelvingSaleEmpty determina si ka ubicación itemShelvingSale se ha
+ * quedado vacio tras el movimiento
+ */
+ DECLARE vSaleFk INT;
+ DECLARE vCursorSaleFk INT;
+ DECLARE vItemShelvingFk INT;
+ DECLARE vReservedQuantity INT;
+ DECLARE vRemainingQuantity INT;
+ DECLARE vItemFk INT;
+ DECLARE vUserFk INT;
+ DECLARE vDone BOOLEAN DEFAULT FALSE;
+ DECLARE vSales CURSOR FOR
+ SELECT iss.saleFk, iss.userFk
+ FROM itemShelvingSale iss
+ JOIN sale s ON s.id = iss.saleFk
+ WHERE iss.id = vItemShelvingSaleFk
+ AND s.itemFk = vItemFk
+ AND NOT iss.isPicked;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ IF (SELECT isPicked FROM itemShelvingSale WHERE id = vItemShelvingSaleFk) THEN
+ CALL util.throw('Booking completed');
+ END IF;
+
+ SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk
+ INTO vItemFk, vSaleFk, vItemShelvingFk
+ FROM itemShelvingSale iss
+ JOIN sale s ON s.id = iss.saleFk
+ WHERE iss.id = vItemShelvingSaleFk
+ AND NOT iss.isPicked;
+
+ UPDATE itemShelvingSale
+ SET isPicked = TRUE,
+ quantity = vQuantity
+ WHERE id = vItemShelvingSaleFk;
+
+ UPDATE itemShelving
+ SET visible = IF(vIsItemShelvingSaleEmpty, 0, GREATEST(0,visible - vQuantity))
+ WHERE id = vItemShelvingFk;
+
+ IF vIsItemShelvingSaleEmpty THEN
+ OPEN vSales;
+l: LOOP
+ SET vDone = FALSE;
+ FETCH vSales INTO vCursorSaleFk, vUserFk;
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.sale
+ (INDEX(saleFk, userFk))
+ ENGINE = MEMORY
+ SELECT vCursorSaleFk, vUserFk;
+
+ CALL itemShelvingSale_reserveWhitUser();
+ DROP TEMPORARY TABLE tmp.sale;
+
+ END LOOP;
+ CLOSE vSales;
+
+ DELETE iss
+ FROM itemShelvingSale iss
+ JOIN sale s ON s.id = iss.saleFk
+ WHERE iss.id = vItemShelvingSaleFk
+ AND s.itemFk = vItemFk
+ AND NOT iss.isPicked;
+ END IF;
+
+ SELECT SUM(quantity) INTO vRemainingQuantity
+ FROM itemShelvingSale
+ WHERE saleFk = vSaleFk
+ AND NOT isPicked;
+
+ IF vRemainingQuantity THEN
+ CALL itemShelvingSale_reserveBySale (vSaleFk, vRemainingQuantity, NULL);
+
+ SELECT SUM(quantity) INTO vRemainingQuantity
+ FROM itemShelvingSale
+ WHERE saleFk = vSaleFk
+ AND NOT isPicked;
+
+ IF NOT vRemainingQuantity <=> 0 THEN
+ SELECT SUM(iss.quantity)
+ INTO vReservedQuantity
+ FROM itemShelvingSale iss
+ WHERE iss.saleFk = vSaleFk;
+
+ CALL saleTracking_new(
+ vSaleFk,
+ TRUE,
+ vReservedQuantity,
+ `account`.`myUser_getId`(),
+ NULL,
+ 'PREPARED',
+ TRUE);
+
+ UPDATE sale s
+ SET s.quantity = vReservedQuantity
+ WHERE s.id = vSaleFk ;
+ END IF;
+ 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 `itemShelvingTransfer` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -60680,14 +61161,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemShelving_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 */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT)
BEGIN
@@ -60743,7 +61224,7 @@ BEGIN
vQuantity,
IFNULL(vGrouping, b.grouping),
IFNULL(vPacking, b.packing),
- IFNULL(vPackagingFk, b.packageFk)
+ IFNULL(vPackagingFk, b.packagingFk)
FROM item i
LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
@@ -60860,27 +61341,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 `itemShelving_BuyerGet` */;
-/*!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 `itemShelving_BuyerGet`( )
-BEGIN
-
- SELECT * FROM vn.buyer;
-
-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 `itemShelving_filterBuyer` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -61101,90 +61561,165 @@ DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getSaleDate`(vShelvingFk VARCHAR(3))
BEGIN
- /* Devuelve la minima fecha en que se necesita cada producto en esa matricula.
+ /* Devuelve la mínima fecha en que se necesita cada producto en esa matrícula.
*
* @param vShelvingFk Matrícula del carro o pallet
*/
DECLARE vWarehouseFk INT;
+ DECLARE vStockScopeDays INT;
- SELECT warehouseFk INTO vWarehouseFk
- FROM shelving s
- JOIN parking p ON s.parkingFk = p.id
- JOIN sector st ON st.id = p.sectorFk
- WHERE s.code = vShelvingFk COLLATE utf8_unicode_ci;
+ SELECT s.warehouseFk, stockScopeDays
+ INTO vWarehouseFk, vStockScopeDays
+ FROM sector s
+ JOIN operator o ON s.id = o.sectorFk
+ JOIN productionConfig pc
+ WHERE o.workerFk = account.myUser_getId();
- DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingDistinct;
- CREATE TEMPORARY TABLE tmp.itemShelvingDistinct
+ IF vWarehouseFk IS NULL
+ THEN CALL util.throw('WarehouseFk not setted');
+ END IF;
+
+ IF vStockScopeDays IS NULL
+ THEN CALL util.throw('StockScopeDays not setted');
+ END IF;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.tItems
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
- SELECT itemFk, SUM(visible) visible
- FROM vn.itemShelving
- WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
- GROUP BY itemFk;
+ SELECT itemFk, SUM(visible) visible
+ FROM itemShelving
+ WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
+ GROUP BY itemFk;
- DROP TEMPORARY TABLE IF EXISTS tmp.item;
- CREATE TEMPORARY TABLE tmp.item
- (PRIMARY KEY (itemFk))
- ENGINE = MEMORY
- SELECT * FROM tmp.itemShelvingDistinct;
+ CREATE OR REPLACE TEMPORARY TABLE tmp.tStockByDay
+ (INDEX (itemFk, dated))
+ ENGINE = MEMORY
+ SELECT dated,
+ SUM(t3.amount) OVER (PARTITION BY t3.itemFk ORDER BY dated) stock,
+ t3.itemFk
+ FROM (
+ SELECT t.itemFk, dated, SUM(amount) amount
+ FROM (
+ SELECT t2.itemFk, t2.amount, t2.dated
+ FROM (
+ SELECT item_id itemFk, amount, util.VN_CURDATE() dated
+ FROM cache.stock s
+ JOIN tmp.tItems i ON i.itemFk = s.item_id
+ WHERE s.warehouse_id = vWarehouseFk
+ UNION ALL
+ SELECT ish.itemFk, - SUM(ish.visible), util.VN_CURDATE()
+ FROM itemShelving ish
+ JOIN tmp.tItems i ON i.itemFk = ish.itemFk
+ JOIN shelving sh ON sh.code = ish.shelvingFk
+ JOIN parking p ON sh.parkingFk = p.id
+ JOIN sector s ON s.id = p.sectorFk
+ WHERE s.isReserve
+ GROUP BY ish.itemFk
+ UNION ALL
+ SELECT iei.itemFk, SUM(quantity), landed
+ FROM itemEntryIn iei
+ JOIN tmp.tItems i ON i.itemFk = iei.itemFk
+ WHERE iei.landed BETWEEN util.VN_CURDATE() AND util.VN_CURDATE() + INTERVAL vStockScopeDays DAY
+ AND iei.warehouseInFk = vWarehouseFk
+ AND NOT isVirtualStock
+ GROUP BY iei.itemFk, iei.landed
+ UNION ALL
+ SELECT ieo.itemFk, SUM(quantity), shipped
+ FROM itemEntryOut ieo
+ JOIN tmp.tItems i ON i.itemFk = ieo.itemFk
+ WHERE ieo.shipped BETWEEN util.VN_CURDATE() AND util.VN_CURDATE() + INTERVAL vStockScopeDays DAY
+ AND ieo.warehouseOutFk = vWarehouseFk
+ GROUP BY ieo.itemFk, ieo.shipped
+ UNION ALL
+ SELECT i.itemFk, SUM(ito.quantity), DATE(ito.shipped)
+ FROM itemTicketOut ito
+ JOIN tmp.tItems i ON i.itemFk = ito.itemFk
+ WHERE ito.shipped BETWEEN util.VN_CURDATE() AND util.VN_CURDATE() + INTERVAL vStockScopeDays DAY
+ AND ito.warehouseFk = vWarehouseFk
+ GROUP BY ito.itemFk, ito.shipped
+ ) t2
+ JOIN tmp.tItems i ON i.itemFk = t2.itemFk)t
+ GROUP BY t.itemFk, dated
+ ) t3;
- DROP TEMPORARY TABLE IF EXISTS tmp.stockByDay;
- CREATE TEMPORARY TABLE tmp.stockByDay
- (index (itemFk, dated))
- ENGINE = MEMORY
- SELECT t3.amount, dated,
- @stock := IF(@itemFk = t3.itemFk, @stock + t3.amount, t3.amount) stock,
- @itemFk := t3.itemFk itemFk
- FROM (
- SELECT * FROM (
- SELECT t2.* FROM (
- SELECT item_id itemFk, amount, util.VN_CURDATE() dated
- FROM cache.stock
- WHERE warehouse_id = vWarehouseFk
- UNION ALL
- SELECT ish.itemFk, - sum(visible), util.VN_CURDATE()
- FROM vn.itemShelving ish
+ -- Se restan las entradas de hoy
+ UPDATE tmp.tStockByDay sbd
+ JOIN (SELECT iei.itemFk, SUM(quantity) todayEntry
+ FROM itemEntryIn iei
+ JOIN tmp.tItems i ON i.itemFk = iei.itemFk
+ WHERE iei.landed = util.VN_CURDATE()
+ AND iei.warehouseInFk = vWarehouseFk
+ AND NOT iei.isVirtualStock) sub ON sub.itemFk = sbd.itemFk
+ SET sbd.stock = sbd.stock - sub.todayEntry
+ WHERE sbd.dated = util.VN_CURDATE();
+
+ -- Se añaden las lineas de venta servidas
+ UPDATE tmp.tStockByDay sbd
+ JOIN (SELECT s.itemFK, SUM(quantity) amount
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ WHERE t.warehouseFk = vWarehouseFk
+ AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight()
+ AND s.isPicked
+ GROUP BY s.itemFk) sub ON sub.itemFk = sbd.itemFk
+ SET sbd.stock = sbd.stock + sub.amount;
+
+ -- Se añaden los items ubicados hoy
+ UPDATE tmp.tStockByDay sbd
+ JOIN (SELECT ish.itemFK, SUM(ish.visible) amount
+ FROM itemShelving ish
JOIN shelving sh ON sh.code = ish.shelvingFk
- JOIN parking p ON sh.parkingFk = p.id
+ JOIN parking p ON p.id = sh.parkingFk
JOIN sector s ON s.id = p.sectorFk
- WHERE s.isReserve
- GROUP BY ish.itemFk
- UNION ALL
- SELECT item_id, sum(iei.amount), dat
- FROM vn2008.item_entry_in iei
- WHERE dat >= util.VN_CURDATE()
- AND warehouse_id = vWarehouseFk
- AND isVirtualStock = FALSE
- GROUP BY item_id, dat
- UNION ALL
- SELECT item_id, sum(ieo.amount), dat
- FROM vn2008.item_entry_out ieo
- WHERE dat >= util.VN_CURDATE()
- AND warehouse_id = vWarehouseFk
- GROUP BY item_id, dat
- UNION ALL
- SELECT i.itemFk, sum(io.amount), dat
- FROM vn2008.item_out io
- JOIN tmp.item i ON i.itemFk = io.item_id
- WHERE io.dat >= util.VN_CURDATE()
- AND io.warehouse_id = vWarehouseFk
- GROUP BY io.item_id, io.dat
- ) t2
- JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = t2.itemFk) t
- order by t.itemFk, DATE(t.dated), t.amount DESC) t3;
+ WHERE s.warehouseFk = vWarehouseFk
+ AND NOT s.isReserve
+ AND ish.created BETWEEN util.VN_CURDATE() AND util.midnight()
+ GROUP BY ish.itemFk) sub ON sub.itemFk = sbd.itemFk
+ SET sbd.stock = sbd.stock + sub.amount;
- SELECT sbd.itemFk, i.longName, DATE(dated) dated, ish.visible amount, sbd.stock
- FROM tmp.stockByDay sbd
- JOIN vn.item i ON i.id = sbd.itemFk
- JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = sbd.itemFk
- WHERE ish.visible >= sbd.stock
- GROUP BY itemFk
- ORDER BY dated;
+ SELECT ts.itemFk,
+ i.longName,
+ IF(ts.stock<=0, ts.dated, NULL) dated,
+ ts.stock,
+ sub4.visible,
+ sub4.shelvingFk
+ FROM(
+ SELECT IFNULL(sub2.minDated, sub.minDated) dated,
+ IFNULL(sub2.itemFk, sub.itemFk) itemFk
+ FROM(SELECT sbd.itemFk,
+ MIN(dated) minDated,
+ sbd.stock
+ FROM tmp.tItems ti
+ LEFT JOIN tmp.tStockByDay sbd ON sbd.itemFk = ti.itemFk
+ GROUP BY itemFk)sub
+ LEFT JOIN (
+ SELECT sbd.itemFk,
+ MIN(dated) minDated,
+ sbd.stock
+ FROM tmp.tItems ti
+ LEFT JOIN tmp.tStockByDay sbd ON sbd.itemFk = ti.itemFk
+ WHERE sbd.stock <= 0
+ GROUP BY itemFk)sub2 ON sub2.itemFk =sub.itemFk
+ WHERE sub2.itemFk IS NOT NULL
+ OR (sub2.itemFk IS NULL AND sub.itemFk IS NOT NULL)) sub3
+ LEFT JOIN tmp.tStockByDay ts ON ts.itemFk = sub3.itemFk AND ts.dated = sub3.dated
+ JOIN (SELECT ish.itemFk,
+ ish.visible,
+ p.sectorFk,
+ ish.shelvingFk
+ FROM itemShelving ish
+ JOIN vn.shelving sh ON sh.code = ish.shelvingFk
+ LEFT JOIN parking p ON p.id = parkingFk
+ LEFT JOIN vn.sector s ON s.id = p.sectorFk
+ WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci
+ ) sub4 ON sub4.itemFk = ts.itemFk
+ LEFT JOIN sector s ON s.id = sub4.sectorFk
+ LEFT JOIN item i ON i.id = ts.itemFk
+ WHERE NOT s.isReserve;
+
+ DROP TEMPORARY TABLE tmp.tStockByDay, tmp.tItems;
- DROP TEMPORARY TABLE tmp.stockByDay,
- tmp.itemShelvingDistinct,
- tmp.item;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -62072,8 +62607,7 @@ BEGIN
* @table tmp.itemCalc(itemFk, wareHouseFk, dated, quantity)
* @return tmp.itemAtp(itemFk, warehouseFk, quantity)
*/
- DROP TEMPORARY TABLE IF EXISTS tItemOrdered;
- CREATE TEMPORARY TABLE tItemOrdered
+ CREATE OR REPLACE TEMPORARY TABLE tItemOrdered
(UNIQUE(itemFk, warehouseFk, dated))
ENGINE = MEMORY
SELECT itemFk, warehouseFk, dated, SUM(quantity) quantity
@@ -62091,8 +62625,8 @@ BEGIN
SET @lastWareHouseFk := 0;
SET @lastQuantity := 0;
- DROP TEMPORARY TABLE IF EXISTS tmp.itemAtp;
- CREATE TEMPORARY TABLE tmp.itemAtp
+ CREATE OR REPLACE TEMPORARY TABLE tmp.itemAtp
+ (INDEX (itemFk, wareHouseFk))
SELECT itemFk, wareHouseFk, MIN(quantityAccumulated) quantity
FROM (
SELECT
@@ -62458,6 +62992,7 @@ BEGIN
CALL `cache`.stock_refresh(vForce);
CALL item_getMinacum(NULL, util.VN_CURDATE(), vDays, NULL);
CALL item_getMinETD();
+ CALL item_zoneClosure();
SELECT i.id itemFk,
i.longName,
@@ -62468,7 +63003,8 @@ BEGIN
w.name warehouse,
SUM(IFNULL(sub.amount,0)) lack,
i.inkFk,
- IFNULL(im.timed, util.midnight()) timed
+ IFNULL(im.timed, util.midnight()) timed,
+ IFNULL(izc.timed, util.midnight()) minTimed
FROM (SELECT item_id,
warehouse_id,
amount
@@ -62486,14 +63022,16 @@ BEGIN
JOIN itemType it ON it.id = i.typeFk
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
WHERE w.isForTicket
- AND ic.display <> 0
+ AND ic.display
AND it.code != 'GEN'
GROUP BY i.id, w.id
HAVING lack < 0;
DROP TEMPORARY TABLE tmp.itemMinacum;
DROP TEMPORARY TABLE tmp.itemMinETD;
+ DROP TEMPORARY TABLE tmp.itemZoneClosure;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -62916,7 +63454,7 @@ BEGIN
),
i.subname = JSON_VALUE(vValues, '$.4'),
i.size = JSON_VALUE(vOverwrites, '$.size'),
- i.stems = JSON_VALUE(vOverwrites, '$.stems'),
+ i.stems = IFNULL(JSON_VALUE(vOverwrites, '$.stems'),i.stems),
i.category = JSON_VALUE(vOverwrites, '$.category'),
i.tag5 = JSON_VALUE(vTags, '$.5'),
i.tag6 = JSON_VALUE(vTags, '$.6'),
@@ -63086,6 +63624,97 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `item_setVisibleDiscard` */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setVisibleDiscard`(
+ vItemFk INT,
+ vWarehouseFk INT,
+ vQuantity INT,
+ vAddressFk INT)
+BEGIN
+/**
+ * Procedimiento para dar dar de baja/alta un item, si vAddressFk es NULL se entiende que se da de alta y se toma el addressFk de la configuración
+ *
+ * @param vItemFk Identificador del ítem
+ * @param vWarehouseFk id del warehouse
+ * @param vQuantity a dar de alta/baja
+ * @param vAddressFk id address
+ */
+ DECLARE vTicketFk INT;
+ DECLARE vClientFk INT;
+ DECLARE vDefaultCompanyFk INT;
+ DECLARE vCalc INT;
+ DECLARE vAddressShortage INT;
+
+ SELECT barcodeToItem(vItemFk) INTO vItemFk;
+
+ SELECT DEFAULT(companyFk) INTO vDefaultCompanyFk
+ FROM vn.ticket LIMIT 1;
+
+ IF vAddressFk IS NULL THEN
+ SELECT pc.shortageAddressFk INTO vAddressShortage
+ FROM productionConfig pc ;
+ ELSE
+ SET vAddressShortage = vAddressFk;
+ END IF;
+
+ SELECT a.clientFk INTO vClientFk
+ FROM address a
+ WHERE a.id = vAddressFk;
+
+ SELECT t.id INTO vTicketFk
+ FROM ticket t
+ JOIN address a ON a.id = t.addressFk
+ JOIN ticketState ts ON ts.ticketFk = t.id
+ WHERE t.warehouseFk = vWarehouseFk
+ AND a.id = vAddressShortage
+ AND DATE(t.shipped) = util.VN_CURDATE()
+ AND ts.code = 'DELIVERED'
+ LIMIT 1;
+
+ CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk);
+
+ IF vTicketFk IS NULL THEN
+ CALL ticket_add(
+ vClientFk,
+ util.VN_CURDATE(),
+ vWarehouseFk,
+ vDefaultCompanyFk,
+ vAddressFk,
+ NULL,
+ NULL,
+ util.VN_CURDATE(),
+ account.myUser_getId(),
+ FALSE,
+ vTicketFk);
+ END IF;
+
+ INSERT INTO sale(ticketFk, itemFk, concept, quantity)
+ SELECT vTicketFk,
+ vItemFk,
+ CONCAT(longName,' ', worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)),
+ vQuantity
+ FROM item
+ WHERE id = vItemFk;
+
+ UPDATE cache.visible
+ SET visible = visible - vQuantity
+ WHERE calc_id = vCalc
+ AND item_id = vItemFk;
+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_updatePackingShelve` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
@@ -63158,6 +63787,10 @@ BEGIN
DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE;
DECLARE vInventoried2 DATE;
DECLARE vDateDayEnd DATETIME;
+ DECLARE vInventorySupplierFk INT;
+
+ SELECT inventorySupplierFk INTO vInventorySupplierFk
+ FROM entryConfig;
SET vDateDayEnd = util.dayEnd(vDated);
@@ -63165,7 +63798,7 @@ BEGIN
FROM travel tr
JOIN entry E ON E.travelFk = tr.id
WHERE landed <= vDateDayEnd
- AND E.supplierFk = 4
+ AND E.supplierFk = vInventorySupplierFk
ORDER BY landed DESC
LIMIT 1;
@@ -63177,7 +63810,7 @@ BEGIN
FROM travel tr
JOIN entry E ON E.travelFk = tr.id
WHERE landed >= vDated
- AND E.supplierFk = 4
+ AND E.supplierFk = vInventorySupplierFk
ORDER BY landed ASC
LIMIT 1;
@@ -63209,7 +63842,7 @@ BEGIN
JOIN itemType t ON t.id = i.typeFk
JOIN warehouse w ON w.id = warehouseInFk
WHERE landed = vDateDayEnd
- AND e.supplierFk = 4
+ AND e.supplierFk = vInventorySupplierFk
AND w.valuatedInventory
AND t.isInventory
GROUP BY tr.warehouseInFk, b.itemFk;
@@ -63217,19 +63850,24 @@ BEGIN
END IF;
INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen)
- SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name`
- FROM buy b
- JOIN item i ON i.id = b.itemFk
- JOIN entry e ON e.id = b.entryFk
- JOIN travel tr ON tr.id = e.travelFk
- JOIN itemType t ON t.id = i.typeFk
- JOIN warehouse w ON w.id = tr.warehouseInFk
- WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
- AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, trUE)
- AND NOT e.isRaid
- AND w.valuatedInventory
- AND t.isInventory
- ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1));
+ SELECT tr.warehouseInFk,
+ b.itemFk,
+ b.quantity * IF(vHasNotInventory,-1,1),
+ w.`name`
+ FROM buy b
+ JOIN item i ON i.id = b.itemFk
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel tr ON tr.id = e.travelFk
+ JOIN itemType t ON t.id = i.typeFk
+ JOIN warehouse w ON w.id = tr.warehouseInFk
+ WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
+ AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, trUE)
+ AND NOT e.isRaid
+ AND w.valuatedInventory
+ AND t.isInventory
+ AND e.supplierFk <> vInventorySupplierFk
+ ON DUPLICATE KEY UPDATE inv.cantidad =
+ inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1));
INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen)
SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name`
@@ -63348,6 +63986,44 @@ 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_zoneClosure` */;
+/*!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_zoneClosure`()
+BEGIN
+
+/* Devuelve una tabla temporal con la hora minima de un ticket sino tiene el de la zoneClosure y
+ * si tampoco hay el de la zona , para todos los artículos con salida hoy.
+ *
+ * @return tmp.itemZoneClosure(itemFk, timed)
+ */
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.itemZoneClosure
+ (INDEX (itemFk))
+ ENGINE = MEMORY
+ SELECT s.itemFk,
+ MIN(DATE_FORMAT(IF(HOUR(t.shipped),t.shipped,
+ IFNULL(zc.hour, z.HOUR)), '%H:%i')
+ )timed
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ LEFT JOIN `zone` z ON z.id = t.zoneFk
+ LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
+ WHERE t.shipped BETWEEN util.VN_CURDATE() AND CONCAT(util.VN_CURDATE(), ' 23:59:59')
+ GROUP BY s.itemFk;
+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 `ledger_doCompensation` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -63848,74 +64524,244 @@ DELIMITER ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `manaSpellersRequery`(vWorkerFk INTEGER)
+`whole_proc`:
BEGIN
/**
- * Recalcula el mana consumido por un trabajador
+ * Guarda en workerMana el mana consumido por un trabajador
*
* @param vWorkerFk Id Trabajador
*/
DECLARE vWorkerIsExcluded BOOLEAN;
- DECLARE vFromDated DATE;
- DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,util.VN_CURDATE());
- DECLARE vMana INT;
- DECLARE vAutoMana INT;
- DECLARE vClaimMana INT;
- DECLARE vManaBank INT;
- DECLARE vManaGreugeType INT;
SELECT COUNT(*) INTO vWorkerIsExcluded
FROM workerManaExcluded
WHERE workerFk = vWorkerFk;
- IF NOT vWorkerIsExcluded THEN
- SELECT id INTO vMana
- FROM `component` WHERE code = 'mana';
-
- SELECT id INTO vAutoMana
- FROM `component` WHERE code = 'autoMana';
-
- SELECT id INTO vClaimMana
- FROM `component` WHERE code = 'manaClaim';
-
- SELECT id INTO vManaBank
- FROM `bank` WHERE code = 'mana';
-
- SELECT id INTO vManaGreugeType
- FROM `greugeType` WHERE code = 'mana';
-
- SELECT max(dated) INTO vFromDated
- FROM clientManaCache;
-
- REPLACE workerMana (workerFk, amount)
- SELECT vWorkerFk, sum(mana) FROM
- (
- SELECT s.quantity * sc.value as mana
- FROM ticket t
- JOIN address a ON a.id = t.addressFk
- JOIN client c ON c.id = a.clientFk
- JOIN sale s ON s.ticketFk = t.id
- JOIN saleComponent sc ON sc.saleFk = s.id
- WHERE c.salesPersonFk = vWorkerFk AND sc.componentFk IN (vMana, vAutoMana, vClaimMana)
- AND t.shipped > vFromDated AND t.shipped < vToDated
- UNION ALL
- SELECT - r.amountPaid
- FROM receipt r
- JOIN client c ON c.id = r.clientFk
- WHERE c.salesPersonFk = vWorkerFk AND bankFk = vManaBank
- AND payed > vFromDated
- UNION ALL
- SELECT g.amount
- FROM greuge g
- JOIN client c ON c.id = g.clientFk
- WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType
- AND g.shipped > vFromDated and g.shipped < util.VN_CURDATE()
- UNION ALL
- SELECT cc.mana
- FROM clientManaCache cc
- JOIN client c ON c.id = cc.clientFk
- WHERE c.salesPersonFk = vWorkerFk AND cc.dated = vFromDated
- ) sub;
+ IF vWorkerIsExcluded THEN
+ LEAVE whole_proc;
END IF;
+
+ CREATE OR REPLACE TEMPORARY TABLE tmp.client
+ SELECT id
+ FROM client
+ WHERE salesPersonFk = vWorkerFk;
+
+ CALL client_getMana();
+
+ INSERT INTO workerMana (workerFk, amount)
+ SELECT vWorkerFk, sum(mana)
+ FROM tmp.clientMana
+ ON DUPLICATE KEY UPDATE amount = VALUES(amount);
+
+ DROP TEMPORARY TABLE
+ tmp.client,
+ tmp.clientMana;
+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 `multipleInventory` */;
+/*!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 `multipleInventory`(
+ vDate DATE,
+ vWarehouseFk TINYINT,
+ vMaxDays TINYINT
+)
+proc: BEGIN
+ DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY;
+ DECLARE vDateFrom DATE DEFAULT vDate;
+ DECLARE vDateTo DATETIME;
+ DECLARE vDateToTomorrow DATETIME;
+ DECLARE vDefaultDayRange INT;
+
+ IF vDate < util.VN_CURDATE() THEN
+ LEAVE proc;
+ END IF;
+
+ IF vDate = util.VN_CURDATE() THEN
+ SELECT inventoried INTO vDateFrom
+ FROM config;
+ END IF;
+
+ SELECT defaultDayRange INTO vDefaultDayRange
+ FROM comparativeConfig;
+
+ SET vDateTo = vDate + INTERVAL IFNULL(vMaxDays, vDefaultDayRange) DAY;
+ SET vDateToTomorrow = vDateTo + INTERVAL 1 DAY;
+
+ ALTER TABLE vn2008.article_inventory
+ ADD `avalaible` INT NOT NULL,
+ ADD `sd` INT NOT NULL,
+ ADD `rest` INT NOT NULL,
+ ADD `expected` INT NOT NULL,
+ ADD `inventory` INT NOT NULL,
+ ADD `visible` INT NOT NULL,
+ ADD `life` TINYINT NOT NULL DEFAULT '0';
+
+ -- Calculo del inventario
+ UPDATE vn2008.article_inventory ai
+ JOIN (
+ SELECT itemFk Id_Article, SUM(quantity) Subtotal
+ FROM (
+ SELECT s.itemFk, - s.quantity quantity
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN warehouse w ON w.id = t.warehouseFk
+ WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
+ AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
+ AND w.isComparative
+ UNION ALL
+ SELECT b.itemFk, b.quantity
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseInFk
+ WHERE t.landed BETWEEN vDateFrom AND util.dayEnd(vDate)
+ AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
+ AND w.isComparative
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ UNION ALL
+ SELECT b.itemFk, - b.quantity
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseOutFk
+ WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDate)
+ AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
+ AND w.isComparative
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ ) sub2
+ GROUP BY itemFk
+ ) sub ON ai.article_id = sub.Id_Article
+ SET ai.inventory = sub.Subtotal,
+ ai.visible = sub.Subtotal,
+ ai.avalaible = sub.Subtotal,
+ ai.sd = sub.Subtotal;
+
+ -- Cálculo del visible
+ UPDATE vn2008.article_inventory ai
+ JOIN (
+ SELECT itemFk Id_Article, SUM(quantity) Subtotal
+ FROM (
+ SELECT s.itemFk, s.quantity
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN warehouse w ON w.id = t.warehouseFk
+ WHERE t.shipped >= vDate
+ AND t.shipped < vDateTomorrow
+ AND (NOT isPicked AND NOT t.isLabeled AND t.refFk IS NULL)
+ AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
+ AND w.isComparative
+ UNION ALL
+ SELECT b.itemFk, - b.quantity
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseInFk
+ WHERE t.landed = vDate
+ AND NOT t.isReceived
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
+ AND w.isComparative
+ UNION ALL
+ SELECT b.itemFk, b.quantity
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseOutFk
+ WHERE t.shipped = vDate
+ AND NOT t.isReceived
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
+ AND w.isComparative
+ ) sub2
+ GROUP BY itemFk
+ ) sub ON ai.article_id = sub.Id_Article
+ SET ai.visible = ai.visible + sub.Subtotal;
+
+ -- Calculo del disponible
+ CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
+ (INDEX (itemFk, warehouseFk))
+ ENGINE = MEMORY
+ SELECT sub.itemFk,
+ vWarehouseFk warehouseFk,
+ sub.dated,
+ SUM(sub.quantity) quantity
+ FROM (
+ SELECT s.itemFk,
+ DATE(t.shipped) dated,
+ - s.quantity quantity
+ FROM sale s
+ JOIN ticket t ON t.id = s.ticketFk
+ JOIN warehouse w ON w.id = t.warehouseFk
+ WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
+ AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
+ AND w.isComparative
+ UNION ALL
+ SELECT b.itemFk, t.landed, b.quantity
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseInFk
+ WHERE t.landed BETWEEN vDateTomorrow AND vDateTo
+ AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
+ AND w.isComparative
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ UNION ALL
+ SELECT b.itemFk, t.shipped, - b.quantity
+ FROM buy b
+ JOIN entry e ON e.id = b.entryFk
+ JOIN travel t ON t.id = e.travelFk
+ JOIN warehouse w ON w.id = t.warehouseOutFk
+ WHERE t.shipped BETWEEN vDateTomorrow AND vDateTo
+ AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
+ AND w.isComparative
+ AND NOT e.isExcludedFromAvailable
+ AND NOT e.isRaid
+ ) sub
+ GROUP BY sub.itemFk, sub.dated;
+
+ CALL item_getAtp(vDate);
+ CALL vn2008.item_travel(vWarehouseFk, vDate);
+ UPDATE vn2008.article_inventory ai
+ JOIN (
+ SELECT it.itemFk,
+ SUM(it.quantity) quantity,
+ im.quantity minQuantity
+ FROM tmp.itemCalc it
+ JOIN tmp.itemAtp im ON im.itemFk = it.itemFk
+ JOIN item i ON i.id = it.itemFk
+ LEFT JOIN origin o ON o.id = i.originFk
+ LEFT JOIN vn2008.item_travel t ON t.wh = o.warehouseFk
+ WHERE it.dated < IF(vMaxDays < 0 AND t.landing IS NOT NULL,
+ t.landing,
+ vDateToTomorrow)
+ GROUP BY it.itemFk
+ ) sub ON sub.itemFk = ai.article_id
+ SET ai.avalaible = IF(sub.minQuantity > 0,
+ ai.avalaible,
+ ai.avalaible + sub.minQuantity),
+ ai.sd = ai.inventory + sub.quantity;
+
+ DROP TEMPORARY TABLE
+ vn2008.item_travel,
+ tmp.itemCalc,
+ tmp.itemAtp;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -64885,15 +65731,15 @@ proc: BEGIN
DECLARE vEndingDate DATETIME;
DECLARE vIsTodayRelative BOOLEAN;
- SELECT TIMESTAMPADD(DAY, LEAST(vScopeDays, pc.maxProductionScopeDays), util.dayEnd(util.VN_CURDATE()))
+ SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
INTO vEndingDate
- FROM productionConfig pc;
+ FROM productionConfig;
SELECT isTodayRelative INTO vIsTodayRelative
FROM worker
- WHERE id = getUser();
+ WHERE id = getUser(); -- Cambiar por account.myUser_getId(), falta dar permisos
- CALL prepareTicketList( util.VN_CURDATE() - INTERVAL 1 DAY, vEndingDate);
+ CALL prepareTicketList(util.yesterday(), vEndingDate);
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
SELECT * FROM tmp.productionTicket;
@@ -64962,7 +65808,7 @@ proc: BEGIN
JOIN agency ag ON ag.id = am.agencyFk
LEFT JOIN ticketState tls ON tls.ticket = tt.ticketFk
LEFT JOIN ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk
- LEFT JOIN worker w on w.id = tls.worker
+ LEFT JOIN worker w ON w.id = tls.worker
LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN `zone` z ON z.id = t.zoneFk
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
@@ -65022,31 +65868,33 @@ proc: BEGIN
FROM tmp.productionTicket tt
JOIN saleVolume sv ON sv.ticketFk = tt.ticketFk
GROUP BY tt.ticketFk
- ) m on m.ticketFk = pb.ticketFk
+ ) m ON m.ticketFk = pb.ticketFk
SET pb.`lines` = m.`lines`,
pb.m3 = m.m3,
pb.preparationRate = m.rate;
DELETE FROM tmp.productionBuffer
- WHERE `lines`= 0;
+ WHERE NOT `lines`;
-- Lineas por linea de encajado
UPDATE tmp.productionBuffer pb
- JOIN ( SELECT ticketFk,
+ JOIN (
+ SELECT ticketFk,
SUM(sub.H) H,
SUM(sub.V) V,
SUM(sub.N) N
FROM (
- SELECT t.ticketFk,
+ SELECT t.ticketFk,
SUM(i.itemPackingTypeFk = 'H') H,
SUM(i.itemPackingTypeFk = 'V') V,
SUM(i.itemPackingTypeFk IS NULL) N
FROM tmp.productionTicket t
JOIN sale s ON s.ticketFk = t.ticketFk
JOIN item i ON i.id = s.itemFk
- GROUP BY t.ticketFk, i.itemPackingTypeFk) sub
+ GROUP BY t.ticketFk, i.itemPackingTypeFk
+ ) sub
GROUP BY ticketFk
- ) sub2 ON sub2.ticketFk = pb.ticketFk
+ ) sub2 ON sub2.ticketFk = pb.ticketFk
SET pb.H = sub2.H,
pb.V = sub2.V,
pb.N = sub2.N;
@@ -65070,15 +65918,30 @@ proc: BEGIN
-- Insertamos todos los tickets que tienen productos parkineados
-- en sectores de previa, segun el sector
+ CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock
+ (PRIMARY KEY(itemFk, sectorFk))
+ ENGINE = MEMORY
+ SELECT ish.itemFk,
+ p.sectorFk,
+ sc.isPreviousPrepared,
+ sc.itemPackingTypeFk
+ FROM itemShelving ish
+ JOIN shelving sh ON sh.code = ish.shelvingFk
+ JOIN parking p ON p.id = sh.parkingFk
+ JOIN sector sc ON sc.id = p.sectorFk
+ WHERE p.sectorFk
+ AND ish.visible
+ GROUP BY ish.itemFk, p.sectorFk;
+
INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount)
SELECT pb.ticketFk, COUNT(DISTINCT s.id)
FROM tmp.productionBuffer pb
JOIN sale s ON s.ticketFk = pb.ticketFk
- JOIN itemShelvingStock iss ON iss.itemFk = s.itemFk
+ JOIN tItemShelvingStock iss ON iss.itemFk = s.itemFk
JOIN sector sc ON sc.id = iss.sectorFk
JOIN item i ON i.id = iss.itemFk
WHERE iss.isPreviousPrepared
- AND (sc.itemPackingTypeFk IS NULL
+ AND (sc.itemPackingTypeFk IS NULL
OR (i.itemPackingTypeFk IS NULL AND NOT pb.V)
OR sc.itemPackingTypeFk = i.itemPackingTypeFk)
AND s.quantity > 0
@@ -65086,14 +65949,16 @@ proc: BEGIN
-- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado
UPDATE tmp.ticketWithPrevia twp
- JOIN ( SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
- FROM tmp.productionBuffer pb
- JOIN sale s ON s.ticketFk = pb.ticketFk
- JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
- JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
- WHERE sg.parkingFk IS NOT NULL
- AND s.quantity > 0
- GROUP BY pb.ticketFk) sub ON twp.ticketFk = sub.ticketFk
+ JOIN (
+ SELECT pb.ticketFk, COUNT(DISTINCT s.id) salesInParkingCount
+ FROM tmp.productionBuffer pb
+ JOIN sale s ON s.ticketFk = pb.ticketFk
+ JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
+ JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
+ WHERE sg.parkingFk IS NOT NULL
+ AND s.quantity > 0
+ GROUP BY pb.ticketFk
+ ) sub ON twp.ticketFk = sub.ticketFk
SET twp.salesInParkingCount = sub.salesInParkingCount;
-- Marcamos como pendientes aquellos que no coinciden las cantidades
@@ -65102,11 +65967,244 @@ proc: BEGIN
SET pb.previousWithoutParking = TRUE
WHERE twp.salesCount > twp.salesInParkingCount;
- DROP TEMPORARY TABLE tmp.productionTicket;
- DROP TEMPORARY TABLE tmp.ticket;
- DROP TEMPORARY TABLE tmp.risk;
- DROP TEMPORARY TABLE tmp.ticket_problems;
- DROP TEMPORARY TABLE tmp.ticketWithPrevia;
+ DROP TEMPORARY TABLE
+ tmp.productionTicket,
+ tmp.ticket,
+ tmp.risk,
+ tmp.ticket_problems,
+ tmp.ticketWithPrevia,
+ tItemShelvingStock;
+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 `productionError_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 `productionError_add`()
+BEGIN
+ DECLARE vDatedFrom DATETIME;
+ DECLARE vDatedTo DATETIME;
+/**
+ * Rellena la tabla vn.productionError con estadisticas de encajadores, revisores y sacadores. Se ejecuta en el nightTask
+ */
+ SELECT util.VN_CURDATE() - INTERVAL 1 DAY, util.dayend(util.VN_CURDATE() - INTERVAL 1 DAY) INTO vDatedFrom, vDatedTo;
+ CALL timeControl_calculateAll(vDatedFrom, vDatedTo);
+
+ -- Rellena la tabla tmp.errorsByClaim con encajadores, revisores y sacadores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.errorsByClaim
+ ENGINE = MEMORY
+ SELECT COUNT(c.ticketFk) errors,
+ cd.workerFk
+ FROM claimDevelopment cd
+ JOIN claim c ON cd.claimFk = c.id
+ JOIN ticket t ON c.ticketFk = t.id
+ JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ AND cr.code IN ('pic', 'chk', 'pck')
+ GROUP BY cd.workerFk;
+
+ -- Genera la tabla tmp.volume con encajadores, sacadores y revisores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.volume
+ ENGINE = MEMORY
+ SELECT SUM(w.volume) volume,
+ w.workerFk
+ FROM bs.workerProductivity w
+ WHERE w.dated BETWEEN vDatedFrom AND vDatedTo
+ GROUP BY w.workerFk;
+
+ -- Rellena la tabla tmp.errorsByChecker con fallos de revisores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.errorsByChecker
+ ENGINE = MEMORY
+ SELECT st.workerFk,
+ COUNT(t.id) errors
+ FROM saleMistake sm
+ JOIN saleTracking st ON sm.saleFk = st.saleFk
+ JOIN `state` s2 ON s2.id = st.stateFk
+ JOIN sale s ON s.id = sm.saleFk
+ JOIN ticket t on t.id = s.ticketFk
+ WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
+ AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
+ GROUP BY st.workerFk;
+
+ -- Rellena la tabla tmp.expeditionErrors con fallos de expediciones
+ CREATE OR REPLACE TEMPORARY TABLE tmp.expeditionErrors
+ ENGINE = MEMORY
+ SELECT COUNT(t.id) errors,
+ e.workerFk
+ FROM vn.expeditionMistake pm
+ JOIN vn.expedition e ON e.id = pm.expeditionFk
+ JOIN vn.ticket t ON t.id = e.ticketFk
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ GROUP BY e.workerFk;
+
+ -- Genera la tabla tmp.total para sacadores y revisores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.total
+ ENGINE = MEMORY
+ SELECT st.workerFk,
+ COUNT(DISTINCT t.id) ticketCount,
+ COUNT(s.id) lineCount
+ FROM saleTracking st
+ JOIN `state` s2 ON s2.id = st.stateFk
+ JOIN sale s ON s.id = st.saleFk
+ JOIN ticket t ON s.ticketFk = t.id
+ WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo)
+ AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED')
+ GROUP BY st.workerFk;
+
+ -- Rellena la tabla vn.productionError con sacadores
+ INSERT INTO productionError(userFk,
+ firstname,
+ lastname,
+ rol,
+ ticketNumber,
+ lineNumber,
+ error,
+ volume,
+ hourStart,
+ hourEnd,
+ hourWorked,
+ dated)
+ SELECT w.id,
+ w.firstName,
+ w.lastName,
+ "Sacadores",
+ t.ticketCount totalTickets,
+ t.lineCount,
+ IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) errors,
+ v.volume volume,
+ SUBSTRING(tc.tableTimed, 1, 5) hourStart,
+ SUBSTRING(tc.tableTimed, LENGTH(tc.tableTimed)-4, 5) hourEnd,
+ IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked,
+ vDatedFrom dated
+ FROM tmp.total t
+ LEFT JOIN worker w ON w.id = t.workerFk
+ LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk
+ LEFT JOIN tmp.errorsByClaim ec ON ec.workerFk = t.workerFk
+ LEFT JOIN tmp.volume v ON v.workerFk = t.workerFk
+ LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = t.workerFk
+ JOIN (SELECT DISTINCT w.id -- Verificamos que son sacadores
+ FROM vn.collection c
+ JOIN vn.state s ON s.id = c.stateFk
+ JOIN vn.train tn ON tn.id = c.trainFk
+ JOIN vn.worker w ON w.id = c.workerFk
+ WHERE c.created BETWEEN vDatedFrom AND vDatedTo) sub ON sub.id = w.id
+ GROUP BY w.id;
+
+ CREATE OR REPLACE TEMPORARY TABLE itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores
+ ENGINE = MEMORY
+ SELECT COUNT(c.ticketFk) errors,
+ tt.workerFk
+ FROM claimDevelopment cd
+ JOIN claim c ON cd.claimFk = c.id
+ JOIN ticket t ON c.ticketFk = t.id
+ JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id
+ JOIN ticketTracking tt ON tt.ticketFk = t.id
+ JOIN `state` s ON s.id = tt.stateFk
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ AND cr.code = 'chk'
+ AND s.code = 'ON_PREPARATION'
+ GROUP BY workerFk;
+
+ UPDATE productionError ep
+ JOIN itemPickerErrors ipe ON ipe.workerFk = ep.userFk
+ SET ep.error = ep.error + ipe.errors
+ WHERE vDatedFrom = ep.dated AND ep.rol = 'Sacadores';
+
+ DROP TEMPORARY TABLE itemPickerErrors;
+
+ -- Rellena la tabla vn.productionError con revisores
+ CALL productionError_addCheckerPackager(vDatedFrom, vDatedTo, "Revisadores");
+
+ -- Genera la tabla tmp.total para encajadores
+ CREATE OR REPLACE TEMPORARY TABLE tmp.total
+ ENGINE = MEMORY
+ SELECT e.workerFk,
+ COUNT(DISTINCT t.id) ticketCount,
+ COUNT(s.id) lineCount
+ FROM expedition e
+ JOIN ticket t ON e.ticketFk = t.id
+ JOIN sale s ON s.ticketFk = t.id
+ WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
+ GROUP BY e.workerFk;
+
+ -- Rellena la tabla vn.productionError con encajadores
+ CALL productionError_addCheckerPackager(vDatedFrom, vDatedTo, "Encajadores");
+
+ DROP TEMPORARY TABLE tmp.errorsByClaim,
+ tmp.volume,
+ tmp.errorsByChecker,
+ tmp.expeditionErrors,
+ tmp.total;
+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 `productionError_addCheckerPackager` */;
+/*!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 `productionError_addCheckerPackager`(
+ vDatedFrom DATETIME,
+ vDatedTo DATETIME,
+ vRol VARCHAR(50))
+BEGIN
+/**
+ * Rellena la tabla vn.productionError con rol
+ *
+ * @param vDatedFrom Fecha desde
+ * @param vDatedTo Fecha hasta
+ * @param vRol rol a insertar
+ */
+ INSERT INTO productionError(userFk,
+ firstname,
+ lastname,
+ rol,
+ ticketNumber,
+ lineNumber,
+ error,
+ volume,
+ hourStart,
+ hourEnd,
+ hourWorked,
+ dated)
+ SELECT w.id,
+ w.firstName,
+ w.lastName,
+ vRol,
+ t.ticketCount totalTickets,
+ t.lineCount,
+ IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) + IFNULL(pe.errors,0) errors,
+ NULL volume,
+ SUBSTRING(tc.tableTimed, 1, 5) hourStart,
+ SUBSTRING(tc.tableTimed, LENGTH(tc.tableTimed)-4, 5) hourEnd,
+ IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked,
+ vDatedFrom dated
+ FROM tmp.total t
+ LEFT JOIN worker w ON w.id = t.workerFk
+ LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk
+ LEFT JOIN tmp.errorsByClaim ec ON ec.workerFk = t.workerFk
+ LEFT JOIN tmp.volume v ON v.workerFk = t.workerFk
+ LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = t.workerFk
+ LEFT JOIN tmp.expeditionErrors pe ON pe.workerFk = t.workerFk
+ GROUP BY w.id;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -66079,6 +67177,40 @@ 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 `route_checkDeliveryMethod` */;
+/*!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 `route_checkDeliveryMethod`(vSelf INT)
+BEGIN
+/**
+* Comprueba si el deliveryMethod del agencyMode de la ruta es reparto
+*
+* @param vSelf Id de ruta
+*/
+ DECLARE vDeliveryMethod VARCHAR(45);
+
+ SELECT dm.code INTO vDeliveryMethod
+ FROM route r
+ JOIN agencyMode am ON am.id = r.agencyModeFk
+ JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
+ WHERE r.id = vSelf;
+
+ IF vDeliveryMethod <> 'DELIVERY' THEN
+ CALL util.throw('Route tickets via delivery only');
+ 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 `route_doRecalc` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -66157,63 +67289,66 @@ BEGIN
* @param vRouteFk
* @select Información de los tickets
*/
-SELECT *
- FROM (
- SELECT t.id Id,
- t.clientFk Client,
- a.id Address,
- a.nickname ClientName,
- t.packages Packages,
- a.street AddressName,
- a.postalCode PostalCode,
- a.city City,
- sub2.itemPackingTypeFk PackingType,
- c.phone ClientPhone,
- c.mobile ClientMobile,
- a.phone AddressPhone,
- a.mobile AddressMobile,
- d.longitude Longitude,
- d.latitude Latitude,
- wm.mediaValue SalePersonPhone,
- tob.description Note,
- t.isSigned Signed,
- t.priority,
- t.cmrFk
- FROM ticket t
- JOIN client c ON t.clientFk = c.id
- JOIN address a ON t.addressFk = a.id
- LEFT JOIN delivery d ON d.ticketFk = t.id
- LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk
- LEFT JOIN(
- SELECT tob.description, t.id
- FROM ticketObservation tob
- JOIN ticket t ON tob.ticketFk = t.id
- JOIN observationType ot ON ot.id = tob.observationTypeFk
- WHERE t.routeFk = vRouteFk
- AND ot.code = 'delivery'
- )tob ON tob.id = t.id
- LEFT JOIN(
- SELECT sub.ticketFk,
- CONCAT('(',
- GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk
- ORDER BY sub.items DESC SEPARATOR ','),
- ') ') itemPackingTypeFk
- FROM (
- SELECT s.ticketFk, i.itemPackingTypeFk, COUNT(*) items
- FROM ticket t
- JOIN sale s ON s.ticketFk = t.id
- JOIN item i ON i.id = s.itemFk
- WHERE t.routeFk = vRouteFk
- GROUP BY t.id, i.itemPackingTypeFk
- )sub
- GROUP BY sub.ticketFk
- )sub2 ON sub2.ticketFk = t.id
- WHERE t.routeFk = vRouteFk
- ORDER BY d.id DESC
- LIMIT 10000000000000000000
- )sub3
- GROUP BY sub3.id
- ORDER BY sub3.priority;
+SELECT t.id Id,
+ t.clientFk Client,
+ a.id Address,
+ a.nickname ClientName,
+ t.packages Packages,
+ a.street AddressName,
+ a.postalCode PostalCode,
+ a.city City,
+ sub3.itemPackingTypeFk PackingType,
+ c.phone ClientPhone,
+ c.mobile ClientMobile,
+ a.phone AddressPhone,
+ a.mobile AddressMobile,
+ d.longitude Longitude,
+ d.latitude Latitude,
+ wm.mediaValue SalePersonPhone,
+ tob.description Note,
+ t.isSigned Signed,
+ t.priority,
+ t.cmrFk
+ FROM ticket t
+ JOIN client c ON t.clientFk = c.id
+ JOIN address a ON t.addressFk = a.id
+ LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk
+ LEFT JOIN (
+ SELECT t.addressFk, MAX(d.ticketFk) lastTicketFk
+ FROM ticket t
+ JOIN delivery d ON t.id = d.ticketFk
+ JOIN ticket ti ON ti.routeFk = vRouteFk
+ AND ti.id = t.id
+ AND ti.clientFk = t.clientFk
+ GROUP BY addressFk
+ )sub ON sub.addressFk = a.id
+ LEFT JOIN delivery d ON d.ticketFk = sub.lastTicketFk
+ LEFT JOIN(
+ SELECT t.id ticketFk, tob.description
+ FROM ticketObservation tob
+ JOIN ticket t ON tob.ticketFk = t.id
+ JOIN observationType ot ON ot.id = tob.observationTypeFk
+ WHERE t.routeFk = vRouteFk
+ AND ot.code = 'delivery'
+ )tob ON tob.ticketFk = t.id
+ LEFT JOIN(
+ SELECT sub2.ticketFk,
+ CONCAT('(',
+ GROUP_CONCAT(DISTINCT sub2.itemPackingTypeFk
+ ORDER BY sub2.items DESC SEPARATOR ','),
+ ') ') itemPackingTypeFk
+ FROM (
+ SELECT s.ticketFk, i.itemPackingTypeFk, COUNT(*) items
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ WHERE t.routeFk = vRouteFk
+ GROUP BY t.id, i.itemPackingTypeFk
+ )sub2
+ GROUP BY sub2.ticketFk
+ )sub3 ON sub3.ticketFk = t.id
+ WHERE t.routeFk = vRouteFk
+ ORDER BY priority, Id;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -66426,6 +67561,62 @@ 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 `saleSplit` */;
+/*!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 `saleSplit`(vSaleFk INT, vQuantity INT)
+BEGIN
+
+
+ DECLARE vNewSaleFk INT;
+
+ INSERT INTO vn.sale(itemFk,
+ concept,
+ price,
+ discount,
+ quantity,
+ ticketFk,
+ isPriceFixed)
+ SELECT s.itemFk,
+ i.longName,
+ s.price,
+ s.discount,
+ vQuantity,
+ s.ticketFk,
+ s.isPriceFixed
+ FROM vn.sale s
+ JOIN vn.item i ON i.id = s.itemFk
+ WHERE s.id = vSaleFk;
+
+ UPDATE vn.sale s
+ JOIN vn.item i ON i.id = s.itemFk
+ SET s.quantity = s.quantity - vQuantity, s.concept = i.longName
+ WHERE s.id = vSaleFk;
+
+ SELECT LAST_INSERT_ID() INTO vNewSaleFk;
+
+ INSERT INTO vn.saleComponent( saleFk,
+ componentFk,
+ value)
+ SELECT vNewSaleFk,
+ componentFk,
+ value
+ FROM vn.saleComponent
+ WHERE saleFk = vSaleFk;
+
+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 `sales_merge` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -67016,19 +68207,19 @@ BEGIN
DECLARE vComponentCount INT;
DECLARE vCursor CURSOR FOR
- SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), date(tt.shipped))
+ SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), DATE(tt.shipped))
FROM tmp.sale_getProblems tt
WHERE DATE(tt.shipped) BETWEEN util.VN_CURDATE()
- AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), util.VN_CURDATE());
+ AND util.VN_CURDATE() + INTERVAL IF(vIsTodayRelative, 9.9, 1.9) DAY;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DELETE tt.*
FROM tmp.sale_getProblems tt
- JOIN vn.ticketObservation tto ON tto.ticketFk = tt.ticketFk
- JOIN vn.observationType ot ON ot.id = tto.observationTypeFk
- WHERE ot.code = 'administrative'
- AND tto.description = 'Miriam';
+ JOIN ticketObservation tto ON tto.ticketFk = tt.ticketFk
+ JOIN observationType ot ON ot.id = tto.observationTypeFk
+ WHERE ot.code = 'administrative'
+ AND tto.description = 'Miriam';
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_problems (
ticketFk INT(11),
@@ -67050,38 +68241,41 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket_list
(PRIMARY KEY (ticketFk))
ENGINE = MEMORY
- SELECT tp.ticketFk, tp.clientFk
- FROM tmp.sale_getProblems tp;
+ SELECT ticketFk, clientFk
+ FROM tmp.sale_getProblems;
SELECT COUNT(*) INTO vComponentCount
- FROM vn.component c
- WHERE c.isRequired;
+ FROM component
+ WHERE isRequired;
-- Too Little
INSERT INTO tmp.sale_problems(ticketFk, isTooLittle)
SELECT tp.ticketFk, TRUE
FROM tmp.sale_getProblems tp
- JOIN vn.ticket t ON t.id = tp.ticketFk
- JOIN (SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat
+ JOIN ticket t ON t.id = tp.ticketFk
+ JOIN (
+ SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat
FROM tmp.ticket_list tl
- JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk
- JOIN vn.ticket t ON t.id = tl.ticketFk
- JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = util.VN_CURDATE()
- JOIN vn.agencyMode am ON am.id = t.agencyModeFk
- JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk
- WHERE util.VN_NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),util.VN_CURDATE()))
- AND dm.code IN('AGENCY','DELIVERY','PICKUP')
+ JOIN saleVolume sv ON sv.ticketFk = tl.ticketFk
+ JOIN ticket t ON t.id = tl.ticketFk
+ JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ AND zc.dated = util.VN_CURDATE()
+ JOIN agencyMode am ON am.id = t.agencyModeFk
+ JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
+ WHERE util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE
+ AND dm.code IN ('AGENCY','DELIVERY','PICKUP')
AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight()
- GROUP BY t.addressFk) sub ON sub.addressFk = t.addressFk
- JOIN vn.volumeConfig vc
+ GROUP BY t.addressFk
+ ) sub ON sub.addressFk = t.addressFk
+ JOIN volumeConfig vc
WHERE sub.litros < vc.minTicketVolume
- AND sub.totalWithoutVat < vc.minTicketValue;
+ AND sub.totalWithoutVat < vc.minTicketValue;
-- Faltan componentes
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)
- SELECT sub.ticketFk, sub.hasComponentLack, sub.saleFk
- FROM(
- SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)) hasComponentLack, s.id saleFk
+ SELECT ticketFk, (vComponentCount > nComp) hasComponentLack, saleFk
+ FROM (
+ SELECT COUNT(s.id) nComp, tl.ticketFk, s.id saleFk
FROM tmp.ticket_list tl
JOIN vn.sale s ON s.ticketFk = tl.ticketFk
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
@@ -67089,17 +68283,17 @@ BEGIN
JOIN vn.ticket t ON t.id = tl.ticketFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk
- WHERE dm.code IN('AGENCY','DELIVERY','PICKUP')
+ WHERE dm.code IN ('AGENCY','DELIVERY','PICKUP')
AND s.quantity > 0
GROUP BY s.id
- LIMIT 10000000000000000) sub
- WHERE sub.hasComponentLack;
+ ) sub
+ HAVING hasComponentLack;
-- Cliente congelado
INSERT INTO tmp.sale_problems(ticketFk, isFreezed)
SELECT DISTINCT tl.ticketFk, TRUE
FROM tmp.ticket_list tl
- JOIN vn.client c ON c.id = tl.clientFk
+ JOIN client c ON c.id = tl.clientFk
WHERE c.isFreezed
ON DUPLICATE KEY UPDATE isFreezed = c.isFreezed;
@@ -67107,21 +68301,21 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.clientGetDebt
(PRIMARY KEY (clientFk))
ENGINE = MEMORY
- SELECT DISTINCT clientFk
- FROM tmp.ticket_list;
+ SELECT DISTINCT clientFk
+ FROM tmp.ticket_list;
CALL client_getDebt(util.VN_CURDATE());
INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk)
SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10)
FROM tmp.ticket_list tl
- JOIN vn.ticket t ON t.id = tl.ticketFk
- JOIN vn.agencyMode a ON t.agencyModeFk = a.id
+ JOIN ticket t ON t.id = tl.ticketFk
+ JOIN agencyMode a ON t.agencyModeFk = a.id
JOIN tmp.risk r ON r.clientFk = t.clientFk
- JOIN vn.client c ON c.id = t.clientFk
- JOIN vn.clientConfig cc
+ JOIN client c ON c.id = t.clientFk
+ JOIN clientConfig cc
WHERE r.risk > c.credit + 10
- AND a.isRiskFree = FALSE
+ AND NOT a.isRiskFree
ON DUPLICATE KEY UPDATE
risk = r.risk, hasHighRisk = ((r.risk - cc.riskTolerance) > c.credit + 10);
@@ -67129,13 +68323,12 @@ BEGIN
INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest)
SELECT DISTINCT tl.ticketFk, TRUE
FROM tmp.ticket_list tl
- JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk
+ JOIN ticketRequest tr ON tr.ticketFk = tl.ticketFk
WHERE tr.isOK IS NULL
ON DUPLICATE KEY UPDATE hasTicketRequest = TRUE;
-- Disponible, Faltas, Inventario y Retrasos
OPEN vCursor;
-
l: LOOP
SET vDone = FALSE;
FETCH vCursor INTO vWarehouseFk, vDate;
@@ -67157,21 +68350,21 @@ BEGIN
LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem,
s.id AS saleFk
FROM tmp.ticket_list tl
- JOIN vn.ticket t ON t.id = tl.ticketFk
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemType it on it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
+ JOIN ticket t ON t.id = tl.ticketFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it on it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache
LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
- LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
+ LEFT JOIN itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
WHERE IFNULL(v.visible,0) < s.quantity
AND IFNULL(av.available ,0) < s.quantity
AND IFNULL(issw.visible, 0) < s.quantity
- AND s.isPicked = FALSE
- AND s.reserved = FALSE
- AND ic.merchandise = TRUE
- AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
+ AND NOT s.isPicked
+ AND NOT s.reserved
+ AND ic.merchandise
+ AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
AND NOT i.generic
AND util.VN_CURDATE() = vDate
AND t.warehouseFk = vWarehouseFk
@@ -67184,24 +68377,25 @@ BEGIN
FROM (
SELECT tl.ticketFk, LEFT(GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk
FROM tmp.ticket_list tl
- JOIN vn.ticket t ON t.id = tl.ticketFk
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemType it on it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
+ JOIN ticket t ON t.id = tl.ticketFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it on it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache
- LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
+ LEFT JOIN itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
WHERE IFNULL(v.visible,0) >= s.quantity
AND IFNULL(issw.visible, 0) < s.quantity
AND s.quantity > 0
- AND s.isPicked = FALSE
- AND s.reserved = FALSE
- AND ic.merchandise = TRUE
- AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
+ AND NOT s.isPicked
+ AND NOT s.reserved
+ AND ic.merchandise
+ AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
AND NOT i.generic
AND util.VN_CURDATE() = vDate
AND t.warehouseFk = vWarehouseFk
- GROUP BY tl.ticketFk) sub
+ GROUP BY tl.ticketFk
+ ) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
-- Retraso: Disponible suficiente, pero no visible ni ubicado
@@ -67210,26 +68404,27 @@ BEGIN
FROM (
SELECT tl.ticketFk, LEFT(GROUP_CONCAT('R: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk
FROM tmp.ticket_list tl
- JOIN vn.ticket t ON t.id = tl.ticketFk
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemType it on it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
+ JOIN ticket t ON t.id = tl.ticketFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it on it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache
LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
- LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
- WHERE IFNULL(v.visible,0) < s.quantity
- AND IFNULL(av.available ,0) >= s.quantity
+ LEFT JOIN itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
+ WHERE IFNULL(v.visible, 0) < s.quantity
+ AND IFNULL(av.available, 0) >= s.quantity
AND IFNULL(issw.visible, 0) < s.quantity
AND s.quantity > 0
- AND s.isPicked = FALSE
- AND s.reserved = FALSE
- AND ic.merchandise = TRUE
- AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
+ AND NOT s.isPicked
+ AND NOT s.reserved
+ AND ic.merchandise
+ AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
AND NOT i.generic
AND util.VN_CURDATE() = vDate
AND t.warehouseFk = vWarehouseFk
- GROUP BY tl.ticketFk) sub
+ GROUP BY tl.ticketFk
+ ) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
@@ -67237,11 +68432,10 @@ BEGIN
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
SELECT ticketFk, problem, saleFk
FROM (
- SELECT
- tl.ticketFk,
- s.id saleFk ,
- LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem,
- MOD(s.quantity, b.`grouping`) hasRounding
+ SELECT tl.ticketFk,
+ s.id saleFk ,
+ LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem,
+ MOD(s.quantity, b.`grouping`) hasRounding
FROM tmp.ticket_list tl
JOIN ticket t ON t.id = tl.ticketFk
AND t.warehouseFk = vWarehouseFk
@@ -67254,14 +68448,13 @@ BEGIN
) sub
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
END LOOP;
-
CLOSE vCursor;
INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked)
SELECT DISTINCT tl.ticketFk, FALSE
FROM tmp.ticket_list tl
- JOIN vn.client c ON c.id = tl.clientFk
- WHERE c.isTaxDataChecked = FALSE
+ JOIN client c ON c.id = tl.clientFk
+ WHERE NOT c.isTaxDataChecked
ON DUPLICATE KEY UPDATE isTaxDataChecked = FALSE;
DROP TEMPORARY TABLE
@@ -67982,30 +69175,36 @@ DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_clean`()
BEGIN
- DELETE FROM vn.shelving
+ DELETE FROM shelving
WHERE length(code) > 3
AND parked < TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
- DELETE FROM vn.itemShelving
+ DELETE FROM itemShelving
WHERE visible <= 0
AND created < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE());
DELETE ish.*
- FROM vn.itemShelving ish
+ FROM itemShelving ish
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
WHERE sh.parkingFk IS NULL
AND ish.created < TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
- UPDATE vn.shelving sh
- LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code`
+UPDATE shelving sh
+ LEFT JOIN itemShelving its ON its.shelvingFk = sh.`code`
SET isPrinted = 0,
- parkingFk = NULL
- WHERE its.id IS NULL
- AND sh.isRecyclable
- AND ( sh.parked IS NULL
- OR
- sh.parked < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())
- );
+ parkingFk = NULL
+ WHERE its.id IS NULL
+ AND sh.isRecyclable
+ AND (
+ sh.parked IS NULL
+ OR
+ sh.parked < TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())
+ )
+ AND IF(code REGEXP '^[A-Za-z]{2}[0-9]', LEFT (code, 2) NOT IN (
+ SELECT DISTINCT LEFT(its.shelvingFk, 2)
+ FROM itemShelving its
+ WHERE its.shelvingFk REGEXP '^[A-Za-z]{2}[0-9]'
+ ), TRUE);
END ;;
DELIMITER ;
@@ -68213,58 +69412,86 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `stockBuyedByWorker` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyedByWorker`(
- vDate DATE,
- vWorker INT)
+ vDated DATE,
+ vWorker INT
+)
BEGIN
/**
- * Calculates the space reserved by buyers of the same container
+ * Inserta el volumen de compra de un comprador
+ * en stockBuyed de acuerdo con la fecha.
*
- * @param vdate date of container delivery
- * @param vWorker buyer reserving space in the container
+ * @param vDated Fecha de compra
+ * @param vWorker Id de trabajador
*/
- DECLARE vVolume DECIMAL(10, 2);
- DECLARE vWarehouseFk INT;
- DECLARE vCompressionRatio DECIMAL(1, 1);
+ CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
+ (INDEX (userFk))
+ ENGINE = MEMORY
+ SELECT requested, reserved, userFk
+ FROM stockBuyed
+ WHERE dated = vDated
+ AND userFk = vWorker;
- CALL stockTraslation(vDate);
+ DELETE FROM stockBuyed
+ WHERE dated = vDated
+ AND userFk = vWorker;
- SELECT warehouseFk, conversionCoefficient INTO vWarehouseFk, vCompressionRatio
- FROM auctionConfig;
+ CALL stockTraslation(vDated);
- SELECT volume INTO vVolume
- FROM vn.packaging WHERE id = 'cc';
+ INSERT INTO stockBuyed(userFk, buyed, `dated`, reserved, requested, description)
+ SELECT it.workerFk,
+ SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
+ vDated,
+ sb.reserved,
+ sb.requested,
+ u.name
+ FROM itemType it
+ JOIN item i ON i.typeFk = it.id
+ LEFT JOIN tmp.item ti ON ti.itemFk = i.id
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ JOIN warehouse wh ON wh.code = 'VNH'
+ JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
+ AND bu.warehouseFk = wh.id
+ JOIN buy b ON b.id = bu.buyFk
+ JOIN volumeConfig vc
+ JOIN account.`user` u ON u.id = it.workerFk
+ LEFT JOIN tStockBuyed sb ON sb.userFk = it.workerFk
+ WHERE ic.display
+ AND it.workerFk = vWorker;
SELECT b.entryFk Id_Entrada,
i.id Id_Article,
i.name Article,
- ti.amount Cantidad,
- (vCompressionRatio * (ti.amount / b.packing) * vn.buy_getVolume(b.id))
- / vVolume buyed,
- b.packageFk id_cubo,
+ ti.quantity Cantidad,
+ (ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
+ / (vc.trolleyM3 * 1000000) buyed,
+ b.packagingFk id_cubo,
b.packing
FROM tmp.item ti
- JOIN item i ON i.id = ti.item_id
+ JOIN item i ON i.id = ti.itemFk
JOIN itemType it ON i.typeFk = it.id
JOIN itemCategory ic ON ic.id = it.categoryFk
JOIN worker w ON w.id = it.workerFk
+ JOIN auctionConfig ac
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
- AND bu.warehouseFk = vWarehouseFk
+ AND bu.warehouseFk = ac.warehouseFk
JOIN buy b ON b.id = bu.buyFk
- WHERE ic.display AND w.id = vWorker;
+ JOIN volumeConfig vc
+ WHERE ic.display
+ AND w.id = vWorker;
- DROP TEMPORARY TABLE
- tmp.buyUltimate,
- tmp.item;
+ DROP TEMPORARY TABLE tmp.buyUltimate,
+ tmp.item,
+ tStockBuyed;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -68281,51 +69508,59 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(vDated DATE)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(
+ vDated DATE
+)
BEGIN
/**
- * Inserta el volumen de compra por comprador en stockBuyed de acuerdo con la fecha
+ * Inserta el volumen de compra por comprador
+ * en stockBuyed de acuerdo con la fecha.
*
* @param vDated Fecha de compra
*/
-
- CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
+ CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
(INDEX (userFk))
ENGINE = MEMORY
SELECT requested, reserved, userFk
FROM stockBuyed
WHERE dated = vDated;
+ DELETE FROM stockBuyed WHERE dated = vDated;
+
CALL stockTraslation(vDated);
INSERT INTO stockBuyed(userFk, buyed, `dated`, description)
- SELECT it.workerFk,
- SUM(( ti.amount / b.packing ) * buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed,
+ SELECT it.workerFk,
+ SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
vDated,
u.name
- FROM tmp.item ti
- JOIN item i ON i.id = ti.item_id
- JOIN itemType it ON it.id = i.typeFk
+ FROM itemType it
+ JOIN item i ON i.typeFk = it.id
+ LEFT JOIN tmp.item ti ON ti.itemFk = i.id
JOIN itemCategory ic ON ic.id = it.categoryFk
JOIN warehouse wh ON wh.code = 'VNH'
JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id
JOIN buy b ON b.id = bu.buyFk
JOIN volumeConfig vc
JOIN account.`user` u ON u.id = it.workerFk
- WHERE ic.display <> 0
+ JOIN workerDepartment wd ON wd.workerFk = u.id
+ JOIN department d ON d.id = wd.departmentFk
+ WHERE ic.display
+ AND d.code IN ('shopping', 'logistic', 'franceTeam')
GROUP BY it.workerFk;
INSERT INTO stockBuyed(buyed, dated, description)
- SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000),
+ SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000),
vDated,
- IF(c.country = 'España',p.name,c.country) destiny
+ IF(c.code = 'ES', p.name, c.country) destiny
FROM itemTicketOut ito
JOIN ticket t ON t.id = ito.ticketFk
JOIN `address` a ON a.id = t.addressFk
JOIN province p ON p.id = a.provinceFk
JOIN country c ON c.id = p.countryFk
JOIN warehouse wh ON wh.id = t.warehouseFk
- JOIN itemCost ic ON ic.itemFk = ito.itemFk AND ic.warehouseFk = t.warehouseFk
+ JOIN itemCost ic ON ic.itemFk = ito.itemFk
+ AND ic.warehouseFk = t.warehouseFk
JOIN volumeConfig vc
WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated)
AND wh.code = 'VNH'
@@ -68337,8 +69572,7 @@ BEGIN
s.reserved = ts.reserved
WHERE s.dated = vDated;
- DROP TEMPORARY TABLE
- tmp.buyUltimate,
+ DROP TEMPORARY TABLE tmp.buyUltimate,
tmp.item,
tStockBuyed;
END ;;
@@ -68357,44 +69591,44 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stockTraslation`(vDate DATE)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `stockTraslation`(
+ vDated DATE
+)
BEGIN
/**
- * Calcula el stock del almacén de subasta desde FechaInventario hasta vDate
- * sin tener en cuenta las salidas del mismo dia vDate
+ * Calcula el stock del almacén de subasta desde FechaInventario hasta vDated
+ * sin tener en cuenta las salidas del mismo dia vDated
* para ver el transporte a reservar
- * @param vDate Fecha hasta la cual calcula el stock
+ *
+ * @param vDated Fecha hasta la cual calcula el stock
+ * @return tmp.item
*/
DECLARE vAuctionWarehouseFk INT;
- DELETE FROM stockBuyed WHERE dated = vDate;
-
SELECT warehouseFk INTO vAuctionWarehouseFk
FROM auctionConfig;
- DROP TEMPORARY TABLE IF EXISTS tmp.item;
- CREATE TEMPORARY TABLE tmp.item
- (UNIQUE INDEX i USING HASH (item_id))
+ CREATE OR REPLACE TEMPORARY TABLE tmp.item
+ (UNIQUE INDEX i USING HASH (itemFk))
ENGINE = MEMORY
- SELECT item_id, SUM(amount) amount
- FROM vn2008.item_entry_in
- WHERE dat = vDate
- AND vDate >= util.VN_CURDATE()
- AND warehouse_id = vAuctionWarehouseFk
- AND isVirtualStock is FALSE
- GROUP BY item_id
- HAVING amount != 0;
+ SELECT itemFk, SUM(quantity) quantity
+ FROM itemEntryIn
+ WHERE landed = vDated
+ AND vDated >= util.VN_CURDATE()
+ AND warehouseInFk = vAuctionWarehouseFk
+ AND NOT isVirtualStock
+ GROUP BY itemFk
+ HAVING quantity;
- CALL `cache`.stock_refresh (FALSE);
+ CALL `cache`.stock_refresh(FALSE);
- INSERT INTO tmp.item (item_id,amount)
- SELECT item_id,s.amount
- FROM `cache`.stock s
+ INSERT INTO tmp.item (itemFk, quantity)
+ SELECT item_id, amount
+ FROM `cache`.stock
WHERE warehouse_id = vAuctionWarehouseFk
- ON DUPLICATE KEY UPDATE amount = tmp.item.amount + VALUES(amount);
-
- CALL buyUltimate(vAuctionWarehouseFk, vDate);
+ ON DUPLICATE KEY UPDATE quantity = tmp.item.quantity + VALUES(quantity);
+ CALL buyUltimate(vAuctionWarehouseFk, vDated);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -68566,7 +69800,10 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(vFromDated DATE, vSupplierFk INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(
+ vFromDated DATE,
+ vSupplierFk INT
+)
BEGIN
/**
* Selecciona los embalajes de un proveedor a partir de una fecha
@@ -68574,15 +69811,26 @@ BEGIN
* @param vFromDated Fecha de la que partir
* @param vSupplierFk Id del proveedor
*/
- DECLARE vCounter INT DEFAULT 0;
- DECLARE vMaxRow INT DEFAULT 0;
- DECLARE vItemFk INT DEFAULT 0;
SET @vBalance = 0;
+ SET @vItemFk = NULL;
- CREATE OR REPLACE TEMPORARY TABLE tSupplierPackagingList
- SELECT ROW_NUMBER() OVER(ORDER BY landed) `row`,
+ CREATE OR REPLACE TEMPORARY TABLE tSupplierPackaging
+ SELECT supplierFk,
itemFk,
- entryFk
+ longName,
+ supplier,
+ entryFk,
+ landed,
+ `in`,
+ `out`,
+ warehouse,
+ buyingValue,
+ IF (
+ NOT (@vItemFk <=> sub.itemFk),
+ @vBalance := (`in` - `out`),
+ @vBalance := (`in` - `out` + @vBalance)
+ ) balance,
+ @vItemFk := sub.itemFk previousItemFk
FROM (
SELECT supplierFk,
itemFk,
@@ -68590,8 +69838,8 @@ BEGIN
supplier,
entryFk,
landed,
- `out`,
`in`,
+ `out`,
warehouse,
buyingValue
FROM supplierPackaging
@@ -68604,103 +69852,33 @@ BEGIN
supplier,
'previous',
vFromDated,
- SUM(`out`),
SUM(`in`),
+ SUM(`out`),
NULL,
buyingValue
FROM supplierPackaging
WHERE supplierFk = vSupplierFk
AND landed < vFromDated
GROUP BY itemFk
- ) sub
- GROUP BY itemFk
- HAVING entryFk <> 'previous'
- ORDER BY landed;
+ ORDER BY itemFk, landed, entryFk
+ ) sub
+ WHERE `out` OR `in`;
- SELECT MAX(`row`) INTO vMaxRow
- FROM tSupplierPackagingList;
-
- CREATE OR REPLACE TEMPORARY TABLE tSupplierPackaging(
- supplierFk INT,
- itemFk INT,
- longName VARCHAR(50),
- supplier VARCHAR(50),
- entryFk VARCHAR(50),
- landed DATE,
- `in` VARCHAR(50),
- `out` VARCHAR(50),
- warehouse INT,
- buyingValue INT,
- balance INT
- );
-
- l1: LOOP
- SET @vBalance = 0;
- IF vCounter = vMaxRow THEN
- LEAVE l1;
- ELSE
- SET vCounter = vCounter + 1;
- END IF;
-
- SELECT itemFk INTO vItemFk
- FROM tSupplierPackagingList
- WHERE `row` = vCounter;
-
- INSERT INTO tSupplierPackaging
- SELECT supplierFk,
- itemFk,
- longName,
- supplier,
- entryFk,
- landed,
- `in`,
- `out`,
- warehouse,
- buyingValue,
- @vBalance:= (`in` - `out` + @vBalance)
- FROM (
- SELECT supplierFk,
- itemFk,
- longName,
- supplier,
- entryFk,
- landed,
- `out`,
- `in`,
- warehouse,
- buyingValue
- FROM supplierPackaging
- WHERE supplierFk = vSupplierFk
- AND landed >= vFromDated
- AND itemFk = vItemFk
- UNION ALL
- SELECT vSupplierFk,
- itemFk,
- longName,
- supplier,
- 'previous',
- vFromDated,
- SUM(`out`),
- SUM(`in`),
- NULL,
- buyingValue
- FROM supplierPackaging
- WHERE supplierFk = vSupplierFk
- AND landed < vFromDated
- AND itemFk = vItemFk
- GROUP BY itemFk
- ORDER BY landed
- ) sub
- WHERE `out` OR `in`;
- END LOOP l1;
-
- SELECT *
+ SELECT supplierFk,
+ itemFk,
+ longName,
+ supplier,
+ entryFk,
+ landed,
+ `in`,
+ `out`,
+ warehouse,
+ buyingValue,
+ balance
FROM tSupplierPackaging
- ORDER BY itemFk, landed;
+ WHERE NOT (NOT balance AND landed < CURDATE() - INTERVAL 1 YEAR);
- DROP TEMPORARY TABLE IF EXISTS
- tSupplierPackaging,
- tSupplierPackagingList;
+ DROP TEMPORARY TABLE tSupplierPackaging;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -68845,9 +70023,11 @@ BEGIN
UPDATE vn.supplier s
JOIN ( SELECT p.supplierFk
- FROM vn.payment p
- LEFT JOIN vn.supplier s ON s.id = p.supplierFk
- LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk
+ FROM supplier s
+ JOIN payMethod pm ON pm.id = s.payMethodFk
+ JOIN (SELECT supplierFk,MAX(created) created
+ FROM payment
+ GROUP BY supplierFk) p ON p.supplierFk = s.id
WHERE p.created < (util.VN_CURDATE() - INTERVAL pm.graceMonthsDisableChecked MONTH)
AND pm.graceMonthsDisableChecked
AND s.isPayMethodChecked
@@ -68880,14 +70060,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticketBoxesView` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBoxesView`(IN vTicketFk INT)
BEGIN
@@ -68904,7 +70084,7 @@ BEGIN
JOIN item i ON i.id = s.itemFk
JOIN cache.last_buy lb on lb.warehouse_id = t.warehouseFk AND lb.item_id = s.itemFk
JOIN buy b on b.id = lb.buy_id
- JOIN packaging p on p.id = b.packageFk
+ JOIN packaging p on p.id = b.packagingFk
WHERE s.quantity >= b.packing
AND t.id = vTicketFk
AND p.isBox
@@ -70411,11 +71591,26 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`(
,vIsRequiredZone INT
,OUT vNewTicket INT)
BEGIN
+/**
+* Crea un ticket,
+* ¡¡NO se debe llamar directamente, llamar a salix que hace comprobaciones previas!!
+*
+* @param vClientId id del cliente
+* @param vShipped dia preparacion
+* @param vWarehouseFk id del warehouse
+* @param vCompanyFk id la empresa
+* @param vAddressFk id del consignatario
+* @param vAgencyModeFk id de la agencia
+* @param vRouteFk id de la ruta | NULL
+* @param vlanded dia llegada
+* @param vUserId que crea el ticket
+* @param vIsRequiredZone Indica si tiene que tener zona valida para ser creado
+* @return vNewTicket id del ticket creado
+*/
DECLARE vZoneFk INT;
DECLARE vPrice DECIMAL(10,2);
DECLARE vBonus DECIMAL(10,2);
DECLARE vIsActive BOOL;
- DECLARE vNickname VARCHAR(100);
IF vClientId IS NULL THEN
CALL util.throw ('CLIENT_NOT_ESPECIFIED');
@@ -70481,10 +71676,6 @@ BEGIN
JOIN agencyMode am ON am.id = a.agencyModeFk
WHERE a.id = vAddressFk;
- SELECT a.nickname INTO vNickname
- FROM address a
- WHERE a.id = vAddressFk;
-
SET vNewTicket = LAST_INSERT_ID();
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
@@ -70546,14 +71737,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_canAdvance` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
BEGIN
@@ -70620,12 +71811,14 @@ BEGIN
dest.liters,
origin.futureLines - origin.hasStock AS notMovableLines,
(origin.futureLines = origin.hasStock) AS isFullMovable,
+ origin.futureZoneFk,
+ origin.futureZoneName,
origin.classColor futureClassColor,
dest.classColor
FROM (
SELECT
s.ticketFk,
- t.workerFk,
+ c.salesPersonFk workerFk,
t.shipped,
t.totalWithVat,
st.name futureState,
@@ -70635,14 +71828,18 @@ BEGIN
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock,
+ z.id futureZoneFk,
+ z.name futureZoneName,
st.classColor
FROM ticket t
+ JOIN client c ON c.id = t.clientFk
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
+ JOIN zone z ON t.zoneFk = z.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.stock st ON st.itemFk = i.id
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
@@ -70925,22 +72122,22 @@ BEGIN
DECLARE vStateFk INT;
INSERT INTO ticket (
- clientFk,
- shipped,
- addressFk,
- agencyModeFk,
- nickname,
- warehouseFk,
- companyFk,
- landed,
- zoneFk,
- zonePrice,
- zoneBonus,
- routeFk,
- priority,
- hasPriority,
- clonedFrom
- )
+ clientFk,
+ shipped,
+ addressFk,
+ agencyModeFk,
+ nickname,
+ warehouseFk,
+ companyFk,
+ landed,
+ zoneFk,
+ zonePrice,
+ zoneBonus,
+ routeFk,
+ priority,
+ hasPriority,
+ clonedFrom
+ )
SELECT
clientFk,
shipped,
@@ -70957,18 +72154,18 @@ BEGIN
priority,
hasPriority,
vOriginalTicket
- FROM ticket
- WHERE id = vOriginalTicket;
+ FROM ticket
+ WHERE id = vOriginalTicket;
SET vNewTicket = LAST_INSERT_ID();
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
- SELECT vNewTicket, o.observationTypeFk, o.description
- FROM ticketObservation o
- WHERE o.ticketFk = vOriginalTicket;
+ SELECT vNewTicket, observationTypeFk, description
+ FROM ticketObservation
+ WHERE ticketFk = vOriginalTicket;
INSERT INTO ticketTracking(ticketFk, stateFk, workerFk, created)
- SELECT vNewTicket, stateFk, workerFk , created
+ SELECT vNewTicket, stateFk, workerFk, created
FROM ticketTracking
WHERE ticketFk = vOriginalTicket
ORDER BY created;
@@ -72077,32 +73274,29 @@ BEGIN
*/
CALL sale_getProblems(vIsTodayRelative);
- DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems;
- CREATE TEMPORARY TABLE tmp.ticket_problems
- (PRIMARY KEY (ticketFk))
- ENGINE = MEMORY
- SELECT
- ticketFk,
- MAX(p.isFreezed) isFreezed,
- MAX(p.risk) risk,
- MAX(p.hasHighRisk) hasHighRisk,
- MAX(p.hasTicketRequest) hasTicketRequest,
- MAX(p.itemShortage) itemShortage,
- MIN(p.isTaxDataChecked) isTaxDataChecked,
- MAX(p.hasComponentLack) hasComponentLack,
- MAX(p.isTooLittle) isTooLittle,
- MAX(p.itemDelay) itemDelay,
- MAX(p.hasRounding) hasRounding,
- MAX(p.itemLost) itemLost,
- 0 totalProblems
- FROM tmp.sale_problems p
- GROUP BY ticketFk;
+ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket_problems
+ (PRIMARY KEY (ticketFk))
+ ENGINE = MEMORY
+ SELECT ticketFk,
+ MAX(isFreezed) isFreezed,
+ MAX(risk) risk,
+ MAX(hasHighRisk) hasHighRisk,
+ MAX(hasTicketRequest) hasTicketRequest,
+ MAX(itemShortage) itemShortage,
+ MIN(isTaxDataChecked) isTaxDataChecked,
+ MAX(hasComponentLack) hasComponentLack,
+ MAX(isTooLittle) isTooLittle,
+ MAX(itemDelay) itemDelay,
+ MAX(hasRounding) hasRounding,
+ MAX(itemLost) itemLost,
+ 0 totalProblems
+ FROM tmp.sale_problems
+ GROUP BY ticketFk;
UPDATE tmp.ticket_problems tp
- SET tp.totalProblems =
- (
+ SET tp.totalProblems = (
(tp.isFreezed) +
- IF(tp.risk, TRUE, FALSE) +
+ IF(tp.risk,TRUE, FALSE) +
(tp.hasTicketRequest) +
(tp.isTaxDataChecked = 0) +
(tp.hasComponentLack) +
@@ -72113,8 +73307,7 @@ BEGIN
(tp.itemShortage)
);
- DROP TEMPORARY TABLE
- tmp.sale_problems;
+ DROP TEMPORARY TABLE tmp.sale_problems;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -72147,124 +73340,124 @@ BEGIN
CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk);
CALL `vn`.`zoneClosure_recalc`();
- DROP TEMPORARY TABLE IF EXISTS tmp.salesToSplit;
-
- CREATE TEMPORARY TABLE tmp.salesToSplit
+ CREATE OR REPLACE TEMPORARY TABLE tmp.salesToSplit
(saleFk INT PRIMARY KEY,
ticketFk INT,
- problem VARCHAR(1)) ENGINE = MEMORY;
+ problem VARCHAR(1),
+ INDEX(ticketFk)) ENGINE = MEMORY;
INSERT INTO tmp.salesToSplit(saleFk, ticketFk, problem)
- SELECT s.id, s.ticketFk, 'F'
- FROM vn.ticket t
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemType it on it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache
- LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
- LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
- WHERE IFNULL(v.visible,0) < s.quantity
- AND IFNULL(av.available ,0) < s.quantity
- AND IFNULL(issw.visible, 0) < s.quantity
- AND s.isPicked = FALSE
- AND s.reserved = FALSE
- AND ic.merchandise = TRUE
- AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
- AND NOT i.generic
- AND t.warehouseFk = vWarehouseFk;
+ SELECT s.id, s.ticketFk, 'F'
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it on it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache
+ LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
+ LEFT JOIN itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
+ WHERE IFNULL(v.visible,0) < s.quantity
+ AND IFNULL(av.available ,0) < s.quantity
+ AND IFNULL(issw.visible, 0) < s.quantity
+ AND s.isPicked = FALSE
+ AND s.reserved = FALSE
+ AND ic.merchandise = TRUE
+ AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
+ AND NOT i.generic
+ AND t.warehouseFk = vWarehouseFk;
INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem)
- SELECT s.id, s.ticketFk, 'I'
- FROM vn.ticket t
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemType it on it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache
- LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
- WHERE IFNULL(v.visible,0) >= s.quantity
- AND IFNULL(issw.visible, 0) < s.quantity
- AND s.quantity > 0
- AND s.isPicked = FALSE
- AND s.reserved = FALSE
- AND ic.merchandise = TRUE
- AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
- AND NOT i.generic
- AND t.warehouseFk = vWarehouseFk;
+ SELECT s.id, s.ticketFk, 'I'
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it on it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache
+ LEFT JOIN itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
+ WHERE IFNULL(v.visible,0) >= s.quantity
+ AND IFNULL(issw.visible, 0) < s.quantity
+ AND s.quantity > 0
+ AND s.isPicked = FALSE
+ AND s.reserved = FALSE
+ AND ic.merchandise = TRUE
+ AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
+ AND NOT i.generic
+ AND t.warehouseFk = vWarehouseFk;
INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem)
- SELECT s.id, s.ticketFk, 'R'
- FROM vn.ticket t
- JOIN vn.sale s ON s.ticketFk = t.id
- JOIN vn.item i ON i.id = s.itemFk
- JOIN vn.itemType it on it.id = i.typeFk
- JOIN vn.itemCategory ic ON ic.id = it.categoryFk
- LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache
- LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
- LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
- WHERE IFNULL(v.visible,0) < s.quantity
- AND IFNULL(av.available ,0) >= s.quantity
- AND IFNULL(issw.visible, 0) < s.quantity
- AND s.quantity > 0
- AND s.isPicked = FALSE
- AND s.reserved = FALSE
- AND ic.merchandise = TRUE
- AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
- AND NOT i.generic
- AND t.warehouseFk = vWarehouseFk;
+ SELECT s.id, s.ticketFk, 'R'
+ FROM ticket t
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN itemType it on it.id = i.typeFk
+ JOIN itemCategory ic ON ic.id = it.categoryFk
+ LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache
+ LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
+ LEFT JOIN itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
+ WHERE IFNULL(v.visible,0) < s.quantity
+ AND IFNULL(av.available ,0) >= s.quantity
+ AND IFNULL(issw.visible, 0) < s.quantity
+ AND s.quantity > 0
+ AND s.isPicked = FALSE
+ AND s.reserved = FALSE
+ AND ic.merchandise = TRUE
+ AND t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
+ AND NOT i.generic
+ AND t.warehouseFk = vWarehouseFk;
- DROP TEMPORARY TABLE IF EXISTS tmp.ticketsToSplit;
-
- CREATE TEMPORARY TABLE tmp.ticketsToSplit
- (ticketFk INT PRIMARY KEY,
+ CREATE OR REPLACE TEMPORARY TABLE tTicketsToSplit(
+ ticketFk INT PRIMARY KEY,
problems VARCHAR(100),
addressFk INT,
ipt VARCHAR(10),
- etd TIME) ENGINE = MEMORY;
+ etd TIME,
+ INDEX(addressFk)
+ ) ENGINE = MEMORY;
- INSERT INTO tmp.ticketsToSplit
- SELECT
- ss.ticketFk,
- GROUP_CONCAT(DISTINCT ss.problem ORDER BY ss.problem) problems,
- t.addressFk,
- GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
- zc.`hour` etd
- FROM tmp.salesToSplit ss
- JOIN vn.ticket t ON t.id = ss.ticketFk
- JOIN vn.sale s ON s.id = ss.saleFk
- JOIN vn.item i ON i.id = s.itemFk
- LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
- GROUP BY ss.ticketFk;
+ INSERT INTO tTicketsToSplit
+ SELECT ss.ticketFk,
+ GROUP_CONCAT(DISTINCT ss.problem ORDER BY ss.problem) problems,
+ t.addressFk,
+ GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
+ DATE_FORMAT(IF(HOUR(t.shipped),
+ t.shipped,
+ IFNULL(zc.hour, z.HOUR)),'%H:%i') etd
+ FROM tmp.salesToSplit ss
+ JOIN ticket t ON t.id = ss.ticketFk
+ JOIN sale s ON s.id = ss.saleFk
+ JOIN item i ON i.id = s.itemFk
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ LEFT JOIN zone z ON z.id = t.zoneFk
+ GROUP BY ss.ticketFk;
- SELECT
- ts.*,
- t.id ticketFuture,
- st.name state,
- zc.`hour` tfEtd,
- GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt,
- st2.name tfState
- FROM tmp.ticketsToSplit ts
- LEFT JOIN vn.ticketState ts2 ON ts2.ticketFk = ts.ticketFk
- LEFT JOIN vn.state st ON st.id = ts2.stateFk
- LEFT JOIN vn.ticket t
- ON t.id != ts.ticketFk
- AND t.addressFk = ts.addressFk
- AND t.shipped BETWEEN vDated AND util.dayend(vDated)
- LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = vDated
- LEFT JOIN vn.sale s ON s.ticketFk = t.id
- LEFT JOIN vn.item i ON i.id = s.itemFk
- LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id
- LEFT JOIN vn.state st2 ON st2.id = tst.stateFk
+ SELECT ts.*,
+ t.id ticketFuture,
+ st.name state,
+ zc.`hour` tfEtd,
+ GROUP_CONCAT(
+ DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk
+ ) tfIpt,
+ st2.name tfState
+ FROM tTicketsToSplit ts
+ LEFT JOIN ticketState ts2 ON ts2.ticketFk = ts.ticketFk
+ LEFT JOIN `state` st ON st.id = ts2.stateFk
+ LEFT JOIN ticket t ON t.id != ts.ticketFk
+ AND t.addressFk = ts.addressFk
+ AND t.shipped BETWEEN vDated AND util.dayend(vDated)
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = vDated
+ LEFT JOIN sale s ON s.ticketFk = t.id
+ LEFT JOIN item i ON i.id = s.itemFk
+ LEFT JOIN ticketState tst ON tst.ticketFk = t.id
+ LEFT JOIN state st2 ON st2.id = tst.stateFk
WHERE (t.id IS NULL
- OR (vDated > util.VN_CURDATE())
- OR (vDated = util.VN_CURDATE() AND vHour >= zc.`hour`))
+ OR (vDated > util.VN_CURDATE())
+ OR (vDated = util.VN_CURDATE() AND vHour >= zc.`hour`))
AND ts.etd <= vHour
GROUP BY ts.ticketFk, t.id
ORDER BY ts.etd, ts.ticketFk;
- DROP TEMPORARY TABLE
- tmp.ticketsToSplit;
+ DROP TEMPORARY TABLE tTicketsToSplit;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -72899,16 +74092,19 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_setState` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(vSelf INT, vStateCode VARCHAR(255) COLLATE utf8_general_ci)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(
+ vSelf INT,
+ vStateCode VARCHAR(255) COLLATE utf8_general_ci
+)
BEGIN
/**
* Modifica el estado de un ticket si se cumplen las condiciones necesarias.
@@ -72920,35 +74116,27 @@ BEGIN
DECLARE vTicketStateCode VARCHAR(255);
DECLARE vCanChangeState BOOL;
DECLARE vPackedAlertLevel INT;
- DECLARE vOnPreparationAlertLevel INT;
- DECLARE vNextAlertLevel INT;
DECLARE vZoneFk INT;
- SELECT s.alertLevel, s.`code`, s2.alertLevel, t.zoneFk
- INTO vticketAlertLevel, vTicketStateCode, vNextAlertLevel , vZoneFk
+ SELECT s.alertLevel, s.`code`, t.zoneFk
+ INTO vticketAlertLevel, vTicketStateCode, vZoneFk
FROM state s
JOIN ticketTracking tt ON tt.stateFk = s.id
- JOIN state s2 ON s2.code = vStateCode
JOIN ticket t ON t.id = tt.ticketFk
WHERE tt.ticketFk = vSelf
ORDER BY tt.created DESC
LIMIT 1;
SELECT id INTO vPackedAlertLevel FROM alertLevel WHERE code = 'PACKED';
- SELECT id INTO vOnPreparationAlertLevel FROM alertLevel WHERE code = 'ON_PREPARATION';
IF vStateCode = 'OK' AND vZoneFk IS NULL THEN
CALL util.throw('ASSIGN_ZONE_FIRST');
END IF;
- IF vNextAlertLevel > vticketAlertLevel && vticketAlertLevel < vOnPreparationAlertLevel THEN
- UPDATE sale
- SET originalQuantity = quantity
- WHERE ticketFk = vSelf;
- END IF;
-
- SET vCanChangeState = (vStateCode <> 'ON_CHECKING' OR vticketAlertLevel < vPackedAlertLevel)
- AND NOT (
+ SET vCanChangeState = (
+ vStateCode <> 'ON_CHECKING' OR
+ vticketAlertLevel < vPackedAlertLevel
+ )AND NOT (
vTicketStateCode IN ('CHECKED', 'CHECKING')
AND vStateCode IN ('PREPARED', 'ON_PREPARATION')
);
@@ -73323,7 +74511,7 @@ BEGIN
(INDEX (departmentFk))
SELECT dated,
businessFk,
- userFk,
+ sub.id userFk,
departmentFk,
hourStart,
hourEnd,
@@ -73351,8 +74539,7 @@ BEGIN
at2.permissionRate,
at2.discountRate,
ct.hoursWeek hoursWeek,
- at2.isAllowedToWork,
- u.userFk
+ at2.isAllowedToWork
FROM time t
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
LEFT JOIN worker w ON w.id = b.workerFk
@@ -73538,212 +74725,205 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `timeControl_calculate` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculate`(
vDatedFrom DATETIME,
vDatedTo DATETIME)
BEGIN
/*
+ * Agrupa por trabajador y día, el tiempo de trabajo y descanso retribuido(si tiene).
+ * Los registros horarios incorrectos (tmp.timeControlError) no se considerarán.
+ * Si un trabajador ha trabajado más de un cierto umbral de tiempo (vTimeToBreakTime)
+ * y no ha tenido descansos que superen un parámetro determinado(vMaxTimeToBreak),
+ * se le añadirá un tiempo de descanso (vBreakTime) a sus horas trabajadas.
+ * El tiempo de descanso solo se añade si el trabajador realmente disfrutó del descanso.
+ * Si disfrutó de menos tiempo de descanso, solo se añade el tiempo que disfrutó.
+ *
* @param vDatedFrom
* @param vDatedTo
- * Cálculo de horas trabajadas por empleado y día,
- * sin tener en cuenta los días con fichadas incorrectas (tabla tmp.timeControlError)
- * En el caso de haber hecho descanso y trabajado un mínimo de tiempo (vTimeToBreakTime),
- * se añade al tiempo de trabajo efectivo el descanso (vBreakTime)
+ *
* @return tmp.timeControlCalculate
* (workerFk, dated, timeWorkSeconds, timeWorkSexagesimal, timeWorkDecimal, timed)
*/
- DECLARE vHourToSeconds INTEGER;
+ DECLARE vHourSeconds INTEGER;
DECLARE vDatedFromYesterday DATETIME;
DECLARE vDatedToTomorrow DATETIME;
DECLARE vTimeToBreakTime INT;
DECLARE vBreakTime INT;
+ DECLARE vMaxTimeToBreak INT;
SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY)
INTO vDatedFromYesterday, vDatedToTomorrow;
- SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime
+ SELECT timeToBreakTime, breakTime, maxTimeToBreak, TIME_TO_SEC('01:00:00')
+ INTO vTimeToBreakTime, vBreakTime, vMaxTimeToBreak, vHourSeconds
FROM workerTimeControlConfig
LIMIT 1;
- CALL timeControl_getError(vDatedFrom, vDatedTo);
+ CALL timeControl_getError(vDatedFromYesterday, vDatedToTomorrow);
- DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl;
- CREATE TEMPORARY TABLE tmp.workerTimeControl
- (INDEX (userFk), INDEX (timed))
- ENGINE = MEMORY
- SELECT DISTINCT(wtc.id),
- wtc.userFk,
+ CREATE OR REPLACE TEMPORARY TABLE tmp.workerTimeControl
+ (INDEX(userFk, timed), INDEX(timed), INDEX(direction))
+ ENGINE = MEMORY
+ SELECT wtc.userFk,
wtc.timed,
+ DATE(wtc.timed) dated,
wtc.direction,
TRUE isReal
FROM workerTimeControl wtc
- JOIN tmp.`user` w ON w.userFk = wtc.userFk
+ JOIN tmp.`user` u ON u.userFk = wtc.userFk
+ LEFT JOIN (
+ SELECT wtc.userFk, MIN(wtc.timed) firstIn
+ FROM workerTimeControl wtc
+ JOIN tmp.`user` u ON u.userFk = wtc.userFk
+ LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id
+ WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
+ AND wtc.direction = 'in'
+ AND tce.id IS NULL
+ GROUP BY userFk
+ ) fi ON wtc.userFk = fi.userFk
+ LEFT JOIN (
+ SELECT wtc.userFk, MAX(wtc.timed) lastOut
+ FROM workerTimeControl wtc
+ JOIN tmp.`user` u ON u.userFk = wtc.userFk
+ LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id
+ WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
+ AND wtc.direction = 'out'
+ AND tce.id IS NULL
+ GROUP BY userFk
+ ) lo ON wtc.userFk = lo.userFk
LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id
- WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
+ WHERE wtc.timed BETWEEN fi.firstIn AND lo.lastOut
AND tce.id IS NULL
- ORDER BY wtc.userFk, wtc.timed ASC;
+ ORDER BY wtc.userFk, wtc.timed;
- SELECT MAX(id) INTO @vCont
- FROM tmp.workerTimeControl;
+ CREATE OR REPLACE TEMPORARY TABLE tmp.wtcToinsert
+ (INDEX(timed))
+ ENGINE = MEMORY
+ WITH wtc AS(
+ SELECT timed,
+ userFk,
+ dated,
+ direction,
+ LEAD(dated) OVER
+ (PARTITION BY userFk, dated ORDER BY timed) nextDay,
+ LEAD(userFk) OVER
+ (PARTITION BY userFk ORDER BY timed) nextUserFk,
+ ROW_NUMBER() OVER (ORDER BY userFk, timed) MOD 2 isOdd
+ FROM tmp.workerTimeControl
+ WHERE timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
+ ORDER BY userFk, timed
+ ), wtcToinsert AS(
+ SELECT userFk,
+ dated,
+ IF(userFk = nextUserFk
+ AND nextDay IS NULL
+ AND isOdd
+ AND direction <> 'out', TRUE, FALSE) outNextDay,
+ IF(userFk = nextUserFk
+ AND nextDay IS NULL
+ AND NOT isOdd
+ AND direction <> 'out', TRUE, FALSE) outNextDayWhitBreak
+ FROM wtc
+ HAVING outNextDay OR outNextDayWhitBreak
+ )SELECT userFk, util.dayEnd(dated) timed, 'out' direction
+ FROM wtcToinsert
+ WHERE outNextDay
+ UNION ALL
+ SELECT userFk, dated + INTERVAL 1 DAY, 'in'
+ FROM wtcToinsert
+ WHERE outNextDay
+ UNION ALL
+ SELECT userFk, util.dayEnd(dated) - INTERVAL 1 SECOND, 'middle'
+ FROM wtcToinsert
+ WHERE outNextDayWhitBreak
+ UNION ALL
+ SELECT userFk, util.dayEnd(dated), 'out'
+ FROM wtcToinsert
+ WHERE outNextDayWhitBreak
+ UNION ALL
+ SELECT userFk, dated + INTERVAL 1 DAY, 'in'
+ FROM wtcToinsert
+ WHERE outNextDayWhitBreak
+ UNION ALL
+ SELECT userFk, dated + INTERVAL 1 DAY + INTERVAL 1 SECOND, 'middle'
+ FROM wtcToinsert
+ WHERE outNextDayWhitBreak;
- DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux;
- CREATE TEMPORARY TABLE tmp.workerTimeControlAux (
- `id` int(11) ,
- `userFk` int(10) unsigned ,
- `timed` datetime,
- `direction` enum('in', 'out','middle')
- ) ENGINE=MEMORY;
+ INSERT INTO tmp.workerTimeControl (userFk, timed, dated, direction, isReal)
+ SELECT userFk, timed, DATE(timed), direction, FALSE
+ FROM tmp.wtcToinsert;
- SET @counter := 0;
- SET @vIsOdd := FALSE;
-
- -- Cambio de dia en medio de un descanso
- INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction)
- SELECT @vCont:= @vCont + 1 id,
- userFk,
- util.dayEnd(dated) timed,
- 'middle' direction
- FROM(SELECT wtc.userFk,
- DATE(@lastTimed) dated,
- (@vIsOdd := NOT @vIsOdd) isOdd,
- IF(@vIsOdd AND wtc.direction = 'middle'
- AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak,
- @lastTimed := wtc.timed
- FROM tmp.workerTimeControl wtc
- ORDER BY wtc.userFk, wtc.timed
- LIMIT 10000000000000000000
- )sub
- WHERE hasBreak;
-
- SET @counter := 0;
- SET @vIsOdd := FALSE;
-
- INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction)
- SELECT @vCont:= @vCont + 1,
- userFk,
- DATE_ADD(sub.dated, INTERVAL 1 DAY),
- 'middle'
- FROM(SELECT wtc.userFk,
- DATE(@lastTimed) dated,
- (@vIsOdd := NOT @vIsOdd) isOdd,
- IF(@vIsOdd AND wtc.direction = 'middle'
- AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak,
- @lastTimed := wtc.timed
- FROM tmp.workerTimeControl wtc
- ORDER BY wtc.userFk, wtc.timed
- LIMIT 10000000000000000000
- )sub
- WHERE hasBreak;
-
- -- Cambio de dia
- INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction)
- SELECT @vCont:= @vCont + 1 id,
- sub.userFk,
- util.dayEnd(sub.dated) timed,
- 'out' direction
- FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated
- FROM workerTimeControl wtc
- JOIN tmp.`user` w ON w.userFk = wtc.userFk
- LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id
- WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
- AND tce.id IS NULL
- GROUP BY wtc.userFk, DATE(wtc.timed)
- ) sub
- JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed
- AND wtc.userFk = sub.userFk
- WHERE wtc.direction <> 'out';
-
- INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction)
- SELECT @vCont:= @vCont + 1, sub.userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'in'
- FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated
- FROM workerTimeControl wtc
- JOIN tmp.`user` w ON w.userFk = wtc.userFk
- LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id
- WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
- AND tce.id IS NULL
- GROUP BY wtc.userFk, DATE(wtc.timed)
- ) sub
- JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed
- AND wtc.userFk = sub.userFk
- WHERE wtc.direction <> 'out';
-
- INSERT INTO tmp.workerTimeControl (id, userFk, timed, direction, isReal)
- SELECT id, userFk, timed, direction, FALSE FROM tmp.workerTimeControlAux;
-
- SET vHourToSeconds = 3600;
- SET @vIsOdd := TRUE;
- SET @vDated := 0;
- SET @vLastTimed := 0;
- SET @vPreviousTimed := 0;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.workerBreakDays;
- CREATE TEMPORARY TABLE tmp.workerBreakDays
- (INDEX (userFk), INDEX (dated))
- ENGINE = MEMORY
- SELECT sub.userFk,
- sub.dated
- FROM (SELECT (@vIsOdd := NOT @vIsOdd),
- IF(wtc.direction = 'in', @vIsOdd := TRUE, NULL),
- IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(wtc.timed), NULL),
- IF(@vIsOdd, 0, UNIX_TIMESTAMP(wtc.timed) - @vLastTimed) timeWork,
- IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated,
- wtc.userFk
- FROM tmp.workerTimeControl wtc
- ORDER BY wtc.userFk, wtc.timed, wtc.id
- LIMIT 10000000000000000000
- )sub
- GROUP BY sub.userFk, sub.dated
- HAVING SUM(sub.timeWork) >= vTimeToBreakTime;
-
- SET @vIsOdd := TRUE;
- SET @vDated := 0;
- SET @vLastTimed := 0;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux2;
- CREATE TEMPORARY TABLE tmp.workerTimeControlAux2
- SELECT *
- FROM tmp.workerTimeControl
- WHERE timed BETWEEN vDatedFromYesterday AND vDatedTo
- ORDER BY userFk, timed, id;
-
- DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate;
+ SET @accumulatedForBreakTime = 0;
+ SET @oldrealDay = NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.timeControlCalculate
- (INDEX (userFk, dated))
- ENGINE = MEMORY
- SELECT sub.userFk,
- sub.dated,
- IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork) timeWorkSeconds,
- SEC_TO_TIME(IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) timeWorkSexagesimal,
- (IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) / vHourToSeconds timeWorkDecimal,
- CAST(GROUP_CONCAT(DATE_FORMAT(sub.realTimed, "%H:%i")
- ORDER BY sub.timed ASC SEPARATOR ' - ') AS CHAR(256)) timed
- FROM (SELECT (@vIsOdd := NOT @vIsOdd),
- IF(direction='in', @vIsOdd := TRUE, 0),
- IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(timed), 0),
- IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed) - @vLastTimed) timeWork,
- timed,
- userFk,
- DATE(timed) dated,
- IF(isReal, timed, NULL) realTimed
- FROM tmp.workerTimeControlAux2
- )sub
- LEFT JOIN tmp.workerBreakDays wb ON wb.userFk = sub.userFk AND wb.dated = sub.dated
- WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo
- GROUP BY sub.userFk, sub.dated;
+ WITH workerTimed AS (
+ SELECT
+ userFk,
+ dated,
+ timed,
+ (direction ='in' AND isReal) breakPoint,
+ SUM(CASE WHEN (direction ='in' AND isReal) THEN TRUE ELSE FALSE END)
+ OVER (ORDER BY userFk, timed) AS realDay,
+ TIMESTAMPDIFF(SECOND, LAG(timed)
+ OVER (PARTITION BY userFk, dated ORDER BY timed), timed) gapTime,
+ ROW_NUMBER()
+ OVER (PARTITION BY userFk, dated ORDER BY timed) MOD 2 isOdd
+ FROM tmp.workerTimeControl
+ WHERE timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
+ ), accumulated AS (
+ SELECT SUM(IF(isOdd, 0, gapTime))
+ OVER (PARTITION BY userFk,dated ORDER BY userFk,timed) accumulatedWorkTime,
+ SUM(IF(NOT isOdd OR breakPoint, 0, IFNULL(gapTime, 0)))
+ OVER (PARTITION BY realDay ORDER BY realDay,timed) accumulatedBreakTime,
+ IF(realDay <> @oldrealDay OR (isOdd AND gapTime >= vMaxTimeToBreak),
+ @accumulatedForBreakTime := 0,
+ @accumulatedForBreakTime := @accumulatedForBreakTime +
+ IF(isOdd, 0, gapTime )) accumulatedForBreakTime,
+ @oldrealDay := realDay,
+ userFk,
+ dated,
+ realDay
+ FROM workerTimed
+ ), totalWorked AS (
+ SELECT userFk,
+ dated,
+ MAX(accumulatedWorkTime) +
+ IF(MAX(accumulatedForBreakTime) >= vTimeToBreakTime,
+ LEAST(vBreakTime, MAX(accumulatedBreakTime)),
+ 0) timeWorkSeconds
+ FROM accumulated
+ GROUP BY userFk, dated
+ )SELECT tw.userFk,
+ tw.dated,
+ timeWorkSeconds,
+ SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal,
+ timeWorkSeconds / vHourSeconds timeWorkDecimal,
+ sub.tableTimed
+ FROM totalWorked tw
+ JOIN (
+ SELECT userFk,
+ dated,
+ GROUP_CONCAT(DATE_FORMAT(timed, "%H:%i") ORDER BY timed ASC
+ SEPARATOR ' - ')tableTimed
+ FROM tmp.workerTimeControl
+ WHERE timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow
+ AND isReal
+ GROUP BY userFk, dated
+ )sub ON sub.dated = tw.dated
+ AND sub.userFk = tw.userFk
+ WHERE tw.dated BETWEEN vDatedFrom AND vDatedTo;
- DROP TEMPORARY TABLE tmp.workerBreakDays;
DROP TEMPORARY TABLE tmp.timeControlError;
- DROP TEMPORARY TABLE tmp.workerTimeControlAux;
- DROP TEMPORARY TABLE tmp.workerTimeControlAux2;
+ DROP TEMPORARY TABLE tmp.wtcToinsert;
DROP TEMPORARY TABLE tmp.workerTimeControl;
END ;;
DELIMITER ;
@@ -73874,19 +75054,17 @@ BEGIN
* @param vDatedFrom workerTimeControl
* @param vDatedTo workerTimeControl
*/
+ DROP TEMPORARY TABLE IF EXISTS tmp.`user`;
- DROP TEMPORARY TABLE IF EXISTS tmp.`user`;
-
- CREATE TEMPORARY TABLE tmp.`user`
+ CREATE TEMPORARY TABLE tmp.`user`
SELECT u.id userFk
FROM account.user u
- JOIN vn.worker w ON w.userFk = u.id
- WHERE w.id = vWorkerFk;
+ JOIN vn.worker w ON w.id = u.id
+ WHERE w.id = vWorkerFk;
- CALL vn.timeControl_calculate(vDatedFrom, vDatedTo);
-
- DROP TEMPORARY TABLE tmp.`user`;
+ CALL vn.timeControl_calculate(vDatedFrom, vDatedTo);
+ DROP TEMPORARY TABLE tmp.`user`;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -74037,14 +75215,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `travelVolume` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT)
BEGIN
@@ -74058,9 +75236,9 @@ BEGIN
e.id Id_Entrada,
e.invoiceNumber Referencia,
CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) *
- vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) AS CC,
+ vn.item_getVolume(b.itemFk ,b.packagingFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) AS CC,
CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) *
- vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) AS espais
+ vn.item_getVolume(b.itemFk ,b.packagingFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) AS espais
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.supplier s ON s.id = e.supplierFk
@@ -74080,21 +75258,21 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `travelVolume_get` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT)
BEGIN
SELECT tr.landed Fecha,
a.name Agencia,
count(DISTINCT e.id) numEntradas,
- FLOOR(sum(item_getVolume(b.itemFk, b.packageFk) * b.stickers / 1000000 )) AS m3
+ FLOOR(sum(item_getVolume(b.itemFk, b.packagingFk) * b.stickers / 1000000 )) AS m3
FROM vn.travel tr
JOIN vn.agencyMode a ON a.id = tr.agencyModeFk
JOIN vn.entry e ON e.travelFk = tr.id
@@ -74368,52 +75546,46 @@ 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 `travel_doRecalc` */;
/*!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 `travel_doRecalc`()
-BEGIN
+proc: BEGIN
/**
- * Recounts the number of entries of changed travels.
- */
- DECLARE vDone BOOL;
+* Recounts the number of entries of changed travels.
+*/
DECLARE vTravelFk INT;
- DECLARE vTotalEntries INT;
- DECLARE cCur CURSOR FOR
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
+ BEGIN
+ DO RELEASE_LOCK('vn.ticket_doRecalc');
+ END;
+
+ IF !GET_LOCK('vn.travel_doRecalc', 0) THEN
+ LEAVE proc;
+ END IF;
+
+ CREATE OR REPLACE TEMPORARY TABLE tTravel
+ ENGINE = MEMORY
SELECT travelFk FROM travelRecalc;
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET vDone = TRUE;
+ UPDATE travel t
+ JOIN tTravel tt ON tt.travelFk = t.id
+ SET t.totalEntries = (
+ SELECT COUNT(e.id)
+ FROM entry e
+ WHERE e.travelFk = t.id
+ );
- OPEN cCur;
-
- myLoop: LOOP
- SET vDone = FALSE;
- FETCH cCur INTO vTravelFk;
-
- IF vDone THEN
- LEAVE myLoop;
- END IF;
-
- SELECT COUNT(*) INTO vTotalEntries
- FROM entry
- WHERE travelFk = vTravelFk;
-
- UPDATE travel
- SET totalEntries = vTotalEntries
- WHERE id = vTravelFk;
-
- DELETE FROM travelRecalc WHERE travelFk = vTravelFk;
- END LOOP;
-
- CLOSE cCur;
+ DELETE tr FROM travelRecalc tr JOIN tTravel t ON tr.travelFk = t.travelFk;
+ DROP TEMPORARY TABLE tTravel;
+ DO RELEASE_LOCK('vn.travel_doRecalc');
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -74421,14 +75593,14 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 DROP PROCEDURE IF EXISTS `travel_getEntriesMissingPackage` */;
/*!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 character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_getEntriesMissingPackage`(vSelf INT)
BEGIN
@@ -74444,7 +75616,7 @@ BEGIN
JOIN entry e ON e.travelFk = t.id
JOIN buy b ON b.entryFk = e.id
WHERE t.id = vTravelFk
- AND (b.packing IS NULL OR b.packageFk IS NULL);
+ AND (b.packing IS NULL OR b.packagingFk IS NULL);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -75193,38 +76365,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 `workerCreate` */;
-/*!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 `workerCreate`(
- vFirstname VARCHAR(50),
- vLastName VARCHAR(50),
- vCode CHAR(3),
- vBossFk INT,
- vUserFk INT,
- vFi VARCHAR(15) ,
- vBirth DATE
-)
-BEGIN
-/**
- * Create new worker
- *
- */
- INSERT INTO worker(id, code, firstName, lastName, bossFk, fi, birth,userFk)
- VALUES (vUserFk, vCode, vFirstname, vLastName, vBossFk, vFi, vBirth,vUserFk);
-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 `workerCreateExternal` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -76338,41 +77478,44 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = '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 = utf8mb4 */ ;
-/*!50003 SET character_set_results = utf8mb4 */ ;
-/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
+/*!50003 SET character_set_client = utf8mb3 */ ;
+/*!50003 SET character_set_results = utf8mb3 */ ;
+/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`(
- vWorker INT,
+ vWorkerFk INT,
vTimed DATETIME,
- vDirection VARCHAR(10))
+ vDirection VARCHAR(10)
+)
BEGIN
/**
* Verifica si el empleado puede fichar
- * @param vWorker Identificador del trabajador
+ * @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 a que se debe mostrar al usuario
+ * 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;
- DECLARE vLastDirection VARCHAR(6);
- DECLARE vNextDirection VARCHAR(6);
+ DECLARE vNextOut DATETIME;
+ DECLARE vNextDirection ENUM('in', 'out');
+ DECLARE vLastDirection ENUM('in', 'out');
+ DECLARE vDayMaxTime INTEGER;
DECLARE vDayBreak INT;
DECLARE vShortWeekBreak INT;
DECLARE vLongWeekBreak INT;
DECLARE vWeekScope INT;
- DECLARE vGap INT;
DECLARE vMailTo VARCHAR(50) DEFAULT NULL;
DECLARE vUserName VARCHAR(50) DEFAULT NULL;
DECLARE vIsError BOOLEAN DEFAULT FALSE;
@@ -76380,79 +77523,40 @@ BEGIN
DECLARE vErrorCode VARCHAR(50);
DECLARE vDated DATE;
DECLARE vIsAllowedToWork VARCHAR(50);
- DECLARE vDepartmentFk INT;
- DECLARE vTimedLoop BIGINT;
- DECLARE vTimedLoopPrevious BIGINT;
- DECLARE vHasBreakWeek BOOLEAN DEFAULT FALSE;
- DECLARE vManual BOOLEAN DEFAULT TRUE;
- DECLARE vDone INT DEFAULT FALSE;
-
- DECLARE vCursor CURSOR FOR
- SELECT UNIX_TIMESTAMP(vTimed) timed
- UNION
- SELECT UNIX_TIMESTAMP(timed)
- FROM workerTimeControl
- WHERE timed BETWEEN (vTimed - INTERVAL vGap SECOND) AND vTimed
- AND userFk = vWorker
- AND direction IN ('in', 'out')
- ORDER BY timed ASC;
-
- DECLARE vCursor2 CURSOR FOR
- SELECT UNIX_TIMESTAMP(vTimed) timed
- UNION
- SELECT UNIX_TIMESTAMP(timed)
- FROM workerTimeControl
- WHERE timed BETWEEN vTimed AND (vTimed + INTERVAL vGap SECOND)
- AND userFk = vWorker
- AND direction IN ('in', 'out')
- ORDER BY timed ASC;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+ DECLARE vIsManual BOOLEAN DEFAULT TRUE;
+ DECLARE vMaxWorkShortCycle INT;
+ DECLARE vMaxWorkLongCycle INT;
DECLARE EXIT HANDLER FOR SQLSTATE '45000'
BEGIN
- SELECT CONCAT(u.name, '@verdnatura.es'),
+ SELECT CONCAT(u.name, '@verdnatura.es'),
CONCAT(w.firstName, ' ', w.lastName)
INTO vMailTo, vUserName
FROM account.user u
JOIN worker w ON w.bossFk = u.id
- WHERE w.id = vWorker;
+ WHERE w.id = vWorkerFk;
- CASE vErrorCode
- WHEN 'IS_NOT_ALLOWED_FUTURE' THEN
- SELECT 'No se permite fichar a futuro' INTO vErrorMessage;
- WHEN 'INACTIVE_BUSINESS' THEN
- SELECT 'No hay un contrato en vigor' INTO vErrorMessage;
- WHEN 'IS_NOT_ALLOWED_WORK' THEN
- SELECT 'No está permitido trabajar' INTO vErrorMessage;
- WHEN 'ODD_WORKERTIMECONTROL' THEN
- SELECT 'Fichadas impares' INTO vErrorMessage;
- WHEN 'BREAK_DAY' THEN
- SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0), 'h.')
- INTO vErrorMessage;
- WHEN 'BREAK_WEEK' THEN
- SELECT CONCAT('Descanso semanal ',
- FORMAT(vShortWeekBreak / 3600,0) ,'h. / ',
- FORMAT(vLongWeekBreak / 3600, 0) ,'h.') INTO vErrorMessage;
- WHEN 'WRONG_DIRECTION' THEN
- SELECT 'Dirección incorrecta' INTO vErrorMessage;
- ELSE
- SELECT 'Error sin definir'INTO vErrorMessage;
- END CASE;
+ SELECT `description` INTO vErrorMessage
+ FROM workerTimeControlError
+ WHERE `code` = vErrorCode;
+
+ IF vErrorMessage IS NULL THEN
+ SET vErrorMessage = 'Error sin definir';
+ END IF;
SELECT vErrorMessage `error`;
SELECT CONCAT(vUserName,
' no ha podido fichar por el siguiente problema: ',
vErrorMessage)
INTO vErrorMessage;
- CALL mail_insert( vMailTo, vMailTo, 'Error al fichar', vErrorMessage);
+ CALL mail_insert( vMailTo, vMailTo, 'Error al fichar', vErrorMessage);
END;
IF (vTimed IS NULL) THEN
SET vTimed = util.VN_NOW();
- SET vManual = FALSE;
+ SET vIsManual = FALSE;
END IF;
SET vDated = DATE(vTimed);
@@ -76462,70 +77566,38 @@ BEGIN
wc.dayBreak),
wc.shortWeekBreak,
wc.longWeekBreak,
- wc.weekScope
+ wc.weekScope,
+ wc.dayMaxTime,
+ wc.maxWorkShortCycle,
+ wc.maxWorkLongCycle
INTO vDayBreak,
vShortWeekBreak,
vLongWeekBreak,
- vWeekScope
+ vWeekScope,
+ vDayMaxTime,
+ vMaxWorkShortCycle,
+ vMaxWorkLongCycle
FROM business b
JOIN professionalCategory pc
ON pc.id = b.workerBusinessProfessionalCategoryFk
- JOIN workerTimeControlConfig wc ON TRUE
- WHERE b.workerFk = vWorker
+ JOIN workerTimeControlConfig wc
+ WHERE b.workerFk = vWorkerFk
AND vDated BETWEEN b.started AND IFNULL(b.ended, vDated);
- SELECT timed INTO vLastIn
- FROM workerTimeControl
- WHERE userFk = vWorker
- AND direction = 'in'
- AND timed < vTimed
- ORDER BY timed DESC
- LIMIT 1;
-
- SELECT timed INTO vLastOut
- FROM workerTimeControl
- WHERE userFk = vWorker
- AND direction = 'out'
- AND timed < vTimed
- ORDER BY timed DESC
- LIMIT 1;
-
- SELECT timed INTO vNextIn
- FROM workerTimeControl
- WHERE userFk = vWorker
- AND direction = 'in'
- AND timed > vTimed
- ORDER BY timed ASC
- LIMIT 1;
-
- SELECT direction INTO vNextDirection
- FROM workerTimeControl
- WHERE userFk = vWorker
- AND timed > vTimed
- ORDER BY timed ASC
- LIMIT 1;
-
- SELECT direction INTO vLastDirection
- FROM workerTimeControl
- WHERE userFk = vWorker
- AND timed < vTimed
- ORDER BY timed DESC
- LIMIT 1;
-
- -- FICHADAS A FUTURO
- IF vTimed > DATE_ADD(util.VN_NOW(), INTERVAL 60 SECOND) THEN
- SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE';
- CALL util.throw(vErrorCode);
- END IF;
-
-- CONTRATO EN VIGOR
IF vDayBreak IS NULL THEN
SET vErrorCode = 'INACTIVE_BUSINESS';
CALL util.throw(vErrorCode);
END IF;
+ -- FICHADAS A FUTURO
+ IF vTimed > util.VN_NOW() + INTERVAL 1 MINUTE THEN
+ SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE';
+ CALL util.throw(vErrorCode);
+ END IF;
+
-- VERIFICAR SI ESTÁ PERMITIDO TRABAJAR
- CALL timeBusiness_calculateByWorker(vWorker, vDated, vDated);
+ CALL timeBusiness_calculateByWorker(vWorkerFk, vDated, vDated);
SELECT isAllowedToWork INTO vIsAllowedToWork
FROM tmp.timeBusinessCalculate;
DROP TEMPORARY TABLE tmp.timeBusinessCalculate;
@@ -76536,7 +77608,7 @@ BEGIN
END IF;
-- DIRECCION CORRECTA
- CALL workerTimeControl_direction(vWorker, vTimed);
+ CALL workerTimeControl_direction(vWorkerFk, vTimed);
IF (SELECT
IF(IF(option1 IN ('inMiddle', 'outMiddle'),
'middle',
@@ -76552,17 +77624,25 @@ BEGIN
END IF;
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
- IF vIsError = TRUE THEN
+ IF vIsError THEN
SET vErrorCode = 'WRONG_DIRECTION';
CALL util.throw(vErrorCode);
END IF;
-- FICHADAS IMPARES
+ SELECT timed INTO vLastIn
+ FROM workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction = 'in'
+ AND timed < vTimed
+ ORDER BY timed DESC
+ LIMIT 1;
+
IF (SELECT IF(vDirection = 'in',
MOD(COUNT(*), 2) ,
IF (vDirection = 'out', NOT MOD(COUNT(*), 2), FALSE))
FROM workerTimeControl
- WHERE userFk = vWorker
+ WHERE userFk = vWorkerFk
AND timed BETWEEN vLastIn AND vTimed
) THEN
SET vErrorCode = 'ODD_WORKERTIMECONTROL';
@@ -76570,6 +77650,22 @@ BEGIN
END IF;
-- DESCANSO DIARIO
+ SELECT timed INTO vLastOut
+ FROM workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction = 'out'
+ AND timed < vTimed
+ ORDER BY timed DESC
+ LIMIT 1;
+
+ SELECT timed INTO vNextIn
+ FROM workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction = 'in'
+ AND timed > vTimed
+ ORDER BY timed ASC
+ LIMIT 1;
+
CASE vDirection
WHEN 'in' THEN
IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) <= vDayBreak THEN
@@ -76587,94 +77683,93 @@ BEGIN
CALL util.throw(vErrorCode);
END IF;
- -- VERIFICAR DESCANSO SEMANAL
+
+
IF (vDirection IN('in', 'out')) THEN
- -- VERIFICA DESCANSO CORTO EN LA ÚLTIMA SEMANA
- SET vGap = vWeekScope;
- SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND));
- SET vDone = FALSE;
- OPEN vCursor;
- l:LOOP
- FETCH vCursor INTO vTimedLoop;
- IF vDone THEN
- LEAVE l;
- END IF;
- IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN
- SET vHasBreakWeek = TRUE;
- LEAVE l;
- END IF;
- SET vTimedLoopPrevious = vTimedLoop;
- END LOOP l;
- CLOSE vCursor;
- -- VERIFICA DESCANSO LARGO EN LA ÚLTIMAS 2 SEMANAS
- IF NOT vHasBreakWeek THEN
- SET vGap = vWeekScope * 2;
- SET vTimedLoopPrevious = UNIX_TIMESTAMP(vTimed - INTERVAL vGap SECOND);
- SET vDone = FALSE;
- OPEN vCursor;
- l:LOOP
- FETCH vCursor INTO vTimedLoop;
- IF vDone THEN
- LEAVE l;
- END IF;
- IF vLongWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN
- SET vHasBreakWeek = TRUE;
- LEAVE l;
- END IF;
- SET vTimedLoopPrevious = vTimedLoop;
- END LOOP l;
- CLOSE vCursor;
+ -- VERIFICA MAXIMO TIEMPO DESDE ENTRADA HASTA LA SALIDA
+
+ SELECT timed INTO vNextOut
+ FROM workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction = 'out'
+ AND timed > vTimed
+ ORDER BY timed ASC
+ LIMIT 1;
+
+ SELECT direction INTO vNextDirection
+ FROM workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction IN('in','out')
+ AND timed > vTimed
+ ORDER BY timed ASC
+ LIMIT 1;
+
+ SELECT direction INTO vLastDirection
+ FROM workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction IN('in', 'out')
+ AND timed < vTimed
+ ORDER BY timed ASC
+ LIMIT 1;
+
+ IF (vDirection ='in'
+ AND vNextDirection = 'out'
+ AND UNIX_TIMESTAMP(vNextOut) - UNIX_TIMESTAMP(vTimed) > vDayMaxTime) OR
+ (vDirection ='out'
+ AND vLastDirection = 'in'
+ AND UNIX_TIMESTAMP(vTimed) -UNIX_TIMESTAMP(vLastIn) > vDayMaxTime) THEN
+ SET vErrorCode = 'DAY_MAX_TIME';
+ CALL util.throw(vErrorCode);
END IF;
- IF vManual THEN
- -- VERIFICA DESCANSO CORTO EN LA PRÓXIMA SEMANA
- SET vGap = vWeekScope;
- SET vTimedLoopPrevious = vTimed;
- SET vDone = FALSE;
- OPEN vCursor2;
- l:LOOP
- FETCH vCursor2 INTO vTimedLoop;
- IF vDone THEN
- LEAVE l;
- END IF;
- IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN
- SET vHasBreakWeek = TRUE;
- LEAVE l;
- END IF;
- SET vTimedLoopPrevious = vTimedLoop;
- END LOOP l;
- CLOSE vCursor2;
- -- VERIFICA DESCANSO LARGO EN LAS PRÓXIMAS 2 SEMANAS
- IF NOT vHasBreakWeek THEN
- SET vGap = vWeekScope * 2;
- SET vTimedLoopPrevious = vTimed;
- SET vDone = FALSE;
- OPEN vCursor2;
- l:LOOP
- FETCH vCursor2 INTO vTimedLoop;
- IF vDone THEN
- LEAVE l;
- END IF;
- IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) <= 0 THEN
- SET vHasBreakWeek = TRUE;
- LEAVE l;
- END IF;
- SET vTimedLoopPrevious = vTimedLoop;
- END LOOP l;
- CLOSE vCursor2;
- END IF;
- END IF;
- IF NOT vHasBreakWeek THEN
+ -- VERIFICA DESCANSO SEMANAL
+
+ WITH wtc AS(
+ (SELECT timed
+ FROM vn.workerTimeControl
+ WHERE userFk = vWorkerFk
+ AND direction IN ('in', 'out')
+ AND timed BETWEEN vTimed - INTERVAL (vWeekScope * 2) SECOND
+ AND vTimed + INTERVAL (vWeekScope * 2) SECOND )
+ UNION
+ (SELECT vTimed)
+ ), wtcGap AS(
+ SELECT timed,
+ TIMESTAMPDIFF(SECOND, LAG(timed) OVER (ORDER BY timed), timed) gap
+ FROM wtc
+ ORDER BY timed
+ ), wtcBreak AS(
+ SELECT timed,
+ IF(IFNULL(gap, 0) > vShortWeekBreak, TRUE, FALSE) hasShortBreak,
+ IF(IFNULL(gap, 0) > vLongWeekBreak, TRUE, FALSE) hasLongBreak
+ FROM wtcGap
+ ORDER BY timed
+ ), wtcBreakCounter AS(
+ SELECT timed,
+ SUM(hasShortBreak) OVER (ORDER BY timed) breakCounter ,
+ LEAD(hasLongBreak) OVER (ORDER BY timed) nextHasLongBreak
+ FROM wtcBreak
+ )SELECT TIMESTAMPDIFF(SECOND, MIN(timed), MAX(timed)) > vMaxWorkLongCycle OR
+ (TIMESTAMPDIFF(SECOND, MIN(timed), MAX(timed))> vMaxWorkShortCycle
+ AND NOT SUM(IFNULL(nextHasLongBreak, 1)))
+ hasError INTO vIsError
+ FROM wtcBreakCounter
+ 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(vWorker, vTimed, vDirection, vManual);
+ INSERT INTO workerTimeControl(userFk, timed, direction, `manual`)
+ VALUES(vWorkerFk, vTimed, vDirection, vIsManual);
SELECT LAST_INSERT_ID() id;
+
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -77544,15 +78639,28 @@ DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateBusiness`(vSelf INT)
BEGIN
/**
- * Actualiza en la tabla @worker el contrato actual del trabajador.
+ * Activates an account and configures its email settings.
*
- * @param vSelf Id del trabajador
+ * @param vSelf account id.
*/
- UPDATE worker w
- LEFT JOIN business b ON b.workerFk = w.id
- AND util.VN_CURDATE() BETWEEN b.started AND IFNULL(b.ended, util.VN_CURDATE())
- SET w.businessFk = b.id
- WHERE w.id = vSelf;
+ DECLARE vOldBusinessFk INT;
+ DECLARE vNewBusinessFk INT;
+
+ SELECT businessFk INTO vOldBusinessFk FROM worker WHERE id = vSelf;
+
+ SELECT id INTO vNewBusinessFk
+ FROM business
+ WHERE workerFk = vSelf
+ AND util.VN_CURDATE() BETWEEN started AND IFNULL(ended, util.VN_CURDATE())
+ LIMIT 1;
+
+ UPDATE worker
+ SET businessFk = vNewBusinessFk
+ WHERE id = vSelf;
+
+ IF vOldBusinessFk IS NULL THEN
+ CALL account.account_enable(vSelf);
+ END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -78120,6 +79228,74 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `zone_getAddresses` */;
+/*!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 `zone_getAddresses`(
+ vSelf INT,
+ vLanded DATE
+)
+BEGIN
+/**
+ * Devuelve un listado de todos los clientes activos
+ * con consignatarios a los que se les puede
+ * vender producto para esa zona y no tiene un ticket
+ * para ese día.
+ *
+ * @param vSelf Id de zona
+ * @param vDated Fecha de entrega
+ * @return Un select
+ */
+ CALL zone_getPostalCode(vSelf);
+
+ WITH notHasTicket AS (
+ SELECT id
+ FROM vn.client
+ WHERE id NOT IN (
+ SELECT clientFk
+ FROM vn.ticket
+ WHERE landed BETWEEN vLanded AND util.dayEnd(vLanded)
+ )
+ )
+ SELECT c.id clientFk,
+ c.name,
+ c.phone,
+ c.mobile,
+ c.salesPersonFk,
+ u.name username,
+ aai.invoiced,
+ cnb.lastShipped
+ FROM vn.client c
+ JOIN notHasTicket ON notHasTicket.id = c.id
+ LEFT JOIN account.`user` u ON u.id = c.salesPersonFk
+ JOIN vn.`address` a ON a.clientFk = c.id
+ JOIN vn.postCode pc ON pc.code = a.postalCode
+ JOIN vn.town t ON t.id = pc.townFk AND t.provinceFk = a.provinceFk
+ JOIN vn.zoneGeo zg ON zg.name = a.postalCode
+ JOIN tmp.zoneNodes zn ON zn.geoFk = pc.geoFk
+ LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = c.id
+ LEFT JOIN vn.annualAverageInvoiced aai ON aai.clientFk = c.id
+ JOIN vn.clientType ct ON ct.code = c.typeFk
+ WHERE a.isActive
+ AND c.isActive
+ AND ct.code = 'normal'
+ AND c.businessTypeFk <> 'worker'
+ GROUP BY c.id;
+
+ DROP TEMPORARY TABLE tmp.zoneNodes;
+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 `zone_getAgency` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
@@ -78902,8 +80078,7 @@ BEGIN
*/
DECLARE vGeoFk INT DEFAULT NULL;
- DROP TEMPORARY TABLE IF EXISTS tmp.zoneNodes;
- CREATE TEMPORARY TABLE tmp.zoneNodes (
+ CREATE OR REPLACE TEMPORARY TABLE tmp.zoneNodes (
geoFk INT,
name VARCHAR(100),
parentFk INT,
@@ -78916,14 +80091,14 @@ BEGIN
CALL zone_getLeaves(vSelf, NULL , NULL, TRUE);
- UPDATE tmp.zoneNodes zn
+ UPDATE tmp.zoneNodes
SET isChecked = 0
WHERE parentFk IS NULL;
myLoop: LOOP
SET vGeoFk = NULL;
SELECT geoFk INTO vGeoFk
- FROM tmp.zoneNodes zn
+ FROM tmp.zoneNodes
WHERE NOT isChecked
LIMIT 1;
@@ -78939,10 +80114,6 @@ BEGIN
DELETE FROM tmp.zoneNodes
WHERE sons > 0;
-
- SELECT zn.geoFk, zn.name
- FROM tmp.zoneNodes zn
- JOIN zone z ON z.id = zn.zoneFk;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@@ -79913,7 +81084,7 @@ USE `pbx`;
/*!50001 SET collation_connection = utf8mb4_unicode_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on(`u`.`id` = `s`.`user_id`)) left join `pbx`.`sipReg` `r` on(`s`.`user_id` = `r`.`userId`)) join `pbx`.`sipConfig` `c`) */;
+/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,`s`.`extension` AS `regexten`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`directMedia` AS `directmedia`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`c`.`disallow` AS `disallow`,`c`.`allow` AS `allow`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on(`u`.`id` = `s`.`user_id`)) left join `pbx`.`sipReg` `r` on(`s`.`user_id` = `r`.`userId`)) join `pbx`.`sipConfig` `c`) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -80154,12 +81325,12 @@ USE `vn`;
/*!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 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 `awbVolume` AS select `d`.`awbFk` AS `awbFk`,`b`.`stickers` * `i`.`density` * if(`p`.`volume` > 0,`p`.`volume`,`p`.`width` * `p`.`depth` * if(`p`.`height` = 0,`i`.`size` + 10,`p`.`height`)) / (`vc`.`aerealVolumetricDensity` * 1000) AS `volume`,`b`.`id` AS `buyFk` from ((((((((`buy` `b` join `item` `i` on(`b`.`itemFk` = `i`.`id`)) join `itemType` `it` on(`i`.`typeFk` = `it`.`id`)) join `packaging` `p` on(`p`.`id` = `b`.`packageFk`)) join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`t`.`id` = `e`.`travelFk`)) join `duaEntry` `de` on(`de`.`entryFk` = `e`.`id`)) join `dua` `d` on(`d`.`id` = `de`.`duaFk`)) join `volumeConfig` `vc`) where `t`.`shipped` > makedate(year(`util`.`VN_CURDATE`()) - 1,1) */;
+/*!50001 VIEW `awbVolume` AS select `d`.`awbFk` AS `awbFk`,`b`.`stickers` * `i`.`density` * if(`p`.`volume` > 0,`p`.`volume`,`p`.`width` * `p`.`depth` * if(`p`.`height` = 0,`i`.`size` + 10,`p`.`height`)) / (`vc`.`aerealVolumetricDensity` * 1000) AS `volume`,`b`.`id` AS `buyFk` from ((((((((`buy` `b` join `item` `i` on(`b`.`itemFk` = `i`.`id`)) join `itemType` `it` on(`i`.`typeFk` = `it`.`id`)) join `packaging` `p` on(`p`.`id` = `b`.`packagingFk`)) join `entry` `e` on(`b`.`entryFk` = `e`.`id`)) join `travel` `t` on(`t`.`id` = `e`.`travelFk`)) join `duaEntry` `de` on(`de`.`entryFk` = `e`.`id`)) join `dua` `d` on(`d`.`id` = `de`.`duaFk`)) join `volumeConfig` `vc`) where `t`.`shipped` > makedate(year(`util`.`VN_CURDATE`()) - 1,1) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -80290,24 +81461,6 @@ USE `vn`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `cmr_list`
---
-
-/*!50001 DROP VIEW IF EXISTS `cmr_list`*/;
-/*!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 `cmr_list` AS select `cmr`.`id` AS `cmrFk`,`cmr`.`ticketFk` AS `ticketFk`,`cmr`.`truckPlate` AS `truckPlate`,`cmr`.`observations` AS `observations`,`cmr`.`senderInstruccions` AS `senderInstruccions`,`cmr`.`paymentInstruccions` AS `paymentInstruccions`,`cmr`.`specialAgreements` AS `specialAgreements`,`cmr`.`created` AS `created`,`cmr`.`packagesList` AS `packagesList`,`aTo`.`nickname` AS `clientName`,`aTo`.`postalCode` AS `clientPostalCode`,`aTo`.`street` AS `clientStreet`,`aTo`.`city` AS `clientCity`,`pTo`.`name` AS `clientProvince`,`cTo`.`country` AS `clientCountry`,`su`.`name` AS `companyName`,`su`.`street` AS `companyStreet`,`su`.`postCode` AS `companyPostCode`,`su`.`city` AS `companyCity`,`cSu`.`country` AS `companyCountry`,concat(`aFrom`.`street`,' ',`aFrom`.`postalCode`,' ',`aFrom`.`city`,' (',`cFrom`.`country`,')') AS `warehouseAddress`,`cmr`.`created` AS `shipped`,`aTo`.`nickname` AS `clientOficialName`,`cmr`.`supplierFk` AS `supplierFk`,`aSu`.`name` AS `carrierName`,`aSu`.`street` AS `carrierStreet`,`aSu`.`postCode` AS `carrierPostCode`,`aSu`.`city` AS `carrierCity`,`cAs`.`country` AS `carrierCountry`,ifnull(`aTo`.`phone`,`client`.`phone`) AS `phone`,ifnull(`aTo`.`mobile`,`client`.`mobile`) AS `mobile`,`aTo`.`id` AS `addressFk`,`c`.`stamp` AS `stamp`,`cmr`.`merchandiseDetail` AS `merchandiseDetail` from ((((((((((((`cmr` left join `address` `aTo` on(`aTo`.`id` = `cmr`.`addressToFk`)) left join `province` `pTo` on(`pTo`.`id` = `aTo`.`provinceFk`)) left join `country` `cTo` on(`cTo`.`id` = `pTo`.`countryFk`)) left join `client` on(`client`.`id` = `aTo`.`clientFk`)) left join `supplier` `su` on(`su`.`id` = `cmr`.`companyFk`)) left join `country` `cSu` on(`cSu`.`id` = `su`.`countryFk`)) left join `address` `aFrom` on(`aFrom`.`id` = `cmr`.`addressFromFk`)) left join `province` `pFrom` on(`pFrom`.`id` = `aFrom`.`provinceFk`)) left join `country` `cFrom` on(`cFrom`.`id` = `pFrom`.`countryFk`)) left join `supplier` `aSu` on(`aSu`.`id` = `cmr`.`supplierFk`)) left join `country` `cAs` on(`cAs`.`id` = `aSu`.`countryFk`)) join `company` `c` on(`c`.`id` = `cmr`.`companyFk`)) */;
-/*!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 `companyL10n`
--
@@ -81406,24 +82559,6 @@ USE `vn`;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
---
--- Final view structure for view `routesReduced`
---
-
-/*!50001 DROP VIEW IF EXISTS `routesReduced`*/;
-/*!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 `routesReduced` AS select `et`.`description` AS `description`,`rm`.`name` AS `name`,`t`.`routeFk` AS `routeFk`,`et`.`eta` AS `eta`,`rm`.`bufferFk` AS `bufferFk`,`rm`.`beachFk` AS `beachFk`,`i`.`itemPackingTypeFk` AS `itempackingTypeFk` from (((((((`expeditionTruck` `et` join `routesMonitor` `rm` on(`rm`.`expeditionTruckFk` = `et`.`id`)) join `ticket` `t` on(`t`.`routeFk` = `rm`.`routeFk`)) join `ticketState` `ts` on(`ts`.`ticketFk` = `t`.`id`)) join `state` `st` on(`st`.`id` = `ts`.`stateFk`)) join `sale` `s` on(`s`.`ticketFk` = `t`.`id`)) join `item` `i` on(`i`.`id` = `s`.`itemFk`)) join `config` `c`) where `et`.`eta` > `util`.`yesterday`() group by `t`.`routeFk` order by `et`.`eta`,`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 */;
-
--
-- Final view structure for view `saleCost`
--
@@ -82067,7 +83202,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`,cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`,`z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`,`z`.`hour`)) minute as time) AS `hourTheoretical`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `totalVolume`,cast(sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) as decimal(5,1)) AS `remainingVolume`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `speed`,cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) minute as time) AS `hourEffective`,floor(-sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) AS `minutesLess`,cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2,`sv`.`volume`,0)) * 60 / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) minute as time) AS `etc` 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`())) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() group by `t`.`zoneFk` */;
+/*!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 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -82081,4 +83216,4 @@ USE `vn`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2023-08-30 15:59:19
+-- Dump completed on 2023-11-20 10:10:52
diff --git a/db/export-data.sh b/db/export-data.sh
index 7d346b235..97092da4f 100755
--- a/db/export-data.sh
+++ b/db/export-data.sh
@@ -45,12 +45,12 @@ TABLES=(
alertLevel
bookingPlanner
businessType
- cplusInvoiceType472
- cplusInvoiceType477
+ siiTypeInvoiceIn
+ siiTypeInvoiceOut
cplusRectificationType
cplusSubjectOp
cplusTaxBreak
- cplusTrascendency472
+ siiTrascendencyInvoiceIn
claimResponsible
claimReason
claimRedelivery
@@ -68,6 +68,8 @@ TABLES=(
volumeConfig
workCenter
companyI18n
+ workerTimeControlError
+ silexACL
)
dump_tables ${TABLES[@]}
diff --git a/db/tests/vn/ticket_componentMakeUpdate.spec.js b/db/tests/vn/ticket_componentMakeUpdate.spec.js
deleted file mode 100644
index a059f1060..000000000
--- a/db/tests/vn/ticket_componentMakeUpdate.spec.js
+++ /dev/null
@@ -1,123 +0,0 @@
-const app = require('vn-loopback/server/server');
-const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
-
-// 2277 solucionar problema al testear procedimiento con start transaction / rollback
-xdescribe('ticket_componentMakeUpdate()', () => {
- it('should recalculate the ticket components without make modifications', async() => {
- let stmts = [];
- let stmt;
-
- let params = {
- ticketId: 11,
- clientId: 1102,
- agencyModeId: 2,
- addressId: 122,
- zoneId: 3,
- warehouseId: 1,
- companyId: 442,
- isDeleted: 0,
- hasToBeUnrouted: 0,
- componentOption: 1
- };
-
- stmts.push('START TRANSACTION');
-
- stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
- params.ticketId
- ]);
- stmts.push(stmt);
-
- let originalTicketIndex = stmts.push(stmt) - 1;
-
- stmt = new ParameterizedSQL('CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), ?, ?, ?)', [
- params.ticketId,
- params.clientId,
- params.agencyModeId,
- params.addressId,
- params.zoneId,
- params.warehouseId,
- params.companyId,
- params.isDeleted,
- params.hasToBeUnrouted,
- params.componentOption
- ]);
- stmts.push(stmt);
-
- stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
- params.ticketId
- ]);
- stmts.push(stmt);
-
- let updatedTicketIndex = stmts.push(stmt) - 1;
-
- stmts.push('ROLLBACK');
-
- let sql = ParameterizedSQL.join(stmts, ';');
- let result = await app.models.Ticket.rawStmt(sql);
-
- let originalTicketData = result[originalTicketIndex];
- let updatedTicketData = result[updatedTicketIndex];
-
- expect(originalTicketData[0].isDeleted).toEqual(updatedTicketData[0].isDeleted);
- expect(originalTicketData[0].routeFk).toEqual(updatedTicketData[0].routeFk);
- });
-
- it('should delete and unroute a ticket and recalculate the components', async() => {
- let stmts = [];
- let stmt;
-
- let params = {
- ticketId: 11,
- clientId: 1102,
- agencyModeId: 2,
- addressId: 122,
- zoneId: 3,
- warehouseId: 1,
- companyId: 442,
- isDeleted: 1,
- hasToBeUnrouted: 1,
- componentOption: 1
- };
-
- stmts.push('START TRANSACTION');
-
- stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
- params.ticketId
- ]);
- stmts.push(stmt);
-
- let originalTicketIndex = stmts.push(stmt) - 1;
-
- stmt = new ParameterizedSQL('CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), ?, ?, ?)', [
- params.ticketId,
- params.clientId,
- params.agencyModeId,
- params.addressId,
- params.zoneId,
- params.warehouseId,
- params.companyId,
- params.isDeleted,
- params.hasToBeUnrouted,
- params.componentOption
- ]);
- stmts.push(stmt);
-
- stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
- params.ticketId
- ]);
- stmts.push(stmt);
-
- let updatedTicketIndex = stmts.push(stmt) - 1;
-
- stmts.push('ROLLBACK');
-
- let sql = ParameterizedSQL.join(stmts, ';');
- let result = await app.models.Ticket.rawStmt(sql);
-
- let originalTicketData = result[originalTicketIndex];
- let updatedTicketData = result[updatedTicketIndex];
-
- expect(originalTicketData[0].isDeleted).not.toEqual(updatedTicketData[0].isDeleted);
- expect(originalTicketData[0].routeFk).not.toEqual(updatedTicketData[0].routeFk);
- });
-});
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index cec0545a0..dba430e66 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -145,6 +145,7 @@ export default {
adController: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adController"]',
adUser: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adUser"]',
adPassword: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adPassword"]',
+ userDn: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.userDn"]',
verifyCert: 'vn-account-samba vn-check[ng-model="$ctrl.config.verifyCert"]',
save: 'vn-account-samba vn-submit'
},
@@ -722,7 +723,7 @@ export default {
isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]',
warehouseFk: 'vn-autocomplete[label="Warehouse"]',
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
- moveButton: 'vn-button[vn-tooltip="Advance tickets"]',
+ moveButton: 'vn-button[vn-tooltip="Advance tickets with negatives"]',
acceptButton: '.vn-confirm.shown button[response="accept"]',
firstCheck: 'tbody > tr:nth-child(2) > td > vn-check',
tableId: 'vn-textfield[name="id"]',
@@ -734,7 +735,7 @@ export default {
},
createStateView: {
state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]',
- worker: 'vn-worker-autocomplete[ng-model="$ctrl.workerFk"]',
+ worker: 'vn-worker-autocomplete[ng-model="$ctrl.userFk"]',
saveStateButton: `button[type=submit]`
},
claimsIndex: {
diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js
index 5f64aa6ce..c6589d2e3 100644
--- a/e2e/paths/03-worker/04_time_control.spec.js
+++ b/e2e/paths/03-worker/04_time_control.spec.js
@@ -56,63 +56,6 @@ describe('Worker time control path', () => {
expect(result).toContain(month);
});
- it(`should return error when insert 'out' of first entry`, async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
- await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
- await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
- await page.respondToDialog('accept');
- const message = await page.waitForSnackbar();
-
- expect(message.text).toBeDefined();
- });
-
- it(`should insert 'in' monday`, async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
- await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
- await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
- await page.respondToDialog('accept');
- const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
-
- expect(result).toEqual(eightAm);
- });
-
- it(`should insert 'out' monday`, async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
- await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm);
- await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
- await page.respondToDialog('accept');
- const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
-
- expect(result).toEqual(fourPm);
- });
-
- it(`should check Hank Pym worked 8:20 hours`, async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.');
- await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.');
- });
-
- it('should remove first entry of monday', async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm);
- await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm);
- await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete);
- await page.respondToDialog('accept');
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Entry removed');
- });
-
- it(`should be the 'out' the first entry of monday`, async() => {
- pending('https://redmine.verdnatura.es/issues/4707');
- const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
-
- expect(result).toEqual(fourPm);
- });
-
it('should change week of month', async() => {
await page.click(selectors.workerTimeControl.thrirdWeekDay);
const result = await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js
index f177a98df..3bad18303 100644
--- a/e2e/paths/04-item/02_basic_data.spec.js
+++ b/e2e/paths/04-item/02_basic_data.spec.js
@@ -27,11 +27,8 @@ describe('Item Edit basic data path', () => {
it(`should edit the item basic data and confirm the item data was edited`, async() => {
const values = {
- name: 'Rose of Purity',
- longName: 'RS Rose of Purity',
type: 'Anthurium',
intrastat: 'Coral y materiales similares',
- origin: 'Spain',
relevancy: 1,
generic: 'Pallet',
isActive: false,
diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
index 5e82306cc..8be307269 100644
--- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
+++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
@@ -188,17 +188,6 @@ describe('Ticket Edit sale path', () => {
expect(result).toContain('22.50');
});
- it('should check in the history that logs has been added', async() => {
- pending('https://redmine.verdnatura.es/issues/5455');
- await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
- await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
- await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
- const result = await page.countElement(selectors.ticketSales.firstSaleHistory);
-
- expect(result).toBeGreaterThan(0);
- await page.waitToClick(selectors.ticketSales.closeHistory);
- });
-
it('should recalculate price of sales', async() => {
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
@@ -236,7 +225,7 @@ describe('Ticket Edit sale path', () => {
});
it('should show error trying to delete a ticket with a refund', async() => {
- await page.accessToSearchResult('16');
+ await page.accessToSearchResult('7');
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
await page.waitToClick(selectors.globalItems.acceptButton);
diff --git a/e2e/paths/05-ticket/11_diary.spec.js b/e2e/paths/05-ticket/11_diary.spec.js
deleted file mode 100644
index e4c63855a..000000000
--- a/e2e/paths/05-ticket/11_diary.spec.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-// #2221 Local MySQL8 crashes when rest method Items/getBalance is called
-xdescribe('Ticket diary path', () => {
- let page;
-
- beforeAll(async() => {
- page = (await getBrowser()).page;
- await page.loginAndModule('employee', 'ticket');
- });
-
- afterAll(async() => {
- await page.browser().close();
- });
-
- it(`should navigate to item diary from ticket sale and check the lines`, async() => {
- await page.accessToSearchResult('1');
- await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
- await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
- await page.waitForState('item.card.diary');
-
- const secondIdClass = await page.getClassName(selectors.itemDiary.secondTicketId);
- const fourthBalanceClass = await page.getClassName(selectors.itemDiary.fourthBalance);
- const firstBalanceClass = await page.getClassName(selectors.itemDiary.firstBalance);
-
- expect(secondIdClass).toContain('message');
- expect(fourthBalanceClass).toContain('message');
- expect(firstBalanceClass).toContain('balance');
- });
-});
diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js
index 7e5201d11..9c5518424 100644
--- a/e2e/paths/05-ticket/18_index_payout.spec.js
+++ b/e2e/paths/05-ticket/18_index_payout.spec.js
@@ -35,7 +35,7 @@ describe('Ticket index payout path', () => {
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
await page.write(selectors.ticketsIndex.advancedSearchClient, '1101');
await page.keyboard.press('Enter');
- await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 9);
+ await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 10);
await page.waitToClick(selectors.ticketsIndex.firstTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
diff --git a/e2e/paths/06-claim/02_detail.spec.js b/e2e/paths/06-claim/02_detail.spec.js
deleted file mode 100644
index eb4ac5d71..000000000
--- a/e2e/paths/06-claim/02_detail.spec.js
+++ /dev/null
@@ -1,114 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer.js';
-
-// #1528 e2e claim/detail
-xdescribe('Claim detail', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('salesPerson', 'claim');
- await page.accessToSearchResult('1');
- await page.accessToSection('claim.card.detail');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should add the first claimable item from ticket to the claim', async() => {
- await page.waitToClick(selectors.claimDetail.addItemButton);
- await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should confirm the claim contains now two items', async() => {
- const result = await page.countElement(selectors.claimDetail.claimDetailLine);
-
- expect(result).toEqual(2);
- });
-
- it('should edit de first item claimed quantity', async() => {
- await page.clearInput(selectors.claimDetail.firstItemQuantityInput); // selector deleted, find new upon fixes
- await page.write(selectors.claimDetail.firstItemQuantityInput, '4'); // selector deleted, find new upon fixes
- await page.keyboard.press('Enter');
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
- const claimedQuantity = page
- .waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); // selector deleted, find new upon fixes
-
- const totalClaimed = page
- .waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
-
- expect(claimedQuantity).toEqual('4');
- expect(totalClaimed).toContain('€47.62');
- });
-
- it('should login as salesAssistant and navigate to the claim.detail section', async() => {
- await page.loginAndModule('salesAssistant', 'claim');
- await page.accessToSearchResult('1');
- await page.accessToSection('claim.card.detail');
- let url = await page.expectURL('/detail'); // replace with waitForState
-
- expect(url).toBe(true);
- });
-
- it('should edit de second item claimed discount', async() => {
- await page.waitToClick(selectors.claimDetail.secondItemDiscount);
- await page.write(selectors.claimDetail.discount, '100');
- await page.keyboard.press('Enter');
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should check the mana is the expected one', async() => {
- await page.waitToClick(selectors.claimDetail.secondItemDiscount);
- const result = await page.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText');
-
- expect(result).toContain('MANÁ: €106');
- });
-
- it('should delete the second item from the claim', async() => {
- await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should confirm the claim contains now one item', async() => {
- const result = await page.countElement(selectors.claimDetail.claimDetailLine);
-
- expect(result).toEqual(1);
- });
-
- it('should add the deleted ticket from to the claim', async() => {
- await page.waitToClick(selectors.claimDetail.addItemButton);
- await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it(`should have been redirected to the next section in claims`, async() => {
- let url = await page.expectURL('development'); // replace with waitForState
-
- expect(url).toBe(true);
- });
-
- it('should navigate back to claim.detail to confirm the claim contains now two items', async() => {
- await page.accessToSection('claim.card.detail');
- await page.waitForSelector(selectors.claimDetail.claimDetailLine);
- const result = await page.countElement(selectors.claimDetail.claimDetailLine);
-
- expect(result).toEqual(2);
- });
-});
diff --git a/e2e/paths/08-route/03_create_and_clone.spec.js b/e2e/paths/08-route/03_create_and_clone.spec.js
index 0b8da98b4..31c0cfc18 100644
--- a/e2e/paths/08-route/03_create_and_clone.spec.js
+++ b/e2e/paths/08-route/03_create_and_clone.spec.js
@@ -26,7 +26,7 @@ describe('Route create path', () => {
await page.waitToClick(selectors.createRouteView.submitButton);
const message = await page.waitForSnackbar();
- expect(message.text).toContain('Access denied');
+ expect(message.text).toContain('Access Denied');
});
});
diff --git a/e2e/paths/09-invoice-out/01_summary.spec.js b/e2e/paths/09-invoice-out/01_summary.spec.js
index 728f0130a..09ac66ffc 100644
--- a/e2e/paths/09-invoice-out/01_summary.spec.js
+++ b/e2e/paths/09-invoice-out/01_summary.spec.js
@@ -28,7 +28,6 @@ describe('InvoiceOut summary path', () => {
it('should contain the tax breakdown', async() => {
const firstTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxOne, 'innerText');
-
const secondTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxTwo, 'innerText');
expect(firstTax).toContain('10%');
@@ -37,10 +36,9 @@ describe('InvoiceOut summary path', () => {
it('should contain the tickets info', async() => {
const firstTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketOne, 'innerText');
-
const secondTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketTwo, 'innerText');
expect(firstTicket).toContain('Bat cave');
- expect(secondTicket).toContain('Stark tower');
+ expect(secondTicket).toContain('Bat cave');
});
});
diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js
index 5abf8a65e..e6c601d7d 100644
--- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js
+++ b/e2e/paths/10-travel/02_basic_data_and_log.spec.js
@@ -22,7 +22,7 @@ describe('Travel basic data path', () => {
await page.waitForState('travel.card.basicData');
});
- it('should set a wrong delivery date then receive an error on submit', async() => {
+ it('should throw error if try move a travel with entries', async() => {
const lastMonth = Date.vnNew();
lastMonth.setMonth(lastMonth.getMonth() - 1);
@@ -30,6 +30,23 @@ describe('Travel basic data path', () => {
await page.waitToClick(selectors.travelBasicData.save);
const message = await page.waitForSnackbar();
+ expect(message.text).toContain('Cannot past travels with entries');
+ });
+
+ it('should set a wrong delivery date then receive an error on submit', async() => {
+ await page.loginAndModule('buyer', 'travel');
+ await page.write(selectors.travelIndex.generalSearchFilter, '4');
+ await page.keyboard.press('Enter');
+ await page.accessToSection('travel.card.basicData');
+ await page.waitForState('travel.card.basicData');
+
+ const lastMonth = Date.vnNew();
+ lastMonth.setMonth(lastMonth.getMonth() - 2);
+
+ await page.pickDate(selectors.travelBasicData.deliveryDate, lastMonth);
+ await page.waitToClick(selectors.travelBasicData.save);
+ const message = await page.waitForSnackbar();
+
expect(message.text).toContain('Landing cannot be lesser than shipment');
});
@@ -39,7 +56,7 @@ describe('Travel basic data path', () => {
await page.waitToClick(selectors.travelBasicData.undoChanges);
const result = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value');
- expect(result).toEqual('third travel');
+ expect(result).toEqual('fourth travel');
});
it('should now edit the whole form then save', async() => {
@@ -88,17 +105,4 @@ describe('Travel basic data path', () => {
it(`should check the received checkbox was saved even tho it doesn't make sense`, async() => {
await page.waitForClassPresent(selectors.travelBasicData.received, 'checked');
});
-
- it('should navigate to the travel logs', async() => {
- pending('https://redmine.verdnatura.es/issues/5455');
- await page.accessToSection('travel.card.log');
- await page.waitForState('travel.card.log');
- });
-
- it('should check the 1st log contains details from the changes made', async() => {
- pending('https://redmine.verdnatura.es/issues/5455');
- const result = await page.waitToGetProperty(selectors.travelLog.firstLogFirstTD, 'innerText');
-
- expect(result).toContain('new reference!');
- });
});
diff --git a/e2e/paths/14-account/06_accounts.spec.js b/e2e/paths/14-account/06_accounts.spec.js
index 83893e0cf..8bd6ea7d5 100644
--- a/e2e/paths/14-account/06_accounts.spec.js
+++ b/e2e/paths/14-account/06_accounts.spec.js
@@ -23,18 +23,6 @@ describe('Account Accounts path', () => {
expect(message.text).toContain('Roles synchronized!');
});
- it('should sync user', async() => {
- await page.waitToClick(selectors.accountAccounts.syncUser);
- await page.write(selectors.accountAccounts.syncUserName, 'sysadmin');
- await page.write(selectors.accountAccounts.syncUserPassword, 'nightmare');
-
- await page.waitToClick(selectors.accountAccounts.buttonAccept);
-
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('User synchronized!');
- });
-
it('should relogin', async() => {
await page.loginAndModule('sysadmin', 'account');
await page.accessToSection('account.accounts');
diff --git a/e2e/paths/14-account/08_samba.spec.js b/e2e/paths/14-account/08_samba.spec.js
index 6e7ef9bbf..a92344acb 100644
--- a/e2e/paths/14-account/08_samba.spec.js
+++ b/e2e/paths/14-account/08_samba.spec.js
@@ -20,8 +20,9 @@ describe('Account Samba path', () => {
await page.waitToClick(selectors.accountSamba.checkEnable);
await page.write(selectors.accountSamba.adDomain, '1234');
await page.write(selectors.accountSamba.adController, '1234');
- await page.write(selectors.accountSamba.adUser, 'nightmare');
- await page.write(selectors.accountSamba.adPassword, 'sysadmin');
+ await page.write(selectors.accountSamba.adUser, 'sysadmin');
+ await page.write(selectors.accountSamba.adPassword, 'nightmare');
+ await page.write(selectors.accountSamba.userDn, 'testDn');
await page.waitToClick(selectors.accountSamba.verifyCert);
await page.waitToClick(selectors.accountSamba.save);
diff --git a/front/core/components/treeview/index.spec.js b/front/core/components/treeview/index.spec.js
index 9277f3ee4..1979d517f 100644
--- a/front/core/components/treeview/index.spec.js
+++ b/front/core/components/treeview/index.spec.js
@@ -33,18 +33,6 @@ describe('Component vnTreeview', () => {
$element.remove();
});
- // See how to test DOM element in Jest
- xdescribe('undrop()', () => {
- it(`should reset all drop events and properties`, () => {
- controller.dropping = angular.element(``);
- jest.spyOn(controller.dropping.classList, 'remove');
-
- controller.undrop();
-
- expect(controller.dropping).toBeNull();
- });
- });
-
describe('dragOver()', () => {
it(`should set the dragClientY property`, () => {
const event = new Event('dragover');
diff --git a/front/core/directives/rule.js b/front/core/directives/rule.js
index f65efe176..34781c2aa 100644
--- a/front/core/directives/rule.js
+++ b/front/core/directives/rule.js
@@ -23,7 +23,6 @@ export function directive($translate, $window) {
let rule = $attrs.rule.split('.');
let modelName = rule.shift();
let fieldName = rule.shift();
-
let split = $attrs.ngModel.split('.');
if (!fieldName) fieldName = split.pop() || null;
if (!modelName) modelName = firstUpper(split.pop() || '');
diff --git a/front/core/locale/es.yml b/front/core/locale/es.yml
index 96c34d98c..17e955ff5 100644
--- a/front/core/locale/es.yml
+++ b/front/core/locale/es.yml
@@ -68,3 +68,4 @@ Load more results: Cargar más resultados
Send cau: Enviar cau
By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
ExplainReason: Explique el motivo por el que no deberia aparecer este fallo
+You already have the mailAlias: Ya tienes este alias de correo
diff --git a/front/core/services/locale/en.yml b/front/core/services/locale/en.yml
index 2be73e696..8eb8a6f0d 100644
--- a/front/core/services/locale/en.yml
+++ b/front/core/services/locale/en.yml
@@ -3,4 +3,4 @@ Could not contact the server: Could not contact the server, make sure you have a
Please enter your username: Please enter your username
It seems that the server has fall down: It seems that the server has fall down, wait a few minutes and try again
Session has expired: Your session has expired, please login again
-Access denied: Access denied
\ No newline at end of file
+Access Denied: Access Denied
\ No newline at end of file
diff --git a/front/core/services/locale/es.yml b/front/core/services/locale/es.yml
index e9811e38f..2c43ca3b2 100644
--- a/front/core/services/locale/es.yml
+++ b/front/core/services/locale/es.yml
@@ -3,5 +3,5 @@ Could not contact the server: No se ha podido contactar con el servidor, asegura
Please enter your username: Por favor introduce tu nombre de usuario
It seems that the server has fall down: Parece que el servidor se ha caído, espera unos minutos e inténtalo de nuevo
Session has expired: Tu sesión ha expirado, por favor vuelve a iniciar sesión
-Access denied: Acción no permitida
+Access Denied: Acción no permitida
Direction not found: Dirección no encontrada
diff --git a/front/core/services/token.js b/front/core/services/token.js
index 426fe2b73..c8cb4f6bb 100644
--- a/front/core/services/token.js
+++ b/front/core/services/token.js
@@ -82,7 +82,7 @@ export default class Token {
if (!data) return;
this.renewPeriod = data.renewPeriod;
this.stopRenewer();
- this.inservalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000);
+ this.intervalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000);
});
}
@@ -103,17 +103,13 @@ export default class Token {
const token = res.data;
this.set(token.id, now, token.ttl, this.remember);
})
- .catch(res => {
- if (res.data?.error?.code !== 'periodNotExceeded')
- throw res;
- })
.finally(() => {
this.checking = false;
});
}
stopRenewer() {
- clearInterval(this.inservalId);
+ clearInterval(this.intervalId);
}
}
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];
diff --git a/front/salix/locale/es.yml b/front/salix/locale/es.yml
index bed41c63b..044d0d043 100644
--- a/front/salix/locale/es.yml
+++ b/front/salix/locale/es.yml
@@ -18,6 +18,7 @@ Show summary: Mostrar vista previa
What is new: Novedades de la versión
Settings: Ajustes
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
+This ticket is locked: Este ticket está bloqueado
# Actions
diff --git a/front/salix/module.js b/front/salix/module.js
index f8fa0faf0..0ce855308 100644
--- a/front/salix/module.js
+++ b/front/salix/module.js
@@ -120,7 +120,7 @@ function $exceptionHandler(vnApp, $window, $state, $injector) {
messageT = 'Invalid login';
break;
case 403:
- messageT = 'Access denied';
+ messageT = exception.data?.error?.message || 'Access Denied';
break;
case 502:
messageT = 'It seems that the server has fall down';
diff --git a/loopback/common/methods/application/execute.js b/loopback/common/methods/application/execute.js
new file mode 100644
index 000000000..a468dcd70
--- /dev/null
+++ b/loopback/common/methods/application/execute.js
@@ -0,0 +1,28 @@
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.execute = async(ctx, type, query, params, options) => {
+ const userId = ctx.req.accessToken.userId;
+ const models = Self.app.models;
+ params = params ?? [];
+
+ const myOptions = {userId: ctx.req.accessToken.userId};
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ const chain = query.split(' ')[1];
+
+ const [canExecute] = await models.ProcsPriv.rawSql(
+ 'SELECT account.user_hasRoutinePriv(?,?,?)',
+ [type, chain, userId],
+ myOptions);
+
+ if (!Object.values(canExecute)[0]) throw new UserError(`You don't have enough privileges`, 'ACCESS_DENIED');
+
+ const argString = params.map(() => '?').join(',');
+
+ const response = await models.ProcsPriv.rawSql(query + `(${argString})`, params, myOptions);
+ if (!Array.isArray(response)) return;
+ return response[0];
+ };
+};
diff --git a/loopback/common/methods/application/executeFunc.js b/loopback/common/methods/application/executeFunc.js
new file mode 100644
index 000000000..a42fdae67
--- /dev/null
+++ b/loopback/common/methods/application/executeFunc.js
@@ -0,0 +1,41 @@
+module.exports = Self => {
+ Self.remoteMethodCtx('executeFunc', {
+ description: 'Return result of function',
+ accessType: 'EXECUTE',
+ accepts: [
+ {
+ arg: 'routine',
+ type: 'string',
+ description: 'The routine name',
+ required: true,
+ http: {source: 'path'}
+ },
+ {
+ arg: 'schema',
+ type: 'string',
+ description: 'The routine schema',
+ required: true,
+ },
+ {
+ arg: 'params',
+ type: ['any'],
+ description: 'The params array',
+ },
+ ],
+ returns: {
+ type: 'any',
+ root: true
+ },
+ http: {
+ path: `/:routine/execute-func`,
+ verb: 'POST'
+ }
+ });
+
+ Self.executeFunc = async(ctx, routine, schema, params, options) => {
+ const query = `SELECT ${schema}.${routine}`;
+
+ const response = await Self.execute(ctx, 'FUNCTION', query, params, options);
+ return Object.values(response)[0];
+ };
+};
diff --git a/loopback/common/methods/application/executeProc.js b/loopback/common/methods/application/executeProc.js
new file mode 100644
index 000000000..a8825da0f
--- /dev/null
+++ b/loopback/common/methods/application/executeProc.js
@@ -0,0 +1,39 @@
+module.exports = Self => {
+ Self.remoteMethodCtx('executeProc', {
+ description: 'Return result of procedure',
+ accessType: 'EXECUTE',
+ accepts: [
+ {
+ arg: 'routine',
+ type: 'string',
+ description: 'The routine name',
+ required: true,
+ http: {source: 'path'}
+ },
+ {
+ arg: 'schema',
+ type: 'string',
+ description: 'The routine schema',
+ required: true,
+ },
+ {
+ arg: 'params',
+ type: ['any'],
+ description: 'The params array',
+ },
+ ],
+ returns: {
+ type: 'any',
+ root: true
+ },
+ http: {
+ path: `/:routine/execute-proc`,
+ verb: 'POST'
+ }
+ });
+
+ Self.executeProc = async(ctx, routine, schema, params, options) => {
+ const query = `CALL ${schema}.${routine}`;
+ return Self.execute(ctx, 'PROCEDURE', query, params, options);
+ };
+};
diff --git a/loopback/common/methods/application/spec/execute.spec.js b/loopback/common/methods/application/spec/execute.spec.js
new file mode 100644
index 000000000..1a0a8ace9
--- /dev/null
+++ b/loopback/common/methods/application/spec/execute.spec.js
@@ -0,0 +1,161 @@
+const models = require('vn-loopback/server/server').models;
+
+describe('Application execute()/executeProc()/executeFunc()', () => {
+ const userWithoutPrivileges = 1;
+ const userWithPrivileges = 9;
+ const userWithInheritedPrivileges = 120;
+ let tx;
+
+ function getCtx(userId) {
+ return {
+ req: {
+ accessToken: {userId},
+ headers: {origin: 'http://localhost'}
+ }
+ };
+ }
+
+ beforeEach(async() => {
+ tx = await models.Application.beginTransaction({});
+ const options = {transaction: tx};
+
+ await models.Application.rawSql(`
+ CREATE OR REPLACE PROCEDURE vn.myProcedure(vMyParam INT)
+ BEGIN
+ SELECT vMyParam myParam, t.*
+ FROM ticket t
+ LIMIT 2;
+ END
+ `, null, options);
+
+ await models.Application.rawSql(`
+ CREATE OR REPLACE FUNCTION bs.myFunction(vMyParam INT) RETURNS int(11)
+ BEGIN
+ RETURN vMyParam;
+ END
+ `, null, options);
+
+ await models.Application.rawSql(`
+ GRANT EXECUTE ON PROCEDURE vn.myProcedure TO developer;
+ GRANT EXECUTE ON FUNCTION bs.myFunction TO developer;
+ `, null, options);
+ });
+
+ it('should throw error when execute procedure and not have privileges', async() => {
+ const ctx = getCtx(userWithoutPrivileges);
+
+ let error;
+ try {
+ const options = {transaction: tx};
+
+ await models.Application.execute(
+ ctx,
+ 'PROCEDURE',
+ 'CALL vn.myProcedure',
+ [1],
+ options
+ );
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error.message).toEqual(`You don't have enough privileges`);
+ });
+
+ it('should execute procedure and get data', async() => {
+ const ctx = getCtx(userWithPrivileges);
+ try {
+ const options = {transaction: tx};
+
+ const response = await models.Application.execute(
+ ctx,
+ 'PROCEDURE',
+ 'CALL vn.myProcedure',
+ [1],
+ options
+ );
+
+ expect(response.length).toEqual(2);
+ expect(response[0].myParam).toEqual(1);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ describe('Application executeProc()', () => {
+ it('should execute procedure and get data (executeProc)', async() => {
+ const ctx = getCtx(userWithPrivileges);
+ try {
+ const options = {transaction: tx};
+
+ const response = await models.Application.executeProc(
+ ctx,
+ 'myProcedure',
+ 'vn',
+ [1],
+ options
+ );
+
+ expect(response.length).toEqual(2);
+ expect(response[0].myParam).toEqual(1);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+ });
+
+ describe('Application executeFunc()', () => {
+ it('should execute function and get data', async() => {
+ const ctx = getCtx(userWithPrivileges);
+ try {
+ const options = {transaction: tx};
+
+ const response = await models.Application.executeFunc(
+ ctx,
+ 'myFunction',
+ 'bs',
+ [1],
+ options
+ );
+
+ expect(response).toEqual(1);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should execute function and get data with user with inherited privileges', async() => {
+ const ctx = getCtx(userWithInheritedPrivileges);
+ try {
+ const options = {transaction: tx};
+
+ const response = await models.Application.executeFunc(
+ ctx,
+ 'myFunction',
+ 'bs',
+ [1],
+ options
+ );
+
+ expect(response).toEqual(1);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+ });
+});
diff --git a/loopback/common/mixins/loggable.js b/loopback/common/mixins/loggable.js
new file mode 100644
index 000000000..760fdf60a
--- /dev/null
+++ b/loopback/common/mixins/loggable.js
@@ -0,0 +1,12 @@
+const LoopBackContext = require('loopback-context');
+async function handleObserve(ctx) {
+ ctx.options.httpCtx = LoopBackContext.getCurrentContext();
+}
+module.exports = function(Self) {
+ let Mixin = {
+ 'before save': handleObserve,
+ 'before delete': handleObserve,
+ };
+ for (const [listener, handler] of Object.entries(Mixin))
+ Self.observe(listener, handler);
+};
diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js
index 5e767fdc1..ac8ae78f0 100644
--- a/loopback/common/models/application.js
+++ b/loopback/common/models/application.js
@@ -2,4 +2,7 @@
module.exports = function(Self) {
require('../methods/application/status')(Self);
require('../methods/application/post')(Self);
+ require('../methods/application/execute')(Self);
+ require('../methods/application/executeProc')(Self);
+ require('../methods/application/executeFunc')(Self);
};
diff --git a/loopback/common/models/loggable.js b/loopback/common/models/loggable.js
deleted file mode 100644
index 360c84566..000000000
--- a/loopback/common/models/loggable.js
+++ /dev/null
@@ -1,15 +0,0 @@
-const LoopBackContext = require('loopback-context');
-
-module.exports = function(Self) {
- Self.setup = function() {
- Self.super_.setup.call(this);
- };
-
- Self.observe('before save', async function(ctx) {
- ctx.options.httpCtx = LoopBackContext.getCurrentContext();
- });
-
- Self.observe('before delete', async function(ctx) {
- ctx.options.httpCtx = LoopBackContext.getCurrentContext();
- });
-};
diff --git a/loopback/common/models/loggable.json b/loopback/common/models/loggable.json
deleted file mode 100644
index 9101532a3..000000000
--- a/loopback/common/models/loggable.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "Loggable",
- "base": "VnModel",
- "validateUpsert": true
-}
diff --git a/loopback/common/models/procs-priv.json b/loopback/common/models/procs-priv.json
new file mode 100644
index 000000000..25221d586
--- /dev/null
+++ b/loopback/common/models/procs-priv.json
@@ -0,0 +1,44 @@
+{
+ "name": "ProcsPriv",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "mysql.procs_priv"
+ }
+ },
+ "properties": {
+ "name": {
+ "id": 1,
+ "type": "string",
+ "mysql": {
+ "columnName": "Routine_name"
+ }
+ },
+ "schema": {
+ "id": 3,
+ "type": "string",
+ "mysql": {
+ "columnName": "Db"
+ }
+ },
+ "role": {
+ "type": "string",
+ "mysql": {
+ "columnName": "user"
+ }
+ },
+ "type": {
+ "id": 2,
+ "type": "string",
+ "mysql": {
+ "columnName": "Routine_type"
+ }
+ },
+ "host": {
+ "type": "string",
+ "mysql": {
+ "columnName": "Host"
+ }
+ }
+ }
+}
diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index 26650175d..568916bef 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -45,6 +45,7 @@
"Extension format is invalid": "Extension format is invalid",
"NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
"This client can't be invoiced": "This client can't be invoiced",
+ "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice",
"The introduced hour already exists": "The introduced hour already exists",
"Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket",
"Concept cannot be blank": "Concept cannot be blank",
@@ -68,8 +69,7 @@
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
- "Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
- "Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
+ "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*",
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
"Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
"Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",
@@ -178,12 +178,13 @@
"The renew period has not been exceeded": "The renew period has not been exceeded",
"You can not use the same password": "You can not use the same password",
"Valid priorities": "Valid priorities: %d",
- "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}",
+ "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}",
+ "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}",
"This ticket cannot be left empty.": "This ticket cannot be left empty. %s",
"Social name should be uppercase": "Social name should be uppercase",
"Street should be uppercase": "Street should be uppercase",
"You don't have enough privileges.": "You don't have enough privileges.",
- "This ticket is locked.": "This ticket is locked.",
+ "This ticket is locked": "This ticket is locked",
"This ticket is not editable.": "This ticket is not editable.",
"The ticket doesn't exist.": "The ticket doesn't exist.",
"The sales do not exists": "The sales do not exists",
@@ -196,6 +197,11 @@
"Negative basis of tickets: 23": "Negative basis of tickets: 23",
"Booking completed": "Booking complete",
"The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation",
- "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets"
-}
-
+ "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets",
+ "Try again": "Try again",
+ "keepPrice": "keepPrice",
+ "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
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index b42720458..5555ef8b0 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -72,6 +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",
"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",
@@ -135,8 +136,7 @@
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
- "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*",
- "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*",
+ "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",
@@ -224,7 +224,7 @@
"date in the future": "Fecha en el futuro",
"reference duplicated": "Referencia duplicada",
"This ticket is already a refund": "Este ticket ya es un abono",
- "isWithoutNegatives": "isWithoutNegatives",
+ "isWithoutNegatives": "Sin negativos",
"routeFk": "routeFk",
"Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
"No hay un contrato en vigor": "No hay un contrato en vigor",
@@ -305,14 +305,15 @@
"Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
"The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
"Valid priorities": "Prioridades válidas: %d",
- "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}",
+ "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
+ "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
"You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
"This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
"You don't have enough privileges.": "No tienes suficientes permisos.",
- "This ticket is locked.": "Este ticket está bloqueado.",
+ "This ticket is locked": "Este ticket está bloqueado.",
"This ticket is not editable.": "Este ticket no es editable.",
"The ticket doesn't exist.": "No existe el ticket.",
"Social name should be uppercase": "La razón social debe ir en mayúscula",
@@ -323,7 +324,17 @@
"The response is not a PDF": "La respuesta no es un PDF",
"Booking completed": "Reserva completada",
"The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
- "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mímina",
- "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mímina",
- "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada"
+ "Incoterms data for consignee is missing": "Faltan los datos de los Incoterms para el consignatario",
+ "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
+ "User disabled": "Usuario desactivado",
+ "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
+ "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
+ "Cannot past travels with entries": "No se pueden pasar envíos con entradas",
+ "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
+ "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
+ "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",
+ "No tickets to invoice": "No hay tickets para facturar"
}
diff --git a/loopback/server/boot/date.js b/loopback/server/boot/date.js
index 810745562..d592dc416 100644
--- a/loopback/server/boot/date.js
+++ b/loopback/server/boot/date.js
@@ -1,6 +1,5 @@
module.exports = () => {
- Date.vnUTC = () => {
- const env = process.env.NODE_ENV;
+ Date.vnUTC = (env = process.env.NODE_ENV) => {
if (!env || env === 'development')
return new Date(Date.UTC(2001, 0, 1, 11));
diff --git a/loopback/server/middleware.json b/loopback/server/middleware.json
index 31a2f113b..cfc693217 100644
--- a/loopback/server/middleware.json
+++ b/loopback/server/middleware.json
@@ -39,7 +39,7 @@
"./middleware/salix-version": {}
},
"parse": {
- "body-parser#json":{}
+ "body-parser#json":{}
},
"routes": {
"loopback#rest": {
diff --git a/loopback/server/model-config.json b/loopback/server/model-config.json
index 52b539f60..56b5360e8 100644
--- a/loopback/server/model-config.json
+++ b/loopback/server/model-config.json
@@ -25,20 +25,19 @@
"FieldAcl": {
"dataSource": "vn"
},
- "Role": {
- "dataSource": "vn",
- "options": {
- "mysql": {
- "table": "salix.Role"
- }
- }
- },
"RoleMapping": {
"dataSource": "vn",
"options": {
"mysql": {
"table": "salix.RoleMapping"
}
+ },
+ "relations": {
+ "role": {
+ "type": "belongsTo",
+ "model": "VnRole",
+ "foreignKey": "roleId"
+ }
}
},
"Schema": {
@@ -49,5 +48,13 @@
},
"Container": {
"dataSource": "vn"
+ },
+ "ProcsPriv": {
+ "dataSource": "vn",
+ "options": {
+ "mysql": {
+ "table": "mysql.procs_priv"
+ }
+ }
}
-}
\ No newline at end of file
+}
diff --git a/modules/account/back/methods/account-synchronizer/test.js b/modules/account/back/methods/account-linker/test.js
similarity index 59%
rename from modules/account/back/methods/account-synchronizer/test.js
rename to modules/account/back/methods/account-linker/test.js
index a77940168..990af2df8 100644
--- a/modules/account/back/methods/account-synchronizer/test.js
+++ b/modules/account/back/methods/account-linker/test.js
@@ -1,3 +1,4 @@
+const NotFoundError = require('vn-loopback/util/not-found-error');
module.exports = Self => {
Self.remoteMethod('test', {
@@ -9,7 +10,8 @@ module.exports = Self => {
});
Self.test = async function() {
- let connector = await Self.getSynchronizer();
+ const connector = await Self.getLinker();
+ if (!connector) throw new NotFoundError('Linker not configured');
await connector.test();
};
};
diff --git a/modules/account/back/methods/account/specs/change-password.spec.js b/modules/account/back/methods/account/specs/change-password.spec.js
index 2fa3010af..c79960212 100644
--- a/modules/account/back/methods/account/specs/change-password.spec.js
+++ b/modules/account/back/methods/account/specs/change-password.spec.js
@@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
describe('account changePassword()', () => {
const userId = 70;
- const unauthCtx = {
+ const unAuthCtx = {
req: {
headers: {},
connection: {
@@ -79,7 +79,7 @@ describe('account changePassword()', () => {
passExpired: yesterday
}
, options);
- await models.VnUser.signIn(unauthCtx, 'trainee', 'nightmare', options);
+ await models.VnUser.signIn(unAuthCtx, 'trainee', 'nightmare', options);
} catch (e) {
if (e.message != 'Pass expired')
throw e;
diff --git a/modules/account/back/methods/account/sync.js b/modules/account/back/methods/account/sync.js
index a5befc22c..1026c5020 100644
--- a/modules/account/back/methods/account/sync.js
+++ b/modules/account/back/methods/account/sync.js
@@ -1,3 +1,4 @@
+const ForbiddenError = require('vn-loopback/util/forbiddenError');
module.exports = Self => {
Self.remoteMethod('sync', {
@@ -25,21 +26,46 @@ module.exports = Self => {
});
Self.sync = async function(userName, password, force, options) {
+ const models = Self.app.models;
const myOptions = {};
-
+ let tx;
+
if (typeof options == 'object')
Object.assign(myOptions, options);
- const models = Self.app.models;
- const user = await models.VnUser.findOne({
- fields: ['id'],
- where: {name: userName}
- }, myOptions);
- const isSync = !await models.UserSync.exists(userName, myOptions);
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ };
- if (!force && isSync && user) return;
- await models.AccountConfig.syncUser(userName, password);
- await models.UserSync.destroyById(userName, myOptions);
+ try {
+ const user = await models.VnUser.findOne({
+ fields: ['id', 'password'],
+ where: {name: userName}
+ }, myOptions);
+
+ if (user && password && !await user.hasPassword(password))
+ throw new ForbiddenError('Wrong password');
+
+ const isSync = !await models.UserSync.exists(userName, myOptions);
+
+ if (!force && isSync && user) {
+ if (tx) await tx.rollback();
+ return;
+ }
+
+ await Self.rawSql(`
+ SELECT id
+ FROM account.user
+ WHERE id = ?
+ FOR UPDATE`, [user.id], myOptions);
+
+ await models.AccountConfig.syncUser(userName, password);
+ await models.UserSync.destroyById(userName, myOptions);
+ if (tx) await tx.commit();
+ } catch (err) {
+ if (tx) await tx.rollback();
+ throw err;
+ }
};
};
-
diff --git a/modules/account/back/mixins/account-synchronizer.js b/modules/account/back/mixins/account-linker.js
similarity index 85%
rename from modules/account/back/mixins/account-synchronizer.js
rename to modules/account/back/mixins/account-linker.js
index 8ba8bfe9d..c882d0893 100644
--- a/modules/account/back/mixins/account-synchronizer.js
+++ b/modules/account/back/mixins/account-linker.js
@@ -3,14 +3,14 @@ const app = require('vn-loopback/server/server');
const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self, options) {
- require('../methods/account-synchronizer/test')(Self);
+ require('../methods/account-linker/test')(Self);
Self.once('attached', function() {
- app.models.AccountConfig.addSynchronizer(Self);
+ app.models.AccountConfig.addLinker(Self);
});
/**
- * Mixin for user synchronizers.
+ * Mixin for account linkers.
*
* @property {Array} $
* @property {Object} accountConfig
@@ -18,12 +18,12 @@ module.exports = function(Self, options) {
*/
let Mixin = {
/**
- * Initalizes the synchronizer.
+ * Initalizes the linker.
*/
async init() {},
/**
- * Deinitalizes the synchronizer.
+ * Deinitalizes the linker.
*/
async deinit() {},
@@ -57,7 +57,7 @@ module.exports = function(Self, options) {
async syncRoles() {},
/**
- * Tests synchronizer configuration.
+ * Tests linker configuration.
*/
async test() {
try {
diff --git a/modules/account/back/model-config.json b/modules/account/back/model-config.json
index a4eb9fa57..0cd43d0ce 100644
--- a/modules/account/back/model-config.json
+++ b/modules/account/back/model-config.json
@@ -14,6 +14,9 @@
"MailAliasAccount": {
"dataSource": "vn"
},
+ "MailAliasAcl": {
+ "dataSource": "vn"
+ },
"MailConfig": {
"dataSource": "vn"
},
@@ -35,6 +38,9 @@
"SambaConfig": {
"dataSource": "vn"
},
+ "SignInLog": {
+ "dataSource": "vn"
+ },
"Sip": {
"dataSource": "vn"
},
diff --git a/modules/account/back/models/account-config.js b/modules/account/back/models/account-config.js
index 0db699b99..2cc6b240d 100644
--- a/modules/account/back/models/account-config.js
+++ b/modules/account/back/models/account-config.js
@@ -3,94 +3,85 @@ const models = require('vn-loopback/server/server').models;
module.exports = Self => {
Object.assign(Self, {
- synchronizers: [],
+ linkers: [],
- addSynchronizer(synchronizer) {
- this.synchronizers.push(synchronizer);
+ addLinker(linker) {
+ this.linkers.push(linker);
},
- async getInstance() {
- let instance = await Self.findOne({
+ async initEngine() {
+ const accountConfig = await Self.findOne({
fields: ['homedir', 'shell', 'idBase']
});
- await instance.synchronizerInit();
- return instance;
+ const mailConfig = await models.MailConfig.findOne({
+ fields: ['domain']
+ });
+
+ const linkers = [];
+
+ for (const Linker of Self.linkers) {
+ const linker = await Linker.getLinker();
+ if (!linker) continue;
+ Object.assign(linker, {accountConfig});
+ await linker.init();
+ linkers.push(linker);
+ }
+
+ Object.assign(accountConfig, {
+ linkers,
+ domain: mailConfig.domain
+ });
+
+ return {
+ accountConfig,
+ linkers
+ };
+ },
+
+ async deinitEngine(engine) {
+ for (const linker of engine.linkers)
+ await linker.deinit();
+ },
+
+ async syncUser(userName, password) {
+ const engine = await Self.initEngine();
+ try {
+ await Self.syncUserBase(engine, userName, password, true);
+ } finally {
+ await Self.deinitEngine(engine);
+ }
},
async syncUsers() {
- let instance = await Self.getInstance();
+ const engine = await Self.initEngine();
+
+ let usersToSync = new Set();
+ for (const linker of engine.linkers)
+ await linker.getUsers(usersToSync);
- let usersToSync = await instance.synchronizerGetUsers();
usersToSync = Array.from(usersToSync.values())
.sort((a, b) => a.localeCompare(b));
for (let userName of usersToSync) {
try {
+ // eslint-disable-next-line no-console
console.log(`Synchronizing user '${userName}'`);
- await instance.synchronizerSyncUser(userName);
+
+ await Self.syncUserBase(engine, userName);
+
+ // eslint-disable-next-line no-console
console.log(` -> User '${userName}' sinchronized`);
} catch (err) {
+ // eslint-disable-next-line no-console
console.error(` -> User '${userName}' synchronization error:`, err.message);
}
}
- await instance.synchronizerDeinit();
+ await Self.deinitEngine(engine);
await Self.syncRoles();
},
- async syncUser(userName, password) {
- let instance = await Self.getInstance();
- try {
- await instance.synchronizerSyncUser(userName, password, true);
- } finally {
- await instance.synchronizerDeinit();
- }
- },
-
- async syncRoles() {
- let instance = await Self.getInstance();
- try {
- await instance.synchronizerSyncRoles();
- } finally {
- await instance.synchronizerDeinit();
- }
- },
-
- async getSynchronizer() {
- return await Self.findOne();
- }
- });
-
- Object.assign(Self.prototype, {
- async synchronizerInit() {
- let mailConfig = await models.MailConfig.findOne({
- fields: ['domain']
- });
-
- let synchronizers = [];
-
- for (let Synchronizer of Self.synchronizers) {
- let synchronizer = await Synchronizer.getSynchronizer();
- if (!synchronizer) continue;
- Object.assign(synchronizer, {
- accountConfig: this
- });
- await synchronizer.init();
- synchronizers.push(synchronizer);
- }
-
- Object.assign(this, {
- synchronizers,
- domain: mailConfig.domain
- });
- },
-
- async synchronizerDeinit() {
- for (let synchronizer of this.synchronizers)
- await synchronizer.deinit();
- },
-
- async synchronizerSyncUser(userName, password, syncGroups) {
+ async syncUserBase(engine, userName, password, syncGroups) {
if (!userName) return;
userName = userName.toLowerCase();
@@ -98,7 +89,7 @@ module.exports = Self => {
if (['administrator', 'root'].indexOf(userName) >= 0)
return;
- let user = await models.VnUser.findOne({
+ const user = await models.VnUser.findOne({
where: {name: userName},
fields: [
'id',
@@ -130,27 +121,28 @@ module.exports = Self => {
]
});
- let info = {
+ const info = {
user,
hasAccount: false
};
if (user) {
- let exists = await models.Account.exists(user.id);
+ const exists = await models.Account.exists(user.id);
+ const {accountConfig} = engine;
Object.assign(info, {
hasAccount: user.active && exists,
- corporateMail: `${userName}@${this.domain}`,
- uidNumber: this.idBase + user.id
+ corporateMail: `${userName}@${accountConfig.domain}`,
+ uidNumber: accountConfig.idBase + user.id
});
}
- let errs = [];
+ const errs = [];
- for (let synchronizer of this.synchronizers) {
+ for (const linker of engine.linkers) {
try {
- await synchronizer.syncUser(userName, info, password);
+ await linker.syncUser(userName, info, password);
if (syncGroups)
- await synchronizer.syncUserGroups(userName, info);
+ await linker.syncUserGroups(userName, info);
} catch (err) {
errs.push(err);
}
@@ -159,18 +151,16 @@ module.exports = Self => {
if (errs.length) throw errs[0];
},
- async synchronizerGetUsers() {
- let usersToSync = new Set();
+ async syncRoles() {
+ const engine = await Self.initEngine();
+ try {
+ await Self.rawSql(`CALL account.role_sync`);
- for (let synchronizer of this.synchronizers)
- await synchronizer.getUsers(usersToSync);
-
- return usersToSync;
- },
-
- async synchronizerSyncRoles() {
- for (let synchronizer of this.synchronizers)
- await synchronizer.syncRoles();
+ for (const linker of engine.linkers)
+ await linker.syncRoles();
+ } finally {
+ await Self.deinitEngine(engine);
+ }
}
});
};
diff --git a/modules/account/back/models/account.json b/modules/account/back/models/account.json
index 3c22521cb..6c2784696 100644
--- a/modules/account/back/models/account.json
+++ b/modules/account/back/models/account.json
@@ -1,49 +1,49 @@
{
- "name": "Account",
- "base": "VnModel",
- "options": {
- "mysql": {
- "table": "account.account"
- }
- },
- "properties": {
- "id": {
- "id": true
- }
- },
- "relations": {
- "user": {
- "type": "belongsTo",
- "model": "VnUser",
- "foreignKey": "id"
- },
- "aliases": {
- "type": "hasMany",
- "model": "MailAliasAccount",
- "foreignKey": "account"
- }
- },
- "acls": [
- {
- "property": "login",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$everyone",
- "permission": "ALLOW"
+ "name": "Account",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "account.account"
+ }
+ },
+ "properties": {
+ "id": {
+ "id": true
+ }
+ },
+ "relations": {
+ "user": {
+ "type": "belongsTo",
+ "model": "VnUser",
+ "foreignKey": "id"
},
- {
+ "aliases": {
+ "type": "hasMany",
+ "model": "MailAliasAccount",
+ "foreignKey": "account"
+ }
+ },
+ "acls": [
+ {
+ "property": "login",
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ },
+ {
"property": "logout",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$authenticated",
- "permission": "ALLOW"
- },
- {
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$authenticated",
+ "permission": "ALLOW"
+ },
+ {
"property": "changePassword",
- "accessType": "EXECUTE",
- "principalType": "ROLE",
- "principalId": "$everyone",
- "permission": "ALLOW"
- }
- ]
+ "accessType": "EXECUTE",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ }
+ ]
}
diff --git a/modules/account/back/models/ldap-config.js b/modules/account/back/models/ldap-config.js
index f9ae7562b..89f0add48 100644
--- a/modules/account/back/models/ldap-config.js
+++ b/modules/account/back/models/ldap-config.js
@@ -5,9 +5,9 @@ const crypto = require('crypto');
const nthash = require('smbhash').nthash;
module.exports = Self => {
- const shouldSync = process.env.NODE_ENV === 'production';
+ const shouldSync = process.env.NODE_ENV !== 'test';
- Self.getSynchronizer = async function() {
+ Self.getLinker = async function() {
return await Self.findOne({
fields: [
'server',
@@ -24,6 +24,7 @@ module.exports = Self => {
this.client = ldap.createClient({
url: this.server
});
+ this.client.on('error', () => {});
await this.client.bind(this.rdn, this.password);
},
@@ -140,6 +141,7 @@ module.exports = Self => {
try {
if (shouldSync)
await client.del(dn);
+ // eslint-disable-next-line no-console
console.log(` -> User '${userName}' removed from LDAP`);
} catch (e) {
if (e.name !== 'NoSuchObjectError') throw e;
@@ -237,7 +239,7 @@ module.exports = Self => {
// Prepare data
- let roles = await $.Role.find({
+ let roles = await $.VnRole.find({
fields: ['id', 'name', 'description']
});
let roleRoles = await $.RoleRole.find({
diff --git a/modules/account/back/models/ldap-config.json b/modules/account/back/models/ldap-config.json
index 2fd5aa901..d4d3a094d 100644
--- a/modules/account/back/models/ldap-config.json
+++ b/modules/account/back/models/ldap-config.json
@@ -7,7 +7,7 @@
}
},
"mixins": {
- "AccountSynchronizer": {}
+ "AccountLinker": {}
},
"properties": {
"id": {
diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js
index 6f5213f24..5eb561408 100644
--- a/modules/account/back/models/mail-alias-account.js
+++ b/modules/account/back/models/mail-alias-account.js
@@ -2,54 +2,44 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
+ Self.rewriteDbError(function(err) {
+ if (err.code === 'ER_DUP_ENTRY')
+ return new UserError(`You already have the mailAlias`);
+ return err;
+ });
+
Self.observe('before save', async ctx => {
const changes = ctx.currentInstance || ctx.instance;
- await Self.hasGrant(ctx, changes.mailAlias);
+ await checkModifyPermission(ctx, changes.mailAlias);
});
Self.observe('before delete', async ctx => {
const mailAliasAccount = await Self.findById(ctx.where.id);
- await Self.hasGrant(ctx, mailAliasAccount.mailAlias);
+ await checkModifyPermission(ctx, mailAliasAccount.mailAlias);
});
- /**
- * Checks if current user has
- * grant to add/remove alias
- *
- * @param {Object} ctx - Request context
- * @param {Interger} mailAlias - mailAlias id
- * @return {Boolean} True for user with grant
- */
- Self.hasGrant = async function(ctx, mailAlias) {
+ async function checkModifyPermission(ctx, mailAliasFk) {
+ const userId = ctx.options.accessToken.userId;
const models = Self.app.models;
- const accessToken = {req: {accessToken: ctx.options.accessToken}};
- const userId = accessToken.req.accessToken.userId;
- const canEditAlias = await models.ACL.checkAccessAcl(accessToken, 'MailAliasAccount', 'canEditAlias', 'WRITE');
- if (canEditAlias) return true;
+ const roles = await models.RoleMapping.find({
+ fields: ['roleId'],
+ where: {principalId: userId}
+ });
- const user = await models.VnUser.findById(userId, {fields: ['hasGrant']});
- if (!user.hasGrant)
- throw new UserError(`You don't have grant privilege`);
-
- const account = await models.Account.findById(userId, {
- fields: ['id'],
- include: {
- relation: 'aliases',
- scope: {
- fields: ['mailAlias']
- }
+ const availableMailAlias = await models.MailAliasAcl.findOne({
+ fields: ['mailAliasFk'],
+ include: {relation: 'mailAlias'},
+ where: {
+ roleFk: {
+ inq: roles.map(role => role.roleId),
+ },
+ mailAliasFk
}
});
- const aliases = account.aliases().map(alias => alias.mailAlias);
-
- const hasAlias = aliases.includes(mailAlias);
- if (!hasAlias)
- throw new UserError(`You cannot assign/remove an alias that you are not assigned to`);
-
- return true;
- };
+ if (!availableMailAlias) throw new UserError('The alias cant be modified');
+ }
};
diff --git a/modules/account/back/models/mail-alias-acl.json b/modules/account/back/models/mail-alias-acl.json
new file mode 100644
index 000000000..014b95d14
--- /dev/null
+++ b/modules/account/back/models/mail-alias-acl.json
@@ -0,0 +1,31 @@
+{
+ "name": "MailAliasAcl",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "account.mailAliasAcl"
+ }
+ },
+ "properties": {
+ "mailAliasFk": {
+ "id": true,
+ "type": "number"
+ },
+ "roleFk": {
+ "id": true,
+ "type": "number"
+ }
+ },
+ "relations": {
+ "mailAlias": {
+ "type": "belongsTo",
+ "model": "MailAlias",
+ "foreignKey": "mailAliasFk"
+ },
+ "role": {
+ "type": "belongsTo",
+ "model": "Role",
+ "foreignKey": "roleFk"
+ }
+ }
+}
diff --git a/modules/account/back/models/role-config.js b/modules/account/back/models/role-config.js
index ba7bf9d52..d6c57b70b 100644
--- a/modules/account/back/models/role-config.js
+++ b/modules/account/back/models/role-config.js
@@ -1,6 +1,6 @@
module.exports = Self => {
- Self.getSynchronizer = async function() {
+ Self.getLinker = async function() {
let NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV || NODE_ENV == 'development')
return null;
@@ -27,8 +27,7 @@ module.exports = Self => {
const [row] = await Self.rawSql(
`SELECT COUNT(*) AS nRows
FROM mysql.user
- WHERE User = ?
- AND Host = ?`,
+ WHERE User = ? AND Host = ?`,
[mysqlUser, this.userHost]
);
let userExists = row.nRows > 0;
@@ -38,8 +37,7 @@ module.exports = Self => {
const [row] = await Self.rawSql(
`SELECT Priv AS priv
FROM mysql.global_priv
- WHERE User = ?
- AND Host = ?`,
+ WHERE User = ? AND Host = ?`,
[mysqlUser, this.userHost]
);
const priv = row && JSON.parse(row.priv);
@@ -47,6 +45,7 @@ module.exports = Self => {
}
if (!isUpdatable) {
+ // eslint-disable-next-line no-console
console.warn(`RoleConfig.syncUser(): User '${userName}' cannot be updated, not managed by me`);
return;
}
@@ -84,14 +83,23 @@ module.exports = Self => {
[mysqlUser, this.userHost]);
} catch (err) {
if (err.code == 'ER_REVOKE_GRANTS')
+ // eslint-disable-next-line no-console
console.warn(`${err.code}: ${err.sqlMessage}: ${err.sql}`);
else
throw err;
}
- await Self.rawSql('GRANT ? TO ?@?',
- [role, mysqlUser, this.userHost]);
- if (role) {
+ const [row] = await Self.rawSql(
+ `SELECT COUNT(*) AS nRows
+ FROM mysql.user
+ WHERE User = ? AND Host = ''`,
+ [role]
+ );
+ const roleExists = row.nRows > 0;
+
+ if (roleExists) {
+ await Self.rawSql('GRANT ? TO ?@?',
+ [role, mysqlUser, this.userHost]);
await Self.rawSql('SET DEFAULT ROLE ? FOR ?@?',
[role, mysqlUser, this.userHost]);
} else {
diff --git a/modules/account/back/models/role-config.json b/modules/account/back/models/role-config.json
index f4138bea8..3b843eaea 100644
--- a/modules/account/back/models/role-config.json
+++ b/modules/account/back/models/role-config.json
@@ -7,7 +7,7 @@
}
},
"mixins": {
- "AccountSynchronizer": {}
+ "AccountLinker": {}
},
"properties": {
"id": {
diff --git a/modules/account/back/models/role-inherit.js b/modules/account/back/models/role-inherit.js
index 7d31e62b1..e994f844e 100644
--- a/modules/account/back/models/role-inherit.js
+++ b/modules/account/back/models/role-inherit.js
@@ -9,7 +9,7 @@ module.exports = Self => {
Self.observe(hook, async() => {
try {
await Self.rawSql(`
- CREATE EVENT account.role_sync
+ CREATE DEFINER = CURRENT_ROLE EVENT account.role_sync
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 5 SECOND
DO CALL role_sync;
`);
diff --git a/modules/account/back/models/role-inherit.json b/modules/account/back/models/role-inherit.json
index 4b69ffdc2..a89f47b77 100644
--- a/modules/account/back/models/role-inherit.json
+++ b/modules/account/back/models/role-inherit.json
@@ -15,12 +15,12 @@
"relations": {
"owner": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "role"
},
"inherits": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "inheritsFrom"
}
}
diff --git a/modules/account/back/models/role-role.json b/modules/account/back/models/role-role.json
index 77df7a920..e59351c59 100644
--- a/modules/account/back/models/role-role.json
+++ b/modules/account/back/models/role-role.json
@@ -14,12 +14,12 @@
"relations": {
"owner": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "role"
},
"inherits": {
"type": "belongsTo",
- "model": "Role",
+ "model": "VnRole",
"foreignKey": "inheritsFrom"
}
}
diff --git a/modules/account/back/models/samba-config.js b/modules/account/back/models/samba-config.js
index 168b5ffb4..927510a29 100644
--- a/modules/account/back/models/samba-config.js
+++ b/modules/account/back/models/samba-config.js
@@ -1,17 +1,20 @@
const ldap = require('../util/ldapjs-extra');
-const ssh = require('node-ssh');
+const execFile = require('child_process').execFile;
/**
* Summary of userAccountControl flags:
* https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties
*/
const UserAccountControlFlags = {
- ACCOUNTDISABLE: 2
+ ACCOUNTDISABLE: 0x2,
+ DONT_EXPIRE_PASSWD: 0x10000
};
module.exports = Self => {
- Self.getSynchronizer = async function() {
+ const shouldSync = process.env.NODE_ENV !== 'test';
+
+ Self.getLinker = async function() {
return await Self.findOne({
fields: [
'host',
@@ -19,6 +22,7 @@ module.exports = Self => {
'adController',
'adUser',
'adPassword',
+ 'userDn',
'verifyCert'
]
});
@@ -26,88 +30,125 @@ module.exports = Self => {
Object.assign(Self.prototype, {
async init() {
- let sshClient = new ssh.NodeSSH();
- await sshClient.connect({
- host: this.adController,
- username: this.adUser,
- password: this.adPassword
- });
+ const baseDn = this.adDomain
+ .split('.')
+ .map(part => `dc=${part}`)
+ .join(',');
+ const bindDn = `cn=${this.adUser},cn=Users,${baseDn}`;
- let adUser = `cn=${this.adUser},${this.usersDn()}`;
-
- let adClient = ldap.createClient({
+ const adClient = ldap.createClient({
url: `ldaps://${this.adController}:636`,
tlsOptions: {rejectUnauthorized: this.verifyCert}
});
- await adClient.bind(adUser, this.adPassword);
-
+ adClient.on('error', () => {});
+ await adClient.bind(bindDn, this.adPassword);
Object.assign(this, {
- sshClient,
- adClient
+ adClient,
+ fullUsersDn: `${this.userDn},${baseDn}`,
+ bindDn
});
},
async deinit() {
- await this.sshClient.dispose();
await this.adClient.unbind();
},
- usersDn() {
- let dnBase = this.adDomain
- .split('.')
- .map(part => `dc=${part}`)
- .join(',');
- return `cn=Users,${dnBase}`;
+ async sambaTool(command, args = []) {
+ let authArgs = [
+ '--URL', `ldaps://${this.adController}`,
+ '--simple-bind-dn', this.bindDn,
+ '--password', this.adPassword
+ ];
+ if (!this.verifyCert)
+ authArgs.push('--option', 'tls verify peer = no_check');
+
+ const allArgs = [command].concat(
+ args, authArgs
+ );
+
+ if (!shouldSync) return;
+ return await new Promise((resolve, reject) => {
+ execFile('samba-tool', allArgs, (err, stdout, stderr) => {
+ if (err)
+ reject(err);
+ else
+ resolve({stdout, stderr});
+ });
+ });
},
- async syncUser(userName, info, password) {
- let {sshClient} = this;
-
- let sambaUser = await this.adClient.searchOne(this.usersDn(), {
+ async getAdUser(userName) {
+ const sambaUser = await this.adClient.searchOne(this.fullUsersDn, {
scope: 'sub',
- attributes: ['userAccountControl'],
+ attributes: [
+ 'dn',
+ 'userAccountControl',
+ 'uidNumber',
+ 'accountExpires',
+ 'mail'
+ ],
filter: `(&(objectClass=user)(sAMAccountName=${userName}))`
});
- let isEnabled = sambaUser
- && !(sambaUser.userAccountControl & UserAccountControlFlags.ACCOUNTDISABLE);
-
- if (process.env.NODE_ENV === 'test')
- return;
+ if (sambaUser) {
+ for (const intProp of ['uidNumber', 'userAccountControl']) {
+ if (sambaUser[intProp] != null)
+ sambaUser[intProp] = parseInt(sambaUser[intProp]);
+ }
+ }
+ return sambaUser;
+ },
+
+ async syncUser(userName, info, password) {
+ let sambaUser = await this.getAdUser(userName);
+ let entry;
if (info.hasAccount) {
if (!sambaUser) {
- await sshClient.exec('samba-tool user create', [
- userName,
- '--uid-number', `${info.uidNumber}`,
- '--mail-address', info.corporateMail,
+ await this.sambaTool('user', [
+ 'create', userName,
+ '--userou', this.userDn,
'--random-password'
]);
- await sshClient.exec('samba-tool user setexpiry', [
- userName,
- '--noexpiry'
- ]);
- await sshClient.exec('mkhomedir_helper', [
- userName,
- '0027'
- ]);
- }
- if (!isEnabled) {
- await sshClient.exec('samba-tool user enable', [
- userName
- ]);
+ sambaUser = await this.getAdUser(userName);
}
if (password) {
- await sshClient.exec('samba-tool user setpassword', [
- userName,
+ await this.sambaTool('user', [
+ 'setpassword', userName,
'--newpassword', password
]);
}
- } else if (isEnabled) {
- await sshClient.exec('samba-tool user disable', [
- userName
- ]);
+
+ entry = {
+ userAccountControl: (sambaUser.userAccountControl
+ | UserAccountControlFlags.DONT_EXPIRE_PASSWD)
+ & ~UserAccountControlFlags.ACCOUNTDISABLE,
+ uidNumber: info.uidNumber,
+ accountExpires: 0,
+ mail: info.corporateMail
+ };
+ } else if (sambaUser) {
+ entry = {
+ userAccountControl: sambaUser.userAccountControl
+ | UserAccountControlFlags.ACCOUNTDISABLE
+ };
+ // eslint-disable-next-line no-console
console.log(` -> User '${userName}' disabled on Samba`);
}
+
+ if (sambaUser && entry) {
+ const changes = [];
+ for (const prop in entry) {
+ if (sambaUser[prop] == entry[prop]) continue;
+ changes.push(new ldap.Change({
+ operation: 'replace',
+ modification: {
+ [prop]: entry[prop]
+ }
+ }));
+ }
+ if (changes.length && shouldSync)
+ await this.adClient.modify(sambaUser.dn, changes);
+ }
},
/**
@@ -117,14 +158,15 @@ module.exports = Self => {
*/
async getUsers(usersToSync) {
const LDAP_MATCHING_RULE_BIT_AND = '1.2.840.113556.1.4.803';
- let filter = `!(userAccountControl:${LDAP_MATCHING_RULE_BIT_AND}:=${UserAccountControlFlags.ACCOUNTDISABLE})`;
+ const filter = `!(userAccountControl:${LDAP_MATCHING_RULE_BIT_AND}`
+ + `:=${UserAccountControlFlags.ACCOUNTDISABLE})`;
- let opts = {
+ const opts = {
scope: 'sub',
attributes: ['sAMAccountName'],
filter: `(&(objectClass=user)(${filter}))`
};
- await this.adClient.searchForeach(this.usersDn(), opts,
+ await this.adClient.searchForeach(this.fullUsersDn, opts,
o => usersToSync.add(o.sAMAccountName));
}
});
diff --git a/modules/account/back/models/samba-config.json b/modules/account/back/models/samba-config.json
index 732c9b071..4c9e0a794 100644
--- a/modules/account/back/models/samba-config.json
+++ b/modules/account/back/models/samba-config.json
@@ -7,7 +7,7 @@
}
},
"mixins": {
- "AccountSynchronizer": {}
+ "AccountLinker": {}
},
"properties": {
"id": {
@@ -28,6 +28,10 @@
"adPassword": {
"type": "string"
},
+ "userDn": {
+ "type": "string",
+ "required": true
+ },
"verifyCert": {
"type": "boolean"
}
diff --git a/modules/account/back/models/sign_in-log.json b/modules/account/back/models/sign_in-log.json
new file mode 100644
index 000000000..8656e92dc
--- /dev/null
+++ b/modules/account/back/models/sign_in-log.json
@@ -0,0 +1,49 @@
+{
+ "name": "SignInLog",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "account.signInLog"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "token": {
+ "required": true,
+ "type": "string",
+ "description": "Token's user"
+ },
+ "creationDate": {
+ "type": "date"
+ },
+ "userFk": {
+ "required": true,
+ "type": "number"
+ },
+ "ip": {
+ "type": "string"
+ },
+ "userName": {
+ "type": "string"
+ },
+ "owner": {
+ "type": "boolean",
+ "required": true,
+ "default": true
+ }
+ },
+ "relations": {
+ "user": {
+ "type": "belongsTo",
+ "model": "VnUser",
+ "foreignKey": "userFk"
+ }
+ },
+ "scope": {
+ "order": ["creationDate DESC", "id DESC"]
+ }
+}
diff --git a/modules/account/back/models/sip-config.js b/modules/account/back/models/sip-config.js
index 3b5cb2dbb..703783337 100644
--- a/modules/account/back/models/sip-config.js
+++ b/modules/account/back/models/sip-config.js
@@ -2,7 +2,7 @@
const app = require('vn-loopback/server/server');
module.exports = Self => {
- Self.getSynchronizer = async function() {
+ Self.getLinker = async function() {
return await Self.findOne({fields: ['id']});
};
diff --git a/modules/account/back/models/sip-config.json b/modules/account/back/models/sip-config.json
index 6c5ba3db3..a25d09c67 100644
--- a/modules/account/back/models/sip-config.json
+++ b/modules/account/back/models/sip-config.json
@@ -7,7 +7,7 @@
}
},
"mixins": {
- "AccountSynchronizer": {}
+ "AccountLinker": {}
},
"properties": {
"id": {
@@ -16,4 +16,3 @@
}
}
}
-
\ No newline at end of file
diff --git a/modules/account/front/accounts/index.html b/modules/account/front/accounts/index.html
index 6941bb15b..6847e68d1 100644
--- a/modules/account/front/accounts/index.html
+++ b/modules/account/front/accounts/index.html
@@ -12,40 +12,40 @@
@@ -61,10 +61,6 @@
label="Synchronize all"
ng-click="$ctrl.onSynchronizeAll()">
-
-
@@ -77,25 +73,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/account/front/accounts/index.js b/modules/account/front/accounts/index.js
index 0e78ab8d6..ab19126a1 100644
--- a/modules/account/front/accounts/index.js
+++ b/modules/account/front/accounts/index.js
@@ -1,6 +1,5 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-import UserError from 'core/lib/user-error';
export default class Controller extends Section {
onSynchronizeAll() {
@@ -8,27 +7,10 @@ export default class Controller extends Section {
this.$http.patch(`Accounts/syncAll`);
}
- onUserSync() {
- if (!this.syncUser)
- throw new UserError('Please enter the username');
-
- let params = {
- password: this.syncPassword,
- force: true
- };
- return this.$http.patch(`Accounts/${this.syncUser}/sync`, params)
- .then(() => this.vnApp.showSuccess(this.$t('User synchronized!')));
- }
-
onSynchronizeRoles() {
this.$http.patch(`RoleInherits/sync`)
.then(() => this.vnApp.showSuccess(this.$t('Roles synchronized!')));
}
-
- onSyncClose() {
- this.syncUser = '';
- this.syncPassword = '';
- }
}
ngModule.component('vnAccountAccounts', {
diff --git a/modules/account/front/accounts/locale/es.yml b/modules/account/front/accounts/locale/es.yml
index 9a6bb5073..614ade3eb 100644
--- a/modules/account/front/accounts/locale/es.yml
+++ b/modules/account/front/accounts/locale/es.yml
@@ -3,7 +3,6 @@ Homedir base: Directorio base para carpetas de usuario
Shell: Intérprete de línea de comandos
User and role base id: Id base usuarios y roles
Synchronize all: Sincronizar todo
-Synchronize user: Sincronizar usuario
Synchronize roles: Sincronizar roles
If password is not specified, just user attributes are synchronized: >-
Si la contraseña no se especifica solo se sincronizarán lo atributos del usuario
@@ -12,5 +11,4 @@ Users synchronized!: ¡Usuarios sincronizados!
Username: Nombre de usuario
Synchronize: Sincronizar
Please enter the username: Por favor introduce el nombre de usuario
-User synchronized!: ¡Usuario sincronizado!
Roles synchronized!: ¡Roles sincronizados!
diff --git a/modules/account/front/acl/create/index.html b/modules/account/front/acl/create/index.html
index 7f4fa9e46..14332f737 100644
--- a/modules/account/front/acl/create/index.html
+++ b/modules/account/front/acl/create/index.html
@@ -15,7 +15,7 @@
@@ -32,7 +32,7 @@
diff --git a/modules/account/front/acl/search-panel/index.html b/modules/account/front/acl/search-panel/index.html
index b83b9c255..a3efab440 100644
--- a/modules/account/front/acl/search-panel/index.html
+++ b/modules/account/front/acl/search-panel/index.html
@@ -4,7 +4,7 @@
-
\ No newline at end of file
+
diff --git a/modules/account/front/create/index.html b/modules/account/front/create/index.html
index acc07d346..70a518885 100644
--- a/modules/account/front/create/index.html
+++ b/modules/account/front/create/index.html
@@ -30,7 +30,7 @@
Deactivate user
+
+ Synchronize
+
@@ -153,6 +161,32 @@
+
+
+ Do you want to synchronize user?
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/account/front/descriptor/index.js b/modules/account/front/descriptor/index.js
index 786870d36..18d93b924 100644
--- a/modules/account/front/descriptor/index.js
+++ b/modules/account/front/descriptor/index.js
@@ -120,6 +120,20 @@ class Controller extends Descriptor {
this.vnApp.showSuccess(this.$t(message));
});
}
+
+ onSync() {
+ const params = {force: true};
+ if (this.shouldSyncPassword)
+ params.password = this.syncPassword;
+
+ return this.$http.patch(`Accounts/${this.user.name}/sync`, params)
+ .then(() => this.vnApp.showSuccess(this.$t('User synchronized!')));
+ }
+
+ onSyncClose() {
+ this.shouldSyncPassword = false;
+ this.syncPassword = undefined;
+ }
}
ngModule.component('vnUserDescriptor', {
diff --git a/modules/account/front/descriptor/locale/es.yml b/modules/account/front/descriptor/locale/es.yml
index 5e8242819..98ced7694 100644
--- a/modules/account/front/descriptor/locale/es.yml
+++ b/modules/account/front/descriptor/locale/es.yml
@@ -22,6 +22,10 @@ Old password: Contraseña antigua
New password: Nueva contraseña
Repeat password: Repetir contraseña
Password changed succesfully!: ¡Contraseña modificada correctamente!
+Synchronize: Sincronizar
+Do you want to synchronize user?: ¿Quieres sincronizar el usuario?
+Synchronize password: Sincronizar contraseña
+User synchronized!: ¡Usuario sincronizado!
Role changed succesfully!: ¡Rol modificado correctamente!
Password requirements: >
La contraseña debe tener al menos {{ length }} caracteres de longitud,
diff --git a/modules/account/front/privileges/index.html b/modules/account/front/privileges/index.html
index 61f2c534e..343c179e3 100644
--- a/modules/account/front/privileges/index.html
+++ b/modules/account/front/privileges/index.html
@@ -22,7 +22,7 @@
+ url="VnRoles">
diff --git a/modules/account/front/role/basic-data/index.html b/modules/account/front/role/basic-data/index.html
index 749927186..846f8b455 100644
--- a/modules/account/front/role/basic-data/index.html
+++ b/modules/account/front/role/basic-data/index.html
@@ -1,25 +1,27 @@
\ No newline at end of file
+
diff --git a/modules/account/front/role/card/index.js b/modules/account/front/role/card/index.js
index 6f888211d..3c7c758ef 100644
--- a/modules/account/front/role/card/index.js
+++ b/modules/account/front/role/card/index.js
@@ -3,7 +3,7 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
- this.$http.get(`Roles/${this.$params.id}`)
+ this.$http.get(`VnRoles/${this.$params.id}`)
.then(res => this.role = res.data);
}
}
diff --git a/modules/account/front/role/card/index.spec.js b/modules/account/front/role/card/index.spec.js
index f39840e5f..f02c08f28 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';
-describe('component vnRoleCard', () => {
+fdescribe('component vnRoleCard', () => {
let controller;
let $httpBackend;
@@ -15,7 +15,7 @@ describe('component vnRoleCard', () => {
it('should reload the controller data', () => {
controller.$params.id = 1;
- $httpBackend.expectGET('Roles/1').respond('foo');
+ $httpBackend.expectGET('VnRoles/1').respond('foo');
controller.reload();
$httpBackend.flush();
diff --git a/modules/account/front/role/create/index.html b/modules/account/front/role/create/index.html
index 02900d580..77d6fc2c1 100644
--- a/modules/account/front/role/create/index.html
+++ b/modules/account/front/role/create/index.html
@@ -1,6 +1,6 @@
@@ -12,15 +12,15 @@
+ rule="VnRole.description">
diff --git a/modules/account/front/role/descriptor/index.html b/modules/account/front/role/descriptor/index.html
index 4cd4ac822..d8bf4857a 100644
--- a/modules/account/front/role/descriptor/index.html
+++ b/modules/account/front/role/descriptor/index.html
@@ -24,4 +24,4 @@
on-accept="$ctrl.onDelete()"
question="Are you sure you want to continue?"
message="Role will be removed">
-
\ No newline at end of file
+
diff --git a/modules/account/front/role/descriptor/index.js b/modules/account/front/role/descriptor/index.js
index a1b578133..17b585cb7 100644
--- a/modules/account/front/role/descriptor/index.js
+++ b/modules/account/front/role/descriptor/index.js
@@ -11,7 +11,7 @@ class Controller extends Descriptor {
}
onDelete() {
- return this.$http.delete(`Roles/${this.id}`)
+ return this.$http.delete(`VnRoles/${this.id}`)
.then(() => this.$state.go('account.role'))
.then(() => this.vnApp.showSuccess(this.$t('Role removed')));
}
diff --git a/modules/account/front/role/descriptor/index.spec.js b/modules/account/front/role/descriptor/index.spec.js
index e2761c639..eafb96727 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';
-describe('component vnRoleDescriptor', () => {
+fdescribe('component vnRoleDescriptor', () => {
let controller;
let $httpBackend;
@@ -18,7 +18,7 @@ describe('component vnRoleDescriptor', () => {
controller.$state.go = jest.fn();
jest.spyOn(controller.vnApp, 'showSuccess');
- $httpBackend.expectDELETE('Roles/1').respond();
+ $httpBackend.expectDELETE('VnRoles/1').respond();
controller.onDelete();
$httpBackend.flush();
diff --git a/modules/account/front/role/main/index.html b/modules/account/front/role/main/index.html
index 9d7e6e053..cfef28e57 100644
--- a/modules/account/front/role/main/index.html
+++ b/modules/account/front/role/main/index.html
@@ -1,6 +1,6 @@
@@ -15,4 +15,4 @@
-
\ No newline at end of file
+
diff --git a/modules/account/front/role/subroles/index.html b/modules/account/front/role/subroles/index.html
index bc554b9f9..eba1002b0 100644
--- a/modules/account/front/role/subroles/index.html
+++ b/modules/account/front/role/subroles/index.html
@@ -33,14 +33,14 @@
ng-click="$ctrl.onAddClick()"
fixed-bottom-right>
-
@@ -49,7 +49,7 @@
- this.$.summary = res.data);
}
diff --git a/modules/account/front/samba/index.html b/modules/account/front/samba/index.html
index 4379f10a2..0186cac7c 100644
--- a/modules/account/front/samba/index.html
+++ b/modules/account/front/samba/index.html
@@ -12,7 +12,7 @@
@@ -20,28 +20,33 @@
ng-if="watcher.hasData"
class="vn-mt-md">
+
+
@@ -63,4 +68,4 @@
ng-click="watcher.loadOriginalData()">
-
\ No newline at end of file
+
diff --git a/modules/account/front/samba/locale/es.yml b/modules/account/front/samba/locale/es.yml
index d098a4fbe..efa3b1597 100644
--- a/modules/account/front/samba/locale/es.yml
+++ b/modules/account/front/samba/locale/es.yml
@@ -3,6 +3,7 @@ Domain controller: Controlador de dominio
AD domain: Dominio AD
AD user: Usuario AD
AD password: Contraseña AD
+User DN (without domain part): DN usuarios (sin la parte del dominio)
Verify certificate: Verificar certificado
Test connection: Probar conexión
Samba connection established!: ¡Conexión con Samba establecida!
diff --git a/modules/account/front/search-panel/index.html b/modules/account/front/search-panel/index.html
index f80b537aa..a539d9657 100644
--- a/modules/account/front/search-panel/index.html
+++ b/modules/account/front/search-panel/index.html
@@ -19,7 +19,7 @@
vn-one
label="Role"
ng-model="filter.roleFk"
- url="Roles"
+ url="VnRoles"
value-field="id"
show-field="name">
@@ -28,4 +28,4 @@
-