diff --git a/Dockerfile b/Dockerfile index f2cbeeff9..5a65b9b18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,5 +34,5 @@ COPY \ CMD ["pm2-runtime", "./back/process.yml"] -HEALTHCHECK --interval=1m --timeout=10s \ +HEALTHCHECK --interval=15s --timeout=10s \ CMD curl -f http://localhost:3000/api/Applications/status || exit 1 diff --git a/Jenkinsfile b/Jenkinsfile index 0d56f7476..1fa6a49ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,20 +6,13 @@ pipeline { disableConcurrentBuilds() } environment { - PROJECT_NAME = 'salix' - REGISTRY = 'registry.verdnatura.es' - PORT_MASTER_FRONT = '5002' - PORT_MASTER_BACK = '3001' - PORT_TEST_FRONT = '5001' - PORT_TEST_BACK = '4001' - TAG = "${env.BRANCH_NAME}" + PROJECT_NAME = 'salix' + STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { stage('Checkout') { steps { script { - env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" - if (!env.GIT_COMMITTER_EMAIL) { env.COMMITTER_EMAIL = sh( script: 'git --no-pager show -s --format="%ae"', @@ -29,16 +22,6 @@ pipeline { env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; } - switch (env.BRANCH_NAME) { - case 'master': - env.PORT_FRONT = PORT_MASTER_FRONT - env.PORT_BACK = PORT_MASTER_BACK - break - case 'test': - env.PORT_FRONT = PORT_TEST_FRONT - env.PORT_BACK = PORT_TEST_BACK - break - } switch (env.BRANCH_NAME) { case 'master': env.NODE_ENV = 'production' @@ -48,6 +31,14 @@ pipeline { break } } + + configFileProvider([ + configFile(fileId: "salix.groovy", + variable: 'GROOVY_FILE') + ]) { + load env.GROOVY_FILE + } + sh 'printenv' } } @@ -57,8 +48,8 @@ pipeline { } steps { nodejs('node-lts') { - sh 'npm install --no-audit' - sh 'gulp install' + sh 'npm install --no-audit --prefer-offline' + sh 'gulp install --ci' } } } diff --git a/back/process.yml b/back/process.yml index 3062091b4..41a2fafff 100644 --- a/back/process.yml +++ b/back/process.yml @@ -2,4 +2,5 @@ apps: - script: ./loopback/server/server.js name: salix-back instances: 1 - max_restarts: 5 + max_restarts: 3 + restart_delay: 15000 diff --git a/db/changes/10130-christmas/00-catalog_componentCalculate.sql b/db/changes/10130-christmas/00-catalog_componentCalculate.sql index 6eb30bbfd..d6fb52727 100644 --- a/db/changes/10130-christmas/00-catalog_componentCalculate.sql +++ b/db/changes/10130-christmas/00-catalog_componentCalculate.sql @@ -125,13 +125,13 @@ proc: BEGIN INSERT INTO tmp.ticketComponent SELECT tcb.warehouseFk, tcb.itemFk, - cr.id, - GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3) + c.id, + GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) FROM tmp.ticketComponentBase tcb - JOIN componentRate cr + JOIN component c JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; + WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 @@ -178,9 +178,9 @@ proc: BEGIN vSpecialPriceComponent, sp.value - SUM(tcc.cost) sumCost FROM tmp.ticketComponentCopy tcc - JOIN componentRate cr ON cr.id = tcc.componentFk + JOIN component c ON c.id = tcc.componentFk JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - WHERE cr.classRate IS NULL + WHERE c.classRate IS NULL GROUP BY tcc.itemFk, tcc.warehouseFk HAVING ABS(sumCost) > 0.001; @@ -188,10 +188,10 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.ticketComponentSum (INDEX (itemFk, warehouseFk)) ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate + SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate FROM tmp.ticketComponent tc - JOIN componentRate cr ON cr.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate; + JOIN component c ON c.id = tc.componentFk + GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY diff --git a/db/changes/10140-kings/00-ACL.sql b/db/changes/10140-kings/00-ACL.sql new file mode 100644 index 000000000..7d22bc270 --- /dev/null +++ b/db/changes/10140-kings/00-ACL.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Thermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer'); +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TravelThermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer'); + \ No newline at end of file diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index e9b5af23b..111b98084 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -36,7 +36,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-08 11:05:21 USE `account`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -61,7 +61,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2018-04-23 14:33:59'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',0,'2018-02-26 15:28:23','2019-01-21 12:57:21'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'); +INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2018-04-23 14:33:36','2018-04-23 14:33:59'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',1,'2018-02-16 14:07:10','2019-04-12 05:38:08'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',0,'2018-02-26 15:28:23','2019-01-21 12:57:21'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'),(51,'marketing','Departamento de marketing',1,'2018-03-01 07:28:39','2018-03-01 07:28:39'),(52,'marketingBoss','Jefe del departamento de marketing',1,'2018-03-01 07:28:57','2018-03-01 07:28:57'),(53,'insurance','Gestor de seguros de cambio',0,'2018-03-05 07:44:35','2019-02-01 13:47:57'),(54,'itemPicker','Sacador en cámara',1,'2018-03-05 12:08:17','2018-03-05 12:08:17'),(55,'itemPickerBoss','Jefe de sacadores',1,'2018-03-05 12:08:31','2018-03-05 12:08:31'),(56,'delivery','Personal de reparto',1,'2018-05-30 06:07:02','2018-05-30 06:07:02'),(57,'deliveryBoss','Jefe de personal de reparto',1,'2018-05-30 06:07:19','2018-05-30 06:07:19'),(58,'packager','Departamento encajadores',1,'2019-01-21 12:43:45','2019-01-21 12:43:45'),(59,'packagerBoss','Jefe departamento encajadores',1,'2019-01-21 12:44:10','2019-01-21 12:44:10'),(60,'productionAssi','Tareas relacionadas con producción y administración',1,'2019-01-29 13:29:01','2019-01-29 13:29:01'),(61,'replenisherBos','Jefe de Complementos/Camara',1,'2019-07-01 06:44:07','2019-07-01 06:44:07'),(62,'noLogin','Role without login access to MySQL',0,'2019-07-01 06:50:19','2019-07-02 13:42:05'),(64,'balanceSheet','Consulta de Balance',0,'2019-07-16 12:12:08','2019-07-16 12:12:08'),(65,'officeBoss','Jefe de filial',1,'2019-08-02 06:54:26','2019-08-02 06:54:26'),(66,'sysadmin','Administrador de sistema',1,'2019-08-08 06:58:56','2019-08-08 06:58:56'),(67,'adminOfficer','categoria profesional oficial de administración',1,'2020-01-03 08:09:23','2020-01-03 08:09:23'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -71,7 +71,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(49,36),(61,36),(17,37),(38,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(15,57),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65); +INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(67,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(49,36),(61,36),(17,37),(38,37),(67,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(15,57),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; @@ -81,7 +81,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,13),(15,15),(15,35),(15,56),(15,57),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(16,56),(16,57),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66); +INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(0,67),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(9,67),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,13),(15,15),(15,35),(15,56),(15,57),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(16,56),(16,57),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66),(66,67),(67,1),(67,2),(67,3),(67,5),(67,6),(67,11),(67,13),(67,18),(67,21),(67,33),(67,37),(67,53),(67,67); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -94,7 +94,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-08 11:05:21 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -119,7 +119,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(193,'Zone','editPrices','WRITE','ALLOW','ROLE','deliveryBoss'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'WorkerCalendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'WorkerCalendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(164,'InvoiceOut','regenerate','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','READ','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','employee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(188,'TicketDms','removeFile','WRITE','ALLOW','ROLE','employee'),(189,'TicketDms','*','READ','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','employee'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','employee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','salesAssistant'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -142,7 +142,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-08 11:05:21 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -287,7 +287,7 @@ UNLOCK TABLES; LOCK TABLES `state` WRITE; /*!40000 ALTER TABLE `state` DISABLE KEYS */; -INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0),(2,'Libre',1,0,'FREE',NULL,2,0,0,0),(3,'OK',3,0,'OK',3,28,1,0,0),(4,'Impreso',4,1,'PRINTED',2,29,1,0,1),(5,'Preparación',5,1,'ON_PREPARATION',7,5,0,0,0),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0),(7,'Sin Acabar',2,0,'NOT_READY',NULL,7,0,0,0),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0),(9,'Encajando',9,1,'PACKING',NULL,9,0,1,0),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0),(11,'Facturado',0,0,'INVOICED',NULL,11,0,1,0),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0),(17,'Eliminado',14,3,'ERASED',NULL,17,0,0,0),(20,'Asignado',4,1,'PICKER_DESIGNED',NULL,20,1,0,0),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0),(22,'¿Fecha?',2,0,'WRONG_DATE',NULL,22,0,0,0),(23,'URGENTE',2,0,'LAST_CALL',NULL,23,1,0,0),(24,'Encadenado',3,0,'CHAINED',4,24,0,0,0),(25,'Embarcando',3,0,'BOARDING',5,25,0,0,0),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,26,0,0,0),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0),(28,'Previa OK',3,1,'OK PREVIOUS',3,28,1,0,0),(29,'Previa Impreso',4,1,'PRINTED PREVIOUS',2,29,1,0,1); +INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0),(2,'Libre',1,0,'FREE',NULL,2,0,0,0,0),(3,'OK',3,0,'OK',3,28,1,0,0,0),(4,'Impreso',4,1,'PRINTED',2,29,1,0,1,0),(5,'Preparación',5,1,'ON_PREPARATION',7,5,0,0,0,2),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3),(7,'Sin Acabar',2,0,'NOT_READY',NULL,7,0,0,0,0),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3),(9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0),(11,'Facturado',0,0,'INVOICED',NULL,11,0,1,0,0),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0),(17,'Eliminado',14,3,'ERASED',NULL,17,0,0,0,0),(20,'Asignado',4,1,'PICKER_DESIGNED',NULL,20,1,0,0,0),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0),(22,'¿Fecha?',2,0,'WRONG_DATE',NULL,22,0,0,0,0),(23,'URGENTE',2,0,'LAST_CALL',NULL,23,1,0,0,0),(24,'Encadenado',3,0,'CHAINED',4,24,0,0,0,0),(25,'Embarcando',3,0,'BOARDING',5,25,0,0,0,0),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,26,0,0,0,1),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0),(28,'Previa OK',3,1,'OK PREVIOUS',3,28,1,0,0,1),(29,'Previa Impreso',4,1,'PRINTED PREVIOUS',2,29,1,0,1,1); /*!40000 ALTER TABLE `state` ENABLE KEYS */; UNLOCK TABLES; @@ -320,7 +320,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-08 11:05:21 USE `bi`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -368,7 +368,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:14 +-- Dump completed on 2020-01-08 11:05:21 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -406,7 +406,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:15 +-- Dump completed on 2020-01-08 11:05:21 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -464,7 +464,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:15 +-- Dump completed on 2020-01-08 11:05:21 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.28, for osx10.15 (x86_64) -- @@ -539,7 +539,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,1026,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2851,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL); +INSERT INTO `workcenter` VALUES (1,'Silla',20,1027,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20008,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2852,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -552,4 +552,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-20 11:02:15 +-- Dump completed on 2020-01-08 11:05:22 diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 8eb878e74..4b4b8fa13 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -53,20 +53,20 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` VALUES (1, 978, 1, 0, 2000, 9, 0); -INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lang`) +INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`) VALUES - (101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'), - (102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'), - (103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'), - (104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'), - (105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'), - (106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'), - (107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'), - (108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'), - (109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'), - (110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'), - (111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'), - (112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'); + (101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'), + (102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'), + (103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'), + (104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'), + (105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'), + (106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'), + (107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'), + (108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'), + (109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'), + (110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'), + (111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'), + (112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'); INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`) VALUES @@ -643,7 +643,8 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk (2, 'ITG', 'Anthurium', 1, 31, 5, 0), (3, 'WPN', 'Paniculata', 2, 31, 5, 0), (4, 'PRT', 'Delivery ports', 3, NULL, 5, 1), - (5, 'CON', 'Container', 3, NULL, 5, 1); + (5, 'CON', 'Container', 3, NULL, 5, 1), + (6, 'ALS', 'Alstroemeria', 1, 31, 5, 0); INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`) VALUES @@ -1549,7 +1550,7 @@ INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`) FROM `postgresql`.`person` `p`; INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `provider_id`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`) - SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-31'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL + SELECT p.profile_id, p.profile_id, 1000, CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL FROM `postgresql`.`profile` `p`; INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`) @@ -1586,20 +1587,20 @@ INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, ` INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`) VALUES - (106, 1, DATE_ADD(CURDATE(), INTERVAL 10 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL 11 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL 12 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)), - (106, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (106, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)), - (106, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 15 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 16 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL 30 DAY)), - (107, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), - (107, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)), - (107, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY)); + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))), + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))), + (106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))), + (106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))), + (106, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))), + (106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))), + (107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))), + (107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))), + (107, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))), + (107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY))); INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`) VALUES @@ -1901,7 +1902,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), - (4, 3, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()); + (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), + (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()); INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`) VALUES @@ -1998,3 +2000,16 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week (1, 43200, 129600, 734400, 43200, 50400); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); + +INSERT INTO `vn`.`thermograph`(`id`, `model`) + VALUES + ('TMM190901395', 'TEMPMATE'), + ('TL.BBA85422', 'TL30'), + ('TZ1905012010', 'DISPOSABLE'); + +INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperature`, `result`, `dmsFk`) + VALUES + ('TMM190901395', CURDATE(), 1, 1, 'WARM', 'Ok', NULL), + ('TL.BBA85422', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL), + ('TL.BBA85422', CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL), + ('TZ1905012010', CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5); \ No newline at end of file diff --git a/db/dump/structure.sql b/db/dump/structure.sql index c56b2a0a1..2f2806665 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -6593,8 +6593,7 @@ CREATE TABLE `item` ( `change_date_time` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `group_id` (`group_id`), - KEY `plant_id` (`plant_id`), - CONSTRAINT `item_fk1` FOREIGN KEY (`group_id`) REFERENCES `item_group` (`group_code`) ON DELETE CASCADE ON UPDATE CASCADE + KEY `plant_id` (`plant_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -10792,9 +10791,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -10920,6 +10919,7 @@ BEGIN WHERE o.id = vOrder AND t.invoiceOutFk IS NULL AND IFNULL(tls.alertLevel,0) = 0 + AND t.clientFk <> 1118 LIMIT 1; -- Crea el ticket en el caso de no existir uno adecuado @@ -17204,8 +17204,6 @@ CREATE TABLE `botanicExport` ( KEY `Id_Paises` (`countryFk`), KEY `botanicExport_ibfk_2_idx` (`ediGenusFk`), KEY `botanicExport_ibfk_3_idx` (`ediSpecieFk`), - CONSTRAINT `botanicExport_ediGenusFk` FOREIGN KEY (`ediGenusFk`) REFERENCES `edi`.`genus` (`genus_id`) ON UPDATE CASCADE, - CONSTRAINT `botanicExport_ediSpecieFk` FOREIGN KEY (`ediSpecieFk`) REFERENCES `edi`.`specie` (`specie_id`) ON UPDATE CASCADE, CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -18391,7 +18389,7 @@ CREATE TABLE `cmr` ( `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `cmr_fk1_idx` (`ticketFk`), - CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE + CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -18487,8 +18485,11 @@ CREATE TABLE `collection` ( `id` int(11) NOT NULL AUTO_INCREMENT, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `workerFk` int(11) DEFAULT NULL, + `stateFk` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `ticketCollection_idx` (`workerFk`), + KEY `collection_id2_idx` (`stateFk`), + CONSTRAINT `collection_id2` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `ticketCollection` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -18602,14 +18603,14 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `componentRate` +-- Temporary table structure for view `componentRate__` -- -DROP TABLE IF EXISTS `componentRate`; -/*!50001 DROP VIEW IF EXISTS `componentRate`*/; +DROP TABLE IF EXISTS `componentRate__`; +/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `componentRate` AS SELECT +/*!50001 CREATE VIEW `componentRate__` AS SELECT 1 AS `id`, 1 AS `name`, 1 AS `componentTypeRate`, @@ -18635,14 +18636,14 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `componentTypeRate` +-- Temporary table structure for view `componentTypeRate__` -- -DROP TABLE IF EXISTS `componentTypeRate`; -/*!50001 DROP VIEW IF EXISTS `componentTypeRate`*/; +DROP TABLE IF EXISTS `componentTypeRate__`; +/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `componentTypeRate` AS SELECT +/*!50001 CREATE VIEW `componentTypeRate__` AS SELECT 1 AS `id`, 1 AS `type`, 1 AS `base`*/; @@ -21179,7 +21180,8 @@ CREATE TABLE `itemCategory` ( `icon` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `reino_UNIQUE` (`name`) + UNIQUE KEY `reino_UNIQUE` (`name`), + KEY `itemCategory_idx3` (`merchandise`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22595,8 +22597,9 @@ CREATE TABLE `parking` ( `row` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '--', `sectorFk` int(11) NOT NULL DEFAULT '2', `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL, + `pickingOrder` int(11) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `column_UNIQUE` (`column`,`row`), + UNIQUE KEY `column_UNIQUE` (`column`,`row`,`sectorFk`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `parking_fk1_idx` (`sectorFk`), CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -24074,6 +24077,29 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Temporary table structure for view `saleValue` +-- + +DROP TABLE IF EXISTS `saleValue`; +/*!50001 DROP VIEW IF EXISTS `saleValue`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `saleValue` AS SELECT + 1 AS `warehouse`, + 1 AS `client`, + 1 AS `clientTypeFk`, + 1 AS `buyer`, + 1 AS `family`, + 1 AS `itemFk`, + 1 AS `concept`, + 1 AS `quantity`, + 1 AS `cost`, + 1 AS `value`, + 1 AS `year`, + 1 AS `week`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `saleVolume` -- @@ -24127,6 +24153,7 @@ CREATE TABLE `sector` ( `pickingPlacement` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, `path` int(11) DEFAULT NULL, `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT '0', + `isPackagingArea` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`warehouseFk`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `sector_fk1_idx` (`warehouseFk`), @@ -24484,6 +24511,7 @@ CREATE TABLE `state` ( `isPreviousPreparable` tinyint(1) NOT NULL DEFAULT '0', `isPicked` tinyint(1) NOT NULL DEFAULT '0', `isPreparable` tinyint(1) NOT NULL DEFAULT '0', + `semaphore` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -24845,6 +24873,20 @@ CREATE TABLE `taxType` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `thermograph` +-- + +DROP TABLE IF EXISTS `thermograph`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `thermograph` ( + `id` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `model` enum('TL30','SENSITECH','TREKVIEW1','TREKVIEW2','DISPOSABLE','TEMPMATE') COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `ticket` -- @@ -25337,6 +25379,7 @@ CREATE TABLE `ticketParking` ( `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `ticketParking_idx1` (`ticketFk`,`parkingFk`), + UNIQUE KEY `ticketFk_UNIQUE` (`ticketFk`), KEY `ticketParking_fk1_idx` (`parkingFk`), CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE @@ -26042,7 +26085,7 @@ CREATE TABLE `travelThermograph` ( KEY `travel_id` (`travelFk`), KEY `warehouse_id` (`warehouseFk`), CONSTRAINT `travelThermographDmsFgn` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `vn2008`.`thermograph` (`thermograph_id`) ON UPDATE CASCADE, + CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `thermograph` (`id`) ON UPDATE CASCADE, CONSTRAINT `travelThermographTravelFgn` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`), CONSTRAINT `travelThermographWarehouseFgn` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; @@ -27391,7 +27434,7 @@ DELIMITER ;; CLOSE vCur; INSERT INTO vn2008.mail (`to`, subject, text) - VALUES ('cau@verdnatura.es', + VALUES ('cau@verdnatura.es, sysadmin@verdnatura.es', 'servidor de impresion parado', CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '')); @@ -32107,9 +32150,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -32238,13 +32281,13 @@ proc: BEGIN INSERT INTO tmp.ticketComponent SELECT tcb.warehouseFk, tcb.itemFk, - cr.id, - GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3) + c.id, + GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) FROM tmp.ticketComponentBase tcb - JOIN componentRate cr + JOIN `component` c JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; + WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL; INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 @@ -32291,9 +32334,9 @@ proc: BEGIN vSpecialPriceComponent, sp.value - SUM(tcc.cost) sumCost FROM tmp.ticketComponentCopy tcc - JOIN componentRate cr ON cr.id = tcc.componentFk + JOIN `component` c ON c.id = tcc.componentFk JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - WHERE cr.classRate IS NULL + WHERE c.classRate IS NULL GROUP BY tcc.itemFk, tcc.warehouseFk HAVING ABS(sumCost) > 0.001; @@ -32301,10 +32344,10 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.ticketComponentSum (INDEX (itemFk, warehouseFk)) ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate + SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate FROM tmp.ticketComponent tc - JOIN componentRate cr ON cr.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate; + JOIN `component` c ON c.id = tc.componentFk + GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY @@ -33464,6 +33507,176 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collectionPlacement_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionPlacement_get`(vCollectionFk INT) +BEGIN + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + + SELECT t.warehouseFk + INTO vWarehouseFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.parked; + CREATE TEMPORARY TABLE tmp.parked + ENGINE MEMORY + SELECT s.itemFk, + sum(IFNULL(ish.visible,0)) as quantity + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + LEFT JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + GROUP BY s.itemFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + ENGINE MEMORY + SELECT itemFk, `grouping` + FROM ( + SELECT itemFk, + CASE groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN packing + ELSE `grouping` + END AS `grouping` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWarehouseFk + AND landed BETWEEN (SELECT FechaInventario FROM vn2008.tblContadores LIMIT 1) AND CURDATE() + AND b.isIgnored = FALSE + ORDER BY tr.landed DESC + ) sub + GROUP BY sub.itemFk ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + SELECT s.id as saleFk, s.itemFk, + p.code COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IFNULL(p.pickingOrder,0) as `order`, + IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`) as `grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN tmp.`grouping` g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + UNION ALL + SELECT s.id as saleFk, s.itemFk, + ip.code COLLATE utf8_general_ci as placement, + '' COLLATE utf8_general_ci as shelving, + modificationDate as created, + v.visible - p.quantity as visible, + IFNULL(cpd.id,0) as `order`, + g.`grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemPlacement ip ON ip.itemFk = s.itemFk AND ip.warehouseFk = vWarehouseFk + LEFT JOIN vn.coolerPathDetail cpd ON cpd.hallway = LEFT(ip.`code`,3) + JOIN tmp.parked p ON p.itemFk = s.itemFk + JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vCalcFk + LEFT JOIN tmp.grouping2 g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk; + + DROP TEMPORARY TABLE + tmp.parked, + tmp.`grouping`, + tmp.grouping2; +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 DROP PROCEDURE IF EXISTS `collectionSale_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionSale_get`(vCollectionFk INT) +BEGIN + + SELECT ticketFk, + saleFk, + itemFk, + quantity, + longName, + size, + reserved, + max(isPreviousPrepared) as isPreviousPrepared, + max(isPrepared) as isPrepared, + max(isControlled) as isControlled + FROM ( + SELECT s.ticketFk, + s.id as saleFk, + s.itemFk, + s.quantity, + i.longName, + i.size, + s.reserved, + stPrevious.isChecked as isPreviousPrepared, + stPrepared.isChecked as isPrepared, + stControled.isChecked as isControlled + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 + JOIN vn.ticketCollection tc ON tc.ticketFk = s.ticketFk + WHERE tc.collectionFk = vCollectionFk + ) sub + GROUP BY saleFk + + UNION ALL + + SELECT stow.shipFk, + stow.id as stowawayFk, + 0, + 1, + CONCAT('POLIZON T',stow.id), + NULL, + NULL, + IF(st.semaphore <=> 1,TRUE, FALSE) as isPreviousPrepared, + IF(st.semaphore <=> 2,TRUE, FALSE) as isPrepared, + IF(st.semaphore <=> 3,TRUE, FALSE) as isControlled + FROM vn.ticketCollection tc + JOIN vn.stowaway stow ON stow.shipFk = tc.ticketFk + LEFT JOIN vn.ticketState ts ON ts.ticketFk = stow.id + LEFT JOIN vn.state st ON st.id = ts.stateFk + WHERE tc.collectionFk = vCollectionFk; + +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 DROP PROCEDURE IF EXISTS `collectionStickers_print` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -33487,6 +33700,34 @@ BEGIN FROM vn.ticketCollection tc WHERE tc.collectionFk = vCollectionFk; +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 DROP PROCEDURE IF EXISTS `collectionTicket_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `collectionTicket_get`(vCollectionFk INT) +BEGIN + + SELECT tc.ticketFk, + tc.level, + am.name as agencyName + FROM vn.ticketCollection tc + JOIN vn.ticket t ON t.id = tc.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + WHERE tc.collectionFk = vCollectionFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33651,7 +33892,13 @@ proc:BEGIN END WHILE; - SELECT vCollectionFk; + + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + SELECT vCollectionFk; CLOSE cVolumetry; CLOSE cTicket; @@ -35673,17 +35920,17 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `getItemVisibleAvailable` */; +/*!50003 DROP PROCEDURE IF EXISTS `getItemVisibleAvailable__` */; /*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `getItemVisibleAvailable`( +CREATE DEFINER=`root`@`%` PROCEDURE `getItemVisibleAvailable__`( vItem INT, vDate DATE, vWarehouse TINYINT, @@ -36053,8 +36300,8 @@ proc: BEGIN SET @isModeInventory := FALSE; DELETE e, t - FROM travel t - JOIN entry e ON e.travelFk = t.id + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id WHERE e.supplierFk = 4 AND t.shipped <= vDeleteDate AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, CURDATE())); @@ -38903,17 +39150,17 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemGetVisibleAvailable` */; +/*!50003 DROP PROCEDURE IF EXISTS `itemGetVisibleAvailable__` */; /*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemGetVisibleAvailable`( +CREATE DEFINER=`root`@`%` PROCEDURE `itemGetVisibleAvailable__`( vItem INT, vDate DATE, vWarehouse TINYINT, @@ -40917,6 +41164,201 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `item_ValuateInventory` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `item_ValuateInventory`(IN vDated DATE, IN vIsDetailed BOOLEAN) +BEGIN + + DECLARE vInventoried DATE; + DECLARE vHasNotInventory BOOLEAN DEFAULT 0; + DECLARE vInventoried2 DATE; + DECLARE vDateDayEnd DATETIME; + + SET vDateDayEnd = util.dayEnd(vDated); + SELECT landed INTO vInventoried + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed <= vDateDayEnd + AND E.supplierFk = 4 + ORDER BY landed DESC + LIMIT 1; + + SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); + + IF vHasNotInventory THEN + + SELECT landed INTO vInventoried2 + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed >= vDated + AND E.supplierFk = 4 + ORDER BY landed ASC + LIMIT 1; + + SET vInventoried = TIMESTAMPADD(DAY,1,vDated); + SET vDateDayEnd = vInventoried2; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS inv; + + CREATE TEMPORARY TABLE inv + (warehouseFk SMALLINT, + Id_Article BIGINT, + cantidad INT, + coste DOUBLE DEFAULT 0, + total DOUBLE DEFAULT 0, + Almacen VARCHAR(20), + PRIMARY KEY (Almacen, Id_Article) USING HASH) + ENGINE = MEMORY; + + IF vHasNotInventory = TRUE THEN + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, SUM(b.quantity), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = warehouseInFk + WHERE landed = vDateDayEnd + AND e.supplierFk = 4 + AND w.valuatedInventory + AND t.isInventory + GROUP BY tr.warehouseInFk, b.itemFk; + + END IF; + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseInFk + WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd + AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,1,-1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); + + IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vDated AND vDateDayEnd + AND (s.isPicked <> 0 or t.isLabeled <> 0 ) + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); + + END IF; + + -- Mercancia en transito + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity, CONCAT(wOut.`name`,' - ', wIn.`name`) + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + WHERE vDated >= tr.shipped AND vDated < tr.landed + AND NOT isRaid + AND wIn.valuatedInventory + AND t.isInventory + AND e.isConfirmed + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); + + CALL vn.buyUltimate(NULL,vDateDayEnd); + + UPDATE inv i + JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.Id_Article = bu.itemFk + JOIN buy b ON b.id = bu.buyFk + SET total = i.cantidad * (ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0)), + coste = ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0) + WHERE i.cantidad <> 0; + + DELETE FROM inv WHERE Cantidad IS NULL or Cantidad = 0; + + IF vIsDetailed THEN + + SELECT inv.warehouseFk, i.id, i.name, i.size, inv.Cantidad, tp.code, + tp.categoryFk, inv.coste, cast(inv.total as decimal(10,2)) total,Almacen + FROM inv + JOIN warehouse w on w.id = warehouseFk + JOIN item i ON i.id = inv.Id_Article + JOIN itemType tp ON tp.id = i.typeFk + WHERE w.valuatedInventory + and inv.total > 0 + order by inv.total desc; + + ELSE + + SELECT i.Almacen, ic.name as Reino, cast(i.total as decimal(10,2)) as Euros, w.code as Comprador,it.id + FROM inv i + JOIN warehouse wh on wh.id = warehouseFk + JOIN item it ON it.id = i.Id_Article + JOIN itemType itp ON itp.id = it.typeFk + LEFT JOIN worker w ON w.id = itp.workerFk + JOIN itemCategory ic ON ic.id = itp.categoryFk + WHERE wh.valuatedInventory + AND i.total > 0; + + END IF; + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE inv; +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 DROP PROCEDURE IF EXISTS `ledger_next` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -42025,16 +42467,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT) +CREATE DEFINER=`root`@`%` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) BEGIN DECLARE vColumn INT; DECLARE vRow INT; + DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; DECLARE vMaxId INT; + DECLARE vCode VARCHAR(8); SET vColumn = vFromColumn; SET vRow = vFromRow; - + SET vCode = CONCAT(LPAD(vColumn,3,'0'),IF(vIsLetterMode, MID(vLetters, vRow, 1), CONCAT('-',LPAD(vRow, 2,'0')))); + SELECT MAX(id) INTO vMaxId FROM vn.parking; @@ -42042,20 +42487,23 @@ BEGIN WHILE vRow <= vToRow DO - INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`) - VALUES (vColumn, vRow, vSectorFk, CONCAT(LPAD(vColumn,3,'0'),'-',LPAD(vRow, 2,'0'))); + INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) + VALUES (vColumn, vRow, vSectorFk, vCode, vColumn ) + ON DUPLICATE KEY UPDATE `code` = vCode; SET vRow = vRow + 1; + SET vCode = CONCAT(LPAD(vColumn,3,'0'),IF(vIsLetterMode, MID(vLetters, vRow, 1), CONCAT('-',LPAD(vRow, 2,'0')))); END WHILE; SET vRow = vFromRow; - - SET vColumn = vColumn + 1; - + SET vColumn = vColumn + 1; + + SET vCode = CONCAT(LPAD(vColumn,3,'0'),IF(vIsLetterMode, MID(vLetters, vRow, 1), CONCAT('-',LPAD(vRow, 2,'0')))); + END WHILE; - SELECT * FROM vn.parking WHERE id > vMaxId; + SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; END ;; DELIMITER ; @@ -42627,9 +43075,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -42734,9 +43182,9 @@ BEGIN JOIN vn.ticket t ON t.routeFk = r.id JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.componentRate cr ON cr.id = sc.componentFk - JOIN vn.componentTypeRate ctr ON ctr.id = cr.componentTypeRate - WHERE ctr.type = 'agencia' + JOIN vn.`component` c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE ct.type = 'agencia' AND tm.year = vYear AND tm.month = vMonth GROUP BY r.id @@ -42965,48 +43413,46 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `saleMove`(IN vSaleFk BIGINT, IN vQuantity BIGINT) BEGIN --- JGF is working in this file 2019-12-20 - DECLARE vclientFk INT; + DECLARE vShipped DATE; DECLARE vWarehouseFk INT; - DECLARE vCompanyFk INT; DECLARE vAddressFk INT; DECLARE vAgencyModeFk INT; DECLARE vNewTicket BIGINT; DECLARE vNewSale BIGINT; DECLARE vLanded DATE; - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - DECLARE vAuxId INT; - DECLARE vNumLine INT; + DECLARE vShippedDayEnd DATETIME; + DECLARE vTicketOriginalFk INT; + DECLARE hasAlreadyItem BOOLEAN; DECLARE vItemFk INT; + DECLARE vClientTypeFk VARCHAR(20); - SELECT clientFk,shipped,warehouseFk,companyFk,addressFk,agencyModeFk,landed,t.id - INTO vclientFk,vShipped,vWarehouseFk,vCompanyFk,vAddressFk,vAgencyModeFk,vLanded,vAuxId + SELECT t.shipped, t.warehouseFk, t.addressFk, agencyModeFk, landed, t.id, s.itemfk, c.typeFk + INTO vShipped, vWarehouseFk, vAddressFk, vAgencyModeFk, vLanded, vTicketOriginalFk, vItemFk, vClientTypeFk FROM ticket t - JOIN sale s ON s.ticketFk=t.id + JOIN sale s ON s.ticketFk = t.id + JOIN `client` c ON t.clientFk = c.id WHERE s.id = vSaleFk; - - SET vDateStart = TIMESTAMP(vShipped); - SET vDateEnd = TIMESTAMP(vShipped, '23:59:59'); - - SELECT t.id INTO vNewTicket - FROM ticket t - JOIN ticketState ts ON ts.ticketFk=t.id - WHERE t.addressFk = vAddressFk - AND t.warehouseFk = vWarehouseFk - AND t.agencyModeFk = vAgencyModeFk - AND t.landed <=> vLanded - AND t.shipped BETWEEN vDateStart AND vDateEnd - AND t.refFk IS NULL - AND t.clientFk <> 1118 - AND t.id <> vAuxId - AND IFNULL(ts.alertLevel,0) = 0 - LIMIT 1; + SET vShippedDayEnd = util.dayEnd(vShipped); + + IF vClientTypeFk <> 'handMaking' THEN + SELECT t.id INTO vNewTicket + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + WHERE t.addressFk = vAddressFk + AND t.warehouseFk = vWarehouseFk + AND t.agencyModeFk = vAgencyModeFk + AND t.landed <=> vLanded + AND t.shipped BETWEEN vShipped AND vShippedDayEnd + AND t.refFk IS NULL + AND t.id <> vTicketOriginalFk + AND IFNULL(ts.alertLevel,0) = 0 + LIMIT 1; + END IF; + IF vNewTicket IS NULL THEN - CALL vn.ticket_Clone(vAuxId, vNewTicket); - /*CALL vn2008.bionic_calc_ticket(vNewTicket);*/ + CALL vn.ticket_Clone(vTicketOriginalFk, vNewTicket); END IF; INSERT INTO ticketTracking(ticketFk, workerFk, stateFk) @@ -43014,34 +43460,30 @@ BEGIN FROM state s WHERE s.code = 'FIXING'; - - /*parche para campapña, eliminar y modificar el front*/ - SELECT COUNT(id) INTO vNumLine + SELECT COUNT(id) INTO hasAlreadyItem FROM sale s - WHERE s.ticketFk = vNewTicket AND s.itemFk = (SELECT itemFk FROM sale WHERE id = vSaleFk); + WHERE s.ticketFk = vNewTicket AND s.itemFk = vItemFk; + + IF hasAlreadyItem = FALSE THEN - IF vNumLine = 0 THEN - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) SELECT vNewTicket, itemFk, concept, vQuantity, price, discount FROM sale s WHERE s.id = vSaleFk; - SELECT LAST_INSERT_ID() INTO vNewSale; + SELECT LAST_INSERT_ID() INTO vNewSale; - INSERT INTO saleComponent(saleFk, componentFk, `value`) + INSERT INTO saleComponent(saleFk, componentFk, `value`) SELECT vNewSale, componentFk, `value` FROM saleComponent WHERE saleFk = vSaleFk; - ELSE - IF vQuantity <> 0 THEN + ELSE - SELECT itemFk INTO vItemFk FROM sale WHERE id = vSaleFk; - UPDATE sale SET quantity = vQuantity - WHERE ticketFk = vNewTicket AND itemFk = vItemFk; + UPDATE sale + SET quantity = quantity + vQuantity + WHERE ticketFk = vNewTicket AND itemFk = vItemFk; - END IF; END IF; END ;; @@ -44310,6 +44752,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `subordinateGetList`(vBossFk INT) BEGIN + + -- deprecated usar vn.worker_GetHierarch DECLARE vBossId INT; DECLARE vDone BOOL; DECLARE workerCur CURSOR FOR @@ -45976,9 +46420,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -46058,8 +46502,8 @@ BEGIN DELETE sc.* FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk - JOIN componentRate cr ON cr.id = sc.componentFk - WHERE cr.isRenewable; + JOIN `component` c ON c.id = sc.componentFk + WHERE c.isRenewable; REPLACE INTO saleComponent(saleFk, componentFk, value) SELECT s.id, tc.componentFk, tc.cost @@ -46068,8 +46512,8 @@ BEGIN JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk - LEFT JOIN componentRate cr ON cr.id = tc.componentFk - WHERE IF(sc.componentFk IS NULL AND NOT cr.isRenewable, FALSE, TRUE); + LEFT JOIN `component` c ON c.id = tc.componentFk + WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); END IF; IF vKeepPrices THEN @@ -46107,8 +46551,8 @@ BEGIN SELECT SUM(sc.value) sumValue, sc.saleFk FROM saleComponent sc JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN componentRate cr ON cr.id = sc.componentFk - JOIN componentTypeRate ctr on ctr.id = cr.componentTypeRate AND ctr.base + JOIN `component` c ON c.id = sc.componentFk + JOIN componentType ct on ct.id = c.typeFk AND ct.base GROUP BY sc.saleFk) sc ON sc.saleFk = s.id SET s.priceFixed = sumValue, s.isPriceFixed = 1; @@ -46950,6 +47394,64 @@ BEGIN JOIN vn.ticket t on t.id = s.ticketFk JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk WHERE s.ticketFk = vTicketId; +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 DROP PROCEDURE IF EXISTS `ticketMissed_List` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketMissed_List`(vTicketFk INT) +BEGIN + + DECLARE vParkingFk INT; + DECLARE vParked DATETIME; + DECLARE vLevel INT; + DECLARE vCollectionFk INT; + + SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) + INTO vLevel, vCollectionFk + FROM vn.ticketCollection + WHERE ticketFk = vTicketFk; + + SELECT created, parkingFk + INTO vParked, vParkingFk + FROM vn.ticketParking + WHERE ticketFk = vTicketFk; + + SELECT tp.ticketFk, CONCAT(vCollectionFk, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector sc ON sc.code = p.sectorFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.state s ON s.id = tst.state + WHERE s.alertLevel < 2 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND ( + ( + ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) + OR + ( tc.collectionFk = vCollectionFk AND LEFT(tc.level,1) < LEFT(vLevel,1) ) + ) + ); + + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47631,9 +48133,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -47718,13 +48220,13 @@ BEGIN FROM saleComponent sc JOIN sale s ON s.id = sc.saleFk JOIN ticket t ON t.id = s.ticketFk - JOIN componentRate cr ON cr.id = sc.componentFk + JOIN `component` c ON c.id = sc.componentFk WHERE s.ticketFk = vTicketFk - AND (cr.isRenewable = FALSE + AND (c.isRenewable = FALSE OR (NOT vHasChangeAll - AND (NOT (cr.componentTypeRate <=> vAddressTypeRateFk - OR cr.componentTypeRate <=> vAgencyModeTypeRateFk)))); + AND (NOT (c.typeFk <=> vAddressTypeRateFk + OR c.typeFk <=> vAgencyModeTypeRateFk)))); SET @shipped = vShipped; @@ -47982,9 +48484,9 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -48023,11 +48525,11 @@ BEGIN AND tc.warehouseFk = t.warehouseFk LEFT JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk - LEFT JOIN componentRate cr ON cr.id = tc.componentFk + LEFT JOIN `component` c ON c.id = tc.componentFk WHERE t.id = vTicketFk AND IF(sc.componentFk IS NULL - AND cr.classRate IS NOT NULL, FALSE, TRUE) + AND c.classRate IS NOT NULL, FALSE, TRUE) GROUP BY s.id ORDER BY s.id; DROP TEMPORARY TABLE @@ -50615,6 +51117,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `worker_getHierarch`(vBoss INT) BEGIN +-- eliminar no se usa DECLARE EXIT HANDLER FOR 1062 BEGIN CALL util.throw('INFINITE_LOOP'); END; @@ -50659,6 +51162,62 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `worker_getHierarchy` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `worker_getHierarchy`(vBoss INT) +BEGIN + DECLARE EXIT HANDLER FOR 1062 BEGIN + CALL util.throw('INFINITE_LOOP'); + END; + + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; + CREATE TEMPORARY TABLE workerHierarchy + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchyList; + CREATE TEMPORARY TABLE tmp.workerHierarchyList + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk, 0 AS isChecked; + + + WHILE (SELECT COUNT(*) FROM tmp.workerHierarchyList WHERE NOT isChecked) > 0 DO + + INSERT INTO tmp.workerHierarchyList + SELECT w.id, 0 + FROM worker w + JOIN workerHierarchy wh ON wh.workerFk = w.bossFk; + + UPDATE tmp.workerHierarchyList whl + JOIN workerHierarchy wh ON wh.workerFk = whl.workerFk + SET whl.isChecked = 1; + + TRUNCATE workerHierarchy; + + INSERT INTO workerHierarchy + SELECT workerFk + FROM tmp.workerHierarchyList + WHERE NOT isChecked; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; +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 DROP PROCEDURE IF EXISTS `workingHours` */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -53062,19 +53621,19 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `componentRate` +-- Final view structure for view `componentRate__` -- -/*!50001 DROP VIEW IF EXISTS `componentRate`*/; +/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentRate` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; +/*!50001 VIEW `componentRate__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53098,19 +53657,19 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `componentTypeRate` +-- Final view structure for view `componentTypeRate__` -- -/*!50001 DROP VIEW IF EXISTS `componentTypeRate`*/; +/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentTypeRate` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `t` */; +/*!50001 VIEW `componentTypeRate__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53560,7 +54119,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`quantity` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `itemShelvingSale` `iss` on((`iss`.`itemShelvingFk` = `ish`.`id`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ish`.`id` */; +/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`quantity` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) group by `ish`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -53799,6 +54358,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `saleValue` +-- + +/*!50001 DROP VIEW IF EXISTS `saleValue`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `clientTypeFk`,`u`.`name` AS `buyer`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `cost`,((((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) * `s`.`quantity`) AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `account`.`user` `u` on((`u`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`warehouse` `wh` on((`wh`.`id` = `t`.`warehouseFk`))) join `vn`.`time` `tm` on((`tm`.`dated` = cast(`t`.`shipped` as date)))) join `cache`.`last_buy` `lb` on(((`lb`.`item_id` = `i`.`id`) and (`lb`.`warehouse_id` = `wh`.`id`)))) join `vn`.`buy` `b` on((`b`.`id` = `lb`.`buy_id`))) where `wh`.`isManaged` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `saleVolume` -- @@ -54005,12 +54582,12 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` > curdate()) and (`b`.`date_start` <= curdate()))) */; +/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` >= curdate()) and (`b`.`date_start` <= curdate()))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -54174,4 +54751,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-12-23 14:34:48 +-- Dump completed on 2020-01-08 13:31:07 diff --git a/docker-compose.yml b/docker-compose.yml index c9011bdf4..ff53b238d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,45 @@ -version: '3.5' +version: '3.7' services: - front: - image: registry.verdnatura.es/salix-front:${TAG} - restart: unless-stopped - build: - context: . - dockerfile: front/Dockerfile - ports: - - ${PORT_FRONT}:80 - links: - - back - deploy: - replicas: 3 - back: - image: registry.verdnatura.es/salix-back:${TAG} - restart: unless-stopped - build: . - ports: - - ${PORT_BACK}:3000 - environment: - - NODE_ENV - volumes: - - /mnt/storage/containers/salix:/etc/salix - - /mnt/storage/pdfs:/var/lib/salix/pdfs - - /mnt/storage/dms:/var/lib/salix/dms - deploy: - replicas: 6 + front: + image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?} + build: + context: . + dockerfile: front/Dockerfile + ports: + - ${FRONT_PORT:?}:80 + deploy: + replicas: 3 + back: + image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?} + build: . + ports: + - ${BACK_PORT:?}:3000 + environment: + - NODE_ENV + 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/storage/pdfs:/var/lib/salix/pdfs + - /mnt/storage/dms:/var/lib/salix/dms + deploy: + replicas: 6 +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 diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ed984348c..b24f385cf 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -164,8 +164,8 @@ export default { }, clientBalance: { balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]', - companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyFk"]', - newPaymentButton: 'vn-float-button', + companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', + newPaymentButton: `vn-float-button`, newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', newPaymentAmountInput: '.vn-dialog.shown [ng-model="$ctrl.receipt.amountPaid"]', saveButton: '.vn-dialog.shown vn-button[label="Save"]', @@ -603,8 +603,8 @@ export default { orderByAutocomplete: 'vn-autocomplete[label="Order by"]', plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', typeAutocomplete: 'vn-autocomplete[data="$ctrl.itemTypes"]', - itemIdInput: 'vn-catalog-filter [ng-model="$ctrl.itemFk"]', - itemTagValueInput: 'vn-catalog-filter [ng-model="$ctrl.value"]', + itemIdInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.itemId"]', + itemTagValueInput: 'vn-catalog-filter vn-textfield[ng-model="$ctrl.value"]', openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i', tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]', tagValueInput: 'vn-order-catalog-search-panel [ng-model="filter.value"]', diff --git a/e2e/paths/08-route-module/02_basic_data.spec.js b/e2e/paths/08-route-module/02_basic_data.spec.js index 63ed673d9..8f81d9cba 100644 --- a/e2e/paths/08-route-module/02_basic_data.spec.js +++ b/e2e/paths/08-route-module/02_basic_data.spec.js @@ -34,7 +34,7 @@ describe('Route basic Data path', () => { .waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value'); - expect(worker).toEqual('adminBossNick'); + expect(worker).toEqual('adminBoss - adminBossNick'); }); it('should confirm the vehicle was edited', async() => { diff --git a/front/core/components/data-viewer/locale/es.yml b/front/core/components/data-viewer/locale/es.yml new file mode 100644 index 000000000..0368321f2 --- /dev/null +++ b/front/core/components/data-viewer/locale/es.yml @@ -0,0 +1 @@ +No service for the specified zone: No hay servicio para la zona especificada \ No newline at end of file diff --git a/front/core/directives/droppable.scss b/front/core/directives/droppable.scss index 97e6f8a19..f2e18a3ad 100644 --- a/front/core/directives/droppable.scss +++ b/front/core/directives/droppable.scss @@ -11,11 +11,9 @@ .vn-droppable, [vn-droppable] { - display: block; - &.dropping { background-color: $color-hover-cd; - border-color: $color-bg-dark; + border-color: $color-font-secondary; } } diff --git a/front/core/mocks/crud-model.js b/front/core/mocks/crud-model.js index af6406eec..7dd32e93f 100644 --- a/front/core/mocks/crud-model.js +++ b/front/core/mocks/crud-model.js @@ -1,4 +1,5 @@ -module.exports = { +const crudModel = { + _data: [1, 2, 3], data: [], filter: {}, order: {}, @@ -31,7 +32,28 @@ module.exports = { } }; }, - refresh: () => {}, - addFilter: () => {}, - applyFilter: () => {}, + refresh: () => { + return { + then: callback => { + return callback({data: {id: 1234}}); + } + }; + }, + addFilter: () => { + return { + then: callback => { + return callback({data: {id: 1234}}); + } + }; + }, + applyFilter: () => { + crudModel.data = crudModel._data; + return { + then: callback => { + return callback({data: {id: 1234}}); + } + }; + }, }; + +module.exports = crudModel; diff --git a/front/salix/components/app/style.scss b/front/salix/components/app/style.scss index aab37c8a3..96d6a6193 100644 --- a/front/salix/components/app/style.scss +++ b/front/salix/components/app/style.scss @@ -7,7 +7,7 @@ vn-app { ui-view { display: block; box-sizing: border-box; - height: inherit; + height: 100%; &.ng-enter { animation-name: nothing, slideIn; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 9a9d903a6..b66c620ad 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -87,6 +87,8 @@ vn-layout { & > * { display: block; padding: $spacing-md; + box-sizing: border-box; + height: 100% } &.ng-enter { vn-side-menu { diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index 3737c508a..b0c926def 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -11,7 +11,6 @@ transition: all 0.5s; padding: $spacing-sm; position: relative; - opacity: 0.7; width: 28em; .image { @@ -20,6 +19,7 @@ 0 1px 5px 0 rgba(0,0,0,.12); background: no-repeat center center fixed; background-size: cover !important; + border: 2px solid transparent; overflow: hidden; cursor: zoom-in; height: 100%; @@ -34,7 +34,7 @@ top: 1em } } - .photo:hover { - opacity: 1 + .photo:hover .image { + border: 2px solid $color-primary } } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 72dc514df..050106e29 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -101,6 +101,7 @@ async function backTestOnce() { gulp.src(backSpecFiles) .pipe(jasmine(options)) .on('end', resolve) + .on('error', reject) .resume(); }); @@ -110,27 +111,33 @@ backTestOnce.description = `Runs the backend tests once, can receive --junit arg async function backTestDockerOnce() { let containerId = await docker(); + let err; + try { await backTestOnce(); } catch (e) { - throw e; - } finally { - if (argv['random']) - await execP(`docker rm -fv ${containerId}`); + err = e; } + + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + if (err) throw err; } backTestDockerOnce.description = `Runs backend tests using in site container once`; async function backTestDocker() { let containerId = await docker(); + let err; + try { await backTest(); } catch (e) { - throw e; - } finally { - if (argv['random']) - await execP(`docker rm -fv ${containerId}`); + err = e; } + + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + if (err) throw err; } backTestDocker.description = `Runs backend tests restoring fixtures first`; @@ -283,14 +290,15 @@ function install() { const install = require('gulp-install'); const print = require('gulp-print'); + let npmArgs = []; + if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline']; + let packageFiles = ['front/package.json', 'print/package.json']; return gulp.src(packageFiles) .pipe(print(filepath => { return `Installing packages in ${filepath}`; })) - .pipe(install({ - npm: ['--no-package-lock'] - })); + .pipe(install({npm: npmArgs})); } install.description = `Installs node dependencies in all directories`; @@ -472,15 +480,22 @@ async function docker() { let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); containerId = result.stdout; - if (argv['random']) { - let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); - let netSettings = JSON.parse(inspect.stdout); + try { + if (argv['random']) { + let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); + let netSettings = JSON.parse(inspect.stdout); - dbConf.host = netSettings.Gateway; - dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + dbConf.host = netSettings.Gateway; + dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + } + + if (runChown) await dockerWait(); + } catch (err) { + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + throw err; } - if (runChown) await dockerWait(); return containerId; } docker.description = `Builds the database image and runs a container`; diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index bbd8ce0d5..0ea634484 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -14,7 +14,7 @@ "multipleStatements": true, "legacyUtcDateProcessing": false, "timezone": "local", - "connectTimeout": 20000, + "connectTimeout": 40000, "acquireTimeout": 20000 }, "storage": { diff --git a/modules/agency/back/methods/zone/getEvents.js b/modules/agency/back/methods/zone/getEvents.js index 1c70dfffd..abf3d7e19 100644 --- a/modules/agency/back/methods/zone/getEvents.js +++ b/modules/agency/back/methods/zone/getEvents.js @@ -9,7 +9,7 @@ module.exports = Self => { description: 'The province id', required: true }, { - arg: 'search', + arg: 'postCode', type: 'String', description: 'The postcode' }, { diff --git a/modules/agency/front/delivery-days/index.js b/modules/agency/front/delivery-days/index.js index e9c885a13..0d7baeb60 100644 --- a/modules/agency/front/delivery-days/index.js +++ b/modules/agency/front/delivery-days/index.js @@ -8,8 +8,14 @@ class Controller extends Section { } onSubmit() { + this.$.data = null; this.$http.get(`Zones/getEvents`, {params: this.$.params}) - .then(res => this.$.data = res.data); + .then(res => { + let data = res.data; + this.$.data = data; + if (!data.events.length) + this.vnApp.showMessage(this.$t('No service for the specified zone')); + }); } } diff --git a/modules/agency/front/events/index.html b/modules/agency/front/events/index.html index 274d79997..693b24a85 100644 --- a/modules/agency/front/events/index.html +++ b/modules/agency/front/events/index.html @@ -160,12 +160,12 @@ response="cancel" translate-attr="{value: 'Cancel'}"> - - Delete - + translate-attr="{value: 'Delete'}"> + Add Save diff --git a/modules/claim/front/detail/index.html b/modules/claim/front/detail/index.html index 7551be257..7e225b16a 100644 --- a/modules/claim/front/detail/index.html +++ b/modules/claim/front/detail/index.html @@ -54,8 +54,8 @@ {{::saleClaimed.sale.price | currency: 'EUR':2}} - {{saleClaimed.sale.discount}} % diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js index f66a296c8..74033b565 100644 --- a/modules/claim/front/detail/index.js +++ b/modules/claim/front/detail/index.js @@ -29,8 +29,10 @@ class Controller { set salesClaimed(value) { this._salesClaimed = value; - if (value) + if (value) { this.calculateTotals(); + this.isClaimEditable(); + } } get salesClaimed() { @@ -119,13 +121,14 @@ class Controller { } showEditPopover(event, saleClaimed) { - this.saleClaimed = saleClaimed; + if (this.isEditable) { + if (!this.aclService.hasAny(['salesAssistant'])) + return this.vnApp.showError(this.$translate.instant('Insuficient permisos')); - if (!this.aclService.hasAny(['salesAssistant'])) - return this.vnApp.showError(this.$translate.instant('Insuficient permisos')); - - this.$.editPopover.parent = event.target; - this.$.editPopover.show(); + this.saleClaimed = saleClaimed; + this.$.editPopover.parent = event.target; + this.$.editPopover.show(); + } } getSalespersonMana() { @@ -134,6 +137,12 @@ class Controller { }); } + isClaimEditable() { + this.$http.get(`Tickets/${this.claim.ticketFk}/isEditable`).then(res => { + this.isEditable = res.data; + }); + } + updateDiscount() { const claimedSale = this.saleClaimed.sale; if (this.newDiscount != claimedSale.discount) { diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index 24491075d..8d102ae96 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -17,13 +17,14 @@ describe('claim', () => { show: () => {} }; $httpBackend = _$httpBackend_; - $httpBackend.when('GET', 'Claims/ClaimBeginnings').respond({}); + $httpBackend.whenGET('Claims/ClaimBeginnings').respond({}); + $httpBackend.whenGET(`Tickets/1/isEditable`).respond(true); $state = _$state_; aclService = {hasAny: () => true}; controller = $componentController('vnClaimDetail', {$state, aclService, $scope}); + controller.claim = {ticketFk: 1}; controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}]; controller.salesClaimed = [{id: 1, sale: {}}]; - controller.claim = {ticketFk: 1}; controller.$.model = crudModel; controller.$.addSales = { hide: () => {}, @@ -36,7 +37,6 @@ describe('claim', () => { describe('openAddSalesDialog()', () => { it('should call getClaimableFromTicket and $.addSales.show', () => { - controller.$ = {addSales: {show: () => {}}}; spyOn(controller, 'getClaimableFromTicket'); spyOn(controller.$.addSales, 'show'); controller.openAddSalesDialog(); @@ -146,5 +146,14 @@ describe('claim', () => { expect(controller.$.descriptor.show).toHaveBeenCalledWith(); }); }); + + describe('isClaimEditable()', () => { + it('should check if the claim is editable', () => { + controller.isClaimEditable(); + $httpBackend.flush(); + + expect(controller.isEditable).toBeTruthy(); + }); + }); }); }); diff --git a/modules/claim/front/dms/index/index.html b/modules/claim/front/dms/index/index.html index bd6b9a21d..447538bd1 100644 --- a/modules/claim/front/dms/index/index.html +++ b/modules/claim/front/dms/index/index.html @@ -5,31 +5,28 @@ data="$ctrl.photos"> - - - Drag & Drop files here... - - - - - - - - - - + + + + Drag & Drop photos here... + + + - - + + + + + + + @@ -38,4 +35,10 @@ message="This file will be deleted" question="Are you sure you want to continue?" on-response="$ctrl.deleteDms($response)"> - \ No newline at end of file + + + diff --git a/modules/claim/front/dms/index/index.js b/modules/claim/front/dms/index/index.js index 20eba62a3..e83204000 100644 --- a/modules/claim/front/dms/index/index.js +++ b/modules/claim/front/dms/index/index.js @@ -68,6 +68,19 @@ class Controller { }); } + openUploadDialog() { + const element = document.createElement('input'); + element.setAttribute('type', 'file'); + element.setAttribute('multiple', true); + element.click(); + + element.addEventListener('change', () => + this.setDefaultParams().then(() => { + this.dms.files = element.files; + this.create(); + }) + ); + } create() { const query = `claims/${this.claim.id}/uploadFile`; diff --git a/modules/claim/front/dms/index/style.scss b/modules/claim/front/dms/index/style.scss index e7e957cd8..28f9db6fc 100644 --- a/modules/claim/front/dms/index/style.scss +++ b/modules/claim/front/dms/index/style.scss @@ -2,13 +2,16 @@ vn-claim-dms-index { .drop-zone { - border: 2px dashed $color-font-secondary; color: $color-font-secondary; box-sizing: border-box; - padding: 2em $spacing-md; border-radius: 0.5em; text-align: center; - font-size: 1.4em; + min-height: 100%; + + .empty-rows { + padding: 5em $spacing-md; + font-size: 1.4em + } vn-icon { font-size: 3em diff --git a/modules/claim/front/dms/locale/en.yml b/modules/claim/front/dms/locale/en.yml deleted file mode 100644 index a202e8bf2..000000000 --- a/modules/claim/front/dms/locale/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -FileDescription: Ticket id {{ticketId}} from client {{clientName}} id {{clientId}} -ContentTypesInfo: Allowed file types {{allowedContentTypes}} \ No newline at end of file diff --git a/modules/claim/front/dms/locale/es.yml b/modules/claim/front/dms/locale/es.yml index 3e765ae78..8ccc1dba4 100644 --- a/modules/claim/front/dms/locale/es.yml +++ b/modules/claim/front/dms/locale/es.yml @@ -1,4 +1,5 @@ Are you sure you want to continue?: ¿Seguro que quieres continuar? -Drag & Drop files here...: Arrastra y suelta archivos aquí... +Drag & Drop photos here...: Arrastra y suelta fotos aquí... Photo deleted: Foto eliminada -Photo uploaded!: Foto subida! \ No newline at end of file +Photo uploaded!: Foto subida! +Select photo: Seleccionar foto \ No newline at end of file diff --git a/modules/claim/front/summary/style.scss b/modules/claim/front/summary/style.scss index 38136f24a..afd3838be 100644 --- a/modules/claim/front/summary/style.scss +++ b/modules/claim/front/summary/style.scss @@ -1,12 +1,10 @@ @import "./variables"; vn-claim-summary { - .photo { - height: 15.5em; + section.photo { + height: 15.5em } - .photo .image { - border: 2px solid $color-bg-dark; - border-radius: 0.2em; + .photo .image { + border-radius: 0.2em } - } \ No newline at end of file diff --git a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js index 7cc49cd90..b9b28fe09 100644 --- a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js +++ b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js @@ -7,7 +7,7 @@ describe('Client activeWorkersWithRole', () => { let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson'); - expect(result.length).toEqual(13); + expect(result.length).toEqual(14); expect(isSalesPerson).toBeTruthy(); }); diff --git a/modules/client/back/methods/client/specs/listWorkers.spec.js b/modules/client/back/methods/client/specs/listWorkers.spec.js index 5f3836ba1..728268457 100644 --- a/modules/client/back/methods/client/specs/listWorkers.spec.js +++ b/modules/client/back/methods/client/specs/listWorkers.spec.js @@ -6,7 +6,7 @@ describe('Client listWorkers', () => { .then(result => { let amountOfEmployees = Object.keys(result).length; - expect(amountOfEmployees).toEqual(48); + expect(amountOfEmployees).toEqual(49); done(); }) .catch(done.fail); diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index 5c0d6c1dd..532d72811 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -11,10 +11,15 @@ module.exports = Self => { description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', http: {source: 'query'} }, { - arg: 'params', - type: 'Object', - description: 'clientFk', - http: {source: 'query'} + arg: 'clientId', + type: 'Number', + description: 'The client id', + required: true, + }, { + arg: 'companyId', + type: 'Number', + description: 'The company id', + required: true, } ], returns: { @@ -27,7 +32,7 @@ module.exports = Self => { } }); - Self.filter = async(filter, params) => { + Self.filter = async(filter, clientId, companyId) => { let stmt = new ParameterizedSQL( `SELECT * FROM ( SELECT @@ -72,10 +77,10 @@ module.exports = Self => { ORDER BY payed DESC, created DESC ) t ORDER BY payed DESC, created DESC`, [ - params.clientFk, - params.companyFk, - params.clientFk, - params.companyFk, + clientId, + companyId, + clientId, + companyId, ] ); diff --git a/modules/client/back/methods/receipt/specs/filter.spec.js b/modules/client/back/methods/receipt/specs/filter.spec.js index 5e8ccd807..2af3b3127 100644 --- a/modules/client/back/methods/receipt/specs/filter.spec.js +++ b/modules/client/back/methods/receipt/specs/filter.spec.js @@ -2,12 +2,10 @@ const app = require('vn-loopback/server/server'); describe('receipt filter()', () => { it('should return the receipts', async() => { - let filter = {limit: 20}; - let params = { - clientFk: 101, - companyFk: 442 - }; - let result = await app.models.Receipt.filter(filter, params); + const filter = {limit: 20}; + const clientId = 101; + const companyId = 442; + let result = await app.models.Receipt.filter(filter, clientId, companyId); expect(result.length).toBeGreaterThan(0); }); diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js index 5ba2ad063..a7b9bc23b 100644 --- a/modules/client/front/address/index/index.js +++ b/modules/client/front/address/index/index.js @@ -2,10 +2,12 @@ import ngModule from '../../module'; import './style.scss'; class Controller { - constructor($http, $scope, $stateParams) { + constructor($http, $scope, $stateParams, $translate, vnApp) { this.$http = $http; this.$scope = $scope; this.$stateParams = $stateParams; + this.$translate = $translate; + this.vnApp = vnApp; this.filter = { fields: [ 'id', @@ -51,6 +53,7 @@ class Controller { if (res.data) { this.client.defaultAddressFk = res.data.defaultAddressFk; this.sortAddresses(); + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); } }); } @@ -69,7 +72,7 @@ class Controller { }); } } -Controller.$inject = ['$http', '$scope', '$stateParams']; +Controller.$inject = ['$http', '$scope', '$stateParams', '$translate', 'vnApp']; ngModule.component('vnClientAddressIndex', { template: require('./index.html'), diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index 29f3d02e6..f42998bbd 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -1,10 +1,8 @@ + data="$ctrl.balances"> { - if (response.data) { - this.clientRisks = response.data; - - this.getBalances(); } - }); + }; } - get balances() { - return this._balances; + get companyId() { + if (!this._companyId) + this.companyId = this.vnConfig.companyFk; + + return this._companyId; } + set companyId(value) { + this._companyId = value; + + if (value) this.getData(); + } + + getData() { + return this.$.model.applyFilter(null, { + clientId: this.$stateParams.id, + companyId: this.companyId + }).then(() => this.$.riskModel.applyFilter({ + where: { + clientFk: this.$stateParams.id, + companyFk: this.companyId + } + })).then(() => this.getBalances()); + } + + getCurrentBalance() { - const selectedCompany = this.$.company.selection; - const currentBalance = this.clientRisks.find(balance => { - return balance.companyFk === selectedCompany.id; + const clientRisks = this.$.riskModel.data; + const selectedCompany = this.companyId; + const currentBalance = clientRisks.find(balance => { + return balance.companyFk === selectedCompany; }); return currentBalance.amount; } getBalances() { - this.balances.forEach((balance, index) => { + const balances = this.$.model.data; + balances.forEach((balance, index) => { if (index === 0) balance.balance = this.getCurrentBalance(); if (index > 0) { - let previousBalance = this.balances[index - 1]; - + let previousBalance = balances[index - 1]; balance.balance = previousBalance.balance - (previousBalance.debit - previousBalance.credit); } }); @@ -92,10 +70,8 @@ class Controller { openCreateDialog() { - this.$.balanceCreateDialog.companyFk = this.companyFk; - this.$.balanceCreateDialog.onResponse = () => { - this.refresh(); - }; + this.$.balanceCreateDialog.companyFk = this.companyId; + this.$.balanceCreateDialog.onResponse = () => this.getData(); this.$.balanceCreateDialog.show(); } diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index 6de7bb3cb..8551d12f5 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -3,41 +3,98 @@ import './index'; describe('Client', () => { describe('Component vnClientBalanceIndex', () => { let $componentController; - let $scope; - let $httpBackend; - let $httpParamSerializer; let controller; beforeEach(ngModule('client')); - beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + beforeEach(angular.mock.inject((_$componentController_, $rootScope) => { $componentController = _$componentController_; - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - $scope = $rootScope.$new(); + let $scope = $rootScope.$new(); controller = $componentController('vnClientBalanceIndex', {$scope}); + controller.$.model = {applyFilter: () => {}}; + controller.$.riskModel = { + applyFilter: () => {}, + data: + [{ + clientFk: 101, + companyFk: 442, + amount: 713.24, + company: { + id: 442, + code: 'VNL' + } + }] + }; })); - describe('balances() setter', () => { - it('should calculate the balance for each line from the oldest date to the newest', () => { - controller.getCurrentBalance = jasmine.createSpy(controller, 'getCurrentBalance').and.returnValue(1000); - let balances = [ - {credit: -100, debit: 0}, - {credit: 0, debit: 300}, - {credit: 100, debit: 0}, - {credit: 0, debit: -300} - ]; - const params = {filter: controller.filter}; - let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `ClientRisks?${serializedParams}`).respond(balances); - $httpBackend.expect('GET', `ClientRisks?${serializedParams}`); - controller.balances = balances; - $httpBackend.flush(); + describe('getData()', () => { + it('should apply the filters on he models and get the client balance', () => { + controller._companyId = 442; + controller.$stateParams.id = 101; + spyOn(controller, 'getBalances'); + spyOn(controller.$.model, 'applyFilter').and.returnValue(Promise.resolve()); + spyOn(controller.$.riskModel, 'applyFilter').and.returnValue(Promise.resolve()); - expect(controller.balances[0].balance).toEqual(1000); - expect(controller.balances[1].balance).toEqual(900); - expect(controller.balances[2].balance).toEqual(600); - expect(controller.balances[3].balance).toEqual(700); + controller.getData().then(() => { + expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientId': 101, 'companyId': 442}); + expect(controller.$.riskModel.applyFilter).toHaveBeenCalledWith({'where': {'clientFk': 101, 'companyFk': 442}}); + expect(controller.getBalances).toHaveBeenCalledWith(); + }); + }); + }); + + describe('company setter/getter', () => { + it('should return the company', () => { + controller.companyId = null; + + expect(controller._companyId).toEqual(jasmine.any(Object)); + }); + + it('should return the company and then call getData()', () => { + spyOn(controller, 'getData'); + controller.companyId = 442; + + expect(controller._companyId).toEqual(442); + expect(controller.getData).toHaveBeenCalledWith(); + }); + }); + + describe('getCurrentBalance()', () => { + it('should return the client balance amount', () => { + controller._companyId = 442; + let result = controller.getCurrentBalance(); + + expect(result).toEqual(713.24); + }); + }); + + describe('getBalances()', () => { + it('should return the total client balance amount', () => { + spyOn(controller, 'getCurrentBalance').and.callThrough(); + controller._companyId = 442; + controller.$.model = {data: + [{ + id: 1, + debit: 1000, + credit: null + }, + { + id: 2, + debit: null, + credit: 500 + }, + { + id: 3, + debit: null, + credit: 300 + } + ]}; + controller.getBalances(); + const expectedBalances = controller.$.model.data; + + expect(expectedBalances[0].balance).toEqual(713.24); + expect(expectedBalances[1].balance).toEqual(-286.76); + expect(expectedBalances[2].balance).toEqual(213.24); }); }); }); diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index f8eb7b2ef..d7329bf8c 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -29,13 +29,24 @@ describe('Component VnClientWebAccess', () => { }); describe('isCustomer()', () => { - it(`should perform a query if client is defined with an ID`, () => { + it('should return true if the password can be modified', () => { controller.client = {id: '1234'}; - controller.isCustomer(); - $httpBackend.when('GET', `Clients/${controller.client.id}/hasCustomerRole`).respond('ok'); - $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`); + $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond({isCustomer: true}); + controller.isCustomer(); $httpBackend.flush(); + + expect(controller.canChangePassword).toBeTruthy(); + }); + + it(`should return a false if the password can't be modified`, () => { + controller.client = {id: '1234'}; + + $httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond({isCustomer: false}); + controller.isCustomer(); + $httpBackend.flush(); + + expect(controller.canChangePassword).toBeFalsy(); }); }); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js index fece307de..85821773c 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/book.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('invoiceOut book()', () => { - const invoiceOutId = 1; + const invoiceOutId = 5; let bookedDate; let OriginalInvoiceOut; let updatedInvoiceOut; diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 100f27c1f..a69f6ed8b 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -53,7 +53,7 @@ class Controller { } showInvoiceOutPdf() { - let url = `InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; + let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); } diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js index c75b2bebe..dd8219fae 100644 --- a/modules/invoiceOut/front/index/index.js +++ b/modules/invoiceOut/front/index/index.js @@ -27,7 +27,7 @@ export default class Controller { } openPdf(id, event) { - let url = `InvoiceOuts/${id}/download?access_token=${this.accessToken}`; + let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); event.preventDefault(); event.stopImmediatePropagation(); diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index adb66171e..40c60b5ea 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -20,7 +20,7 @@ class Controller { ]; this.orderFields = [].concat(this.defaultOrderFields); this._orderWay = this.orderWays[0].way; - this._orderField = this.orderFields[0].field; + this.orderField = this.orderFields[0].field; } /** @@ -76,15 +76,13 @@ class Controller { if (value) this.applyOrder(); } - /** - * Get order fields - */ - get orderField() { - return this._orderField; + get orderSelection() { + return this._orderSelection; } - set orderField(value) { - this._orderField = value; + set orderSelection(value) { + this._orderSelection = value; + if (value) this.applyOrder(); } @@ -94,10 +92,11 @@ class Controller { * @return {Object} - Order param */ getOrderBy() { + const isTag = !!(this.orderSelection && this.orderSelection.isTag); return { field: this.orderField, way: this.orderWay, - isTag: !!(this.orderSelection && this.orderSelection.isTag) + isTag: isTag }; } diff --git a/modules/order/front/filter/index.html b/modules/order/front/filter/index.html index 2b92b5f4a..13010a553 100644 --- a/modules/order/front/filter/index.html +++ b/modules/order/front/filter/index.html @@ -6,27 +6,26 @@ + + + ng-click="$ctrl.categoryId = category.id"> - - - - @@ -73,7 +69,7 @@ + ng-model="$ctrl.itemId"> @@ -106,20 +102,20 @@ - {{$ctrl.category.value}} + {{category.selection.name}} - {{$ctrl.type.value}} + {{type.selection.name}} { - let category; - let type; + if (this.$stateParams.categoryId) + this.categoryId = this.$stateParams.categoryId; - if (this.$stateParams.category) - category = JSON.parse(this.$stateParams.category); - - if (this.$stateParams.type) - type = JSON.parse(this.$stateParams.type); - - if (category && category.id) - this.category = category; - - if (type && type.id) - this.type = type; + if (this.$stateParams.typeId) + this.typeId = this.$stateParams.typeId; }); } - get category() { - return this._category; + get categoryId() { + return this._categoryId; } - set category(value) { - this.catalog.$scope.model.data = []; - this.itemTypes = []; - this.type = null; + set categoryId(value) { + if (!value || (this.categoryId == value)) + value = null; - if (!value || (this.category && this.category.id == value.id)) - this._category = null; - else - this._category = value; + this._categoryId = value; + this.itemTypes = []; + this.typeId = null; this.updateStateParams(); if (this.tags.length > 0) this.applyFilters(); - if (this._category) + if (value) this.updateItemTypes(); } - get type() { - return this._type; + get typeId() { + return this._typeId; } - set type(value) { - if (value && this.type && this.type.id == value.id) return; - - this._type = value; - - if (!value || !value.id) - this._type = null; + set typeId(value) { + this._typeId = value; this.updateStateParams(); - if ((value && value.id) || this.tags.length > 0) + if ((value) || this.tags.length > 0) this.applyFilters(); } @@ -91,17 +76,17 @@ class Controller { */ updateItemTypes() { let params = { - itemCategoryId: this.category.id + itemCategoryId: this.categoryId }; const query = `Orders/${this.order.id}/getItemTypeAvailable`; - this.$http.get(query, {params}).then(res => { - this.itemTypes = res.data; - }); + this.$http.get(query, {params}).then(res => + this.itemTypes = res.data); } onSearchById(event) { - if (event.key === 'Enter' && (this.tags.length > 0 || this.itemFk || this.type)) + const hasValue = this.tags.length > 0 || this.itemId || this.typeId; + if (event.key === 'Enter' && hasValue) this.applyFilters(); } @@ -117,7 +102,7 @@ class Controller { remove(index) { this.tags.splice(index, 1); - if (this.tags.length >= 0 || this.itemFk || this.type) + if (this.tags.length >= 0 || this.itemId || this.typeId) this.applyFilters(); } @@ -126,14 +111,14 @@ class Controller { let newFilter = {}; const model = this.catalog.$scope.model; - if (this.category) - newFilter.categoryFk = this.category.id; + if (this.categoryId) + newFilter.categoryFk = this.categoryId; - if (this.type) - newFilter.typeFk = this.type.id; + if (this.typeId) + newFilter.typeFk = this.typeId; - if (this.itemFk) - newFilter = {'i.id': this.itemFk}; + if (this.itemId) + newFilter = {'i.id': this.itemId}; newParams = { orderFk: this.order.id, @@ -164,13 +149,13 @@ class Controller { updateStateParams() { const params = {}; - if (this.category) - params.category = JSON.stringify(this.category); + if (this.categoryId) + params.categoryId = this.categoryId; + else params.categoryId = undefined; - if (this.type) - params.type = JSON.stringify(this.type); - else - params.type = undefined; + if (this.typeId) + params.typeId = this.typeId; + else params.typeId = undefined; this.$state.go(this.$state.current.name, params); } diff --git a/modules/order/front/filter/index.spec.js b/modules/order/front/filter/index.spec.js index 8fb4baeca..72a0f206b 100644 --- a/modules/order/front/filter/index.spec.js +++ b/modules/order/front/filter/index.spec.js @@ -16,8 +16,8 @@ describe('Order', () => { $scope.model = crudModel; $scope.search = {}; $state = _$state_; - $state.params.category = '{"id": 1, "value": "My Category"}'; - $state.params.type = '{"id": 1, "value": "My type"}'; + $state.params.categoryId = 1; + $state.params.typeId = 2; $state.current.name = 'my.current.state'; controller = $componentController('vnCatalogFilter', {$element: null, $scope, $state}); controller.catalog = { @@ -35,15 +35,15 @@ describe('Order', () => { $scope.$apply(); - expect(controller.category).toEqual({id: 1, value: 'My Category'}); - expect(controller.type).toEqual({id: 1, value: 'My type'}); + expect(controller.categoryId).toEqual(1); + expect(controller.typeId).toEqual(2); }); }); - describe('category() setter', () => { + describe('categoryId() setter', () => { it(`should set category property to null, call updateStateParams() method and not call applyFilters()`, () => { spyOn(controller, 'updateStateParams'); - controller.category = null; + controller.categoryId = null; expect(controller.updateStateParams).toHaveBeenCalledWith(); }); @@ -51,17 +51,17 @@ describe('Order', () => { it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { spyOn(controller, 'updateStateParams'); controller._order = {id: 4}; - controller.category = {id: 2, value: 'My category'}; + controller.categoryId = 2; expect(controller.updateStateParams).toHaveBeenCalledWith(); }); }); - describe('type() setter', () => { + describe('typeId() setter', () => { it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => { spyOn(controller, 'updateStateParams'); spyOn(controller, 'applyFilters'); - controller.type = null; + controller.typeId = null; expect(controller.updateStateParams).toHaveBeenCalledWith(); expect(controller.applyFilters).not.toHaveBeenCalledWith(); @@ -70,7 +70,7 @@ describe('Order', () => { it(`should set category property and then call updateStateParams() and applyFilters() methods`, () => { spyOn(controller, 'updateStateParams'); spyOn(controller, 'applyFilters'); - controller.type = {id: 2, value: 'My type'}; + controller.typeId = 2; expect(controller.updateStateParams).toHaveBeenCalledWith(); expect(controller.applyFilters).toHaveBeenCalledWith(); @@ -101,7 +101,7 @@ describe('Order', () => { describe('onSearchById()', () => { it(`should not filter by id if the event key code doesn't equals to 'Enter'`, () => { spyOn(controller, 'applyFilters'); - controller.itemFk = 1; + controller.itemId = 1; controller.onSearchById({key: 'Tab'}); expect(controller.applyFilters).not.toHaveBeenCalledWith(); @@ -109,7 +109,7 @@ describe('Order', () => { it(`should filter by id if the event key code equals to 'Enter' an then call applyFilters()`, () => { spyOn(controller, 'applyFilters'); - controller.itemFk = 1; + controller.itemId = 1; controller.onSearchById({key: 'Enter'}); @@ -121,14 +121,14 @@ describe('Order', () => { it(`should call model applyFilter() method with a new filter`, () => { let model = controller.catalog.$scope.model; spyOn(model, 'applyFilter'); - controller._category = {id: 1, value: 'My Category'}; - controller._type = {id: 1, value: 'My type'}; + controller._categoryId = 2; + controller._typeId = 4; controller._order = {id: 4}; controller.applyFilters(); expect(model.applyFilter).toHaveBeenCalledWith( - {where: {categoryFk: 1, typeFk: 1}}, + {where: {categoryFk: 2, typeFk: 4}}, {orderFk: 4, orderBy: controller.catalog.getOrderBy(), tags: []}); }); }); @@ -146,8 +146,8 @@ describe('Order', () => { it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => { spyOn(controller, 'applyFilters'); - controller._category = {id: 1, value: 'My Category'}; - controller._type = {id: 1, value: 'My type'}; + controller._categoryId = 1; + controller._typeId = 1; controller.tags = [{tagFk: 1, value: 'Blue'}]; controller.remove(0); @@ -159,9 +159,9 @@ describe('Order', () => { describe('updateStateParams()', () => { it(`should call state go() method passing category and type state params`, () => { spyOn(controller.$state, 'go'); - controller._category = {id: 1, value: 'My Category'}; - controller._type = {id: 1, value: 'My type'}; - let result = {category: '{"id":1,"value":"My Category"}', type: '{"id":1,"value":"My type"}'}; + controller._categoryId = 2; + controller._typeId = 4; + let result = {categoryId: 2, typeId: 4}; controller.updateStateParams(); expect(controller.$state.go).toHaveBeenCalledWith('my.current.state', result); diff --git a/modules/order/front/filter/style.scss b/modules/order/front/filter/style.scss index 0cac5765f..f4fe226f2 100644 --- a/modules/order/front/filter/style.scss +++ b/modules/order/front/filter/style.scss @@ -14,6 +14,10 @@ vn-catalog-filter > div { align-items: flex-start; flex-wrap: wrap; + vn-autocomplete[vn-id="category"] { + display: none + } + & > vn-one { padding: $spacing-sm; min-width: 33.33%; diff --git a/modules/order/front/routes.json b/modules/order/front/routes.json index 86eda488f..789870fd1 100644 --- a/modules/order/front/routes.json +++ b/modules/order/front/routes.json @@ -41,7 +41,7 @@ "order": "$ctrl.order" } }, { - "url": "/catalog?category&type", + "url": "/catalog?categoryId&typeId", "state": "order.card.catalog", "component": "vn-order-catalog", "description": "Catalog", diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index dcdfd37d7..4f05680ed 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -8,7 +8,7 @@ - + + {{name}} - {{nickname}} + Entries - + Confirmed @@ -51,8 +51,8 @@ Supplier Reference HB - Freight cost - Package cost + Freight + Package CC Pallet m3 @@ -61,16 +61,18 @@ - - + + + + {{entry.id}} {{entry.supplierName}} {{entry.ref}} {{entry.hb}} - {{entry.freightValue}} - {{entry.packageValue}} + {{entry.freightValue | currency: 'EUR': 2}} + {{entry.packageValue | currency: 'EUR': 2}} {{entry.cc}} {{entry.pallet}} {{entry.m3}} @@ -81,13 +83,28 @@ icon="insert_drive_file"> + + + + + + + {{$ctrl.total('hb')}} + {{$ctrl.total('freightValue') | currency: 'EUR': 2}} + {{$ctrl.total('packageValue') | currency: 'EUR': 2}} + {{$ctrl.total('cc')}} + {{$ctrl.total('pallet')}} + {{$ctrl.total('m3')}} + + + diff --git a/modules/travel/front/summary/index.js b/modules/travel/front/summary/index.js index 20946ed3b..670adbd9d 100644 --- a/modules/travel/front/summary/index.js +++ b/modules/travel/front/summary/index.js @@ -5,6 +5,7 @@ class Controller { constructor($scope, $http) { this.$ = $scope; this.$http = $http; + this.entries = []; } get travel() { @@ -31,6 +32,15 @@ class Controller { this.entries = response.data; }); } + + total(field) { + let total = 0; + + for (let entry of this.entries) + total += entry[field]; + + return total; + } } Controller.$inject = ['$scope', '$http']; diff --git a/modules/travel/front/summary/index.spec.js b/modules/travel/front/summary/index.spec.js index dc6e4b23a..ec5beb053 100644 --- a/modules/travel/front/summary/index.spec.js +++ b/modules/travel/front/summary/index.spec.js @@ -58,4 +58,18 @@ describe('component vnTravelSummary', () => { expect(controller.entries).toEqual('I am the entries'); }); }); + + describe('total()', () => { + it('should calculate the total amount of a given property for every row', () => { + controller.entries = [ + {id: 1, freightValue: 1, packageValue: 2, cc: 0.01}, + {id: 2, freightValue: 1, packageValue: 2, cc: 0.01}, + {id: 3, freightValue: 1, packageValue: 2, cc: 0.01} + ]; + + expect(controller.total('freightValue')).toEqual(3); + expect(controller.total('packageValue')).toEqual(6); + expect(controller.total('cc')).toEqual(0.03); + }); + }); }); diff --git a/modules/travel/front/summary/locale/es.yml b/modules/travel/front/summary/locale/es.yml index 16f21fdde..c82508dfc 100644 --- a/modules/travel/front/summary/locale/es.yml +++ b/modules/travel/front/summary/locale/es.yml @@ -12,6 +12,6 @@ Confirmed: Confirmada Entry Id: Entrada Id Supplier: Proveedor Pallet: Pallet -Freight cost: Coste porte -Package cost: Coste embalaje +Freight: Porte +Package: Embalaje Half box: Media caja diff --git a/modules/worker/back/methods/worker-calendar/specs/absences.spec.js b/modules/worker/back/methods/worker-calendar/specs/absences.spec.js index aebe5a24b..8f36707c3 100644 --- a/modules/worker/back/methods/worker-calendar/specs/absences.spec.js +++ b/modules/worker/back/methods/worker-calendar/specs/absences.spec.js @@ -1,7 +1,6 @@ const app = require('vn-loopback/server/server'); -// #1924 - Fix hours -xdescribe('Worker absences()', () => { +describe('Worker absences()', () => { it('should get the absence calendar for a full year contract', async() => { let ctx = {req: {accessToken: {userId: 106}}}; let workerFk = 106; @@ -27,8 +26,8 @@ xdescribe('Worker absences()', () => { let firstType = absences[0].absenceType().name; let sixthType = absences[5].absenceType().name; - expect(firstType).toEqual('Leave of absence'); - expect(sixthType).toEqual('Holidays'); + expect(firstType).toMatch(/(Holidays|Leave of absence)/); + expect(sixthType).toMatch(/(Holidays|Leave of absence)/); }); it('should get the absence calendar for a permanent contract', async() => { @@ -64,8 +63,8 @@ xdescribe('Worker absences()', () => { let firstType = absences[0].absenceType().name; let sixthType = absences[5].absenceType().name; - expect(firstType).toEqual('Leave of absence'); - expect(sixthType).toEqual('Holidays'); + expect(firstType).toMatch(/(Holidays|Leave of absence)/); + expect(sixthType).toMatch(/(Holidays|Leave of absence)/); // restores the contract end date await app.models.WorkerLabour.rawSql( @@ -146,8 +145,8 @@ xdescribe('Worker absences()', () => { let firstType = absences[0].absenceType().name; let sixthType = absences[5].absenceType().name; - expect(firstType).toEqual('Leave of absence'); - expect(sixthType).toEqual('Holidays'); + expect(firstType).toMatch(/(Holidays|Leave of absence)/); + expect(sixthType).toMatch(/(Holidays|Leave of absence)/); // resets the holidays per year with originalHolidaysValue and the contract starting date await app.models.WorkCenterHoliday.updateAll( diff --git a/modules/worker/back/methods/worker/isSubordinate.js b/modules/worker/back/methods/worker/isSubordinate.js index a85484668..18c7df17e 100644 --- a/modules/worker/back/methods/worker/isSubordinate.js +++ b/modules/worker/back/methods/worker/isSubordinate.js @@ -29,7 +29,7 @@ module.exports = Self => { const mySubordinates = await Self.mySubordinates(ctx); const isSubordinate = mySubordinates.find(subordinate => { - return subordinate.workerFk === id; + return subordinate.workerFk == id; }); const isHr = await models.Account.hasRole(myUserId, 'hr'); diff --git a/modules/worker/front/log/style.scss b/modules/worker/front/log/style.scss index bf5e763d7..7bfa9c87c 100644 --- a/modules/worker/front/log/style.scss +++ b/modules/worker/front/log/style.scss @@ -19,7 +19,7 @@ vn-log { } @media screen and (max-width: 1570px) { - .expendable { + vn-table .expendable { display: none; } .changes { diff --git a/print/core/config.js b/print/core/config.js index 8db388401..864e1658a 100644 --- a/print/core/config.js +++ b/print/core/config.js @@ -4,8 +4,10 @@ let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; let configPath = `/etc/salix`; let config = require('../config/print.json'); let configFiles = [ + `${appPath}/config/print.local.json`, `${appPath}/config/print.${env}.json`, `${configPath}/print.json`, + `${configPath}/print.local.json`, `${configPath}/print.${env}.json` ]; diff --git a/print/templates/email/buyer-week-waste/assets/css/import.js b/print/templates/email/buyer-week-waste/assets/css/import.js new file mode 100644 index 000000000..b44d6bd37 --- /dev/null +++ b/print/templates/email/buyer-week-waste/assets/css/import.js @@ -0,0 +1,8 @@ +const Stylesheet = require(`${appPath}/core/stylesheet`); + +module.exports = new Stylesheet([ + `${appPath}/common/css/spacing.css`, + `${appPath}/common/css/misc.css`, + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html new file mode 100644 index 000000000..47d162a6f --- /dev/null +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -0,0 +1,69 @@ + + + + + + {{ $t('subject') }} + + + + + + + + + + + + + + + + + + + + {{ $t('title') }} + {{$t('dear')}}, + + + + + + + + + + {{$t('buyer')}} + {{$t('percentage')}} + {{$t('dwindle')}} + {{$t('total')}} + + + + + {{waste.buyer}} + {{(waste.percentage / 100) | percentage(4, 4, locale)}} + {{waste.dwindle | currency('EUR', locale)}} + {{waste.total | currency('EUR', locale)}} + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.js b/print/templates/email/buyer-week-waste/buyer-week-waste.js new file mode 100755 index 000000000..4639e7d5b --- /dev/null +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.js @@ -0,0 +1,31 @@ +const Component = require(`${appPath}/core/component`); +const db = require(`${appPath}/core/database`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + name: 'buyer-week-waste', + async serverPrefetch() { + this.wastes = await this.fetchWastes(); + + if (!this.wastes) + throw new Error('Something went wrong'); + }, + computed: { + dated: function() { + const filters = this.$options.filters; + + return filters.date(new Date(), '%d-%m-%Y'); + } + }, + methods: { + fetchWastes() { + return db.findOne(`CALL bs.weekWaste()`); + } + }, + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + props: {} +}; diff --git a/print/templates/email/buyer-week-waste/locale/es.yml b/print/templates/email/buyer-week-waste/locale/es.yml new file mode 100644 index 000000000..96e49d9eb --- /dev/null +++ b/print/templates/email/buyer-week-waste/locale/es.yml @@ -0,0 +1,8 @@ +subject: Merma semanal +title: Merma semanal +dear: Hola +description: A continuación se muestra la merma semanal a fecha de {0}. +buyer: Comprador +percentage: Porcentaje +weakening: Mermas +total: Total \ No newline at end of file diff --git a/print/templates/reports/claim-pickup-order/locale/es.yml b/print/templates/reports/claim-pickup-order/locale/es.yml index 534fd2da8..b37793b70 100644 --- a/print/templates/reports/claim-pickup-order/locale/es.yml +++ b/print/templates/reports/claim-pickup-order/locale/es.yml @@ -12,4 +12,4 @@ claim: Reclamación {0} sections: agency: description: 'Para agilizar tu recogida, por favor, pónte en contacto con la oficina - de integrados. Tlf: 96 166 77 88 - Ana Gómez (Ext. 2133) (agomezf@integra2.es)' + de integrados. Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) (agomezf@integra2.es)'
{{$t('dear')}},