Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2589-entry_index

This commit is contained in:
Joan Sanchez 2021-04-01 13:42:38 +02:00
commit f89419962d
459 changed files with 28273 additions and 26008 deletions

View File

@ -34,4 +34,5 @@ rules:
no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }] no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }]
space-in-parens: ["error", "never"] space-in-parens: ["error", "never"]
jasmine/no-focused-tests: 0 jasmine/no-focused-tests: 0
jasmine/prefer-toHaveBeenCalledWith: 0 jasmine/prefer-toHaveBeenCalledWith: 0
arrow-spacing: ["error", { "before": true, "after": true }]

8
Jenkinsfile vendored
View File

@ -49,7 +49,7 @@ pipeline {
NODE_ENV = "" NODE_ENV = ""
} }
steps { steps {
nodejs('node-lts') { nodejs('node-v12') {
sh 'npm install --no-audit --prefer-offline' sh 'npm install --no-audit --prefer-offline'
sh 'gulp install --ci' sh 'gulp install --ci'
} }
@ -66,14 +66,14 @@ pipeline {
parallel { parallel {
stage('Frontend') { stage('Frontend') {
steps { steps {
nodejs('node-lts') { nodejs('node-v12') {
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2'
} }
} }
} }
// stage('Backend') { // stage('Backend') {
// steps { // steps {
// nodejs('node-lts') { // nodejs('node-v12') {
// sh 'gulp launchBackTest --ci' // sh 'gulp launchBackTest --ci'
// } // }
// } // }
@ -89,7 +89,7 @@ pipeline {
CREDS = credentials('docker-registry') CREDS = credentials('docker-registry')
} }
steps { steps {
nodejs('node-lts') { nodejs('node-v12') {
sh 'gulp build' sh 'gulp build'
} }

View File

@ -66,15 +66,38 @@ For end-to-end tests run from project's root.
$ gulp e2e $ gulp e2e
``` ```
## Recommended tools ## Visual Studio Code extensions
* Visual Studio Code Open Visual Studio Code, press Ctrl+P and paste the following commands.
In Visual Studio Code we use the ESLint extension. Open Visual Studio Code, press Ctrl+P and paste the following command. In Visual Studio Code we use the ESLint extension.
``` ```
ext install dbaeumer.vscode-eslint 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 ## Built With
* [angularjs](https://angularjs.org/) * [angularjs](https://angularjs.org/)

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
presets: [ presets: [
'@babel/preset-env', '@babel/env',
], ],
}; };

View File

@ -0,0 +1,39 @@
module.exports = Self => {
Self.remoteMethodCtx('notifyIssues', {
description: 'Notifies new urgent issues',
accessType: 'READ',
returns: {
type: 'Object',
root: true
},
http: {
path: `/notifyIssues`,
verb: 'GET'
}
});
Self.notifyIssues = async ctx => {
const models = Self.app.models;
const $t = ctx.req.__; // $translate
const [urgentIssue] = await Self.rawSql(`
SELECT * FROM managedesktop.vn_workOrderInmediata LIMIT 1
`);
if (!urgentIssue) return;
const message = $t(`There's a new urgent ticket`, {
title: urgentIssue.title,
issueId: urgentIssue.workOrderId
});
const department = await models.Department.findOne({
where: {code: 'IT'}
});
const channelName = department && department.chatName;
if (channelName)
return Self.send(ctx, `#${channelName}`, `@all ➔ ${message}`);
return;
};
};

View File

@ -1,21 +1,21 @@
const request = require('request-promise-native'); const got = require('got');
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('send', { Self.remoteMethodCtx('send', {
description: 'Send a RocketChat message', description: 'Send a RocketChat message',
accessType: 'WRITE', accessType: 'WRITE',
accepts: [{ accepts: [{
arg: 'to', arg: 'to',
type: 'String', type: 'string',
required: true, required: true,
description: 'User (@) or channel (#) to send the message' description: 'User (@) or channel (#) to send the message'
}, { }, {
arg: 'message', arg: 'message',
type: 'String', type: 'string',
required: true, required: true,
description: 'The message' description: 'The message'
}], }],
returns: { returns: {
type: 'Object', type: 'object',
root: true root: true
}, },
http: { http: {
@ -30,8 +30,15 @@ module.exports = Self => {
const sender = await models.Account.findById(accessToken.userId); const sender = await models.Account.findById(accessToken.userId);
const recipient = to.replace('@', ''); const recipient = to.replace('@', '');
if (sender.name != recipient) if (sender.name != recipient) {
return sendMessage(sender, to, message); let {body} = await sendMessage(sender, to, message);
if (body)
body = JSON.parse(body);
else
body = false;
return body;
}
return false; return false;
}; };
@ -65,12 +72,15 @@ module.exports = Self => {
if (!this.auth || this.auth && !this.auth.authToken) { if (!this.auth || this.auth && !this.auth.authToken) {
const config = await getConfig(); const config = await getConfig();
const uri = `${config.api}/login`; const uri = `${config.api}/login`;
const res = await send(uri, { let {body} = await send(uri, {
user: config.user, user: config.user,
password: config.password password: config.password
}); });
this.auth = res.data; if (body) {
body = JSON.parse(body);
this.auth = body.data;
}
} }
return this.auth; return this.auth;
@ -93,29 +103,29 @@ module.exports = Self => {
/** /**
* Send unauthenticated request * Send unauthenticated request
* @param {*} uri - Request uri * @param {*} uri - Request uri
* @param {*} body - Request params * @param {*} params - Request params
* @param {*} options - Request options * @param {*} options - Request options
* *
* @return {Object} Request response * @return {Object} Request response
*/ */
async function send(uri, body, options) { async function send(uri, params, options = {}) {
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
return new Promise(resolve => { return new Promise(resolve => {
return resolve({statusCode: 200, message: 'Fake notification sent'}); return resolve({
body: JSON.stringify(
{statusCode: 200, message: 'Fake notification sent'}
)
});
}); });
} }
const defaultOptions = { const defaultOptions = {
method: 'POST', body: params
uri: uri,
body: body,
headers: {'content-type': 'application/json'},
json: true
}; };
if (options) Object.assign(defaultOptions, options); if (options) Object.assign(defaultOptions, options);
return request(defaultOptions); return got.post(uri, defaultOptions);
} }
/** /**
@ -128,7 +138,7 @@ module.exports = Self => {
async function sendAuth(uri, body) { async function sendAuth(uri, body) {
const login = await getAuthToken(); const login = await getAuthToken();
const options = { const options = {
headers: {'content-type': 'application/json'} headers: {}
}; };
if (login) { if (login) {

View File

@ -7,7 +7,8 @@ module.exports = Self => {
type: 'Number', type: 'Number',
required: true, required: true,
description: 'The worker id of the destinatary' description: 'The worker id of the destinatary'
}, { },
{
arg: 'message', arg: 'message',
type: 'String', type: 'String',
required: true, required: true,

View File

@ -0,0 +1,38 @@
const app = require('vn-loopback/server/server');
describe('Chat notifyIssue()', () => {
const ctx = {req: {accessToken: {userId: 1}}};
ctx.req.__ = value => {
return value;
};
const chatModel = app.models.Chat;
const departmentId = 31;
it(`should not call to the send() method and neither return a response`, async() => {
spyOn(chatModel, 'send').and.callThrough();
spyOn(chatModel, 'rawSql').and.returnValue([]);
const response = await chatModel.notifyIssues(ctx);
expect(chatModel.send).not.toHaveBeenCalled();
expect(response).toBeUndefined();
});
it(`should return a response calling the send() method`, async() => {
spyOn(chatModel, 'send').and.callThrough();
spyOn(chatModel, 'rawSql').and.returnValue([{title: 'Issue title'}]);
const department = await app.models.Department.findById(departmentId);
let orgChatName = department.chatName;
await department.updateAttribute('chatName', 'IT');
const response = await chatModel.notifyIssues(ctx);
expect(response.statusCode).toEqual(200);
expect(response.message).toEqual('Fake notification sent');
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#IT', `@all ➔ There's a new urgent ticket`);
// restores
await department.updateAttribute('chatName', orgChatName);
});
});

View File

@ -1,6 +1,6 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
describe('chat send()', () => { describe('Chat send()', () => {
it('should return a "Fake notification sent" as response', async() => { it('should return a "Fake notification sent" as response', async() => {
let ctx = {req: {accessToken: {userId: 1}}}; let ctx = {req: {accessToken: {userId: 1}}};
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something'); let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');

View File

@ -1,6 +1,6 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
describe('chat sendCheckingPresence()', () => { describe('Chat sendCheckingPresence()', () => {
const today = new Date(); const today = new Date();
today.setHours(6, 0); today.setHours(6, 0);
const ctx = {req: {accessToken: {userId: 1}}}; const ctx = {req: {accessToken: {userId: 1}}};

View File

@ -20,17 +20,37 @@ module.exports = Self => {
} }
}); });
Self.removeFile = async(ctx, id) => { Self.removeFile = async(ctx, id, options) => {
const models = Self.app.models; let tx;
const dms = await models.Dms.findById(id); let myOptions = {};
const trashDmsType = await models.DmsType.findOne({
where: {code: 'trash'}
});
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, dms.dmsTypeFk); if (typeof options == 'object')
if (!hasWriteRole) Object.assign(myOptions, options);
throw new UserError(`You don't have enough privileges`);
return dms.updateAttribute('dmsTypeFk', trashDmsType.id); if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const models = Self.app.models;
const dms = await models.Dms.findById(id, null, myOptions);
const trashDmsType = await models.DmsType.findOne({
where: {code: 'trash'}
}, myOptions);
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, dms.dmsTypeFk, myOptions);
if (!hasWriteRole)
throw new UserError(`You don't have enough privileges`);
await dms.updateAttribute('dmsTypeFk', trashDmsType.id, myOptions);
if (tx) await tx.commit();
return dms;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
}; };
}; };

View File

@ -11,25 +11,36 @@ module.exports = Self => {
type: 'Number', type: 'Number',
description: 'The document id', description: 'The document id',
http: {source: 'path'} http: {source: 'path'}
}, { },
{
arg: 'warehouseId', arg: 'warehouseId',
type: 'Number', type: 'Number',
description: 'The warehouse id' description: 'The warehouse id'
}, { },
{
arg: 'companyId', arg: 'companyId',
type: 'Number', type: 'Number',
description: 'The company id' description: 'The company id'
}, { },
{
arg: 'dmsTypeId', arg: 'dmsTypeId',
type: 'Number', type: 'Number',
description: 'The dms type id' description: 'The dms type id'
}, { },
{
arg: 'reference', arg: 'reference',
type: 'String' type: 'String'
}, { },
{
arg: 'description', arg: 'description',
type: 'String' type: 'String'
}, { },
{
arg: 'hasFile',
type: 'Boolean',
description: 'True if has an attached file'
},
{
arg: 'hasFileAttached', arg: 'hasFileAttached',
type: 'Boolean', type: 'Boolean',
description: 'True if has an attached file' description: 'True if has an attached file'
@ -70,7 +81,8 @@ module.exports = Self => {
companyFk: args.companyId, companyFk: args.companyId,
warehouseFk: args.warehouseId, warehouseFk: args.warehouseId,
reference: args.reference, reference: args.reference,
description: args.description description: args.description,
hasFile: args.hasFile
}, myOptions); }, myOptions);
if (args.hasFileAttached) if (args.hasFileAttached)

View File

@ -110,11 +110,10 @@ module.exports = Self => {
async function createDms(ctx, file, myOptions) { async function createDms(ctx, file, myOptions) {
const models = Self.app.models; const models = Self.app.models;
const myUserId = ctx.req.accessToken.userId; const myUserId = ctx.req.accessToken.userId;
const myWorker = await models.Worker.findOne({where: {userFk: myUserId}}, myOptions);
const args = ctx.args; const args = ctx.args;
const newDms = await Self.create({ const newDms = await Self.create({
workerFk: myWorker.id, workerFk: myUserId,
dmsTypeFk: args.dmsTypeId, dmsTypeFk: args.dmsTypeId,
companyFk: args.companyId, companyFk: args.companyId,
warehouseFk: args.warehouseId, warehouseFk: args.warehouseId,

View File

@ -57,6 +57,9 @@ module.exports = Self => {
const entity = await models[imageCollection.model].findById(id, { const entity = await models[imageCollection.model].findById(id, {
fields: ['id', imageCollection.property] fields: ['id', imageCollection.property]
}); });
if (!entity) return false;
const image = await models.Image.findOne({where: { const image = await models.Image.findOne({where: {
collectionFk: collection, collectionFk: collection,
name: entity[imageCollection.property]} name: entity[imageCollection.property]}

View File

@ -48,7 +48,7 @@ module.exports = Self => {
throw new UserError(`You don't have enough privileges`); throw new UserError(`You don't have enough privileges`);
if (process.env.NODE_ENV == 'test') if (process.env.NODE_ENV == 'test')
throw new UserError(`You can't upload images on the test environment`); throw new UserError(`Action not allowed on the test environment`);
// Upload file to temporary path // Upload file to temporary path
const tempContainer = await TempContainer.container(args.collection); const tempContainer = await TempContainer.container(args.collection);

View File

@ -0,0 +1,28 @@
module.exports = function(Self) {
Self.remoteMethodCtx('getStarredModules', {
description: 'returns the starred modules for the current user',
accessType: 'READ',
returns: {
type: 'object',
root: true
},
http: {
path: `/getStarredModules`,
verb: 'get'
}
});
Self.getStarredModules = async ctx => {
const userId = ctx.req.accessToken.userId;
const filter = {
where: {
workerFk: userId
},
fields: ['moduleFk']
};
const starredModules = await Self.app.models.StarredModule.find(filter);
return starredModules;
};
};

View File

@ -0,0 +1,31 @@
const app = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('getStarredModules()', () => {
const activeCtx = {
accessToken: {userId: 9},
http: {
req: {
headers: {origin: 'http://localhost'}
}
}
};
const ctx = {req: activeCtx};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it(`should return the starred modules for a given user`, async() => {
const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'Clients'});
const starredModules = await app.models.StarredModule.getStarredModules(ctx);
expect(starredModules.length).toEqual(1);
expect(starredModules[0].moduleFk).toEqual('Clients');
// restores
await app.models.StarredModule.destroyById(newStarred.id);
});
});

View File

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

View File

@ -0,0 +1,41 @@
module.exports = function(Self) {
Self.remoteMethodCtx('toggleStarredModule', {
description: 'creates or deletes a starred module for the current user',
accessType: 'WRITE',
returns: {
type: 'object',
root: true
},
accepts: {
arg: 'moduleName',
type: 'string',
required: true,
description: 'The module name'
},
http: {
path: `/toggleStarredModule`,
verb: 'post'
}
});
Self.toggleStarredModule = async(ctx, moduleName) => {
const userId = ctx.req.accessToken.userId;
const filter = {
where: {
workerFk: userId,
moduleFk: moduleName
}
};
const [starredModule] = await Self.app.models.StarredModule.find(filter);
if (starredModule)
await starredModule.destroy();
else {
return Self.app.models.StarredModule.create({
workerFk: userId,
moduleFk: moduleName
});
}
};
};

View File

@ -35,6 +35,15 @@
"DmsContainer": { "DmsContainer": {
"dataSource": "dmsStorage" "dataSource": "dmsStorage"
}, },
"Dms": {
"dataSource": "vn"
},
"DmsType": {
"dataSource": "vn"
},
"EmailUser": {
"dataSource": "vn"
},
"Image": { "Image": {
"dataSource": "vn" "dataSource": "vn"
}, },
@ -50,41 +59,41 @@
"Language": { "Language": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Module": {
"dataSource": "vn"
},
"Province": { "Province": {
"dataSource": "vn" "dataSource": "vn"
}, },
"TempContainer": { "Payment": {
"dataSource": "tempStorage"
},
"UserConfig": {
"dataSource": "vn"
},
"Warehouse": {
"dataSource": "vn"
},
"SageWithholding": {
"dataSource": "vn"
},
"UserConfigView": {
"dataSource": "vn"
},
"EmailUser": {
"dataSource": "vn"
},
"Dms": {
"dataSource": "vn"
},
"DmsType": {
"dataSource": "vn"
},
"Town": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Postcode": { "Postcode": {
"dataSource": "vn" "dataSource": "vn"
}, },
"SageWithholding": {
"dataSource": "vn"
},
"StarredModule": {
"dataSource": "vn"
},
"TempContainer": {
"dataSource": "tempStorage"
},
"Town": {
"dataSource": "vn"
},
"UserConfig": {
"dataSource": "vn"
},
"UserConfigView": {
"dataSource": "vn"
},
"UserLog": { "UserLog": {
"dataSource": "vn" "dataSource": "vn"
},
"Warehouse": {
"dataSource": "vn"
} }
} }

View File

@ -8,17 +8,20 @@
}, },
"properties": { "properties": {
"id": { "id": {
"type": "Number", "type": "number",
"id": true, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
"description": { "description": {
"type": "String", "type": "string",
"required": true "required": true
}, },
"receiptDescription": { "receiptDescription": {
"type": "String", "type": "string",
"required": true "required": true
},
"code": {
"type": "string"
} }
}, },
"acls": [{ "acls": [{

View File

@ -0,0 +1,13 @@
module.exports = Self => {
Self.validatesPresenceOf('name', {
message: 'Name cannot be blank'
});
Self.validatesPresenceOf('bic', {
message: 'Swift / BIC cannot be empty'
});
Self.validatesUniquenessOf('bic', {
message: 'This BIC already exist.'
});
};

View File

@ -1,4 +1,5 @@
module.exports = Self => { module.exports = Self => {
require('../methods/chat/send')(Self); require('../methods/chat/send')(Self);
require('../methods/chat/sendCheckingPresence')(Self); require('../methods/chat/sendCheckingPresence')(Self);
require('../methods/chat/notifyIssues')(Self);
}; };

View File

@ -18,6 +18,9 @@
}, },
"expired": { "expired": {
"type": "date" "type": "date"
},
"isOfficial": {
"type": "boolean"
} }
}, },

View File

@ -30,7 +30,7 @@
"type": "string" "type": "string"
}, },
"hardCopyNumber": { "hardCopyNumber": {
"type": "Number" "type": "number"
}, },
"hasFile": { "hasFile": {
"type": "boolean" "type": "boolean"

View File

@ -1,11 +1,51 @@
const fs = require('fs-extra'); const fs = require('fs-extra');
const sharp = require('sharp'); const sharp = require('sharp');
const path = require('path'); const path = require('path');
const readChunk = require('read-chunk');
const imageType = require('image-type');
const bmp = require('bmp-js');
module.exports = Self => { module.exports = Self => {
require('../methods/image/download')(Self); require('../methods/image/download')(Self);
require('../methods/image/upload')(Self); require('../methods/image/upload')(Self);
// Function extracted from jimp package (utils)
function scan(image, x, y, w, h, f) {
// round input
x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
h = Math.round(h);
for (let _y = y; _y < y + h; _y++) {
for (let _x = x; _x < x + w; _x++) {
const idx = (image.bitmap.width * _y + _x) << 2;
f.call(image, _x, _y, idx);
}
}
return image;
}
// Function extracted from jimp package (type-bmp)
function fromAGBR(bitmap) {
return scan({bitmap}, 0, 0, bitmap.width, bitmap.height, function(
x,
y,
index
) {
const alpha = this.bitmap.data[index + 0];
const blue = this.bitmap.data[index + 1];
const green = this.bitmap.data[index + 2];
const red = this.bitmap.data[index + 3];
this.bitmap.data[index + 0] = red;
this.bitmap.data[index + 1] = green;
this.bitmap.data[index + 2] = blue;
this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
}).bitmap;
}
Self.registerImage = async(collectionName, srcFilePath, fileName, entityId) => { Self.registerImage = async(collectionName, srcFilePath, fileName, entityId) => {
const models = Self.app.models; const models = Self.app.models;
const tx = await Self.beginTransaction({}); const tx = await Self.beginTransaction({});
@ -48,13 +88,31 @@ module.exports = Self => {
const dstDir = path.join(collectionDir, 'full'); const dstDir = path.join(collectionDir, 'full');
const dstFile = path.join(dstDir, file); const dstFile = path.join(dstDir, file);
const buffer = readChunk.sync(srcFilePath, 0, 12);
const type = imageType(buffer);
let sharpOptions;
let imgSrc = srcFilePath;
if (type.mime == 'image/bmp') {
const bmpBuffer = fs.readFileSync(srcFilePath);
const bmpData = fromAGBR(bmp.decode(bmpBuffer));
imgSrc = bmpData.data;
sharpOptions = {
raw: {
width: bmpData.width,
height: bmpData.height,
channels: 4
}
};
}
const resizeOpts = { const resizeOpts = {
withoutEnlargement: true, withoutEnlargement: true,
fit: 'inside' fit: 'inside'
}; };
await fs.mkdir(dstDir, {recursive: true}); await fs.mkdir(dstDir, {recursive: true});
await sharp(srcFilePath, {failOnError: false}) await sharp(imgSrc, sharpOptions)
.resize(collection.maxWidth, collection.maxHeight, resizeOpts) .resize(collection.maxWidth, collection.maxHeight, resizeOpts)
.png() .png()
.toFile(dstFile); .toFile(dstFile);
@ -69,7 +127,7 @@ module.exports = Self => {
}; };
await fs.mkdir(dstDir, {recursive: true}); await fs.mkdir(dstDir, {recursive: true});
await sharp(srcFilePath, {failOnError: false}) await sharp(imgSrc, sharpOptions)
.resize(size.width, size.height, resizeOpts) .resize(size.width, size.height, resizeOpts)
.png() .png()
.toFile(dstFile); .toFile(dstFile);

View File

@ -8,25 +8,23 @@
}, },
"properties": { "properties": {
"id": { "id": {
"type": "Number", "type": "number",
"id": true, "id": true,
"description": "The id" "description": "The id"
}, },
"name": { "name": {
"type": "String", "type": "string",
"required": true "required": true
}, },
"collectionFk": { "collectionFk": {
"type": "String", "type": "string",
"required": true "required": true
}, },
"updated": { "updated": {
"type": "Number" "type": "number"
}, },
"nRefs": { "nRefs": {
"type": "Number", "type": "number"
"required": true,
"default": 0
} }
}, },
"relations": { "relations": {

23
back/models/module.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "Module",
"base": "VnModel",
"options": {
"mysql": {
"table": "salix.module"
}
},
"properties": {
"code": {
"type": "string",
"id": true
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

64
back/models/payment.json Normal file
View File

@ -0,0 +1,64 @@
{
"name": "Payment",
"base": "VnModel",
"options": {
"mysql": {
"table": "payment"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"received": {
"type": "date"
},
"amount": {
"type": "number"
},
"divisa": {
"type": "number"
},
"concept": {
"type": "string"
},
"created": {
"type": "date"
},
"isConciliated": {
"type": "boolean"
},
"dueDated": {
"type": "date"
}
},
"relations": {
"supplier": {
"type": "belongsTo",
"model": "Supplier",
"foreignKey": "supplierFk"
},
"currency": {
"type": "belongsTo",
"model": "Currency",
"foreignKey": "currencyFk"
},
"bank": {
"type": "belongsTo",
"model": "Bank",
"foreignKey": "bankFk"
},
"payMethod": {
"type": "belongsTo",
"model": "PayMethodFk",
"foreignKey": "payMethodFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyFk"
}
}
}

View File

@ -0,0 +1,4 @@
module.exports = Self => {
require('../methods/starred-module/getStarredModules')(Self);
require('../methods/starred-module/toggleStarredModule')(Self);
};

View File

@ -0,0 +1,35 @@
{
"name": "StarredModule",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.starredModule"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"workerFk": {
"type": "number",
"required": true
},
"moduleFk": {
"type": "string",
"required": true
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"module": {
"type": "belongsTo",
"model": "Module",
"foreignKey": "moduleFk"
}
}
}

View File

@ -1,8 +0,0 @@
UPDATE `salix`.`ACL` SET `principalId` = 'deliveryBoss' WHERE (`id` = '194');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '97');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '100');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '103');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '202');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Town', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Province', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');

View File

@ -1,3 +0,0 @@
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '3');
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '4');
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '5');

View File

@ -1,9 +0,0 @@
ALTER TABLE `vn`.`observationType`
ADD COLUMN `code` VARCHAR(45) NOT NULL AFTER `description`;
UPDATE `vn`.`observationType` SET `code` = 'itemPicker' WHERE (`id` = '1');
UPDATE `vn`.`observationType` SET `code` = 'packager' WHERE (`id` = '2');
UPDATE `vn`.`observationType` SET `code` = 'salesPerson' WHERE (`id` = '4');
UPDATE `vn`.`observationType` SET `code` = 'administrative' WHERE (`id` = '5');
UPDATE `vn`.`observationType` SET `code` = 'weight' WHERE (`id` = '6');
UPDATE `vn`.`observationType` SET `code` = 'delivery' WHERE (`id` = '3');

View File

@ -1,7 +0,0 @@
ALTER TABLE `account`.`roleRole`
ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (`id`);
UPDATE `account`.`role` SET id = 100 WHERE `name` = 'root';
CALL account.role_sync;

View File

@ -1,504 +0,0 @@
DROP PROCEDURE IF EXISTS account.role_syncPrivileges;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `account`.`role_syncPrivileges`()
BEGIN
/**
* Synchronizes permissions of MySQL role users based on role hierarchy.
* The computed role users of permission mix will be named according to
* pattern z-[role_name].
*
* If any@localhost user exists, it will be taken as a template for basic
* attributes.
*
* Warning! This procedure should only be called when MySQL privileges
* are modified. If role hierarchy is modified, you must call the role_sync()
* procedure wich calls this internally.
*/
DECLARE vIsMysql BOOL DEFAULT VERSION() NOT LIKE '%MariaDB%';
DECLARE vVersion INT DEFAULT SUBSTRING_INDEX(VERSION(), '.', 1);
DECLARE vTplUser VARCHAR(255) DEFAULT 'any';
DECLARE vTplHost VARCHAR(255) DEFAULT '%';
DECLARE vRoleHost VARCHAR(255) DEFAULT 'localhost';
DECLARE vAllHost VARCHAR(255) DEFAULT '%';
DECLARE vPrefix VARCHAR(2) DEFAULT 'z-';
DECLARE vPrefixedLike VARCHAR(255);
DECLARE vPassword VARCHAR(255) DEFAULT '';
-- Deletes computed role users
SET vPrefixedLike = CONCAT(vPrefix, '%');
IF vIsMysql THEN
DELETE FROM mysql.user
WHERE `User` LIKE vPrefixedLike;
ELSE
DELETE FROM mysql.global_priv
WHERE `User` LIKE vPrefixedLike;
END IF;
DELETE FROM mysql.db
WHERE `User` LIKE vPrefixedLike;
DELETE FROM mysql.tables_priv
WHERE `User` LIKE vPrefixedLike;
DELETE FROM mysql.columns_priv
WHERE `User` LIKE vPrefixedLike;
DELETE FROM mysql.procs_priv
WHERE `User` LIKE vPrefixedLike;
DELETE FROM mysql.proxies_priv
WHERE `Proxied_user` LIKE vPrefixedLike;
-- Temporary tables
DROP TEMPORARY TABLE IF EXISTS tRole;
CREATE TEMPORARY TABLE tRole
(INDEX (id))
ENGINE = MEMORY
SELECT
id,
`name` role,
CONCAT(vPrefix, `name`) prefixedRole
FROM role
WHERE hasLogin;
DROP TEMPORARY TABLE IF EXISTS tRoleInherit;
CREATE TEMPORARY TABLE tRoleInherit
(INDEX (inheritsFrom))
ENGINE = MEMORY
SELECT
r.prefixedRole,
ri.`name` inheritsFrom
FROM tRole r
JOIN roleRole rr ON rr.role = r.id
JOIN role ri ON ri.id = rr.inheritsFrom;
-- Recreate role users
IF vIsMysql THEN
DROP TEMPORARY TABLE IF EXISTS tUser;
CREATE TEMPORARY TABLE tUser
SELECT
r.prefixedRole `User`,
vTplHost `Host`,
IFNULL(t.`authentication_string`,
'') `authentication_string`,
IFNULL(t.`plugin`,
'mysql_native_password') `plugin`,
IFNULL(IF('' != u.`ssl_type`,
u.`ssl_type`, t.`ssl_type`),
'') `ssl_type`,
IFNULL(IF('' != u.`ssl_cipher`,
u.`ssl_cipher`, t.`ssl_cipher`),
'') `ssl_cipher`,
IFNULL(IF('' != u.`x509_issuer`,
u.`x509_issuer`, t.`x509_issuer`),
'') `x509_issuer`,
IFNULL(IF('' != u.`x509_subject`,
u.`x509_subject`, t.`x509_subject`),
'') `x509_subject`,
IFNULL(IF(0 != u.`max_questions`,
u.`max_questions`, t.`max_questions`),
0) `max_questions`,
IFNULL(IF(0 != u.`max_updates`,
u.`max_updates`, t.`max_updates`),
0) `max_updates`,
IFNULL(IF(0 != u.`max_connections`,
u.`max_connections`, t.`max_connections`),
0) `max_connections`,
IFNULL(IF(0 != u.`max_user_connections`,
u.`max_user_connections`, t.`max_user_connections`),
0) `max_user_connections`
FROM tRole r
LEFT JOIN mysql.user t
ON t.`User` = vTplUser
AND t.`Host` = vRoleHost
LEFT JOIN mysql.user u
ON u.`User` = r.role
AND u.`Host` = vRoleHost;
IF vVersion <= 5 THEN
SELECT `Password` INTO vPassword
FROM mysql.user
WHERE `User` = vTplUser
AND `Host` = vRoleHost;
INSERT INTO mysql.user (
`User`,
`Host`,
`Password`,
`authentication_string`,
`plugin`,
`ssl_type`,
`ssl_cipher`,
`x509_issuer`,
`x509_subject`,
`max_questions`,
`max_updates`,
`max_connections`,
`max_user_connections`
)
SELECT
`User`,
`Host`,
vPassword,
`authentication_string`,
`plugin`,
`ssl_type`,
`ssl_cipher`,
`x509_issuer`,
`x509_subject`,
`max_questions`,
`max_updates`,
`max_connections`,
`max_user_connections`
FROM tUser;
ELSE
INSERT INTO mysql.user (
`User`,
`Host`,
`authentication_string`,
`plugin`,
`ssl_type`,
`ssl_cipher`,
`x509_issuer`,
`x509_subject`,
`max_questions`,
`max_updates`,
`max_connections`,
`max_user_connections`
)
SELECT
`User`,
`Host`,
`authentication_string`,
`plugin`,
`ssl_type`,
`ssl_cipher`,
`x509_issuer`,
`x509_subject`,
`max_questions`,
`max_updates`,
`max_connections`,
`max_user_connections`
FROM tUser;
END IF;
DROP TEMPORARY TABLE IF EXISTS tUser;
ELSE
INSERT INTO mysql.global_priv (
`User`,
`Host`,
`Priv`
)
SELECT
r.prefixedRole,
vTplHost,
JSON_MERGE_PATCH(
IFNULL(t.`Priv`, '{}'),
IFNULL(u.`Priv`, '{}'),
JSON_OBJECT(
'mysql_old_password', JSON_VALUE(t.`Priv`, '$.mysql_old_password'),
'mysql_native_password', JSON_VALUE(t.`Priv`, '$.mysql_native_password'),
'authentication_string', JSON_VALUE(t.`Priv`, '$.authentication_string'),
'ssl_type', JSON_VALUE(t.`Priv`, '$.ssl_type')
)
)
FROM tRole r
LEFT JOIN mysql.global_priv t
ON t.`User` = vTplUser
AND t.`Host` = vRoleHost
LEFT JOIN mysql.global_priv u
ON u.`User` = r.role
AND u.`Host` = vRoleHost;
END IF;
INSERT INTO mysql.proxies_priv (
`User`,
`Host`,
`Proxied_user`,
`Proxied_host`,
`Grantor`
)
SELECT
'',
vAllHost,
prefixedRole,
vTplHost,
CONCAT(prefixedRole, '@', vTplHost)
FROM tRole;
-- Copies global privileges
DROP TEMPORARY TABLE IF EXISTS tUserPriv;
IF vIsMysql THEN
CREATE TEMPORARY TABLE tUserPriv
(INDEX (prefixedRole))
ENGINE = MEMORY
SELECT
r.prefixedRole,
MAX(u.`Select_priv`) `Select_priv`,
MAX(u.`Insert_priv`) `Insert_priv`,
MAX(u.`Update_priv`) `Update_priv`,
MAX(u.`Delete_priv`) `Delete_priv`,
MAX(u.`Create_priv`) `Create_priv`,
MAX(u.`Drop_priv`) `Drop_priv`,
MAX(u.`Reload_priv`) `Reload_priv`,
MAX(u.`Shutdown_priv`) `Shutdown_priv`,
MAX(u.`Process_priv`) `Process_priv`,
MAX(u.`File_priv`) `File_priv`,
MAX(u.`Grant_priv`) `Grant_priv`,
MAX(u.`References_priv`) `References_priv`,
MAX(u.`Index_priv`) `Index_priv`,
MAX(u.`Alter_priv`) `Alter_priv`,
MAX(u.`Show_db_priv`) `Show_db_priv`,
MAX(u.`Super_priv`) `Super_priv`,
MAX(u.`Create_tmp_table_priv`) `Create_tmp_table_priv`,
MAX(u.`Lock_tables_priv`) `Lock_tables_priv`,
MAX(u.`Execute_priv`) `Execute_priv`,
MAX(u.`Repl_slave_priv`) `Repl_slave_priv`,
MAX(u.`Repl_client_priv`) `Repl_client_priv`,
MAX(u.`Create_view_priv`) `Create_view_priv`,
MAX(u.`Show_view_priv`) `Show_view_priv`,
MAX(u.`Create_routine_priv`) `Create_routine_priv`,
MAX(u.`Alter_routine_priv`) `Alter_routine_priv`,
MAX(u.`Create_user_priv`) `Create_user_priv`,
MAX(u.`Event_priv`) `Event_priv`,
MAX(u.`Trigger_priv`) `Trigger_priv`,
MAX(u.`Create_tablespace_priv`) `Create_tablespace_priv`
FROM tRoleInherit r
JOIN mysql.user u
ON u.`User` = r.inheritsFrom
AND u.`Host`= vRoleHost
GROUP BY r.prefixedRole;
UPDATE mysql.user u
JOIN tUserPriv t
ON u.`User` = t.prefixedRole
AND u.`Host` = vTplHost
SET
u.`Select_priv`
= t.`Select_priv`,
u.`Insert_priv`
= t.`Insert_priv`,
u.`Update_priv`
= t.`Update_priv`,
u.`Delete_priv`
= t.`Delete_priv`,
u.`Create_priv`
= t.`Create_priv`,
u.`Drop_priv`
= t.`Drop_priv`,
u.`Reload_priv`
= t.`Reload_priv`,
u.`Shutdown_priv`
= t.`Shutdown_priv`,
u.`Process_priv`
= t.`Process_priv`,
u.`File_priv`
= t.`File_priv`,
u.`Grant_priv`
= t.`Grant_priv`,
u.`References_priv`
= t.`References_priv`,
u.`Index_priv`
= t.`Index_priv`,
u.`Alter_priv`
= t.`Alter_priv`,
u.`Show_db_priv`
= t.`Show_db_priv`,
u.`Super_priv`
= t.`Super_priv`,
u.`Create_tmp_table_priv`
= t.`Create_tmp_table_priv`,
u.`Lock_tables_priv`
= t.`Lock_tables_priv`,
u.`Execute_priv`
= t.`Execute_priv`,
u.`Repl_slave_priv`
= t.`Repl_slave_priv`,
u.`Repl_client_priv`
= t.`Repl_client_priv`,
u.`Create_view_priv`
= t.`Create_view_priv`,
u.`Show_view_priv`
= t.`Show_view_priv`,
u.`Create_routine_priv`
= t.`Create_routine_priv`,
u.`Alter_routine_priv`
= t.`Alter_routine_priv`,
u.`Create_user_priv`
= t.`Create_user_priv`,
u.`Event_priv`
= t.`Event_priv`,
u.`Trigger_priv`
= t.`Trigger_priv`,
u.`Create_tablespace_priv`
= t.`Create_tablespace_priv`;
ELSE
CREATE TEMPORARY TABLE tUserPriv
(INDEX (prefixedRole))
SELECT
r.prefixedRole,
BIT_OR(JSON_VALUE(p.`Priv`, '$.access')) access
FROM tRoleInherit r
JOIN mysql.global_priv p
ON p.`User` = r.inheritsFrom
AND p.`Host`= vRoleHost
GROUP BY r.prefixedRole;
UPDATE mysql.global_priv p
JOIN tUserPriv t
ON p.`User` = t.prefixedRole
AND p.`Host` = vTplHost
SET
p.`Priv` = JSON_SET(p.`Priv`, '$.access', t.access);
END IF;
DROP TEMPORARY TABLE tUserPriv;
-- Copy schema level privileges
INSERT INTO mysql.db (
`User`,
`Host`,
`Db`,
`Select_priv`,
`Insert_priv`,
`Update_priv`,
`Delete_priv`,
`Create_priv`,
`Drop_priv`,
`Grant_priv`,
`References_priv`,
`Index_priv`,
`Alter_priv`,
`Create_tmp_table_priv`,
`Lock_tables_priv`,
`Create_view_priv`,
`Show_view_priv`,
`Create_routine_priv`,
`Alter_routine_priv`,
`Execute_priv`,
`Event_priv`,
`Trigger_priv`
)
SELECT
r.prefixedRole,
vTplHost,
t.`Db`,
MAX(t.`Select_priv`),
MAX(t.`Insert_priv`),
MAX(t.`Update_priv`),
MAX(t.`Delete_priv`),
MAX(t.`Create_priv`),
MAX(t.`Drop_priv`),
MAX(t.`Grant_priv`),
MAX(t.`References_priv`),
MAX(t.`Index_priv`),
MAX(t.`Alter_priv`),
MAX(t.`Create_tmp_table_priv`),
MAX(t.`Lock_tables_priv`),
MAX(t.`Create_view_priv`),
MAX(t.`Show_view_priv`),
MAX(t.`Create_routine_priv`),
MAX(t.`Alter_routine_priv`),
MAX(t.`Execute_priv`),
MAX(t.`Event_priv`),
MAX(t.`Trigger_priv`)
FROM tRoleInherit r
JOIN mysql.db t
ON t.`User` = r.inheritsFrom
AND t.`Host`= vRoleHost
GROUP BY r.prefixedRole, t.`Db`;
-- Copy table level privileges
INSERT INTO mysql.tables_priv (
`User`,
`Host`,
`Db`,
`Table_name`,
`Grantor`,
`Timestamp`,
`Table_priv`,
`Column_priv`
)
SELECT
r.prefixedRole,
vTplHost,
t.`Db`,
t.`Table_name`,
t.`Grantor`,
MAX(t.`Timestamp`),
IFNULL(GROUP_CONCAT(NULLIF(t.`Table_priv`, '')), ''),
IFNULL(GROUP_CONCAT(NULLIF(t.`Column_priv`, '')), '')
FROM tRoleInherit r
JOIN mysql.tables_priv t
ON t.`User` = r.inheritsFrom
AND t.`Host`= vRoleHost
GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`;
-- Copy column level privileges
INSERT INTO mysql.columns_priv (
`User`,
`Host`,
`Db`,
`Table_name`,
`Column_name`,
`Timestamp`,
`Column_priv`
)
SELECT
r.prefixedRole,
vTplHost,
t.`Db`,
t.`Table_name`,
t.`Column_name`,
MAX(t.`Timestamp`),
IFNULL(GROUP_CONCAT(NULLIF(t.`Column_priv`, '')), '')
FROM tRoleInherit r
JOIN mysql.columns_priv t
ON t.`User` = r.inheritsFrom
AND t.`Host`= vRoleHost
GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`, t.`Column_name`;
-- Copy routine privileges
INSERT IGNORE INTO mysql.procs_priv (
`User`,
`Host`,
`Db`,
`Routine_name`,
`Routine_type`,
`Grantor`,
`Timestamp`,
`Proc_priv`
)
SELECT
r.prefixedRole,
vTplHost,
t.`Db`,
t.`Routine_name`,
t.`Routine_type`,
t.`Grantor`,
t.`Timestamp`,
t.`Proc_priv`
FROM tRoleInherit r
JOIN mysql.procs_priv t
ON t.`User` = r.inheritsFrom
AND t.`Host`= vRoleHost;
-- Free memory
DROP TEMPORARY TABLE
tRole,
tRoleInherit;
FLUSH PRIVILEGES;
END$$
DELIMITER ;

View File

@ -1,36 +0,0 @@
ALTER TABLE account.sambaConfig ADD adUser VARCHAR(255) DEFAULT NULL NULL COMMENT 'Active directory user';
ALTER TABLE account.sambaConfig ADD adPassword varchar(255) DEFAULT NULL NULL COMMENT 'Active directory password';
ALTER TABLE account.sambaConfig ADD userDn varchar(255) DEFAULT NULL NULL COMMENT 'The base DN for users';
ALTER TABLE account.sambaConfig DROP COLUMN uidBase;
ALTER TABLE account.sambaConfig CHANGE sshPass sshPassword varchar(255) DEFAULT NULL NULL COMMENT 'The SSH password';
ALTER TABLE account.ldapConfig DROP COLUMN `filter`;
ALTER TABLE account.ldapConfig CHANGE baseDn userDn varchar(255) DEFAULT NULL NULL COMMENT 'The base DN to do the query';
ALTER TABLE account.ldapConfig CHANGE host server varchar(255) NOT NULL COMMENT 'The hostname of LDAP server';
ALTER TABLE account.ldapConfig MODIFY COLUMN password varchar(255) NOT NULL COMMENT 'The LDAP password';
-- Updated
ALTER TABLE account.sambaConfig DROP COLUMN sshUser;
ALTER TABLE account.sambaConfig DROP COLUMN sshPassword;
ALTER TABLE account.sambaConfig CHANGE host adController varchar(255) DEFAULT NULL NULL COMMENT 'The hosname of domain controller';
ALTER TABLE account.sambaConfig MODIFY COLUMN adController varchar(255) DEFAULT NULL NULL COMMENT 'The hosname of domain controller';
ALTER TABLE account.sambaConfig DROP COLUMN userDn;
ALTER TABLE account.sambaConfig ADD adDomain varchar(255) NOT NULL AFTER id;
ALTER TABLE account.sambaConfig ADD verifyCert TINYINT UNSIGNED NOT NULL DEFAULT TRUE AFTER adPassword;
ALTER TABLE account.sambaConfig MODIFY COLUMN adController varchar(255) NOT NULL COMMENT 'The hosname of domain controller';
ALTER TABLE account.user
ADD COLUMN `realm` varchar(512) CHARACTER SET utf8 DEFAULT NULL AFTER id,
ADD COLUMN `emailVerified` tinyint(1) DEFAULT NULL AFTER email,
ADD COLUMN `verificationToken` varchar(512) DEFAULT NULL AFTER emailVerified;
DROP TABLE salix.user;
CREATE OR REPLACE VIEW salix.User
AS SELECT id, realm, name AS username, bcryptPassword AS password, email, emailVerified, verificationToken
FROM account.user;
ALTER TABLE account.`user`
MODIFY COLUMN bcryptPassword varchar(512) DEFAULT NULL NULL;

View File

@ -1,20 +0,0 @@
CREATE TABLE `vn`.`supplierLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) NOT NULL,
`userFk` int(10) unsigned NOT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8 DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `logSupplier_ibfk_1` (`originFk`),
KEY `supplierLog_ibfk_2` (`userFk`),
CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -1,24 +0,0 @@
CREATE TABLE `vn`.`supplierContact` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`supplierFk` INT(11) NULL DEFAULT NULL,
`phone` VARCHAR(16) NULL DEFAULT NULL,
`mobile` VARCHAR(16) NULL DEFAULT NULL,
`email` VARCHAR(255) NULL DEFAULT NULL,
`observation` TEXT NULL DEFAULT NULL,
`name` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
ALTER TABLE `vn`.`supplierContact`
ADD CONSTRAINT `supplier_id`
FOREIGN KEY (`supplierFk`)
REFERENCES `vn`.`supplier` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE;
INSERT INTO vn.supplierContact(supplierFk,phone,mobile,email,observation,`name`)
SELECT r.Id_Proveedor,c.Telefono,c.Movil,c.email,c.Notas,concat(c.Nombre," ", IFNULL(c.Apellidos,""))
FROM vn2008.Contactos c
JOIN vn2008.Relaciones r ON r.Id_Contacto = c.Id_Contacto
JOIN vn.supplier s ON s.id = r.Id_Proveedor;

View File

@ -1,25 +0,0 @@
DROP TRIGGER IF EXISTS `vn`.`ticket_afterUpdate`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `ticket_afterUpdate`
AFTER UPDATE ON `ticket`
FOR EACH ROW
BEGIN
IF !(NEW.id <=> OLD.id)
OR !(NEW.warehouseFk <=> OLD.warehouseFk)
OR !(NEW.shipped <=> OLD.shipped) THEN
CALL stock.log_add('ticket', NEW.id, OLD.id);
END IF;
IF NEW.clientFk = 2067 AND !(NEW.clientFk <=> OLD.clientFk) THEN
-- Fallo que se insertan no se sabe como tickets en este cliente
INSERT INTO vn.mail SET
`sender` = 'jgallego@verdnatura.es',
`replyTo` = 'jgallego@verdnatura.es',
`subject` = 'Modificado ticket al cliente 2067',
`body` = CONCAT(account.myUserGetName(), ' ha modificado el ticket ',
NEW.id);
END IF;
END$$
DELIMITER ;

View File

@ -1,107 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `ticket_componentPreview`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentPreview`(
vTicketFk INT,
vLanded DATE,
vAddressFk INT,
vZoneFk INT,
vWarehouseFk SMALLINT)
BEGIN
/**
* Calcula los componentes de los articulos de un ticket
*
* @param vTicketFk id del ticket
* @param vLanded nueva fecha de entrega
* @param vAddressFk nuevo consignatario
* @param vZoneFk nueva zona
* @param vWarehouseFk nuevo warehouse
*
* @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost)
*/
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
DECLARE vHasAddressChanged BOOL;
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
DECLARE vShipped DATE;
DECLARE vAddressTypeRateFk INT DEFAULT NULL;
DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL;
DECLARE vHasChangeAll BOOL DEFAULT FALSE;
SELECT DATE(landed) <> vLanded,
addressFk <> vAddressFk,
zoneFk <> vZoneFk,
warehouseFk <> vWarehouseFk
INTO
vHasDataChanged,
vHasAddressChanged,
vHasZoneChanged,
vHasWarehouseChanged
FROM vn.ticket t
WHERE t.id = vTicketFk;
IF vHasDataChanged OR vHasWarehouseChanged THEN
SET vHasChangeAll = TRUE;
END IF;
IF vHasAddressChanged THEN
SET vAddressTypeRateFk = 5;
END IF;
IF vHasZoneChanged THEN
SET vAgencyModeTypeRateFk = 6;
END IF;
SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped
FROM zone
WHERE id = vZoneFk;
CALL buyUltimate(vWarehouseFk, vShipped);
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
SELECT
vWarehouseFk AS warehouseFk,
NULL AS available,
s.itemFk,
bu.buyFk,
vZoneFk zoneFk
FROM sale s
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
WHERE s.ticketFk = vTicketFk
GROUP BY bu.warehouseFk, bu.itemFk);
CALL catalog_componentPrepare();
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value
FROM saleComponent sc
JOIN sale s ON s.id = sc.saleFk
JOIN ticket t ON t.id = s.ticketFk
JOIN `component` c ON c.id = sc.componentFk
WHERE s.ticketFk = vTicketFk
AND (c.isRenewable = FALSE
OR
(NOT vHasChangeAll
AND (NOT (c.typeFk <=> vAddressTypeRateFk
OR c.typeFk <=> vAgencyModeTypeRateFk))));
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview;
CREATE TEMPORARY TABLE tmp.ticketComponentPreview
SELECT * FROM tmp.ticketComponent;
CALL catalog_componentPurge();
DROP TEMPORARY TABLE tmp.buyUltimate;
IF vShipped IS NULL THEN
CALL util.throw('NO_ZONE_AVAILABLE');
END IF;
END$$
DELIMITER ;

View File

@ -1,12 +0,0 @@
UPDATE `salix`.`ACL` SET `principalId` = 'deliveryBoss' WHERE (`id` = '194');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '97');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '100');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '103');
UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '202');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Town', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Province', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierContact', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');

View File

@ -1,3 +0,0 @@
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '3');
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '4');
UPDATE `vn`.`claimState` SET `roleFk` = '72' WHERE (`id` = '5');

View File

@ -1,5 +0,0 @@
ALTER TABLE `hedera`.`imageCollection`
ADD COLUMN `readRoleFk` VARCHAR(45) NULL DEFAULT NULL AFTER `column`;
update `hedera`.`imageCollection` set `readRoleFk` = 1;

View File

@ -1,9 +0,0 @@
ALTER TABLE `vn`.`observationType`
ADD COLUMN `code` VARCHAR(45) NOT NULL AFTER `description`;
UPDATE `vn`.`observationType` SET `code` = 'itemPicker' WHERE (`id` = '1');
UPDATE `vn`.`observationType` SET `code` = 'packager' WHERE (`id` = '2');
UPDATE `vn`.`observationType` SET `code` = 'salesPerson' WHERE (`id` = '4');
UPDATE `vn`.`observationType` SET `code` = 'administrative' WHERE (`id` = '5');
UPDATE `vn`.`observationType` SET `code` = 'weight' WHERE (`id` = '6');
UPDATE `vn`.`observationType` SET `code` = 'delivery' WHERE (`id` = '3');

View File

@ -1,20 +0,0 @@
CREATE TABLE `vn`.`supplierLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) NOT NULL,
`userFk` int(10) unsigned NOT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8 DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `logSupplier_ibfk_1` (`originFk`),
KEY `supplierLog_ibfk_2` (`userFk`),
CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -1,25 +0,0 @@
DROP TRIGGER IF EXISTS `vn`.`ticket_afterUpdate`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `ticket_afterUpdate`
AFTER UPDATE ON `ticket`
FOR EACH ROW
BEGIN
IF !(NEW.id <=> OLD.id)
OR !(NEW.warehouseFk <=> OLD.warehouseFk)
OR !(NEW.shipped <=> OLD.shipped) THEN
CALL stock.log_add('ticket', NEW.id, OLD.id);
END IF;
IF NEW.clientFk = 2067 AND !(NEW.clientFk <=> OLD.clientFk) THEN
-- Fallo que se insertan no se sabe como tickets en este cliente
INSERT INTO vn.mail SET
`sender` = 'jgallego@verdnatura.es',
`replyTo` = 'jgallego@verdnatura.es',
`subject` = 'Modificado ticket al cliente 2067',
`body` = CONCAT(account.myUserGetName(), ' ha modificado el ticket ',
NEW.id);
END IF;
END$$
DELIMITER ;

View File

@ -1,107 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `ticket_componentPreview`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentPreview`(
vTicketFk INT,
vLanded DATE,
vAddressFk INT,
vZoneFk INT,
vWarehouseFk SMALLINT)
BEGIN
/**
* Calcula los componentes de los articulos de un ticket
*
* @param vTicketFk id del ticket
* @param vLanded nueva fecha de entrega
* @param vAddressFk nuevo consignatario
* @param vZoneFk nueva zona
* @param vWarehouseFk nuevo warehouse
*
* @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost)
*/
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
DECLARE vHasAddressChanged BOOL;
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
DECLARE vShipped DATE;
DECLARE vAddressTypeRateFk INT DEFAULT NULL;
DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL;
DECLARE vHasChangeAll BOOL DEFAULT FALSE;
SELECT DATE(landed) <> vLanded,
addressFk <> vAddressFk,
zoneFk <> vZoneFk,
warehouseFk <> vWarehouseFk
INTO
vHasDataChanged,
vHasAddressChanged,
vHasZoneChanged,
vHasWarehouseChanged
FROM vn.ticket t
WHERE t.id = vTicketFk;
IF vHasDataChanged OR vHasWarehouseChanged THEN
SET vHasChangeAll = TRUE;
END IF;
IF vHasAddressChanged THEN
SET vAddressTypeRateFk = 5;
END IF;
IF vHasZoneChanged THEN
SET vAgencyModeTypeRateFk = 6;
END IF;
SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped
FROM zone
WHERE id = vZoneFk;
CALL buyUltimate(vWarehouseFk, vShipped);
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
SELECT
vWarehouseFk AS warehouseFk,
NULL AS available,
s.itemFk,
bu.buyFk,
vZoneFk zoneFk
FROM sale s
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
WHERE s.ticketFk = vTicketFk
GROUP BY bu.warehouseFk, bu.itemFk);
CALL catalog_componentPrepare();
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value
FROM saleComponent sc
JOIN sale s ON s.id = sc.saleFk
JOIN ticket t ON t.id = s.ticketFk
JOIN `component` c ON c.id = sc.componentFk
WHERE s.ticketFk = vTicketFk
AND (c.isRenewable = FALSE
OR
(NOT vHasChangeAll
AND (NOT (c.typeFk <=> vAddressTypeRateFk
OR c.typeFk <=> vAgencyModeTypeRateFk))));
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview;
CREATE TEMPORARY TABLE tmp.ticketComponentPreview
SELECT * FROM tmp.ticketComponent;
CALL catalog_componentPurge();
DROP TEMPORARY TABLE tmp.buyUltimate;
IF vShipped IS NULL THEN
CALL util.throw('NO_ZONE_AVAILABLE');
END IF;
END$$
DELIMITER ;

View File

@ -1,43 +0,0 @@
DROP PROCEDURE IF EXISTS `vn`.`timeControl_calculate`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
BEGIN
SET @vIsOdd := TRUE;
SET @vUser := NULL;
SET @vDated := NULL;
DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate;
CREATE TEMPORARY TABLE tmp.timeControlCalculate
SELECT
userFk,
dated,
IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds,
SEC_TO_TIME(@timeWork ) timeWorkSexagesimal,
@timeWork / 3600 timeWorkDecimal,
timed
FROM (SELECT SUM(timeWork) timeWork,
userFk,
dated,
GROUP_CONCAT(DATE_FORMAT(sub.timed,"%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') timed
FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk),
IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE),
IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd),
IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed),
IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork,
IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated,
wtc.timed timed,
wtc.userFk,
direction
FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction
FROM workerTimeControl wtc
JOIN tmp.`user` w ON w.userFk = wtc.userFk
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
ORDER BY userFk, timed ASC
) wtc
WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo
) sub
GROUP BY userFk, dated
)sub2;
END$$
DELIMITER ;

View File

@ -1,2 +0,0 @@
ALTER TABLE `account`.`user`
ADD COLUMN `image` VARCHAR(255) NULL AFTER `password`;

View File

@ -1,20 +0,0 @@
CREATE TABLE `vn`.supplierFreighter
(
supplierFk INT NOT NULL,
CONSTRAINT supplierFreighter_pk
PRIMARY KEY (supplierFk),
CONSTRAINT supplier_id_fk
FOREIGN KEY (supplierFk) REFERENCES supplier (id)
ON UPDATE CASCADE ON DELETE CASCADE
);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (286);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (454);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (582);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (470);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (775);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (812);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1112);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1242);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1281);
INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1765);

View File

@ -1,7 +0,0 @@
ALTER TABLE `vn`.travel
DROP FOREIGN KEY travel_ibfk_4;
ALTER TABLE `vn`.travel
ADD CONSTRAINT supplierFreighter_fk_4
FOREIGN KEY (cargoSupplierFk) REFERENCES supplierFreighter (supplierFk)
ON UPDATE CASCADE ON DELETE SET NULL;

View File

@ -1,20 +0,0 @@
CREATE TABLE `vn`.continent
(
id TINYINT(4) AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
code VARCHAR(2) NOT NULL COLLATE utf8_general_ci,
CONSTRAINT continent_pk
PRIMARY KEY (id)
)
COMMENT 'World continents';
CREATE UNIQUE INDEX continent_name_uindex
ON `vn`.continent (name);
INSERT IGNORE INTO `vn`.continent (`name`, `code`)
VALUES
('Asia', 'AS'),
('América', 'AM'),
('África', 'AF'),
('Europa', 'EU'),
('Oceanía', 'OC');

View File

@ -1,13 +0,0 @@
ALTER TABLE `vn`.`country`
ADD COLUMN `continentFk` TINYINT(4) NULL AFTER `ibanLength`,
ADD INDEX `continent_id_fk_idx` (`continentFk` ASC);
ALTER TABLE `vn`.`country`
ADD CONSTRAINT `continent_id_fk`
FOREIGN KEY (`continentFk`)
REFERENCES `vn`.`continent` (`id`)
ON DELETE NO ACTION
ON UPDATE CASCADE;
UPDATE `vn`.`country` SET `continentFk` = '2' WHERE (`id` = '11');
UPDATE `vn`.`country` SET `continentFk` = '2' WHERE (`id` = '13');

View File

@ -1,2 +0,0 @@
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) VALUES ('Image', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('PayDem', '*', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,14 +0,0 @@
CREATE TABLE `vn`.`entryObservation` (
id int NOT NULL AUTO_INCREMENT,
entryFk int NOT NULL,
observationTypeFk TINYINT(3) UNSIGNED,
description TEXT,
PRIMARY KEY (id),
CONSTRAINT entry_id_entryFk
FOREIGN KEY (entryFk) REFERENCES entry(id),
CONSTRAINT observationType_id_observationTypeFk
FOREIGN KEY (observationTypeFk) REFERENCES observationType(id)
);
ALTER TABLE `vn`.`entryObservation`
ADD UNIQUE INDEX `entryFk_observationTypeFk_UNIQUE` (`entryFk` ASC,`observationTypeFk` ASC);

View File

@ -1,135 +0,0 @@
-- DROP PROCEDURE `vn`.`clonTravelComplete`;
DELIMITER $$
USE `vn`$$
CREATE
DEFINER = root@`%` PROCEDURE `vn`.`travel_cloneWithEntries`(IN vTravelFk INT, IN vDateStart DATE, IN vDateEnd DATE,
IN vRef VARCHAR(255), OUT vNewTravelFk INT)
BEGIN
DECLARE vEntryNew INT;
DECLARE vDone BOOLEAN DEFAULT FALSE;
DECLARE vAuxEntryFk INT;
DECLARE vRsEntry CURSOR FOR
SELECT e.id
FROM entry e
JOIN travel t
ON t.id = e.travelFk
WHERE e.travelFk = vTravelFk;
DECLARE vRsBuy CURSOR FOR
SELECT b.*
FROM buy b
JOIN entry e
ON b.entryFk = e.id
WHERE e.travelFk = vNewTravelFk and b.entryFk=vNewTravelFk
ORDER BY e.id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
START TRANSACTION;
INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg)
SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg
FROM travel
WHERE id = vTravelFk;
SET vNewTravelFk = LAST_INSERT_ID();
SET vDone = FALSE;
OPEN vRsEntry ;
FETCH vRsEntry INTO vAuxEntryFk;
WHILE NOT vDone DO
INSERT INTO entry (supplierFk,
ref,
isInventory,
isConfirmed,
isOrdered,
isRaid,
commission,
created,
evaNotes,
travelFk,
currencyFk,
companyFk,
gestDocFk,
invoiceInFk)
SELECT supplierFk,
ref,
isInventory,
isConfirmed,
isOrdered,
isRaid,
commission,
created,
evaNotes,
vNewTravelFk,
currencyFk,
companyFk,
gestDocFk,
invoiceInFk
FROM entry
WHERE id = vAuxEntryFk;
SET vEntryNew = LAST_INSERT_ID();
INSERT INTO buy (entryFk,
itemFk,
quantity,
buyingValue,
packageFk,
stickers,
freightValue,
packageValue,
comissionValue,
packing,
`grouping`,
groupingMode,
location,
price1,
price2,
price3,
minPrice,
producer,
printedStickers,
isChecked,
weight)
SELECT vEntryNew,
itemFk,
quantity,
buyingValue,
packageFk,
stickers,
freightValue,
packageValue,
comissionValue,
packing,
`grouping`,
groupingMode,
location,
price1,
price2,
price3,
minPrice,
producer,
printedStickers,
isChecked,
weight
FROM buy
WHERE entryFk = vAuxEntryFk;
FETCH vRsEntry INTO vAuxEntryFk;
END WHILE;
CLOSE vRsEntry;
COMMIT;
END;$$
DELIMITER ;

View File

@ -1,18 +0,0 @@
CREATE TABLE `vn`.`zoneLog` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`originFk` int(10) NOT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8 DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -1,13 +0,0 @@
INSERT INTO account.role (id, name, description)
VALUES
(74, 'userPhotos', 'Privilegios para subir fotos de usuario'),
(75, 'catalogPhotos', 'Privilegios para subir fotos del catálogo');
INSERT INTO account.roleInherit (role, inheritsFrom)
VALUES
(37, (SELECT id FROM account.role WHERE name = 'userPhotos')),
(51, (SELECT id FROM account.role WHERE name = 'userPhotos')),
(51, (SELECT id FROM account.role WHERE name = 'catalogPhotos')),
(35, (SELECT id FROM account.role WHERE name = 'catalogPhotos'));
CALL account.role_sync();

View File

@ -1,27 +0,0 @@
ALTER TABLE `hedera`.`imageCollection`
ADD writeRoleFk INT UNSIGNED NULL DEFAULT 1;
ALTER TABLE `hedera`.`imageCollection`
ADD CONSTRAINT role_id_writeRoleFk
FOREIGN KEY (writeRoleFk) REFERENCES account.role (id)
ON UPDATE CASCADE;
ALTER TABLE `hedera`.`imageCollection` modify readRoleFk INT UNSIGNED default 1 null;
ALTER TABLE `hedera`.`imageCollection`
ADD CONSTRAINT role_id_readRoleFk
FOREIGN KEY (readRoleFk) REFERENCES account.role (id)
ON UPDATE CASCADE;
UPDATE hedera.imageCollection t SET t.writeRoleFk = (
SELECT id FROM `account`.`role` WHERE name = 'catalogPhotos'
)
WHERE t.name = 'catalog';
UPDATE hedera.imageCollection t SET t.writeRoleFk = (
SELECT id FROM `account`.`role` WHERE name = 'userPhotos'
)
WHERE t.name = 'user';
UPDATE hedera.imageCollection t SET t.writeRoleFk = 9
WHERE t.name IN ('link', 'news');

View File

@ -1,19 +0,0 @@
DROP TRIGGER IF EXISTS `vn`.`itemTag_afterUpdate`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`itemTag_afterUpdate`
AFTER UPDATE ON `itemTag` FOR EACH ROW
trig: BEGIN
IF @isTriggerDisabled THEN
LEAVE trig;
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
SELECT NEW.itemFk id;
CALL item_refreshTags();
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;

View File

@ -1 +0,0 @@
12271-wisemen

View File

@ -1 +0,0 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('FixedPrice', '*', '*', 'ALLOW', 'ROLE', 'buyer');

View File

@ -0,0 +1 @@
Delete this

View File

@ -3,4 +3,4 @@ host = localhost
port = 3306 port = 3306
user = root user = root
password = root password = root
default-character-set=utf8 default-character-set=utf8

File diff suppressed because one or more lines are too long

View File

@ -150,21 +150,20 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`) INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`)
VALUES VALUES
(1, 'CC y Polizas de crédito', NULL, NULL), (1, 'CC y Polizas de crédito', NULL, NULL),
(2, 'Caja registradora', NULL, NULL), (2, 'Cash', 'Cash', 'cash'),
(3, 'Tarjeta de credito', NULL, NULL), (3, 'Credit card', 'Credit Card', 'creditCard'),
(4, 'Lineas de financiacion', NULL, NULL), (4, 'Finalcial lines', NULL, NULL),
(5, 'Otros productos', NULL, NULL), (5, 'Other products', NULL, NULL),
(6, 'Prestamos', NULL, NULL), (6, 'Loans', NULL, NULL),
(7, 'Leasing', NULL, NULL), (7, 'Leasing', NULL, NULL),
(8, 'Compensaciones', NULL, NULL), (8, 'Compensations', 'Compensations', 'compensation');
(9, 'Cash', 'Cash', NULL),
(10, 'Card', 'Pay on receipt', NULL);
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
VALUES VALUES
(1, 'Pay on receipt', '0000000000', 10, 0, 1, 1), (1, 'Pay on receipt', '5720000001', 3, 0, 1, 1),
(2, 'Cash', '1111111111', 9, 0, 1, 1); (2, 'Cash', '5700000001', 2, 0, 1, 1),
(3, 'Compensation', '4000000000', 8, 0, 1, 1);
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
VALUES VALUES
@ -212,13 +211,13 @@ UPDATE `vn`.`agencyMode` SET `web` = 1;
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23; UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
INSERT INTO `vn`.`payMethod`(`id`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`) INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`)
VALUES VALUES
(1, 'PayMethod one', 0, 001, 0), (1, NULL, 'PayMethod one', 0, 001, 0),
(2, 'PayMethod two', 10, 001, 0), (2, NULL, 'PayMethod two', 10, 001, 0),
(3, 'PayMethod three', 0, 001, 0), (3, 'compensation', 'PayMethod three', 0, 001, 0),
(4, 'PayMethod with IBAN', 0, 001, 1), (4, NULL, 'PayMethod with IBAN', 0, 001, 1),
(5, 'PayMethod five', 10, 001, 0); (5, NULL, 'PayMethod five', 10, 001, 0);
INSERT INTO `vn`.`payDem`(`id`, `payDem`) INSERT INTO `vn`.`payDem`(`id`, `payDem`)
VALUES VALUES
@ -271,17 +270,17 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
VALUES VALUES
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), (105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
(107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), (107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), (109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1), (110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),
(111, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1), (111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1),
(112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1); (112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1);
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`) 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'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1 SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1
@ -295,6 +294,10 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
(103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), (103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)); (104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH));
INSERT INTO `vn`.`clientConfig`(`riskTolerance`)
VALUES
(200);
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`) INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`)
VALUES VALUES
(1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0, 1), (1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0, 1),
@ -565,13 +568,13 @@ INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1');
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`) INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
VALUES VALUES
(1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 1.8, 10, CURDATE(), CURDATE(), 1), (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 1.8, 10, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 1),
(2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 2, 'second route', 0.2, 20, CURDATE(), CURDATE(), 9), (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 2, 'second route', 0.2, 20, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 9),
(3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 3, 'third route', 0.5, 30, CURDATE(), CURDATE(), 10), (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 3, 'third route', 0.5, 30, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 10),
(4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 4, 'fourth route', 0, 40, CURDATE(), CURDATE(), 12), (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 4, 'fourth route', 0, 40, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 12),
(5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 5, 'fifth route', 0.1, 50, CURDATE(), CURDATE(), 13), (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 5, 'fifth route', 0.1, 50, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 13),
(6, NULL, 57, CURDATE(), 5, 7, 'sixth route', 1.7, 60, CURDATE(), CURDATE(), 3), (6, NULL, 57, CURDATE(), 5, 7, 'sixth route', 1.7, 60, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 3),
(7, NULL, 57, CURDATE(), 6, 8, 'seventh route', 0, 70, CURDATE(), CURDATE(), 5); (7, NULL, 57, CURDATE(), 6, 8, 'seventh route', 0, 70, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 5);
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`) INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`)
VALUES VALUES
@ -712,14 +715,14 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code`
(7, 'Accessories', 1, NULL, 'icon-accessory', 'accessory'), (7, 'Accessories', 1, NULL, 'icon-accessory', 'accessory'),
(8, 'Fruit', 1, NULL, 'icon-fruit', 'fruit'); (8, 'Fruit', 1, NULL, 'icon-fruit', 'fruit');
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`) INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`)
VALUES VALUES
(1, 'CRI', 'Crisantemo', 2, 31, 35, 0), (1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0),
(2, 'ITG', 'Anthurium', 1, 31, 35, 0), (2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0),
(3, 'WPN', 'Paniculata', 2, 31, 35, 0), (3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0),
(4, 'PRT', 'Delivery ports', 3, NULL, 35, 1), (4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1),
(5, 'CON', 'Container', 3, NULL, 35, 1), (5, 'CON', 'Container', 3, 1, NULL, 35, 1),
(6, 'ALS', 'Alstroemeria', 1, 31, 35, 0); (6, 'ALS', 'Alstroemeria', 1, 1, 31, 35, 0);
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
VALUES VALUES
@ -770,25 +773,25 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
(05080000, 'Coral y materiales similares', 2, 2), (05080000, 'Coral y materiales similares', 2, 2),
(06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1); (06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`, `minPrice`) INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`, `minPrice`, `stars`)
VALUES VALUES
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '1', 1, NULL, 0), (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '1', 1, NULL, 0, 1),
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '2', 1, NULL, 0), (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '2', 1, NULL, 0, 2),
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '3', 1, NULL, 0), (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '3', 1, NULL, 0, 5),
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, '4', 2, NULL, 0), (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, '4', 2, NULL, 0, 3),
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '5', 2, NULL, 0), (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '5', 2, NULL, 0, 3),
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '6', 2, NULL, 0), (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '6', 2, NULL, 0, 4),
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '7', 2, NULL, 0), (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '7', 2, NULL, 0, 4),
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '8', 1, NULL, 0), (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '8', 1, NULL, 0, 5),
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '9', 1, NULL, 0), (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, '9', 1, NULL, 0, 4),
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '10', 1, NULL, 0), (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, '10', 1, NULL, 0, 4),
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, '11', 2, NULL, 0), (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, '11', 2, NULL, 0, 4),
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '12', 2, NULL, 0), (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, '12', 2, NULL, 0, 3),
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '13', 2, NULL, 0), (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '13', 2, NULL, 0, 2),
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 4),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 0),
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0), (16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 0),
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, '', 2, NULL, 0); (71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, '', 2, NULL, 0, 0);
INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`) INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`)
VALUES VALUES
@ -1065,25 +1068,25 @@ INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `level`)
VALUES VALUES
(1, 1, 1); (1, 1, 1);
INSERT INTO `edi`.`genus`(`genus_id`, `latin_genus_name`, `entry_date`, `expiry_date`, `change_date_time`) INSERT INTO `vn`.`genus`(`id`, `name`)
VALUES VALUES
(1, 'Abelia' , CURDATE(), NULL, CURDATE()), (1, 'Abelia'),
(2, 'Abies', CURDATE(), NULL, CURDATE()), (2, 'Abies'),
(3, 'Abutilon', CURDATE(), NULL, CURDATE()); (3, 'Abutilon');
INSERT INTO `edi`.`specie`(`specie_id`, `genus_id`, `latin_species_name`, `entry_date`, `expiry_date`, `change_date_time`) INSERT INTO `vn`.`specie`(`id`, `name`)
VALUES VALUES
(1, 1, 'grandiflora', CURDATE(), NULL, CURDATE()), (1, 'grandiflora'),
(2, 2, 'procera', CURDATE(), NULL, CURDATE()), (2, 'procera'),
(3, 3, 'decurrens', CURDATE(), NULL, CURDATE()), (3, 'decurrens'),
(4, 3, 'dealbata', CURDATE(), NULL, CURDATE()); (4, 'dealbata');
INSERT INTO `vn`.`itemBotanical`(`itemFk`, `botanical`, `genusFk`, `specieFk`) INSERT INTO `vn`.`itemBotanical`(`itemFk`, `genusFk`, `specieFk`)
VALUES VALUES
(1, 'Hedera helix', 1, 1), (1, 1, 1),
(2, NULL, 2, 2), (2, 2, 2),
(3, 'Cycas revoluta', 2, NULL), (3, 2, NULL),
(4, 'Polygonum', NULL, NULL); (4, NULL, NULL);
INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceTable`, `unit`, `ediTypeFk`, `overwrite`) INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceTable`, `unit`, `ediTypeFk`, `overwrite`)
VALUES VALUES
@ -1234,11 +1237,18 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
(104, 500), (104, 500),
(105, 5000); (105, 5000);
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`) INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
VALUES VALUES
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1), ('animals', 'Food and complements for pets'),
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8), ('complements', 'Other complements'),
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3); ('flowerPlants', 'Wholesale of flowers and plants'),
('vegetablesFruits', 'Fruit and vegetable trade');
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`)
VALUES
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants'),
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals'),
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'flowerPlants');
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`) INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
VALUES VALUES
@ -1247,11 +1257,6 @@ INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email
(3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL), (3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL),
(4, 442, 321654987, NULL, NULL, 'observation442', NULL); (4, 442, 321654987, NULL, NULL, 'observation442', NULL);
INSERT INTO `vn`.`supplierFreighter` (`supplierFk`)
VALUES
(1),
(2);
INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`) INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`)
VALUES VALUES
(1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL), (1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL),
@ -2175,4 +2180,94 @@ INSERT INTO `hedera`.`image`(`collectionFk`, `name`)
INSERT INTO `hedera`.`imageCollectionSize`(`id`, `collectionFk`,`width`, `height`) INSERT INTO `hedera`.`imageCollectionSize`(`id`, `collectionFk`,`width`, `height`)
VALUES VALUES
(1, 4, 160, 160); (1, 4, 160, 160);
INSERT INTO `vn`.`rateConfig`(`rate0`, `rate1`, `rate2`, `rate3`)
VALUES
(36, 31, 25, 21);
INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate3`)
VALUES
(DATE_ADD(CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
(CURDATE(), 1, 12, 17, 22, 27);
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
VALUES
(1, '07546501420', 67, 671, CURDATE(), 1761, 1, 1),
(2, '07546491421', 252, 2769, CURDATE(), 5231, 1, 1),
(3, '07546500823', 102, 1495, CURDATE(), 3221, 1, 1),
(4, '99610288821', 252, 2777, CURDATE(), 3641, 1, 1),
(5, '07546500834', 229, 3292, CURDATE(), 6601, 2, 1),
(6, '22101929561', 37, 458, CURDATE(), 441, 2, 1),
(7, '07546491432', 258, 3034, CURDATE(), 6441, 2, 1),
(8, '99610288644', 476, 4461, CURDATE(), 5751, 442, 1),
(9, '99610289193', 302, 2972, CURDATE(), 3871, 442, 1),
(10, '07546500856', 185, 2364, CURDATE(), 5321, 442, 1);
REPLACE INTO vn.dua (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
VALUES
(1, '19ES0028013A481523', 1, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 1, 11276.95, 442),
(2, '21ES00280136115760', 2, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 1376.20, 442),
(3, '19ES00280131956004', 3, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 3, 14268.50, 442),
(4, '19ES00280131955995', 4, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 1, 8242.50, 442),
(5, '19ES00280132022070', 5, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 10012.49, 442),
(6, '19ES00280132032308', 6, CURDATE(), CURDATE(), CURDATE(), CURDATE(), 2, 19914.25, 442),
(7, '19ES00280132025489', 7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 1934.06, 442),
(8, '19ES00280132025489', 8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 3618.52, 442),
(9, '19ES00280132025489', 9, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 7126.23, 442),
(10, '19ES00280132025489', 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), CURDATE(), CURDATE(), 2, 4631.45, 442);
REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issued`, `created`, `supplierRef`, `isBooked`, `companyFk`, `docFk`)
VALUES
(1, 1001, 'R', 1, CURDATE(), CURDATE(), 1234, 0, 442, 1),
(2, 1002, 'R', 1, CURDATE(), CURDATE(), 1235, 1, 442, 1),
(3, 1003, 'R', 1, CURDATE(), CURDATE(), 1236, 0, 442, 1),
(4, 1004, 'R', 1, CURDATE(), CURDATE(), 1237, 0, 442, 1),
(5, 1005, 'R', 1, CURDATE(), CURDATE(), 1238, 1, 442, 1),
(6, 1006, 'R', 2, CURDATE(), CURDATE(), 1239, 0, 442, 1),
(7, 1007, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1240, 1, 442, 1),
(8, 1008, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1241, 1, 442, 1),
(9, 1009, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1242, 1, 442, 1),
(10, 1010, 'R', 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1243, 1, 442, 1);
INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`)
VALUES
(1, CURDATE(), 1, 237),
(1, CURDATE(), 1, 15.25),
(2, CURDATE(), 1, 168),
(2, CURDATE(), 1, 55.17),
(3, CURDATE(), 1, 87.95),
(3, CURDATE(), 1, 7.65),
(4, CURDATE(), 1, 373.27),
(4, CURDATE(), 1, 73.36),
(5, CURDATE(), 1, 64.23),
(6, CURDATE(), 1, 32.95),
(7, CURDATE(), 1, 58.64);
INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`)
VALUES
(1, 1, 1),
(2, 2, 2),
(3, 3, 3),
(4, 4, 4),
(5, 5, 5),
(6, 6, 6),
(7, 7, 7),
(8, 8, 8),
(9, 9, 9),
(10, 10, 10);
INSERT INTO `vn`.`ticketRecalc`(`ticketFk`)
SELECT `id`
FROM `vn`.`ticket` t
LEFT JOIN vn.ticketRecalc tr ON tr.ticketFk = t.id
WHERE tr.ticketFk IS NULL;
CALL `vn`.`ticket_doRecalc`();
INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`)
VALUES
(1, 1, 1),
(2, 1, 2),
(3, 6, 5),
(4, 7, 1);

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@ TABLES=(
salix salix
ACL ACL
fieldAcl fieldAcl
module
) )
dump_tables ${TABLES[@]} dump_tables ${TABLES[@]}
@ -39,9 +40,12 @@ TABLES=(
vn vn
alertLevel alertLevel
bookingPlanner bookingPlanner
cplusInvoiceType472
cplusInvoiceType477 cplusInvoiceType477
cplusRectificationType
cplusSubjectOp cplusSubjectOp
cplusTaxBreak cplusTaxBreak
cplusTrascendency472
pgc pgc
time time
claimResponsible claimResponsible
@ -54,6 +58,7 @@ TABLES=(
department department
component component
componentType componentType
continent
) )
dump_tables ${TABLES[@]} dump_tables ${TABLES[@]}

View File

@ -31,7 +31,6 @@ IGNORETABLES=(
--ignore-table=vn.agencyModeZone --ignore-table=vn.agencyModeZone
--ignore-table=vn.agencyProvince --ignore-table=vn.agencyProvince
--ignore-table=vn.agencyWarehouse --ignore-table=vn.agencyWarehouse
--ignore-table=vn.awb
--ignore-table=vn.botanicExport__ --ignore-table=vn.botanicExport__
--ignore-table=vn.clientDefaultCompany --ignore-table=vn.clientDefaultCompany
--ignore-table=vn.color --ignore-table=vn.color
@ -39,6 +38,7 @@ IGNORETABLES=(
--ignore-table=vn.comparativeFilter --ignore-table=vn.comparativeFilter
--ignore-table=vn.coolerPath --ignore-table=vn.coolerPath
--ignore-table=vn.coolerPathDetail --ignore-table=vn.coolerPathDetail
--ignore-table=vn.config__
--ignore-table=vn.department__ --ignore-table=vn.department__
--ignore-table=vn.doc --ignore-table=vn.doc
--ignore-table=vn.entity --ignore-table=vn.entity
@ -49,13 +49,8 @@ IGNORETABLES=(
--ignore-table=vn.grant --ignore-table=vn.grant
--ignore-table=vn.grantGroup --ignore-table=vn.grantGroup
--ignore-table=vn.invoiceCorrection__ --ignore-table=vn.invoiceCorrection__
--ignore-table=vn.invoiceIn
--ignore-table=vn.invoiceInAwb
--ignore-table=vn.invoiceInDueDay
--ignore-table=vn.invoiceInEntry
--ignore-table=vn.invoiceInIntrastat
--ignore-table=vn.invoiceInTax
--ignore-table=vn.itemTaxCountrySpain --ignore-table=vn.itemTaxCountrySpain
--ignore-table=vn.itemFreeNumber__
--ignore-table=vn.mail__ --ignore-table=vn.mail__
--ignore-table=vn.manaSpellers --ignore-table=vn.manaSpellers
--ignore-table=vn.outgoingInvoiceKk --ignore-table=vn.outgoingInvoiceKk
@ -69,7 +64,6 @@ IGNORETABLES=(
--ignore-table=vn.printingQueue --ignore-table=vn.printingQueue
--ignore-table=vn.printServerQueue__ --ignore-table=vn.printServerQueue__
--ignore-table=vn.promissoryNote --ignore-table=vn.promissoryNote
--ignore-table=vn.rate
--ignore-table=vn.referenceRate__ --ignore-table=vn.referenceRate__
--ignore-table=vn.routesControl --ignore-table=vn.routesControl
--ignore-table=vn.salesToPrePrepare --ignore-table=vn.salesToPrePrepare
@ -78,6 +72,7 @@ IGNORETABLES=(
--ignore-table=vn.ticketeToPreparePrepared --ignore-table=vn.ticketeToPreparePrepared
--ignore-table=vn.ticketObservation__ --ignore-table=vn.ticketObservation__
--ignore-table=vn.ticketRequest__ --ignore-table=vn.ticketRequest__
--ignore-table=vn.ticket_print__
--ignore-table=vn.ticketToPrepare --ignore-table=vn.ticketToPrepare
--ignore-table=vn.till__ --ignore-table=vn.till__
--ignore-table=vn.travelThermograph__ --ignore-table=vn.travelThermograph__
@ -91,6 +86,8 @@ IGNORETABLES=(
--ignore-table=vn.warehouseJoined --ignore-table=vn.warehouseJoined
--ignore-table=vn.workerTeam__ --ignore-table=vn.workerTeam__
--ignore-table=vn.XDiario__ --ignore-table=vn.XDiario__
--ignore-table=sage.movConta
--ignore-table=sage.movContaCopia
) )
mysqldump \ mysqldump \
--defaults-file=config.production.ini \ --defaults-file=config.production.ini \

View File

@ -0,0 +1,31 @@
const app = require('vn-loopback/server/server');
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
describe('item_getBalance()', () => {
it(`should return the item balance ordered by alert level`, async() => {
let stmts = [];
let params = {
warehouseFk: 1,
itemFk: 1
};
const conn = await app.models.Item.dataSource.connector;
stmts.push(new ParameterizedSQL('CALL vn.item_getBalance(?, ?)', [
params.warehouseFk,
params.itemFk
]));
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql);
let itemBalance = result[0];
expect(itemBalance[0].alertLevel).toBeGreaterThanOrEqual(itemBalance[1].alertLevel);
expect(itemBalance[1].alertLevel).toBeGreaterThanOrEqual(itemBalance[2].alertLevel);
expect(itemBalance[2].alertLevel).toBeGreaterThanOrEqual(itemBalance[3].alertLevel);
expect(itemBalance[3].alertLevel).toBeGreaterThanOrEqual(itemBalance[4].alertLevel);
expect(itemBalance[4].alertLevel).toBeGreaterThanOrEqual(itemBalance[5].alertLevel);
expect(itemBalance[5].alertLevel).toBeGreaterThanOrEqual(itemBalance[6].alertLevel);
});
});

View File

@ -0,0 +1,127 @@
{
"invoices": [
{
"tx_company": "TESSAROSES S.A.",
"id_invoice": "20062926",
"id_purchaseorder": "20106319",
"tx_customer_ref": "",
"id_customer": "56116",
"id_customer_floricode": "",
"nm_bill": "VERDNATURA LEVANTE SL",
"nm_ship": "VERDNATURA LEVANTE SL",
"nm_cargo": "OYAMBARILLO",
"dt_purchaseorder": "06/19/2020",
"dt_fly": "06/20/2020",
"dt_invoice": "06/19/2020",
"nm_incoterm": "FOB UIO",
"tx_awb": "729-6340 2846",
"tx_hawb": "LA0061832844",
"tx_oe": "05520204000335992",
"nu_totalstemsPO": "850",
"mny_flower": "272.5000",
"mny_freight": "0.0000",
"mny_total": "272.5000",
"nu_boxes": "4",
"nu_fulls": "1.75",
"dt_posted": "2020-06-19T13:31:41",
"boxes": [
{
"id_box": "200573095",
"nm_box": "HB",
"tp_box": "HB",
"tx_label": "",
"nu_length": "96",
"nu_width": "32",
"nu_height": "30.5",
"products": [
{
"id_floricode": "27887",
"id_migros_variety": "",
"nm_product": "FREEDOM 60CM 25ST",
"nm_species": "ROSES",
"nm_variety": "FREEDOM",
"nu_length": "60",
"nu_stems_bunch": "25",
"nu_bunches": "10",
"mny_rate_stem": "0.3500",
"mny_freight_unit": "0.0000",
"barcodes": "202727621,202725344,202725345,202725571,202725730,202725731,202725732,202725925,202726131,202726685"
}
]
},
{
"id_box": "200573106",
"nm_box": "HB",
"tp_box": "HB",
"tx_label": "",
"nu_length": "96",
"nu_width": "32",
"nu_height": "30.5",
"products": [
{
"id_floricode": "27887",
"id_migros_variety": "",
"nm_product": "FREEDOM 70CM 25ST",
"nm_species": "ROSES",
"nm_variety": "FREEDOM",
"nu_length": "70",
"nu_stems_bunch": "25",
"nu_bunches": "8",
"mny_rate_stem": "0.4000",
"mny_freight_unit": "0.0000",
"barcodes": "202727077,202727078,202727079,202727080,202727650,202727654,202727656,202727657"
}
]
},
{
"id_box": "200573117",
"nm_box": "HB",
"tp_box": "HB",
"tx_label": "",
"nu_length": "96",
"nu_width": "32",
"nu_height": "30.5",
"products": [
{
"id_floricode": "28409",
"id_migros_variety": "",
"nm_product": "TIBET 40CM 25ST",
"nm_species": "ROSES",
"nm_variety": "TIBET",
"nu_length": "40",
"nu_stems_bunch": "25",
"nu_bunches": "12",
"mny_rate_stem": "0.2500",
"mny_freight_unit": "0.0000",
"barcodes": "202723350,202723351,202723352,202723353,202723354,202723355,202723356,202723357,202726690,202726745,202726813,202726814"
}
]
},
{
"id_box": "200573506",
"nm_box": "QB 2",
"tp_box": "QB",
"tx_label": "",
"nu_length": "80",
"nu_width": "30",
"nu_height": "17.5",
"products": [
{
"id_floricode": "27887",
"id_migros_variety": "",
"nm_product": "FREEDOM 50CM 25ST",
"nm_species": "ROSES",
"nm_variety": "FREEDOM",
"nu_length": "50",
"nu_stems_bunch": "25",
"nu_bunches": "4",
"mny_rate_stem": "0.3000",
"mny_freight_unit": "0.0000",
"barcodes": "202727837,202727839,202727842,202726682"
}
]
}
]
}
]
}

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -23,6 +23,64 @@ export default {
acceptButton: '.vn-confirm.shown button[response=accept]', acceptButton: '.vn-confirm.shown button[response=accept]',
searchButton: 'vn-searchbar vn-icon[icon="search"]' searchButton: 'vn-searchbar vn-icon[icon="search"]'
}, },
moduleIndex: {
anyStarredModule: 'vn-home > div:nth-child(1) > div.modules > a',
firstModulePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="push_pin"]',
firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]'
},
accountIndex: {
addAccount: 'vn-user-index button vn-icon[icon="add"]',
newName: 'vn-user-create vn-textfield[ng-model="$ctrl.user.name"]',
newNickname: 'vn-user-create vn-textfield[ng-model="$ctrl.user.nickname"]',
newEmail: 'vn-user-create vn-textfield[ng-model="$ctrl.user.email"]',
newRole: 'vn-user-create vn-autocomplete[ng-model="$ctrl.user.roleFk"]',
newPassword: 'vn-user-create vn-textfield[ng-model="$ctrl.user.password"]',
createAccountButton: 'vn-user-create button[type="submit"]',
},
accountBasicData: {
name: 'vn-user-basic-data vn-textfield[ng-model="$ctrl.user.name"]',
nickname: 'vn-user-basic-data vn-textfield[ng-model="$ctrl.user.nickname"]',
email: 'vn-user-basic-data vn-textfield[ng-model="$ctrl.user.email"]',
language: 'vn-user-basic-data vn-autocomplete[ng-model="$ctrl.user.lang"]',
save: 'vn-user-basic-data button[type="submit"]'
},
accountRoles: {
anyResult: 'vn-user-roles > vn-data-viewer vn-list > a'
},
accountAliasIndex: {
addAlias: 'vn-alias-index button vn-icon[icon="add"]',
newName: 'vn-alias-create vn-textfield[ng-model="$ctrl.alias.alias"]',
newDescription: 'vn-alias-create vn-textfield[ng-model="$ctrl.alias.description"]',
createAliasButton: 'vn-alias-create button[type="submit"]',
},
accountAliasBasicData: {
name: 'vn-alias-basic-data vn-textfield[ng-model="$ctrl.alias.alias"]',
description: 'vn-alias-basic-data vn-textfield[ng-model="$ctrl.alias.description"]',
save: 'vn-alias-basic-data button[type="submit"]'
},
accountAliasUsers: {
anyResult: 'vn-alias-users > vn-data-viewer vn-tr'
},
accountRoleIndex: {
addRole: 'vn-role-index button vn-icon[icon="add"]',
newName: 'vn-role-create vn-textfield[ng-model="$ctrl.role.name"]',
newDescription: 'vn-role-create vn-textfield[ng-model="$ctrl.role.description"]',
createRoleButton: 'vn-role-create button[type="submit"]',
},
accountRoleBasicData: {
name: 'vn-role-basic-data vn-textfield[ng-model="$ctrl.role.name"]',
description: 'vn-role-basic-data vn-textfield[ng-model="$ctrl.role.description"]',
save: 'vn-role-basic-data button[type="submit"]'
},
accountSubroles: {
addSubrole: 'vn-role-subroles button vn-icon[icon="add"]',
role: 'vn-autocomplete[ng-model="$ctrl.addData.inheritsFrom"]',
save: 'button[response="accept"]',
anyResult: 'vn-role-subroles > vn-data-viewer > div > div > vn-card > vn-list > a'
},
accountRoleInheritance: {
anyResult: 'vn-role-inherited > vn-data-viewer > div > div > vn-card > vn-list > a'
},
clientsIndex: { clientsIndex: {
createClientButton: `vn-float-button` createClientButton: `vn-float-button`
}, },
@ -186,8 +244,11 @@ export default {
clientBalance: { clientBalance: {
company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
newPaymentButton: `vn-float-button`, newPaymentButton: `vn-float-button`,
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.bankFk"]',
newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]', newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.amountPaid"]',
newDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
deliveredAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.deliveredAmount"]',
refundAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.amountToReturn"]',
saveButton: '.vn-dialog.shown [response="accept"]', saveButton: '.vn-dialog.shown [response="accept"]',
firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)', firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)',
firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable', firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable',
@ -313,7 +374,7 @@ export default {
fourthRelevancy: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]', fourthRelevancy: 'vn-item-tags vn-horizontal:nth-child(4) [ng-model="itemTag.priority"]',
fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]', fourthRemoveTagButton: 'vn-item-tags vn-horizontal:nth-child(4) vn-icon-button[icon="delete"]',
fifthTag: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]', fifthTag: 'vn-item-tags vn-horizontal:nth-child(5) > vn-autocomplete[ng-model="itemTag.tagFk"]',
fifthValue: 'vn-item-tags vn-horizontal:nth-child(5) vn-textfield[ng-model="itemTag.value"]', fifthValue: 'vn-item-tags vn-horizontal:nth-child(5) vn-autocomplete[ng-model="itemTag.value"]',
fifthRelevancy: 'vn-item-tags vn-horizontal:nth-child(5) vn-input-number[ng-model="itemTag.priority"]', fifthRelevancy: 'vn-item-tags vn-horizontal:nth-child(5) vn-input-number[ng-model="itemTag.priority"]',
sixthTag: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]', sixthTag: 'vn-item-tags vn-horizontal:nth-child(6) > vn-autocomplete[ng-model="itemTag.tagFk"]',
sixthValue: 'vn-item-tags vn-horizontal:nth-child(6) vn-textfield[ng-model="itemTag.value"]', sixthValue: 'vn-item-tags vn-horizontal:nth-child(6) vn-textfield[ng-model="itemTag.value"]',
@ -349,7 +410,6 @@ export default {
submitNichesButton: 'vn-item-niche button[type=submit]' submitNichesButton: 'vn-item-niche button[type=submit]'
}, },
itemBotanical: { itemBotanical: {
botanical: 'vn-item-botanical vn-horizontal:nth-child(1) vn-textfield[ng-model="$ctrl.botanical.botanical"]',
genus: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]', genus: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]',
species: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]', species: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
submitBotanicalButton: `vn-item-botanical button[type=submit]` submitBotanicalButton: `vn-item-botanical button[type=submit]`
@ -389,18 +449,22 @@ export default {
descriptorTicketId: 'vn-ticket-descriptor > vn-descriptor-content > div > div.body > div.top > div' descriptorTicketId: 'vn-ticket-descriptor > vn-descriptor-content > div > div.body > div.top > div'
}, },
ticketsIndex: { ticketsIndex: {
anySearchResult: 'vn-ticket-index vn-tbody > a',
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]', openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]', advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]',
advancedSearchDaysOnward: 'vn-ticket-search-panel vn-input-number[ng-model="filter.scopeDays"]', advancedSearchDaysOnward: 'vn-ticket-search-panel vn-input-number[ng-model="filter.scopeDays"]',
advancedSearchClient: 'vn-ticket-search-panel vn-textfield[ng-model="filter.clientFk"]',
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]', advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
newTicketButton: 'vn-ticket-index a[ui-sref="ticket.create"]', newTicketButton: 'vn-ticket-index a[ui-sref="ticket.create"]',
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr', searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
firstTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1) > vn-check',
secondTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(2) > vn-td:nth-child(1) > vn-check', secondTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(2) > vn-td:nth-child(1) > vn-check',
thirdTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(3) > vn-td:nth-child(1) > vn-check', thirdTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(3) > vn-td:nth-child(1) > vn-check',
sixthTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(6) > vn-td:nth-child(1) > vn-check', sixthTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(6) > vn-td:nth-child(1) > vn-check',
payoutButton: 'vn-ticket-index vn-button[icon="icon-recovery"]', payoutButton: 'vn-ticket-index vn-button[icon="icon-recovery"]',
payoutCompany: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.companyFk"]', payoutCompany: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.companyFk"]',
payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.bankFk"]',
payoutDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
submitPayout: '.vn-dialog button[response="accept"]', submitPayout: '.vn-dialog button[response="accept"]',
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
searchResultDate: 'vn-ticket-summary [label=Landed] span', searchResultDate: 'vn-ticket-summary [label=Landed] span',
@ -432,6 +496,7 @@ export default {
moreMenuDeleteTicket: '.vn-menu [name="deleteTicket"]', moreMenuDeleteTicket: '.vn-menu [name="deleteTicket"]',
moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]', moreMenuRestoreTicket: '.vn-menu [name="restoreTicket"]',
moreMenuMakeInvoice: '.vn-menu [name="makeInvoice"]', moreMenuMakeInvoice: '.vn-menu [name="makeInvoice"]',
moreMenuRegenerateInvoice: '.vn-menu [name="regenerateInvoice"]',
moreMenuChangeShippedHour: '.vn-menu [name="changeShipped"]', moreMenuChangeShippedHour: '.vn-menu [name="changeShipped"]',
moreMenuPaymentSMS: '.vn-menu [name="sendPaymentSms"]', moreMenuPaymentSMS: '.vn-menu [name="sendPaymentSms"]',
moreMenuSendImportSms: '.vn-menu [name="sendImportSms"]', moreMenuSendImportSms: '.vn-menu [name="sendImportSms"]',
@ -725,10 +790,11 @@ export default {
saveButton: 'vn-route-basic-data button[type=submit]' saveButton: 'vn-route-basic-data button[type=submit]'
}, },
routeTickets: { routeTickets: {
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"]', firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-input-number[ng-model="ticket.priority"]',
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check', firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check',
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]', buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',
anyTicket: 'vn-route-tickets vn-tbody > vn-tr',
confirmButton: '.vn-confirm.shown button[response="accept"]' confirmButton: '.vn-confirm.shown button[response="accept"]'
}, },
workerSummary: { workerSummary: {
@ -842,6 +908,14 @@ export default {
anySearchResult: 'vn-travel-index vn-tbody > a', anySearchResult: 'vn-travel-index vn-tbody > a',
firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)', firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)',
firstTravelAddEntryButton: 'vn-travel-index a:nth-child(1) vn-icon[icon="icon-ticket"]', firstTravelAddEntryButton: 'vn-travel-index a:nth-child(1) vn-icon[icon="icon-ticket"]',
newTravelButton: 'vn-travel-index button vn-icon[icon="add"]',
reference: 'vn-travel-create vn-textfield[ng-model="$ctrl.travel.ref"]',
agency: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]',
shipDate: 'vn-travel-create vn-date-picker[ng-model="$ctrl.travel.shipped"]',
landingDate: 'vn-travel-create vn-date-picker[ng-model="$ctrl.travel.landed"]',
warehouseOut: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]',
warehouseIn: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]',
save: 'vn-travel-create vn-submit > button'
}, },
travelExtraCommunity: { travelExtraCommunity: {
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr', anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
@ -852,6 +926,7 @@ export default {
travelBasicData: { travelBasicData: {
reference: 'vn-travel-basic-data vn-textfield[ng-model="$ctrl.travel.ref"]', reference: 'vn-travel-basic-data vn-textfield[ng-model="$ctrl.travel.ref"]',
agency: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]', agency: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]',
shippedDate: 'vn-travel-basic-data vn-date-picker[ng-model="$ctrl.travel.shipped"]',
deliveryDate: 'vn-travel-basic-data vn-date-picker[ng-model="$ctrl.travel.landed"]', deliveryDate: 'vn-travel-basic-data vn-date-picker[ng-model="$ctrl.travel.landed"]',
outputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]', outputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]',
inputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]', inputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]',
@ -941,6 +1016,17 @@ export default {
travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a', travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a',
entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a' entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a'
}, },
entryBuys: {
importButton: 'vn-entry-buy-index vn-icon[icon="publish"]',
ref: 'vn-entry-buy-import vn-textfield[ng-model="$ctrl.import.ref"]',
observation: 'vn-entry-buy-import vn-textarea[ng-model="$ctrl.import.observation"]',
file: 'vn-entry-buy-import vn-input-file[ng-model="$ctrl.import.file"]',
firstImportedItem: 'vn-entry-buy-import tbody:nth-child(2) vn-autocomplete[ng-model="buy.itemFk"]',
secondImportedItem: 'vn-entry-buy-import tbody:nth-child(3) vn-autocomplete[ng-model="buy.itemFk"]',
thirdImportedItem: 'vn-entry-buy-import tbody:nth-child(4) vn-autocomplete[ng-model="buy.itemFk"]',
fourthImportedItem: 'vn-entry-buy-import tbody:nth-child(5) vn-autocomplete[ng-model="buy.itemFk"]',
importBuysButton: 'vn-entry-buy-import button[type="submit"]'
},
entryLatestBuys: { entryLatestBuys: {
firstBuy: 'vn-entry-latest-buys vn-tbody > a:nth-child(1)', firstBuy: 'vn-entry-latest-buys vn-tbody > a:nth-child(1)',
allBuysCheckBox: 'vn-entry-latest-buys vn-thead vn-check', allBuysCheckBox: 'vn-entry-latest-buys vn-thead vn-check',

View File

@ -0,0 +1,43 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Starred modules path', async() => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.login('employee');
});
afterAll(async() => {
await browser.close();
});
it('should make sure there are no modules pinned yet', async() => {
const count = await page.countElement(selectors.moduleIndex.anyStarredModule);
expect(count).toEqual(0);
});
it('should set a module as favore', async() => {
await page.waitToClick(selectors.moduleIndex.firstModulePinIcon);
const message = await page.waitForSnackbar();
const count = await page.countElement(selectors.moduleIndex.anyStarredModule);
expect(message.text).toContain('Data saved!');
expect(count).toEqual(1);
});
it('should remove the module from favores', async() => {
await page.waitToClick(selectors.moduleIndex.firstModuleRemovePinIcon);
const message = await page.waitForSnackbar();
const count = await page.countElement(selectors.moduleIndex.anyStarredModule);
expect(message.text).toContain('Data saved!');
expect(count).toEqual(0);
});
});

View File

@ -38,7 +38,7 @@ describe('Client balance path', () => {
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should click the new payment button', async() => { it('should reload the section', async() => {
await page.closePopup(); await page.closePopup();
await page.reloadSection('client.card.balance.index'); await page.reloadSection('client.card.balance.index');
}); });
@ -46,7 +46,9 @@ describe('Client balance path', () => {
it('should create a new payment that clears the debt', async() => { it('should create a new payment that clears the debt', async() => {
await page.closePopup(); await page.closePopup();
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Cash');
await page.clearInput(selectors.clientBalance.newDescription);
await page.write(selectors.clientBalance.newDescription, 'Description');
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
@ -78,16 +80,25 @@ describe('Client balance path', () => {
expect(firstBalanceLine).toContain('0.00'); expect(firstBalanceLine).toContain('0.00');
}); });
it('should create a new payment that sets the balance to positive value', async() => { it('should create a new payment and check the cash comparison works correctly', async() => {
const amountPaid = '100';
const cashHanded = '500';
const expectedRefund = '400';
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.overwrite(selectors.clientBalance.newPaymentAmount, '100'); await page.write(selectors.clientBalance.newPaymentAmount, amountPaid);
await page.clearInput(selectors.clientBalance.newDescription);
await page.write(selectors.clientBalance.newDescription, 'Payment');
await page.write(selectors.clientBalance.deliveredAmount, cashHanded);
const refund = await page.waitToGetProperty(selectors.clientBalance.refundAmount, 'value');
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(refund).toEqual(expectedRefund);
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check balance is now -100', async() => { it('should check the balance value is now -100', async() => {
let result = await page let result = await page
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
@ -96,7 +107,10 @@ describe('Client balance path', () => {
it('should create a new payment that sets the balance back to the original negative value', async() => { it('should create a new payment that sets the balance back to the original negative value', async() => {
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150'); await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150');
await page.clearInput(selectors.clientBalance.newDescription);
await page.write(selectors.clientBalance.newDescription, 'Description');
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();

View File

@ -48,10 +48,10 @@ describe('Item summary path', () => {
}); });
it(`should check the item summary preview shows fields from botanical`, async() => { it(`should check the item summary preview shows fields from botanical`, async() => {
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix'); await page.waitForTextInElement(selectors.itemSummary.botanical, 'Abelia');
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('Hedera helix'); expect(result).toContain('Abelia');
}); });
it(`should check the item summary preview shows fields from barcode`, async() => { it(`should check the item summary preview shows fields from barcode`, async() => {
@ -102,7 +102,7 @@ describe('Item summary path', () => {
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true}); await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
}); });
it(`should navigate to the one of the items detailed section`, async() => { it(`should navigate to one of the items detailed section`, async() => {
await page.accessToSearchResult('Melee weapon combat fist 15cm'); await page.accessToSearchResult('Melee weapon combat fist 15cm');
await page.waitForState('item.card.summary'); await page.waitForState('item.card.summary');
}); });
@ -135,7 +135,7 @@ describe('Item summary path', () => {
it(`should check the item summary shows fields from botanical section`, async() => { it(`should check the item summary shows fields from botanical section`, async() => {
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('-'); expect(result).toContain('procera');
}); });
it(`should check the item summary shows fields from barcodes section`, async() => { it(`should check the item summary shows fields from barcodes section`, async() => {

View File

@ -16,7 +16,7 @@ describe('Item create tags path', () => {
await browser.close(); await browser.close();
}); });
it(`should create a new tag and delete a former one`, async() => { it('should create a new tag and delete a former one', async() => {
await page.waitToClick(selectors.itemTags.fourthRemoveTagButton); await page.waitToClick(selectors.itemTags.fourthRemoveTagButton);
await page.waitToClick(selectors.itemTags.addItemTagButton); await page.waitToClick(selectors.itemTags.addItemTagButton);
await page.autocompleteSearch(selectors.itemTags.seventhTag, 'Ancho de la base'); await page.autocompleteSearch(selectors.itemTags.seventhTag, 'Ancho de la base');
@ -29,7 +29,7 @@ describe('Item create tags path', () => {
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the fourth row data is the expected one`, async() => { it('should confirm the fourth row data is the expected one', async() => {
await page.reloadSection('item.card.tags'); await page.reloadSection('item.card.tags');
await page.waitForSelector('vn-item-tags'); await page.waitForSelector('vn-item-tags');
let result = await page.waitToGetProperty(selectors.itemTags.fourthTag, 'value'); let result = await page.waitToGetProperty(selectors.itemTags.fourthTag, 'value');
@ -47,7 +47,7 @@ describe('Item create tags path', () => {
expect(result).toEqual('4'); expect(result).toEqual('4');
}); });
it(`should confirm the fifth row data is the expected one`, async() => { it('should confirm the fifth row data is the expected one', async() => {
let tag = await page let tag = await page
.waitToGetProperty(selectors.itemTags.fifthTag, 'value'); .waitToGetProperty(selectors.itemTags.fifthTag, 'value');
@ -62,7 +62,7 @@ describe('Item create tags path', () => {
expect(relevancy).toEqual('5'); expect(relevancy).toEqual('5');
}); });
it(`should confirm the sixth row data is the expected one`, async() => { it('should confirm the sixth row data is the expected one', async() => {
let tag = await page let tag = await page
.waitToGetProperty(selectors.itemTags.sixthTag, 'value'); .waitToGetProperty(selectors.itemTags.sixthTag, 'value');

View File

@ -17,7 +17,6 @@ describe('Item Create botanical path', () => {
}); });
it(`should create a new botanical for the item`, async() => { it(`should create a new botanical for the item`, async() => {
await page.write(selectors.itemBotanical.botanical, 'Cicuta maculata');
await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abelia'); await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abelia');
await page.autocompleteSearch(selectors.itemBotanical.species, 'dealbata'); await page.autocompleteSearch(selectors.itemBotanical.species, 'dealbata');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
@ -26,15 +25,6 @@ describe('Item Create botanical path', () => {
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the botanical for the item was created`, async() => {
await page.reloadSection('item.card.botanical');
await page.waitForTextInField(selectors.itemBotanical.botanical, 'Cicuta maculata');
const result = await page
.waitToGetProperty(selectors.itemBotanical.botanical, 'value');
expect(result).toEqual('Cicuta maculata');
});
it(`should confirm the Genus for the item was created`, async() => { it(`should confirm the Genus for the item was created`, async() => {
await page.waitForTextInField(selectors.itemBotanical.genus, 'Abelia'); await page.waitForTextInField(selectors.itemBotanical.genus, 'Abelia');
const result = await page const result = await page
@ -51,8 +41,6 @@ describe('Item Create botanical path', () => {
}); });
it(`should edit botanical for the item`, async() => { it(`should edit botanical for the item`, async() => {
await page.clearInput(selectors.itemBotanical.botanical);
await page.write(selectors.itemBotanical.botanical, 'Herp Derp');
await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abies'); await page.autocompleteSearch(selectors.itemBotanical.genus, 'Abies');
await page.autocompleteSearch(selectors.itemBotanical.species, 'decurrens'); await page.autocompleteSearch(selectors.itemBotanical.species, 'decurrens');
await page.waitToClick(selectors.itemBotanical.submitBotanicalButton); await page.waitToClick(selectors.itemBotanical.submitBotanicalButton);
@ -61,15 +49,6 @@ describe('Item Create botanical path', () => {
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it(`should confirm the botanical for the item was edited`, async() => {
await page.reloadSection('item.card.botanical');
await page.waitForTextInField(selectors.itemBotanical.botanical, 'Herp Derp');
const result = await page
.waitToGetProperty(selectors.itemBotanical.botanical, 'value');
expect(result).toEqual('Herp Derp');
});
it(`should confirm the Genus for the item was edited`, async() => { it(`should confirm the Genus for the item was edited`, async() => {
await page.waitForTextInField(selectors.itemBotanical.genus, 'Abies'); await page.waitForTextInField(selectors.itemBotanical.genus, 'Abies');
const result = await page const result = await page

View File

@ -376,7 +376,8 @@ describe('Ticket Edit sale path', () => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
it('should update all sales discount', async() => { // tickets no longer update their totals instantly, a task performed ever 5-10 mins does it. disabled this test until it changes.
xit('should update all sales discount', async() => {
await page.closePopup(); await page.closePopup();
await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount); await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);

View File

@ -129,10 +129,10 @@ describe('Ticket descriptor path', () => {
}); });
describe('Make invoice', () => { describe('Make invoice', () => {
it('should login as adminBoss role then search for a ticket', async() => { it('should login as administrative role then search for a ticket', async() => {
const invoiceableTicketId = '14'; const invoiceableTicketId = '14';
await page.loginAndModule('adminBoss', 'ticket'); await page.loginAndModule('administrative', 'ticket');
await page.accessToSearchResult(invoiceableTicketId); await page.accessToSearchResult(invoiceableTicketId);
await page.waitForState('ticket.card.summary'); await page.waitForState('ticket.card.summary');
}); });
@ -160,6 +160,18 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual('T4444445'); expect(result).toEqual('T4444445');
}); });
it(`should regenerate the invoice using the descriptor menu`, async() => {
const expectedMessage = 'The invoice PDF document has been regenerated';
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitForContentLoaded();
await page.waitToClick(selectors.ticketDescriptor.moreMenuRegenerateInvoice);
await page.respondToDialog('accept');
const message = await page.waitForSnackbar();
expect(message.text).toContain(expectedMessage);
});
}); });
describe('SMS', () => { describe('SMS', () => {

View File

@ -22,23 +22,31 @@ describe('Ticket index payout path', () => {
it('should check the second ticket from a client and 1 of another', async() => { it('should check the second ticket from a client and 1 of another', async() => {
await page.waitToClick(selectors.globalItems.searchButton); await page.waitToClick(selectors.globalItems.searchButton);
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.payoutButton); await page.waitToClick(selectors.ticketsIndex.payoutButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('You cannot make a payment on account from multiple clients'); expect(message.text).toContain('You cannot make a payment on account from multiple clients');
}); });
it('should uncheck the sixth ticket result and check the third which is from the same client then open the payout form', async() => { it('should search for tickets of the same client then open the payout form', async() => {
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox); await page.write(selectors.ticketsIndex.advancedSearchClient, '101');
await page.keyboard.press('Enter');
await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 6);
await page.waitToClick(selectors.ticketsIndex.firstTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.payoutButton); await page.waitToClick(selectors.ticketsIndex.payoutButton);
await page.waitForSelector(selectors.ticketsIndex.payoutCompany); await page.waitForSelector(selectors.ticketsIndex.payoutCompany);
}); });
it('should fill the company and bank to perform a payout', async() => { it('should fill the company and bank to perform a payout', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.payoutCompany, 'VNL');
await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash'); await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash');
await page.write(selectors.clientBalance.newPaymentAmount, '100');
await page.write(selectors.ticketsIndex.payoutDescription, 'Payment');
await page.waitToClick(selectors.ticketsIndex.submitPayout); await page.waitToClick(selectors.ticketsIndex.submitPayout);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
// #1528 e2e claim/detail describe('Route tickets path', () => {
xdescribe('Route basic Data path', () => {
let browser; let browser;
let page; let page;
@ -10,7 +9,7 @@ xdescribe('Route basic Data path', () => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('delivery', 'route'); await page.loginAndModule('delivery', 'route');
await page.accessToSearchResult('3'); await page.accessToSearchResult('2');
await page.accessToSection('route.card.tickets'); await page.accessToSection('route.card.tickets');
}); });
@ -19,40 +18,32 @@ xdescribe('Route basic Data path', () => {
}); });
it('should modify the first ticket priority', async() => { it('should modify the first ticket priority', async() => {
await page.write(selectors.routeTickets.firstTicketPriority, '2'); await page.clearInput(selectors.routeTickets.firstTicketPriority);
await page.type(selectors.routeTickets.firstTicketPriority, '9');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should confirm the buscamanButton is disabled', async() => { it('should confirm the buscaman button is disabled', async() => {
const result = await page.evaluate(selector => { await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`);
return document.querySelector(selector);
}, `${selectors.routeTickets.buscamanButton} :disabled`);
expect(result).toBeTruthy();
}); });
it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => { it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => {
await page.waitToClick(selectors.routeTickets.firstTicketCheckbox); await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`, {visible: false});
const result = await page.evaluate(selector => {
return document.querySelector(selector);
}, `${selectors.routeTickets.buscamanButton} :disabled`);
expect(result).toBeFalsy();
}); });
it('should check the route volume on the descriptor', async() => { it('should check the route volume on the descriptor', async() => {
const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('1.1 / 18 m³'); expect(result).toEqual('0.2 / 50 m³');
}); });
it('should count how many tickets are in route', async() => { it('should count how many tickets are in route', async() => {
const result = await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); const result = await page.countElement(selectors.routeTickets.anyTicket);
expect(result).toEqual(11); expect(result).toEqual(1);
}); });
it('should delete the first ticket in route', async() => { it('should delete the first ticket in route', async() => {
@ -63,23 +54,14 @@ xdescribe('Route basic Data path', () => {
expect(message.text).toContain('Ticket removed from route'); expect(message.text).toContain('Ticket removed from route');
}); });
it('should again delete the first ticket in route', async() => {
await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton);
await page.waitToClick(selectors.routeTickets.confirmButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Ticket removed from route');
});
it('should now count how many tickets are in route to find one less', async() => { it('should now count how many tickets are in route to find one less', async() => {
const result = await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0);
expect(result).toEqual(9);
}); });
it('should confirm the route volume on the descriptor has been updated by the changes made', async() => { // #2862 updateVolume() route descriptor no actualiza volumen
xit('should confirm the route volume on the descriptor has been updated by the changes made', async() => {
const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('0.9 / 18 m³'); expect(result).toEqual('0 / 50 m³');
}); });
}); });

View File

@ -0,0 +1,76 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Travel create path', () => {
let browser;
let page;
const date = new Date();
const day = 15;
date.setDate(day);
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'travel');
});
afterAll(async() => {
await browser.close();
});
it('should open the create travel form by clicking on the "new" button', async() => {
await page.waitToClick(selectors.travelIndex.newTravelButton);
await page.waitForState('travel.create');
});
it('should fill the reference, agency and ship date then save the form', async() => {
await page.write(selectors.travelIndex.reference, 'Testing reference');
await page.autocompleteSearch(selectors.travelIndex.agency, 'inhouse pickup');
await page.pickDate(selectors.travelIndex.shipDate, date);
await page.waitToClick(selectors.travelIndex.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should check the user was redirected to the travel basic data upon creation', async() => {
await page.waitForState('travel.card.basicData');
});
it('should check the travel was created with the correct reference', async() => {
const reference = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value');
expect(reference).toContain('Testing reference');
});
it('should check the travel was created with the correct agency', async() => {
const agency = await page.waitToGetProperty(selectors.travelBasicData.agency, 'value');
expect(agency).toContain('inhouse pickup');
});
it('should check the travel was created with the correct shiping date', async() => {
const shipDate = await page.waitToGetProperty(selectors.travelBasicData.shippedDate, 'value');
expect(shipDate).toContain(day);
});
it('should check the travel was created with the correct landing date', async() => {
const landingDate = await page.waitToGetProperty(selectors.travelBasicData.deliveryDate, 'value');
expect(landingDate).toContain(day);
});
it('should check the travel was created with the correct warehouseOut', async() => {
const warehouseOut = await page.waitToGetProperty(selectors.travelBasicData.outputWarehouse, 'value');
expect(warehouseOut).toContain('Warehouse One');
});
it('should check the travel was created with the correct warehouseIn', async() => {
const warehouseIn = await page.waitToGetProperty(selectors.travelBasicData.inputWarehouse, 'value');
expect(warehouseIn).toContain('Warehouse Five');
});
});

View File

@ -20,6 +20,7 @@ describe('Travel extra community path', () => {
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter); await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
await page.waitForSpinnerLoad(); await page.waitForSpinnerLoad();
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
await page.waitForSpinnerLoad();
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500'); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
}); });

View File

@ -38,7 +38,7 @@ describe('Travel thermograph path', () => {
it('should select the file to upload', async() => { it('should select the file to upload', async() => {
let currentDir = process.cwd(); let currentDir = process.cwd();
let filePath = `${currentDir}/storage/dms/ecc/3.jpeg`; let filePath = `${currentDir}/e2e/assets/thermograph.jpeg`;
const [fileChooser] = await Promise.all([ const [fileChooser] = await Promise.all([
page.waitForFileChooser(), page.waitForFileChooser(),

View File

@ -41,6 +41,6 @@ describe('Entry lastest buys path', () => {
it('should navigate to the entry.buy section by clicking one of the buys', async() => { it('should navigate to the entry.buy section by clicking one of the buys', async() => {
await page.waitToClick(selectors.entryLatestBuys.firstBuy); await page.waitToClick(selectors.entryLatestBuys.firstBuy);
await page.waitForState('entry.card.buy'); await page.waitForState('entry.card.buy.index');
}); });
}); });

View File

@ -0,0 +1,62 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Entry import buys path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'entry');
await page.accessToSearchResult('1');
});
afterAll(async() => {
await browser.close();
});
it('should count the summary buys and find there only one at this point', async() => {
const buysCount = await page.countElement(selectors.entrySummary.anyBuyLine);
expect(buysCount).toEqual(1);
});
it('should navigate to the buy section and then click the import button opening the import form', async() => {
await page.accessToSection('entry.card.buy.index');
await page.waitToClick(selectors.entryBuys.importButton);
await page.waitForState('entry.card.buy.import');
});
it('should fill the form, import the designated JSON file and select items for each import and confirm import', async() => {
await page.write(selectors.entryBuys.ref, 'a reference');
await page.write(selectors.entryBuys.observation, 'an observation');
let currentDir = process.cwd();
let filePath = `${currentDir}/e2e/assets/07_import_buys.json`;
const [fileChooser] = await Promise.all([
page.waitForFileChooser(),
page.waitToClick(selectors.entryBuys.file)
]);
await fileChooser.accept([filePath]);
await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged Reinforced weapon pistol 9mm');
await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Melee Reinforced weapon heavy shield 1x0.5m');
await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Container medical box 1m');
await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Container ammo box 1m');
await page.waitToClick(selectors.entryBuys.importBuysButton);
const message = await page.waitForSnackbar();
const state = await page.getState();
expect(message.text).toContain('Data saved!');
expect(state).toBe('entry.card.buy.index');
});
it('should navigate to the entry summary and count the buys to find 4 buys have been added', async() => {
await page.waitToClick('vn-icon[icon="preview"]');
await page.waitForNumberOfElements(selectors.entrySummary.anyBuyLine, 5);
});
});

View File

@ -0,0 +1,64 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Account create and basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account form by clicking the add button', async() => {
await page.waitToClick(selectors.accountIndex.addAccount);
await page.waitForState('account.create');
});
it('should fill the form and then save it by clicking the create button', async() => {
await page.write(selectors.accountIndex.newName, 'Remy');
await page.write(selectors.accountIndex.newNickname, 'Gambit');
await page.write(selectors.accountIndex.newEmail, 'RemyEtienneLeBeau@verdnatura.es');
await page.autocompleteSearch(selectors.accountIndex.newRole, 'Trainee');
await page.write(selectors.accountIndex.newPassword, 'cestlavie');
await page.waitToClick(selectors.accountIndex.createAccountButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created account basic data section', async() => {
await page.waitForState('account.card.basicData');
});
it('should reload the section and check the name is as expected', async() => {
await page.reloadSection('account.card.basicData');
const result = await page.waitToGetProperty(selectors.accountBasicData.name, 'value');
expect(result).toEqual('Remy');
});
it('should check the nickname is as expected', async() => {
const result = await page.waitToGetProperty(selectors.accountBasicData.nickname, 'value');
expect(result).toEqual('Gambit');
});
it('should check the email is as expected', async() => {
const result = await page.waitToGetProperty(selectors.accountBasicData.email, 'value');
expect(result).toEqual('RemyEtienneLeBeau@verdnatura.es');
});
it('should navigate to the roles section to check the roles are correct', async() => {
await page.accessToSection('account.card.roles');
const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
expect(rolesCount).toEqual(4);
});
});

View File

@ -0,0 +1,66 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Account Alias create and basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
await page.accessToSection('account.alias');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account alias form by clicking the add button', async() => {
await page.waitToClick(selectors.accountAliasIndex.addAlias);
await page.waitForState('account.alias.create');
});
it('should fill the form and then save it by clicking the create alias button', async() => {
await page.write(selectors.accountAliasIndex.newName, 'Boring alias');
await page.write(selectors.accountAliasIndex.newDescription, 'Boring description');
await page.waitToClick(selectors.accountAliasIndex.createAliasButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created account alias basic data section', async() => {
await page.waitForState('account.alias.card.basicData');
});
it('should edit the alias basic data', async() => {
await page.overwrite(selectors.accountAliasBasicData.name, 'Psykers');
await page.overwrite(selectors.accountAliasBasicData.description, 'Email group for psykers');
await page.waitToClick(selectors.accountAliasBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the basicData section and check the name was edited successfully', async() => {
await page.reloadSection('account.alias.card.basicData');
const result = await page.waitToGetProperty(selectors.accountAliasBasicData.name, 'value');
expect(result).toEqual('Psykers');
});
it('should check the alias description was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountAliasBasicData.description, 'value');
expect(result).toContain('psykers');
});
it('should search for the IT alias group then access to the users section then check the role listed is the expected one', async() => {
await page.accessToSearchResult('IT');
await page.accessToSection('account.alias.card.users');
const rolesCount = await page.countElement(selectors.accountAliasUsers.anyResult);
expect(rolesCount).toEqual(1);
});
});

View File

@ -0,0 +1,86 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Account Role create and basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
await page.accessToSection('account.role');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account role form by clicking the add button', async() => {
await page.waitToClick(selectors.accountRoleIndex.addRole);
await page.waitForState('account.role.create');
});
it('should fill the form and then save it by clicking the create role button', async() => {
await page.write(selectors.accountRoleIndex.newName, 'boringRole');
await page.write(selectors.accountRoleIndex.newDescription, 'Boring description');
await page.waitToClick(selectors.accountRoleIndex.createRoleButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created role basic data section', async() => {
await page.waitForState('account.role.card.basicData');
});
it('should edit the role basic data', async() => {
await page.overwrite(selectors.accountRoleBasicData.name, 'psyker');
await page.overwrite(selectors.accountRoleBasicData.description, 'A role just for psykers');
await page.waitToClick(selectors.accountRoleBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the role basicData section and check the name was edited successfully', async() => {
await page.reloadSection('account.role.card.basicData');
const result = await page.waitToGetProperty(selectors.accountRoleBasicData.name, 'value');
expect(result).toEqual('psyker');
});
it('should check the role description was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountRoleBasicData.description, 'value');
expect(result).toContain('psykers');
});
it('should navigate to the subroles section', async() => {
await page.accessToSection('account.role.card.subroles');
});
it('should asign a subrole', async() => {
await page.waitToClick(selectors.accountSubroles.addSubrole);
await page.autocompleteSearch(selectors.accountSubroles.role, 'teamManager');
await page.waitToClick(selectors.accountSubroles.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Role added!');
});
it('should reload the subroles section and check a role was added', async() => {
await page.reloadSection('account.role.card.subroles');
const subrolesCount = await page.countElement(selectors.accountSubroles.anyResult);
expect(subrolesCount).toEqual(1);
});
it('should search for the employee role group then access to the roles inheritance section then check the roles listed are the expected ones', async() => {
await page.accessToSearchResult('employee');
await page.accessToSection('account.role.card.inherited');
const rolesCount = await page.countElement(selectors.accountRoleInheritance.anyResult);
expect(rolesCount).toEqual(7);
});
});

View File

@ -20,7 +20,7 @@ export default class Autocomplete extends Field {
constructor($element, $, $compile, $transclude) { constructor($element, $, $compile, $transclude) {
super($element, $, $compile); super($element, $, $compile);
this.$transclude = $transclude; this.$transclude = $transclude;
this.$compile = $compile;
this._selection = null; this._selection = null;
this.input = this.element.querySelector('input'); this.input = this.element.querySelector('input');
} }
@ -149,6 +149,9 @@ export default class Autocomplete extends Field {
where: where where: where
}; };
if (this.include)
filter.include = this.include;
let json = encodeURIComponent(JSON.stringify(filter)); let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`${this.url}?filter=${json}`).then( this.$http.get(`${this.url}?filter=${json}`).then(
json => this.onSelectionRequest(json.data), json => this.onSelectionRequest(json.data),
@ -182,8 +185,14 @@ export default class Autocomplete extends Field {
} else { } else {
display = this._selection[this.showField]; display = this._selection[this.showField];
if (hasTemplate) { if (hasTemplate) {
let template = this.$transclude(() => {}, null, 'tplItem').text(); let template = this.$transclude(() => {}, null, 'tplItem');
display = this.$interpolate(template)(this._selection); const element = template[0];
const description = element.querySelector('.text-secondary');
if (description) description.remove();
const displayElement = angular.element(element);
const displayText = displayElement.text();
display = this.$interpolate(displayText)(this._selection);
} }
} }
} }

View File

@ -29,7 +29,7 @@ export default class Contextmenu {
if (!event.defaultPrevented) if (!event.defaultPrevented)
event.preventDefault(); event.preventDefault();
if (!this.isFilterEnabled()) return; if (!this.isMenuEnabled()) return;
const parent = this.$.contextmenu; const parent = this.$.contextmenu;
parent.style.top = event.pageY + 'px'; parent.style.top = event.pageY + 'px';
@ -121,13 +121,31 @@ export default class Contextmenu {
return isEnabled != 'false'; return isEnabled != 'false';
} }
isMenuEnabled() {
if (!this.rowHeader) return true;
const isEnabled = this.rowHeader.getAttribute('menu-enabled');
return isEnabled != 'false';
}
/** /**
* Returns true if filter * Returns true if filter
* by selection is allowed * by selection is enabled and
* the menu can be interacted
* *
* @return {Boolean} * @return {Boolean}
*/ */
isFilterAllowed() { isFilterAllowed() {
return this.isActionAllowed() && this.isFilterEnabled();
}
/**
* Returns true if the
* context menu can be interacted
*
* @return {Boolean}
*/
isActionAllowed() {
if (!this.target) return false; if (!this.target) return false;
const isTableCell = this.target.closest('vn-td, .vn-td'); const isTableCell = this.target.closest('vn-td, .vn-td');
@ -179,9 +197,13 @@ export default class Contextmenu {
if (!where) return; if (!where) return;
const whereKeys = Object.keys(where); const whereKeys = Object.keys(where);
for (let key of whereKeys) for (let key of whereKeys) {
removeProp(where, filterKey, key); removeProp(where, filterKey, key);
if (!Object.keys(where))
delete userFilter.where;
}
function removeProp(instance, findProp, prop) { function removeProp(instance, findProp, prop) {
if (prop == findProp) if (prop == findProp)
delete instance[prop]; delete instance[prop];
@ -208,6 +230,16 @@ export default class Contextmenu {
const userParams = this.model.userParams; const userParams = this.model.userParams;
this.model.applyFilter(null, userParams); this.model.applyFilter(null, userParams);
} }
/**
* Copies the current field
* value to the clipboard
*/
copyValue() {
const cell = angular.element(this.cell);
if (navigator && navigator.clipboard)
navigator.clipboard.writeText(cell.text());
}
} }
Contextmenu.$inject = ['$element', '$scope', '$transclude']; Contextmenu.$inject = ['$element', '$scope', '$transclude'];

View File

@ -20,7 +20,8 @@ export default class Field extends FormInput {
super.$onInit(); super.$onInit();
if (this.info) this.classList.add('has-icons'); if (this.info) this.classList.add('has-icons');
this.input.addEventListener('change', () => this.onChange()); this.input.addEventListener('change', event =>
this.onChange(event));
} }
set field(value) { set field(value) {
@ -82,6 +83,9 @@ export default class Field extends FormInput {
this._required = value; this._required = value;
let required = this.element.querySelector('.required'); let required = this.element.querySelector('.required');
display(required, this._required); display(required, this._required);
this.$.$applyAsync(() =>
this.input.setAttribute('required', value));
} }
get required() { get required() {
@ -186,10 +190,13 @@ export default class Field extends FormInput {
this.refreshHint(); this.refreshHint();
} }
onChange() { onChange($event) {
// Changes doesn't reflect until appling async // Changes doesn't reflect until appling async
this.$.$applyAsync(() => { this.$.$applyAsync(() => {
this.emit('change', {value: this.field}); this.emit('change', {
value: this.field,
$event: $event
});
}); });
} }
} }

View File

@ -51,3 +51,4 @@ import './treeview';
import './wday-picker'; import './wday-picker';
import './datalist'; import './datalist';
import './contextmenu'; import './contextmenu';
import './rating';

View File

@ -71,12 +71,23 @@ export default class InputFile extends Field {
this.input.click(); this.input.click();
} }
onChange() { onChange($event) {
this.emit('change', { this.emit('change', {
value: this.field, value: this.field,
$files: this.files $files: this.files,
$event: $event
}); });
} }
get accept() {
return this._accept;
}
set accept(value) {
this._accept = value;
this.$.$applyAsync(() =>
this.input.setAttribute('accept', value));
}
} }
ngModule.vnComponent('vnInputFile', { ngModule.vnComponent('vnInputFile', {

View File

@ -0,0 +1,5 @@
<div>
<vn-icon ng-repeat="star in ::$ctrl.stars" ng-class="::{active: star.isActive}"
icon="star_rate">
</vn-icon>
</div>

View File

@ -0,0 +1,39 @@
import ngModule from '../../module';
import FormInput from '../form-input';
import './style.scss';
export default class Rating extends FormInput {
constructor($element, $scope) {
super($element, $scope);
this.maxStars = 5;
this.stars = [];
}
get field() {
return super.field;
}
set field(value) {
super.field = value;
this.populateStars();
}
populateStars() {
for (let i = 0; i < this.maxStars; i++) {
const star = {isActive: false};
if (i < this.field)
star.isActive = true;
this.stars.push(star);
}
}
}
ngModule.vnComponent('vnRating', {
template: require('./index.html'),
controller: Rating,
bindings: {
maxStars: '<?',
}
});

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