7565-testToMaster #2567

Merged
alexm merged 250 commits from 7565-testToMaster into master 2024-06-11 06:31:18 +00:00
43 changed files with 3109 additions and 3554 deletions
Showing only changes of commit 1bcd7a9665 - Show all commits

16
Jenkinsfile vendored
View File

@ -24,6 +24,7 @@ node {
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
@ -59,7 +60,6 @@ pipeline {
}
environment {
PROJECT_NAME = 'salix'
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
}
stages {
stage('Install') {
@ -203,19 +203,23 @@ pipeline {
sh 'npx myt push $NODE_ENV --force --commit'
}
}
stage('Docker') {
stage('Kubernetes') {
when {
expression { FROM_GIT }
}
environment {
DOCKER_HOST = "${env.SWARM_HOST}"
}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
withKubeConfig([
serverUrl: "$KUBERNETES_API",
credentialsId: 'kubernetes',
namespace: 'salix'
]) {
sh 'kubectl set image deployment/salix-back-$BRANCH_NAME salix-back-$BRANCH_NAME=$REGISTRY/salix-back:$VERSION'
sh 'kubectl set image deployment/salix-front-$BRANCH_NAME salix-front-$BRANCH_NAME=$REGISTRY/salix-front:$VERSION'
}
}
}
}

View File

@ -18,15 +18,10 @@ module.exports = Self => {
Self.renewToken = async function(ctx) {
const {accessToken: token} = ctx.req;
// Check if current token is valid
const {renewPeriod, courtesyTime} = await models.AccessTokenConfig.findOne({
fields: ['renewPeriod', 'courtesyTime']
const {courtesyTime} = await models.AccessTokenConfig.findOne({
fields: ['courtesyTime']
});
const now = Date.now();
const differenceMilliseconds = now - token.created;
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
const isNotExceeded = differenceSeconds < renewPeriod - courtesyTime;
const isNotExceeded = await Self.validateToken(ctx);
if (isNotExceeded)
return token;

View File

@ -0,0 +1,30 @@
const {models} = require('vn-loopback/server/server');
module.exports = Self => {
Self.remoteMethodCtx('validateToken', {
description: 'Validates the current logged user token',
accepts: [],
accessType: 'READ',
returns: {
type: 'Boolean',
root: true
},
http: {
path: `/validateToken`,
verb: 'GET'
}
});
Self.validateToken = async function(ctx) {
const {accessToken: token} = ctx.req;
// Check if current token is valid
const {renewPeriod, courtesyTime} = await models.AccessTokenConfig.findOne({
fields: ['renewPeriod', 'courtesyTime']
});
const now = Date.now();
const differenceMilliseconds = now - token.created;
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
const isNotExceeded = differenceSeconds < renewPeriod - courtesyTime;
return isNotExceeded;
};
};

View File

@ -15,6 +15,7 @@ module.exports = function(Self) {
require('../methods/vn-user/renew-token')(Self);
require('../methods/vn-user/share-token')(Self);
require('../methods/vn-user/update-user')(Self);
require('../methods/vn-user/validate-token')(Self);
Self.definition.settings.acls = Self.definition.settings.acls.filter(acl => acl.property !== 'create');

View File

@ -113,6 +113,13 @@
"principalId": "$everyone",
"permission": "ALLOW"
},
{
"property": "validateToken",
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
},
{
"property": "privileges",
"accessType": "*",

View File

@ -3,7 +3,7 @@ USE `util`;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `version` VALUES ('vn-database','11031','12f36dc825b6660062e2c86fde9c6b451cb58f0d','2024-05-14 08:25:58','11048');
INSERT INTO `version` VALUES ('vn-database','11071','60ac8cf6fc77b99b199b27866011b1efe8c961e8','2024-05-28 07:32:50','11074');
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
@ -759,6 +759,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10953','06-srt.sql','jenkins@db-
INSERT INTO `versionLog` VALUES ('vn-database','10953','07-util.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn2.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10955','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10956','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10957','00-aclTicketClone.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10959','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-18 13:32:25',NULL,NULL);
@ -788,22 +789,46 @@ INSERT INTO `versionLog` VALUES ('vn-database','10996','00-dropOrderRecalc.sql',
INSERT INTO `versionLog` VALUES ('vn-database','10996','01-dropTicketRecalc.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10996','02-dropTravelRecalc.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:31:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10997','00-groupingMode.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11000','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11001','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11002','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11003','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11006','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11007','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11008','00-alter.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11010','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11012','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11013','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11014','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11016','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-27 13:16:09',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11018','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-07 07:34:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11019','00-locker.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11019','01-aclLocker.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11021','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-30 09:07:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11022','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11026','00-entryAlter.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11026','01-entryUpdate.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11026','02-entryInternal.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11030','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11031','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-14 07:45:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11033','00-rollbackAcls.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-07 12:45:45',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11034','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11037','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11038','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11040','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11044','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11045','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-05-10 14:53:29',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11046','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11051','00-sipConfig_callLimit.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-14 14:31:10',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11054','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11055','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11057','00-part.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11057','01-part.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:47',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11057','02-part.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:47',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11057','03-part.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11058','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11061','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','11071','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-05-28 07:32:48',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -1090,7 +1115,6 @@ INSERT INTO `roleInherit` VALUES (249,109,18,NULL);
INSERT INTO `roleInherit` VALUES (250,109,13,NULL);
INSERT INTO `roleInherit` VALUES (251,51,21,NULL);
INSERT INTO `roleInherit` VALUES (253,48,49,NULL);
INSERT INTO `roleInherit` VALUES (254,110,1,NULL);
INSERT INTO `roleInherit` VALUES (255,110,76,NULL);
INSERT INTO `roleInherit` VALUES (256,48,69,NULL);
INSERT INTO `roleInherit` VALUES (257,47,111,NULL);
@ -1165,6 +1189,7 @@ INSERT INTO `roleInherit` VALUES (360,101,129,NULL);
INSERT INTO `roleInherit` VALUES (361,50,112,NULL);
INSERT INTO `roleInherit` VALUES (362,122,15,NULL);
INSERT INTO `roleInherit` VALUES (364,35,18,NULL);
INSERT INTO `roleInherit` VALUES (365,123,119,NULL);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@ -1887,6 +1912,14 @@ INSERT INTO `ACL` VALUES (834,'AgencyMode','*','READ','ALLOW','ROLE','employee')
INSERT INTO `ACL` VALUES (835,'Agency','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (836,'Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `ACL` VALUES (837,'AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `ACL` VALUES (838,'Worker','getAvailablePda','READ','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (839,'Locker','__get__codes','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (840,'Locker','*','*','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (841,'Locker','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (842,'Worker','__get__locker','READ','ALLOW','ROLE','hr');
INSERT INTO `ACL` VALUES (843,'Worker','__get__locker','READ','ALLOW','ROLE','productionBoss');
INSERT INTO `ACL` VALUES (844,'RoadmapStop','*','*','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (845,'RoadmapStop','*','*','ALLOW','ROLE','productionBoss');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@ -2206,8 +2239,8 @@ INSERT INTO `continent` VALUES (3,'África','AF');
INSERT INTO `continent` VALUES (4,'Europa','EU');
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,26,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,25,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
@ -2217,28 +2250,28 @@ INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1
INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',38,69,NULL,0,0,0,1,15,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',76,77,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',38,71,NULL,0,0,0,1,16,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',78,79,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL,NULL,NULL);
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL,NULL,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',86,89,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',41,42,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (61,NULL,'VNH',92,95,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (80,'vallesTeam','EQUIPO ESPAÑA 5',43,44,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',98,99,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (80,'spainTeam5','EQUIPO ESPAÑA 5',43,44,4250,0,0,0,2,0,43,'/1/43/','es5_equipo',1,'es5@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',100,101,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',102,103,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (90,NULL,'TRAILER',93,94,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',45,46,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (94,'spainTeam2','EQUIPO ESPAÑA 2',47,48,3797,0,0,0,2,0,43,'/1/43/','es2_equipo',0,'es2@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
@ -2246,20 +2279,20 @@ INSERT INTO `department` VALUES (95,'spainTeam1','EQUIPO ESPAÑA 1',49,50,24065,
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',51,52,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',53,54,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',55,56,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (125,'miriamMarTeam','EQUIPO ESPAÑA 3',57,58,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',57,58,NULL,72,0,0,2,0,43,'/1/43/',NULL,0,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/','es3_equipo',0,'es3@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',85,86,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',59,60,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',61,62,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',63,64,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',87,88,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',61,62,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',63,64,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',65,66,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL,'3500',NULL);
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (139,'soriaTeam','EQUIPO ESPAÑA 4',65,66,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'equipojsoria@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',67,68,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,1,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (139,'spainTeam4','EQUIPO ESPAÑA 4',67,68,3803,0,0,0,2,0,43,'/1/43/','es4_equipo',1,'es4@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',69,70,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,NULL);
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);

View File

@ -1300,7 +1300,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimState','juan@d
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','company','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','buffer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greuge','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select,Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select,Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -1400,6 +1400,12 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','waste','alexm@db-prox
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientObservation','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInConfig','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicy','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyDetail','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','bankPolicyReview','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','chat','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','roadmapStop','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agencyWorkCenter','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1595,10 +1601,7 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','editorFk',
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','recycledPlastic','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','nonRecycledPlastic','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','minQuantity','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','size','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','originFk','0000-00-00 00:00:00','Select,Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','longName','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','name','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','id','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','warehouseFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','ticket','shipped','0000-00-00 00:00:00','Update');
@ -1873,7 +1876,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaParcialMak
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','palletizerBoss','packingsite_startcollection','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_calculatecomponent','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','manaspellersrequery','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','packageinvoicing','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','packinglistswitch','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','previoussticker_get','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','productioncontrol','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@ -1976,7 +1978,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expeditionscan_ad
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expeditionscan_list','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expeditionscan_put','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','cmrpallet_add','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemtrash','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','item_getbalance','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expedition_checkroute','FUNCTION','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','addnotefromdelivery','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -2029,7 +2030,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','expeditionscan_add'
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','expeditionscan_list','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','expeditionscan_put','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','cmrpallet_add','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemtrash','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','item_getbalance','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','expedition_checkroute','FUNCTION','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','addnotefromdelivery','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');

File diff suppressed because it is too large Load Diff

View File

@ -3789,7 +3789,7 @@ DELIMITER ;;
BEFORE INSERT ON `country`
FOR EACH ROW
BEGIN
SET NEW.geoFk = zoneGeo_new('country', NEW.country, NULL);
SET NEW.geoFk = zoneGeo_new('country', NEW.name, NULL);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -3811,14 +3811,17 @@ DELIMITER ;;
BEGIN
UPDATE sage.Naciones
SET countryFk = NEW.id
WHERE Nacion = NEW.country;
WHERE Nacion = NEW.name;
IF ROW_COUNT() = 0 THEN
CALL mail_insert(
'cau@verdnatura.es',
NULL,
'Actualizar tabla sage.Naciones',
CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.country, ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id)
CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry.
Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna
sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.name,
' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id)
);
END IF;
END */;;
@ -3862,8 +3865,8 @@ DELIMITER ;;
AFTER UPDATE ON `country`
FOR EACH ROW
BEGIN
IF !(OLD.country <=> NEW.country) THEN
UPDATE zoneGeo SET `name` = NEW.country
IF !(OLD.name <=> NEW.name) THEN
UPDATE zoneGeo SET `name` = NEW.name
WHERE id = NEW.geoFk;
END IF;
END */;;
@ -4325,10 +4328,32 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_afterInsert`
AFTER INSERT ON `deviceProductionUser`
FOR EACH ROW
BEGIN
CALL worker_checkMultipleDevice(NEW.userFk);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`deviceProductionUser_beforeUpdate`
BEFORE UPDATE ON `deviceProductionUser`
FOR EACH ROW
BEGIN
CALL worker_checkMultipleDevice(NEW.userFk);
SET NEW.editorFk = account.myUser_getId();
END */;;
DELIMITER ;
@ -5060,50 +5085,6 @@ BEGIN
SET e.stateTypeFk = NEW.typeFk
WHERE e.id = NEW.expeditionFk;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeInsert`
BEFORE INSERT ON `expeditionTruck`
FOR EACH ROW
BEGIN
SET NEW.description = UCASE(NEW.description);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeUpdate`
BEFORE UPDATE ON `expeditionTruck`
FOR EACH ROW
BEGIN
SET NEW.description = UCASE(NEW.description);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -6796,94 +6777,95 @@ DELIMITER ;;
BEFORE INSERT ON `payment`
FOR EACH ROW
BEGIN
DECLARE cuenta_banco,cuenta_proveedor DOUBLE;
DECLARE vNewBookEntry INT;
DECLARE bolCASH BOOLEAN;
DECLARE isSupplierActive BOOLEAN;
DECLARE vBankAccount DOUBLE;
DECLARE vSupplierAccount DOUBLE;
DECLARE vNewBookEntry INT;
DECLARE vIsCash BOOLEAN;
DECLARE vIsSupplierActive BOOLEAN;
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
SELECT (at2.code = 'cash') INTO bolCASH
FROM accounting a
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
WHERE a.id = NEW.bankFk;
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
SELECT (at2.code = 'cash') INTO vIsCash
FROM accounting a
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
WHERE a.id = NEW.bankFk;
IF bolCASH THEN
SELECT account INTO cuenta_banco
FROM accounting
WHERE id = NEW.bankFk;
SELECT account INTO cuenta_proveedor
FROM supplier
WHERE id = NEW.supplierFk;
IF vIsCash THEN
SELECT account INTO vBankAccount
FROM accounting
WHERE id = NEW.bankFk;
CALL ledger_next(vNewBookEntry);
INSERT INTO XDiario ( ASIEN,
FECHA,
SUBCTA,
CONTRA,
CONCEPTO,
EURODEBE,
EUROHABER,
empresa_id)
SELECT vNewBookEntry,
NEW.received,
SUBCTA,
CONTRA,
NEW.concept,
EURODEBE,
EUROHABER,
NEW.companyFk
FROM ( SELECT cuenta_banco SUBCTA,
cuenta_proveedor CONTRA,
0 EURODEBE,
NEW.amount + NEW.bankingFees EUROHABER
UNION ALL
SELECT cuenta_proveedor SUBCTA,
cuenta_banco CONTRA,
NEW.amount EURODEBE,
0 EUROHABER) gf;
IF NEW.bankingFees <> 0 THEN
INSERT INTO XDiario ( ASIEN,
FECHA,
SUBCTA,
CONTRA,
CONCEPTO,
EURODEBE,
EUROHABER,
empresa_id)
SELECT vNewBookEntry,
NEW.received,
IF(c.id = 1,6260000002,
IF(CEE = 1,6260000003,6260000004)),
cuenta_banco,
NEW.concept,
NEW.bankingFees,
0,
NEW.companyFk
FROM supplier s
JOIN country c ON s.countryFk = c.id
WHERE s.id = NEW.supplierFk;
END IF;
END IF;
SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received);
SELECT isActive INTO isSupplierActive
SELECT account INTO vSupplierAccount
FROM supplier
WHERE id = NEW.supplierFk;
IF isSupplierActive = FALSE THEN
CALL util.throw('SUPPLIER_INACTIVE');
END IF;
IF ISNULL(NEW.workerFk) THEN
SET NEW.workerFk = account.myUser_getId();
END IF;
END */;;
CALL ledger_next(YEAR(NEW.received), NEW.companyFk, vNewBookEntry);
INSERT INTO XDiario (
ASIEN,
FECHA,
SUBCTA,
CONTRA,
CONCEPTO,
EURODEBE,
EUROHABER,
empresa_id)
SELECT vNewBookEntry,
NEW.received,
SUBCTA,
CONTRA,
NEW.concept,
EURODEBE,
EUROHABER,
NEW.companyFk
FROM (SELECT vBankAccount SUBCTA,
vSupplierAccount CONTRA,
0 EURODEBE,
NEW.amount + NEW.bankingFees EUROHABER
UNION ALL
SELECT vSupplierAccount SUBCTA,
vBankAccount CONTRA,
NEW.amount EURODEBE,
0 EUROHABER) gf;
IF NEW.bankingFees <> 0 THEN
INSERT INTO XDiario (
ASIEN,
FECHA,
SUBCTA,
CONTRA,
CONCEPTO,
EURODEBE,
EUROHABER,
empresa_id)
SELECT vNewBookEntry,
NEW.received,
IF(c.id = 1,6260000002,
IF(CEE = 1,6260000003,6260000004)),
vBankAccount,
NEW.concept,
NEW.bankingFees,
0,
NEW.companyFk
FROM supplier s
JOIN country c ON s.countryFk = c.id
WHERE s.id = NEW.supplierFk;
END IF;
END IF;
SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received);
SELECT isActive INTO vIsSupplierActive
FROM supplier
WHERE id = NEW.supplierFk;
IF vIsSupplierActive = FALSE THEN
CALL util.throw('SUPPLIER_INACTIVE');
END IF;
IF ISNULL(NEW.workerFk) THEN
SET NEW.workerFk = account.myUser_getId();
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -7472,6 +7454,48 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeInsert`
BEFORE INSERT ON `roadmapStop` FOR EACH ROW
BEGIN
SET NEW.description = UCASE(NEW.description);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expeditionTruck_beforeUpdate`
BEFORE UPDATE ON `roadmapStop` FOR EACH ROW
BEGIN
SET NEW.description = UCASE(NEW.description);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeInsert`
BEFORE INSERT ON `route`
FOR EACH ROW
@ -8961,6 +8985,8 @@ BEGIN
UPDATE expedition
SET hasNewRoute = TRUE
WHERE ticketFk = NEW.id;
CALL ticket_doCmr(NEW.id);
END IF;
END */;;
DELIMITER ;
@ -9318,7 +9344,6 @@ DELIMITER ;;
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -9339,7 +9364,6 @@ DELIMITER ;;
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -9655,11 +9679,6 @@ BEGIN
`changedModel` = 'TicketTracking',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
CALL util.debugAdd('deletedState',
CONCAT('interFk: ', OLD.id,
' ticketFk: ', OLD.ticketFk,
' stateFk: ', OLD.stateFk));
SELECT i.ticketFk, i.id, s.`name`
INTO vTicketFk, vTicketTrackingFk, vStateName
@ -10805,4 +10824,4 @@ USE `vn2008`;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-05-14 6:26:46
-- Dump completed on 2024-05-28 6:58:42

View File

@ -1205,11 +1205,11 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
(32, 36, -92.324),
(32, 39, 0.994);
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`, `userFk`)
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`)
VALUES
(2, 'GVC', 1, 1, 1, 1106),
(4, 'HEJ', 1, 1, 1, 1106),
(1, 'UXN', 2, 12, 12, 1106);
(2, 'GVC', 1, 1, 1, 2,1106),
(4, 'HEJ', 1, 1, 1, NULL,1106),
(1, 'UXN', 2, 12, 12, NULL,1106);
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
VALUES
@ -3788,14 +3788,22 @@ INSERT INTO vn.workerTeam(id, team, workerFk)
VALUES
(8, 1, 19);
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL);
UPDATE vn.locker SET workerFk = 1110 WHERE id = 147;
INSERT INTO `vn`.`locker` (code, gender, workerFk) VALUES
('1M', 'M', 1),
('2M', 'M', 9),
('3M', 'M', NULL),
('4M', 'M', NULL),
('1F', 'F', 1110),
('2F', 'F', NULL),
('3F', 'F', NULL),
('4F', 'F', NULL);
INSERT INTO `vn`.`ledgerCompany` SET
fiscalYear = YEAR(util.VN_CURDATE()),
bookEntry = 2;
INSERT INTO `vn`.`ledgerConfig` SET
INSERT INTO `vn`.`ledgerConfig` SET
maxTolerance = 0.01;

View File

@ -40,18 +40,25 @@ proc:BEGIN
postalCode,
`type`,
image,
description
description,
addressFk
)
SELECT i.name,
i.`size`,
SELECT CONCAT(i.name, ' by ',a.nickname),
i.minPrice + apc.deliveryCost,
i.id,
vLanded,
vPostalCode,
it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description
i.description,
apc.addressFk
FROM vn.item i
JOIN vn.itemType it ON it.id = i.typeFk
JOIN addressPostCode apc
ON apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
JOIN vn.address a ON a.id = apc.addressFk
WHERE it.code IN ('FNR','FNP');
SELECT *

View File

@ -13,8 +13,17 @@ BEGIN
/**
* Set actions for contact request
*
* @param vPostalCode Delivery address postal code
* @param vName Name
* @param vPhone Phone number
* @param vEmail e-mail
* @param vMessage text of the message
*/
CALL vn.mail_insert(
'floranet@verdnatura.es',
vEmail,
'Contact request',
CONCAT('Phone: ',vPhone, ' Message: ', vMessage)
);
END$$
DELIMITER ;

View File

@ -21,7 +21,7 @@ BEGIN
apc.dayOfWeek - vCurrentDayOfWeek,
7 - apc.dayOfWeek
) DAY nextDay,
NOW() + INTERVAL apc.hoursInAdvance - 12 HOUR minDeliveryTime
NOW() + INTERVAL apc.hoursInAdvance HOUR minDeliveryTime
FROM addressPostCode apc
WHERE apc.postCode = vPostalCode
HAVING nextDay > minDeliveryTime) sub;

View File

@ -1,24 +1,127 @@
DROP PROCEDURE IF EXISTS floranet.order_confirm;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost`PROCEDURE floranet.order_confirm(vCatalogueFk INT)
CREATE OR REPLACE DEFINER=`root`@`localhost`PROCEDURE floranet.order_confirm(vCatalogueFk INT)
READS SQL DATA
BEGIN
/** Update order.isPaid field.
proc:BEGIN
/** Update order.isPaid field, and makes the ticket
*
* @param vCatalogueFk floranet.catalogue.id
*
* @returns floranet.order.isPaid
*/
DECLARE vNewTicketFk INT;
DECLARE vCustomerEmail VARCHAR(255);
DECLARE vFloranetEmail VARCHAR(255);
DECLARE vSubjectEmail VARCHAR(100);
DECLARE vBodyEmail TEXT;
DECLARE vZoneFk INT;
IF (SELECT isPaid FROM `order` WHERE catalogueFk = vCatalogueFk) THEN
CALL util.throw('Esta orden ya está confirmada');
END IF;
UPDATE `order`
SET isPaid = TRUE,
payed = NOW()
WHERE catalogueFk = vCatalogueFk;
SELECT isPaid
SELECT zoneFk
INTO vZoneFk
FROM (
SELECT zoneFk, COUNT(*) totalCount
FROM vn.ticket t
JOIN catalogue c ON c.id = vCatalogueFk
WHERE t.shipped > util.VN_CURDATE() - INTERVAL 1 YEAR
AND t.addressFk = c.addressFk
GROUP BY zoneFk
ORDER BY totalCount DESC
LIMIT 10000000000000000000
) sub
LIMIT 1;
INSERT INTO vn.ticket (
clientFk,
shipped,
addressFk,
agencyModeFk,
nickname,
warehouseFk,
routeFk,
companyFk,
landed,
zoneFk
)
SELECT a.clientFk,
c.dated - INTERVAL 1 DAY,
c.addressFk,
a.agencyModeFk,
a.nickname,
ag.warehouseFk,
NULL,
co.id,
c.dated,
vZoneFk
FROM vn.address a
JOIN vn.agencyMode am ON am.id = a.agencyModeFk
JOIN vn.agency ag ON ag.id = am.agencyFk
JOIN catalogue c ON c.addressFk = a.id
JOIN vn.company co ON co.code = 'VNL'
WHERE c.id = vCatalogueFk;
SET vNewTicketFk = LAST_INSERT_ID();
INSERT INTO vn.sale(
ticketFk,
itemFk,
concept,
price,
quantity)
SELECT
vNewTicketFk,
c.itemFk,
CONCAT('Entrega: ',c.name),
- c.price,
1
FROM catalogue c
JOIN addressPostCode apc
ON apc.addressFk = c.addressFk
AND apc.dayOfWeek = dayOfWeek(c.dated)
WHERE c.id = vCatalogueFk;
SELECT cl.email,
cf.email,
CONCAT('Nuevo pedido FLORANET para entrega el ',c.dated),
CONCAT_WS('\n',
CONCAT('Producto: ', c.name),
CONCAT('Fecha de entrega: ',c.dated),
CONCAT('Destinatario: ', o.deliveryName),
CONCAT('Dirección: ', o.address),
CONCAT('CP: ', c.postalCode),
CONCAT('Foto: ', c.image),
CONCAT('Mensaje: ', IFNULL(o.message,"Ninguno.")),
CONCAT('Teléfono: ',IFNULL(o.deliveryPhone,"--")),
CONCAT('Observaciones: ', IFNULL(o.observations,"No hay."))
)
INTO vCustomerEmail,
vFloranetEmail,
vSubjectEmail,
vBodyEmail
FROM vn.client cl
JOIN vn.address a ON a.clientFk = cl.id
JOIN catalogue c ON c.addressFk = a.id
JOIN `order` o ON o.catalogueFk = c.id
JOIN config cf
WHERE c.id = vCatalogueFk;
CALL vn.mail_insert(
vCustomerEmail,
vFloranetEmail,
vSubjectEmail,
vBodyEmail);
SELECT isPaid, vNewTicketFk
FROM `order`
WHERE catalogueFk = vCatalogueFk;
END$$

View File

@ -9,12 +9,11 @@ BEGIN
* Returns list of url for sliders.
*/
SELECT
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url,
i.longName
FROM vn.item i
JOIN vn.itemType it ON it.id = i.typeFk
WHERE it.code IN ('FNR','FNP')
LIMIT 3;
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url,
i.longName
FROM vn.item i
JOIN vn.itemType it ON it.id = i.typeFk
WHERE it.code IN ('FNR','FNP')
LIMIT 3;
END$$
DELIMITER ;

View File

@ -22,6 +22,7 @@ BEGIN
BEGIN
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
END IF;
RESIGNAL;

View File

@ -49,6 +49,7 @@ BEGIN
BEGIN
IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
END IF;
RESIGNAL;

View File

@ -17,13 +17,15 @@ BEGIN
SELECT
itemFk,
packing,
created
created,
buyFk
FROM itemShelving
WHERE id = vItemShelvingFk
) ish2
ON ish2.itemFk = ish.itemFk
AND ish2.packing = ish.packing
AND date(ish2.created) = date(ish.created)
AND ish2.buyFk = ish.buyFk
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
IF vNewItemShelvingFk THEN

View File

@ -2,7 +2,6 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT)
BEGIN
/**
* Añade registro o lo actualiza si ya existe.
*
@ -15,11 +14,23 @@ BEGIN
* @param vWarehouseFk indica el sector
*
**/
DECLARE vItemFk INT;
DECLARE vBuyFk INT;
SELECT id INTO vBuyFk
FROM buy WHERE id = vBarcode;
SELECT barcodeToItem(vBarcode) INTO vItemFk;
IF vBuyFk IS NULL THEN
CALL cache.last_buy_refresh(FALSE);
SELECT buy_id INTO vBuyFk
FROM cache.last_buy
WHERE item_id = vItemFk
AND warehouse_id = vWarehouseFk;
END IF;
IF vPacking IS NULL
THEN
SET vPacking = itemPacking(vBarcode, vWarehouseFk);
@ -29,31 +40,32 @@ BEGIN
IF (SELECT COUNT(*) FROM itemShelving
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk
AND itemFk = vItemFk
AND packing = vPacking) = 1 THEN
AND packing = vPacking
AND buyFk = vBuyFk) THEN
UPDATE itemShelving
SET visible = visible+vQuantity
SET visible = visible + vQuantity
WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking;
ELSE
CALL cache.last_buy_refresh(FALSE);
INSERT INTO itemShelving( itemFk,
shelvingFk,
visible,
grouping,
packing,
packagingFk)
SELECT vItemFk,
vShelvingFk,
vQuantity,
IFNULL(vGrouping, b.grouping),
IFNULL(vPacking, b.packing),
IFNULL(vPackagingFk, b.packagingFk)
FROM item i
LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
WHERE i.id = vItemFk;
INSERT INTO itemShelving(
itemFk,
shelvingFk,
visible,
grouping,
packing,
packagingFk,
buyFk)
SELECT vItemFk,
vShelvingFk,
vQuantity,
IFNULL(vGrouping, b.grouping),
IFNULL(vPacking, b.packing),
IFNULL(vPackagingFk, b.packagingFk),
id
FROM buy b
WHERE id = vBuyFk;
END IF;
END$$
DELIMITER ;

View File

@ -1,18 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketRefund_beforeUpsert`(vRefundTicketFk INT, vOriginalTicketFk INT)
BEGIN
DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE;
IF vRefundTicketFk = vOriginalTicketFk THEN
CALL util.throw('Original ticket and refund ticket has same id');
END IF;
SELECT COUNT(*) INTO vAlreadyExists
FROM ticketRefund
WHERE refundTicketFk = vOriginalTicketFk;
IF vAlreadyExists > 0 THEN
CALL util.throw('This ticket is already a refund');
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,14 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_throwAwb`(vSelf INT)
BEGIN
/**
* Throws an error if travel does not have a logical AWB
* or there are several AWBs associated with the same DUA
*
* @param vSelf The travel id
*/
IF NOT travel_hasUniqueAwb(vSelf) THEN
CALL util.throw('A different AWB is found in the entries');
END IF;
END$$
DELIMITER ;

View File

@ -7,8 +7,8 @@ BEGIN
CALL supplier_checkIsActive(NEW.supplierFk);
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
IF NEW.travelFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.travelFk);
END IF;
END$$
DELIMITER ;

View File

@ -25,8 +25,8 @@ BEGIN
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
IF NEW.travelFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.travelFk);
END IF;
SELECT COUNT(*) > 0 INTO vIsVirtual

View File

@ -4,6 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeIn
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk);
END$$
DELIMITER ;

View File

@ -4,6 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUp
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk);
END$$
DELIMITER ;

View File

@ -9,8 +9,8 @@ BEGIN
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
IF NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
IF NEW.awbFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.id);
END IF;
END$$
DELIMITER ;

View File

@ -33,8 +33,8 @@ BEGIN
END IF;
END IF;
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
CALL travel_throwAwb(NEW.id);
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
ALTER TABLE floranet.catalogue ADD addressFk int(11) NOT NULL;
ALTER TABLE floranet.catalogue ADD CONSTRAINT catalogue_address_FK FOREIGN KEY (addressFk) REFERENCES vn.address(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,6 @@
ALTER TABLE floranet.builder DROP FOREIGN KEY builder_FK_1;
ALTER TABLE floranet.`element` DROP PRIMARY KEY;
ALTER TABLE floranet.`element` ADD id INT NOT NULL;
ALTER TABLE floranet.`element` ADD CONSTRAINT element_pk PRIMARY KEY (id);
ALTER TABLE floranet.builder ADD CONSTRAINT builder_element_FK FOREIGN KEY (elementFk) REFERENCES floranet.`element`(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
CREATE OR REPLACE TABLE floranet.config (
email varchar(255) DEFAULT 'floranet@verdnatura.es' NOT NULL
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;

View File

@ -0,0 +1,35 @@
-- Place your SQL code here
DROP TABLE IF EXISTS floranet.builder;
CREATE OR REPLACE TABLE floranet.`element` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`itemFk` int(11) DEFAULT NULL,
`longNameFilter` varchar(30) DEFAULT NULL,
`typeFk` smallint(5) unsigned DEFAULT NULL,
`minSize` int(10) unsigned DEFAULT NULL,
`maxSize` int(10) unsigned DEFAULT NULL,
`inkFk` char(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`originFk` tinyint(2) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `element_FK` (`itemFk`),
KEY `element_FK_1` (`typeFk`),
KEY `element_FK_2` (`inkFk`),
KEY `element_FK_3` (`originFk`),
CONSTRAINT `element_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `element_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `element_FK_2` FOREIGN KEY (`inkFk`) REFERENCES `vn`.`ink` (`id`) ON UPDATE CASCADE,
CONSTRAINT `element_FK_3` FOREIGN KEY (`originFk`) REFERENCES `vn`.`origin` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Filtro para localizar posibles items que coincidan con la descripción';
CREATE OR REPLACE TABLE floranet.`recipe` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`itemFk` int(11) NOT NULL,
`elementFk` int(11) NOT NULL,
`quantity` int(10) unsigned NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
KEY `recipe_FK` (`itemFk`),
KEY `recipe_FK_1` (`elementFk`),
CONSTRAINT `recipe_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `recipe_element_FK` FOREIGN KEY (`elementFk`) REFERENCES `element` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements';

View File

@ -0,0 +1,5 @@
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('RoadmapStop','*','*','ALLOW','ROLE','production');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('RoadmapStop','*','*','ALLOW','ROLE','productionBoss');

View File

@ -4,62 +4,8 @@ services:
image: registry.verdnatura.es/salix-front:${VERSION:?}
build:
context: front
environment:
- TZ
- NODE_ENV
ports:
- 80
deploy:
replicas: 2
placement:
constraints:
- node.role == worker
resources:
limits:
memory: 1G
back:
image: registry.verdnatura.es/salix-back:${VERSION:?}
build:
context: .
dockerfile: back/Dockerfile
environment:
- TZ
- NODE_ENV
- DEBUG
ports:
- 3000
configs:
- source: datasources
target: /etc/salix/datasources.json
- source: datasources_local
target: /etc/salix/datasources.local.json
- source: print
target: /etc/salix/print.json
- source: print_local
target: /etc/salix/print.local.json
volumes:
- /mnt/appdata/pdfs:/var/lib/salix/pdfs
- /mnt/appdata/dms:/var/lib/salix/dms
- /mnt/appdata/image:/var/lib/salix/image
- /mnt/appdata/vn-access:/var/lib/salix/vn-access
deploy:
replicas: ${BACK_REPLICAS:?}
placement:
constraints:
- node.role == worker
resources:
limits:
memory: 8G
configs:
datasources:
external: true
name: salix_datasources
datasources_local:
external: true
name: salix-${BRANCH_NAME:?}_datasources
print:
external: true
name: salix_print
print_local:
external: true
name: salix-${BRANCH_NAME:?}_print

View File

@ -59,7 +59,7 @@ describe('Client Add address path', () => {
await page.waitToClick(selectors.clientAddresses.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Customs agent is required for a non UEE member');
expect(message.text).toContain('Incoterms and Customs agent are required for a non UEE member');
});
it(`should create a new custom agent and then save the address`, async() => {

View File

@ -69,3 +69,4 @@ Send cau: Enviar cau
By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
ExplainReason: Explique el motivo por el que no deberia aparecer este fallo
You already have the mailAlias: Ya tienes este alias de correo
Error loading ACLs: Error al cargar los ACLs

View File

@ -7,16 +7,17 @@ import UserError from 'core/lib/user-error';
* @property {Boolean} loggedIn Whether the user is currently logged
*/
export default class Auth {
constructor($http, $q, $state, $transitions, $window, vnToken, vnModules, aclService) {
constructor($http, $q, vnApp, $translate, $state, $transitions, $window, vnToken, vnModules) {
Object.assign(this, {
$http,
$q,
vnApp,
$translate,
$state,
$transitions,
$window,
vnToken,
vnModules,
aclService,
loggedIn: false
});
}
@ -39,9 +40,26 @@ export default class Auth {
};
if (this.vnToken.token) {
return this.loadAcls()
.then(() => true)
.catch(redirectToLogin);
const loadWithRetry = () => {
return this.validateToken()
.then(() => true)
.catch(err => {
switch (err.status) {
case 400:
case 401:
return redirectToLogin();
default:
return new Promise(resolve => {
setTimeout(() => {
this.vnApp.showMessage(this.$translate.instant('Loading...'));
resolve(loadWithRetry());
}, 2000);
});
}
});
};
return loadWithRetry();
} else
return redirectToLogin();
});
@ -87,13 +105,11 @@ export default class Auth {
headers: {Authorization: json.data.token}
}).then(({data}) => {
this.vnToken.set(json.data.token, data.multimediaToken.id, now, json.data.ttl, remember);
this.loadAcls().then(() => {
let continueHash = this.$state.params.continue;
if (continueHash)
this.$window.location = continueHash;
else
this.$state.go('home');
});
let continueHash = this.$state.params.continue;
if (continueHash)
this.$window.location = continueHash;
else
this.$state.go('home');
}).catch(() => {});
}
@ -107,24 +123,25 @@ export default class Auth {
this.vnToken.unset();
this.loggedIn = false;
this.vnModules.reset();
this.aclService.reset();
this.vnModules.aclService.reset();
this.$state.go('login');
return promise;
}
loadAcls() {
return this.aclService.load()
validateToken() {
return this.$http.get('VnUsers/validateToken')
.then(() => {
this.loggedIn = true;
this.vnModules.reset();
})
.catch(err => {
this.vnToken.unset();
throw err;
});
}
}
Auth.$inject = ['$http', '$q', '$state', '$transitions', '$window', 'vnToken', 'vnModules', 'aclService'];
Auth.$inject = [
'$http', '$q', 'vnApp', '$translate', '$state',
'$transitions', '$window', 'vnToken', 'vnModules'];
ngModule.service('vnAuth', Auth);

View File

@ -12,7 +12,8 @@ function config($stateProvider, $urlRouterProvider) {
template: '<vn-layout></vn-layout>',
resolve: {
config: ['vnConfig', vnConfig => vnConfig.initialize()],
token: ['vnToken', vnToken => vnToken.fetchConfig()]
token: ['vnToken', vnToken => vnToken.fetchConfig()],
acl: ['aclService', aclService => aclService.load()]
}
})
.state('outLayout', {

View File

@ -361,5 +361,6 @@
"ticketCommercial": "El ticket {{ ticket }} para el vendedor {{ salesMan }} está en preparación. (mensaje generado automáticamente)",
"This PDA is already assigned to another user": "Esta PDA ya está asignado a otro usuario",
"You can only have one PDA": "Solo puedes tener una PDA",
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE"
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
"You can not use the same password": "No puedes usar la misma contraseña"
}

View File

@ -25,5 +25,8 @@
},
"RoutesMonitor": {
"dataSource": "vn"
},
"ExpeditionTruck": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,9 @@
{
"name": "ExpeditionTruck",
"base": "RoadmapStop",
"options": {
"mysql": {
"table": "expeditionTruck"
}
}
}

View File

@ -13,8 +13,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
const failedtickets = [];
for (const ticket of tickets) {
try {
await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId});
await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'M');
await Self.rawSql(
`CALL vn.ticket_closeByTicket(?)`,

View File

@ -6,8 +6,9 @@ describe('locker model ', () => {
const hrId = 37;
const jessicaJonesId = 1110;
const bruceBannerId = 1109;
const lockerMaleId = 1;
const lockerFemaleId = 147;
const lockerMaleId = 3;
const lockerFemaleId = 5;
const lockerNewFemaleId = 6;
let ctx;
let options;
let tx;
@ -46,11 +47,13 @@ describe('locker model ', () => {
});
it('should change a locker', async() => {
const locker = await models.Locker.findById(148, null, options);
await locker.updateAttributes({workerFk: jessicaJonesId}, options);
const oldLocker = await models.Locker.findById(lockerFemaleId, null, options);
const locker = await models.Locker.findById(lockerNewFemaleId, null, options);
await locker.updateAttributes({workerFk: jessicaJonesId}, options);
const oldNowLocker = await models.Locker.findById(lockerFemaleId, null, options);
expect(oldLocker.workerFk).toEqual(jessicaJonesId);
expect(locker.workerFk).toEqual(jessicaJonesId);
expect(oldLocker.workerFk).toEqual(null);
expect(oldNowLocker.workerFk).toEqual(null);
});
});

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "24.24.0",
"version": "24.24.1",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",