Merge branch 'dev' into 7150-greuge_dif_porte_add
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-04-08 06:39:22 +00:00
commit 1e8e6a67a3
125 changed files with 2540 additions and 1540 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ print.*.json
db.json db.json
junit.xml junit.xml
.DS_Store .DS_Store
storage

View File

@ -5,22 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [24.16.01] - 2024-04-18
## [2414.01] - 2024-04-04 ## [2414.01] - 2024-04-04
### Added
### Changed
### Fixed
## [2408.01] - 2024-02-22 ## [2408.01] - 2024-02-22
### Added
### Changed
### Fixed
## [2406.01] - 2024-02-08 ## [2406.01] - 2024-02-08
### Added ### Added

View File

@ -30,7 +30,7 @@ module.exports = Self => {
path: `/:id/downloadFile`, path: `/:id/downloadFile`,
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.downloadFile = async function(ctx, id) { Self.downloadFile = async function(ctx, id) {

View File

@ -43,7 +43,7 @@ module.exports = Self => {
path: `/:id/download`, path: `/:id/download`,
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.download = async function(id, fileCabinet, filter) { Self.download = async function(id, fileCabinet, filter) {

View File

@ -48,7 +48,7 @@ module.exports = Self => {
path: `/:collection/:size/:id/download`, path: `/:collection/:size/:id/download`,
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.download = async function(ctx, collection, size, id) { Self.download = async function(ctx, collection, size, id) {

View File

@ -46,7 +46,7 @@ module.exports = Self => {
html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`; html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`;
const subjectReason = httpRequest?.data?.error; const subjectReason = httpRequest?.data?.error;
smtp.send({ await smtp.send({
to: `${config.app.reportEmail}, ${emailUser.email}`, to: `${config.app.reportEmail}, ${emailUser.email}`,
subject: subject:
'[Support-Salix] ' + '[Support-Salix] ' +

View File

@ -1,5 +0,0 @@
DELETE FROM salix.ACL
WHERE model = 'MailAliasAccount'
AND property = 'canEditAlias'
AND principalType = 'ROLE'
AND principalId = 'marketingBoss';

View File

@ -3,7 +3,7 @@ USE `util`;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `version` VALUES ('vn-database','10962','5411433e529d50d68b3a0675b1a0a6215ea931ca','2024-03-25 17:47:37','10969'); INSERT INTO `version` VALUES ('vn-database','10970','7ea917dc4db761955007c73bbd4667a0e44b8e9c','2024-04-05 07:49:24','10981');
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
@ -673,14 +673,21 @@ INSERT INTO `versionLog` VALUES ('vn-database','10874','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10876','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10876','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10878','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10878','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10879','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10879','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10880','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10881','00-alterTableNotification.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10881','01-notification.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10882','00-vehicle.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10882','00-vehicle.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10883','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10883','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10884','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10884','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10885','00-revokeUpdateClient.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10885','00-revokeUpdateClient.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10887','00-schemaAndUser.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10887','01-tables.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10888','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-16 07:39:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10888','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-16 07:39:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10889','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 09:55:56',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10889','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 09:55:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10891','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10891','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10892','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10893','00-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10896','01-financialProductType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10896','01-financialProductType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10896','02-flight.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10896','02-flight.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10896','03-gastos_resumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:00',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10896','03-gastos_resumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:00',NULL,NULL);
@ -706,6 +713,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10913','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10914','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-28 11:52:54',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10914','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-28 11:52:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10915','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10915','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10918','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:27',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10918','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10919','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10922','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-29 13:44:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10922','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-29 13:44:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10923','00-createParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10923','00-createParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10923','01-aclParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10923','01-aclParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
@ -714,13 +722,32 @@ INSERT INTO `versionLog` VALUES ('vn-database','10925','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10926','00-refactorClaimState.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10926','00-refactorClaimState.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10928','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:52',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10928','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:52',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10929','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:16:19',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10929','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:16:19',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10932','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10940','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-06 16:48:18',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10940','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-06 16:48:18',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10941','00-restoreVn2008Jerarquia.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 09:36:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10941','00-restoreVn2008Jerarquia.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 09:36:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10942','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 10:24:45',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10942','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 10:24:45',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10943','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 10:29:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10943','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 10:29:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10946','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-08 07:56:17',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10946','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-08 07:56:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','00-account.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','01-bs.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','02-edi.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','03-hedera.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','04-pbx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','05-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','06-salix.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','06-srt.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','07-util.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn2.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10956','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10957','00-aclTicketClone.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10959','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-18 13:32:25',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10959','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-18 13:32:25',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10962','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-25 08:27:35',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10962','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-25 08:27:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10968','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10969','00-aclSupplierDms.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10970','00-specialPrice.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10975','00-action.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:03:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:04:52',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -736,7 +763,7 @@ INSERT INTO `role` VALUES (2,'customer','Privilegios básicos de un cliente',1,'
INSERT INTO `role` VALUES (3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); INSERT INTO `role` VALUES (3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
INSERT INTO `role` VALUES (5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); INSERT INTO `role` VALUES (5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
INSERT INTO `role` VALUES (6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); INSERT INTO `role` VALUES (6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL);
INSERT INTO `role` VALUES (9,'developer','Desarrolladores del sistema',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); INSERT INTO `role` VALUES (9,'developer','Desarrollador raso',1,'2017-05-19 09:04:58','2024-03-27 14:14:58',1437);
INSERT INTO `role` VALUES (11,'account','Privilegios relacionados con el login',0,'2017-05-19 09:04:58','2017-09-20 19:06:35',NULL); INSERT INTO `role` VALUES (11,'account','Privilegios relacionados con el login',0,'2017-05-19 09:04:58','2017-09-20 19:06:35',NULL);
INSERT INTO `role` VALUES (13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 09:04:58','2021-06-30 15:29:30',NULL); INSERT INTO `role` VALUES (13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 09:04:58','2021-06-30 15:29:30',NULL);
INSERT INTO `role` VALUES (15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 09:04:58','2018-02-12 11:50:10',NULL); INSERT INTO `role` VALUES (15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 09:04:58','2018-02-12 11:50:10',NULL);
@ -1309,7 +1336,7 @@ INSERT INTO `ACL` VALUES (274,'InvoiceInLog','*','READ','ALLOW','ROLE','administ
INSERT INTO `ACL` VALUES (275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing');
INSERT INTO `ACL` VALUES (276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing');
INSERT INTO `ACL` VALUES (278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'); INSERT INTO `ACL` VALUES (278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant');
INSERT INTO `ACL` VALUES (279,'MailAlias','*','*','ALLOW','ROLE','marketing'); INSERT INTO `ACL` VALUES (279,'MailAlias','*','READ','ALLOW','ROLE','marketing');
INSERT INTO `ACL` VALUES (283,'EntryObservation','*','*','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (283,'EntryObservation','*','*','ALLOW','ROLE','buyer');
INSERT INTO `ACL` VALUES (284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'); INSERT INTO `ACL` VALUES (284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin');
INSERT INTO `ACL` VALUES (285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'); INSERT INTO `ACL` VALUES (285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin');
@ -1777,7 +1804,7 @@ INSERT INTO `ACL` VALUES (804,'DeviceProduction','*','READ','ALLOW','ROLE','empl
INSERT INTO `ACL` VALUES (805,'Collection','assign','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (805,'Collection','assign','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (806,'ExpeditionPallet','getPallet','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (806,'ExpeditionPallet','getPallet','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (807,'MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (807,'MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (808,'MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (808,'MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (809,'SaleTracking','delete','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (809,'SaleTracking','delete','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (810,'SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (810,'SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (811,'SaleTracking','setPicked','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (811,'SaleTracking','setPicked','WRITE','ALLOW','ROLE','production');
@ -1789,6 +1816,10 @@ INSERT INTO `ACL` VALUES (816,'WorkerActivity','*','*','ALLOW','ROLE','productio
INSERT INTO `ACL` VALUES (817,'ParkingLog','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (817,'ParkingLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (818,'ExpeditionPallet','*','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (818,'ExpeditionPallet','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (819,'Ticket','addSaleByCode','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (819,'Ticket','addSaleByCode','WRITE','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (820,'TicketCollection','*','READ','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (821,'Ticket','clone','WRITE','ALLOW','ROLE','administrative');
INSERT INTO `ACL` VALUES (822,'SupplierDms','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','developer');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@ -2492,7 +2523,7 @@ USE `cache`;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `cache` VALUES (1,'equalizator','00:19:00'); INSERT INTO `cache` VALUES (1,'equalizator','00:19:00');
INSERT INTO `cache` VALUES (2,'available','00:06:00'); INSERT INTO `cache` VALUES (2,'available','00:01:00');
INSERT INTO `cache` VALUES (3,'stock','00:30:00'); INSERT INTO `cache` VALUES (3,'stock','00:30:00');
INSERT INTO `cache` VALUES (4,'last_buy','23:59:00'); INSERT INTO `cache` VALUES (4,'last_buy','23:59:00');
INSERT INTO `cache` VALUES (5,'weekly_sales','12:00:00'); INSERT INTO `cache` VALUES (5,'weekly_sales','12:00:00');

View File

@ -45,6 +45,7 @@ INSERT IGNORE INTO `db` VALUES ('','account','salix','Y','Y','Y','Y','N','N','N
INSERT IGNORE INTO `db` VALUES ('','mysql','salix','Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','mysql','salix','Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','psico','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','psico','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','geo','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','geo','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','floranet','developer','Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','tmp','guest','Y','Y','Y','Y','N','Y','N','N','N','N','Y','N','N','N','N','N','N','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','tmp','guest','Y','Y','Y','Y','N','Y','N','N','N','N','Y','N','N','N','N','N','N','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','util','salix','Y','Y','Y','Y','N','N','N','N','N','N','Y','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','util','salix','Y','Y','Y','Y','N','N','N','N','N','N','Y','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','dipole','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','dipole','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
@ -77,6 +78,7 @@ INSERT IGNORE INTO `db` VALUES ('','bi','developer','Y','Y','Y','Y','N','N','N'
INSERT IGNORE INTO `db` VALUES ('','util','grafana','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','util','grafana','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','mysql','developerBoss','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','mysql','developerBoss','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','rfid','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','rfid','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N');
INSERT IGNORE INTO `db` VALUES ('','floranet','floranet','N','N','N','N','N','N','N','N','N','N','Y','Y','N','N','N','N','Y','N','N','N');
/*!40000 ALTER TABLE `db` ENABLE KEYS */; /*!40000 ALTER TABLE `db` ENABLE KEYS */;
/*!40000 ALTER TABLE `tables_priv` DISABLE KEYS */; /*!40000 ALTER TABLE `tables_priv` DISABLE KEYS */;
@ -777,7 +779,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','PreciosEspecia
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','movingState','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','movingState','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferType','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferState','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferState','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicle','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicle','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','buffer','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','buffer','alexm@%','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferGroup','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferGroup','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','lastRFID','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','lastRFID','alexm@%','0000-00-00 00:00:00','Select','');
@ -1373,6 +1375,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accounting',
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accounting','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accounting','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleState','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','expeditionState','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','specialPrice','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1657,9 +1662,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','guest','myUser_checkLogin
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','lang','FUNCTION','juan@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','lang','FUNCTION','juan@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofmonth','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofmonth','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','account_conciliacion_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','account_conciliacion_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','add_awb_component','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','productionAssi','agencyModeImbalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
@ -1686,7 +1689,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTIO
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','client_checkBalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','client_checkBalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','addressTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','absoluteInventoryHistory','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','client_getSalesPersonByTicket','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','client_getSalesPersonByTicket','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','pbx','developer','clientFromPhone','FUNCTION','juan@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','pbx','developer','clientFromPhone','FUNCTION','juan@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','production','log_addWithUser','PROCEDURE','juan@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','production','log_addWithUser','PROCEDURE','juan@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -1694,6 +1697,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_ad
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_delete','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_delete','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_move','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_move','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getSuppliersDebt','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getSuppliersDebt','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','multipleInventoryHistory','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','bi','salesAssistant','defaultersFromDate','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','bi','salesAssistant','defaultersFromDate','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updatepacking','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updatepacking','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updategrouping','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updategrouping','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -1712,8 +1716,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaInvoiceInB
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvinglog_get','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvinglog_get','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expedition_getstate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expedition_getstate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@ -1792,7 +1794,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','zone_getstate','PRO
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_gethierarchy','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_gethierarchy','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workertimecontrol_weekcheckbreak','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workertimecontrol_weekcheckbreak','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','ticket_split','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','ticket_split','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','add_awb_component','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','saletracking_new','PROCEDURE','alexm@pc325.algemesi.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','saletracking_new','PROCEDURE','alexm@pc325.algemesi.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticketnotinvoicedbyclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticketnotinvoicedbyclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','workerjourney_replace','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','workerjourney_replace','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
@ -2047,6 +2048,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"vers
INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}');

File diff suppressed because it is too large Load Diff

View File

@ -2289,17 +2289,26 @@ trig: BEGIN
DECLARE vGroupingMode TINYINT; DECLARE vGroupingMode TINYINT;
DECLARE vGenericFk INT; DECLARE vGenericFk INT;
DECLARE vGenericInDate BOOL; DECLARE vGenericInDate BOOL;
DECLARE vBuyerFk INT;
IF @isModeInventory THEN IF @isModeInventory THEN
LEAVE trig; LEAVE trig;
END IF; END IF;
CALL entry_checkBooked(NEW.entryFk);
IF NEW.printedStickers <> 0 THEN IF NEW.printedStickers <> 0 THEN
CALL util.throw('it is not possible to create buy lines with printedstickers other than 0'); CALL util.throw('it is not possible to create buy lines with printedstickers other than 0');
END IF; END IF;
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SELECT it.workerFk INTO vBuyerFk
FROM item i
JOIN itemType it ON it.id = i.typeFk
WHERE i.id = NEW.itemFk;
SET NEW.buyerFk = vBuyerFk;
CALL buy_checkGrouping(NEW.`grouping`); CALL buy_checkGrouping(NEW.`grouping`);
SELECT t.warehouseInFk, t.landed SELECT t.warehouseInFk, t.landed
@ -2409,11 +2418,13 @@ trig:BEGIN
DECLARE vGenericInDate BOOL; DECLARE vGenericInDate BOOL;
DECLARE vIsInventory BOOL; DECLARE vIsInventory BOOL;
DECLARE vDefaultEntry INT; DECLARE vDefaultEntry INT;
DECLARE vBuyerFk INT;
IF @isTriggerDisabled THEN IF @isTriggerDisabled THEN
LEAVE trig; LEAVE trig;
END IF; END IF;
CALL entry_checkBooked(OLD.entryFk);
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SELECT defaultEntry INTO vDefaultEntry SELECT defaultEntry INTO vDefaultEntry
@ -2467,6 +2478,15 @@ trig:BEGIN
SET NEW.isIgnored = TRUE; SET NEW.isIgnored = TRUE;
END IF; END IF;
IF NOT (NEW.itemFk <=> OLD.itemFk) THEN
SELECT it.workerFk INTO vBuyerFk
FROM item i
JOIN itemType it ON it.id = i.typeFk
WHERE i.id = NEW.itemFk;
SET NEW.buyerFk = vBuyerFk;
END IF;
IF NOT (NEW.itemFk <=> OLD.itemFk) OR IF NOT (NEW.itemFk <=> OLD.itemFk) OR
NOT (OLD.entryFk <=> NEW.entryFk) THEN NOT (OLD.entryFk <=> NEW.entryFk) THEN
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
@ -2557,10 +2577,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete`
BEFORE DELETE ON buy BEFORE DELETE ON `buy`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL entry_checkBooked(OLD.entryFk);
IF OLD.printedStickers <> 0 THEN IF OLD.printedStickers <> 0 THEN
CALL util.throw("it is not possible to delete buys with printed labels "); CALL util.throw("it is not possible to delete buys with printed labels ");
END IF; END IF;
@ -4674,9 +4695,13 @@ BEGIN
DECLARE vIsVirtual BOOL; DECLARE vIsVirtual BOOL;
DECLARE vPrintedCount INT; DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL; DECLARE vHasDistinctWarehouses BOOL;
IF NEW.isBooked = OLD.isBooked THEN
CALL entry_checkBooked(OLD.id);
END IF;
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
@ -4777,6 +4802,7 @@ DELIMITER ;;
BEFORE DELETE ON `entry` BEFORE DELETE ON `entry`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL entry_checkBooked(OLD.id);
DELETE FROM buy WHERE entryFk = OLD.id; DELETE FROM buy WHERE entryFk = OLD.id;
END */;; END */;;
DELIMITER ; DELIMITER ;
@ -10087,6 +10113,10 @@ BEGIN
CALL util.throw('The travel has entries with booked invoices'); CALL util.throw('The travel has entries with booked invoices');
END IF; END IF;
END IF; END IF;
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10126,10 +10156,6 @@ BEGIN
CALL buy_checkItem(); CALL buy_checkItem();
END IF; END IF;
END IF; END IF;
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
END IF;
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10836,6 +10862,7 @@ DELIMITER ;;
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10856,6 +10883,7 @@ DELIMITER ;;
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10865,11 +10893,11 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb3 */ ; /*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb3 */ ; /*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb3_general_ci */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete`
AFTER DELETE ON `zoneIncluded` AFTER DELETE ON `zoneIncluded`
@ -10880,6 +10908,7 @@ BEGIN
`changedModel` = 'zoneIncluded', `changedModel` = 'zoneIncluded',
`changedModelId` = OLD.zoneFk, `changedModelId` = OLD.zoneFk,
`userFk` = account.myUser_getId(); `userFk` = account.myUser_getId();
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -10962,4 +10991,4 @@ USE `vn2008`;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-03-26 6:55:58 -- Dump completed on 2024-04-05 8:00:14

View File

@ -156,16 +156,16 @@ INSERT INTO `vn`.`occupationCode` (`code`, `name`)
('b', 'Representantes de comercio'), ('b', 'Representantes de comercio'),
('c', 'Personal de oficios en trabajos de construcción en general, y en instalac.,edificios y obras'); ('c', 'Personal de oficios en trabajos de construcción en general, y en instalac.,edificios y obras');
INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`nss`,`codpuesto`,`codempresa`,`codcontrato`,`FAntiguedad`,`grupotarifa`,`codcategoria`,`ContratoTemporal`) INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`codempresa`)
VALUES VALUES
(36,'46/10515497-58',6,20,189,'2009-01-02',5,10,0), (36,20),
(43,'46/10235353-50',7,20,189,'2009-04-21',5,10,0), (43,20),
(76,'46/10250562-30',1,20,189,'2009-09-07',9,5,0), (76,20),
(1106,'46/10297768-94',4,20,100,'2021-03-09',7,18,0), (1106,20),
(1107,'46/1627085-11',15,20,402,'2021-03-15',9,6,1), (1107,20),
(1108,'46/10446901-41',25,20,502,'2021-03-22',10,29,1), (1108,20),
(1109,'46/10552113-8',3,20,402,'2021-03-23',9,9,1), (1109,20),
(1110,'46/10723579-75',3,20,402,'2021-03-23',9,9,1); (1110,20);
INSERT INTO `vn`.`trainingCourseType` (`id`, `name`) INSERT INTO `vn`.`trainingCourseType` (`id`, `name`)
VALUES VALUES

View File

@ -2400,7 +2400,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
(18, 'dua', NULL, NULL, 'dua'), (18, 'dua', NULL, NULL, 'dua'),
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'), (19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
(20, 'Reclamación', 1, 1, 'claim'), (20, 'Reclamación', 1, 1, 'claim'),
(21, 'Entrada', 1, 1, 'entry'); (21, 'Entrada', 1, 1, 'entry'),
(22, 'Proveedor', 1, 1, 'supplier');
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES VALUES
@ -2412,7 +2413,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()), (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
(9, 21, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'ENTRADA ID 1', util.VN_CURDATE()); (9, 21, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'ENTRADA ID 1', util.VN_CURDATE()),
(10, 21, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'ENTRADA DE PRUEBA', util.VN_CURDATE());
INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`) INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`)
VALUES VALUES
@ -3221,7 +3223,6 @@ INSERT INTO vn.buy
packing = 20, packing = 20,
`grouping` = 1, `grouping` = 1,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3260,7 +3261,6 @@ INSERT INTO vn.buy
packing = 40, packing = 40,
`grouping` = 5, `grouping` = 5,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3299,7 +3299,6 @@ INSERT INTO vn.buy
packing = 10, packing = 10,
`grouping` = 5, `grouping` = 5,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3346,7 +3345,6 @@ INSERT INTO vn.buy
packing = 20, packing = 20,
`grouping` = 4, `grouping` = 4,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3385,7 +3383,6 @@ INSERT INTO vn.buy
packing = 20, packing = 20,
`grouping` = 1, `grouping` = 1,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3425,7 +3422,6 @@ INSERT INTO vn.buy
packing = 200, packing = 200,
`grouping` = 30, `grouping` = 30,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3465,7 +3461,6 @@ INSERT INTO vn.buy
packing = 500, packing = 500,
`grouping` = 10, `grouping` = 10,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3505,7 +3500,6 @@ INSERT INTO vn.buy
packing = 300, packing = 300,
`grouping` = 50, `grouping` = 50,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3545,7 +3539,6 @@ INSERT INTO vn.buy
packing = 50, packing = 50,
`grouping` = 5, `grouping` = 5,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 1, price1 = 1,
price2 = 1, price2 = 1,
price3 = 1, price3 = 1,
@ -3586,7 +3579,6 @@ INSERT vn.buy
packing = 5, packing = 5,
`grouping` = 2, `grouping` = 2,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 7, price1 = 7,
price2 = 7, price2 = 7,
price3 = 7, price3 = 7,
@ -3626,7 +3618,6 @@ INSERT vn.buy
packing = 100, packing = 100,
`grouping` = 5, `grouping` = 5,
groupingMode = 1, groupingMode = 1,
packageFk = 94,
price1 = 7, price1 = 7,
price2 = 7, price2 = 7,
price3 = 7, price3 = 7,
@ -3740,3 +3731,7 @@ INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description,
INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,newInstance,changedModelId,changedModelValue) INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,newInstance,changedModelId,changedModelValue)
VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man'); VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man');
INSERT INTO `vn`.`supplierDms`(`supplierFk`, `dmsFk`, `editorFk`)
VALUES
(1, 10, 9);

View File

@ -32,7 +32,7 @@ BEGIN
WHERE c.available > 0 WHERE c.available > 0
GROUP BY c.item_id; GROUP BY c.item_id;
CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode); CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode, FALSE);
DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item;
END$$ END$$

View File

@ -16,7 +16,7 @@ BEGIN
ENGINE = MEMORY ENGINE = MEMORY
SELECT vSelf itemFk; SELECT vSelf itemFk;
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
SELECT l.warehouseFk, w.name warehouse, SELECT l.warehouseFk, w.name warehouse,
p.`grouping`, p.price, p.rate, l.available p.`grouping`, p.price, p.rate, l.available

View File

@ -27,7 +27,7 @@ BEGIN
WHERE orderFk = vSelf WHERE orderFk = vSelf
GROUP BY itemFk; GROUP BY itemFk;
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item;
END$$ END$$

View File

@ -22,7 +22,7 @@ BEGIN
FROM `order` FROM `order`
WHERE id = vSelf; WHERE id = vSelf;
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
IF account.myUser_getName() = 'visitor' THEN IF account.myUser_getName() = 'visitor' THEN
UPDATE tmp.ticketCalculateItem UPDATE tmp.ticketCalculateItem

View File

@ -7,9 +7,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
DO BEGIN DO BEGIN
UPDATE account.user u UPDATE account.user u
JOIN client c ON c.id = u.id JOIN client c ON c.id = u.id
JOIN clientType ct ON ct.id = c.typeFk
SET u.active = FALSE SET u.active = FALSE
WHERE ct.code = 'normal' WHERE c.typeFk = 'normal'
AND u.id NOT IN ( AND u.id NOT IN (
SELECT DISTINCT c.id SELECT DISTINCT c.id
FROM client c FROM client c

View File

@ -20,6 +20,7 @@ BEGIN
CALL vn.addressTaxArea(); CALL vn.addressTaxArea();
SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea; SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.addressCompany, tmp.addressCompany,
tmp.addressTaxArea; tmp.addressTaxArea;

View File

@ -8,13 +8,16 @@ BEGIN
SELECT rate3 INTO price SELECT rate3 INTO price
FROM vn.priceFixed FROM vn.priceFixed
WHERE itemFk = vItemFk WHERE itemFk = vItemFk
AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1;
SELECT `value` INTO price SELECT `value` INTO price
FROM vn.specialPrice FROM vn.specialPrice
WHERE itemFk = vItemFk WHERE itemFk = vItemFk
AND clientFk = vClientFk ; AND (clientFk = vClientFk OR clientFk IS NULL)
AND started <= util.VN_CURDATE()
AND (ended >= util.VN_CURDATE() OR ended IS NULL)
ORDER BY id DESC LIMIT 1;
RETURN price; RETURN price;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -20,7 +20,7 @@ BEGIN
ENGINE = MEMORY ENGINE = MEMORY
SELECT vItemFk itemFk; SELECT vItemFk itemFk;
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, TRUE);
DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -1,5 +1,9 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_calculate`(
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
vShowExpiredZones BOOLEAN)
BEGIN BEGIN
/** /**
* Calcula los articulos disponibles y sus precios * Calcula los articulos disponibles y sus precios
@ -25,7 +29,7 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, vShowExpiredZones);
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
CREATE TEMPORARY TABLE tmp.ticketLot( CREATE TEMPORARY TABLE tmp.ticketLot(

View File

@ -10,7 +10,7 @@ BEGIN
* Calcula los componentes de los articulos de tmp.ticketLot * Calcula los componentes de los articulos de tmp.ticketLot
* *
* @param vZoneFk para calcular el transporte * @param vZoneFk para calcular el transporte
* @param vAddressFk Consignatario * @param vAddressFk Consignatario
* @param vShipped dia de salida del pedido * @param vShipped dia de salida del pedido
* @param vWarehouseFk warehouse de salida del pedido * @param vWarehouseFk warehouse de salida del pedido
* @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) * @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk)
@ -24,7 +24,20 @@ BEGIN
SELECT clientFk INTO vClientFK SELECT clientFk INTO vClientFK
FROM address FROM address
WHERE id = vAddressFk; WHERE id = vAddressFk;
CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
(INDEX (itemFk))
ENGINE = MEMORY
SELECT * FROM (
SELECT *
FROM specialPrice
WHERE (clientFk = vClientFk OR clientFk IS NULL)
AND started <= vShipped
AND (ended >= vShipped OR ended IS NULL)
ORDER BY (clientFk = vClientFk) DESC, id DESC
LIMIT 10000000000000000000) t
GROUP BY itemFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate
(PRIMARY KEY (itemFk, warehouseFk)) (PRIMARY KEY (itemFk, warehouseFk))
ENGINE = MEMORY ENGINE = MEMORY
@ -36,7 +49,7 @@ BEGIN
IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing,
IFNULL(pf.`grouping`, b.`grouping`) `grouping`, IFNULL(pf.`grouping`, b.`grouping`) `grouping`,
ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
tl.buyFk, tl.buyFk,
i.typeFk, i.typeFk,
IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping
FROM tmp.ticketLot tl FROM tmp.ticketLot tl
@ -44,8 +57,7 @@ BEGIN
JOIN item i ON i.id = tl.itemFk JOIN item i ON i.id = tl.itemFk
JOIN itemType it ON it.id = i.typeFk JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN specialPrice sp ON sp.itemFk = i.id LEFT JOIN tSpecialPrice sp ON sp.itemFk = i.id
AND sp.clientFk = vClientFk
LEFT JOIN ( LEFT JOIN (
SELECT * FROM ( SELECT * FROM (
SELECT pf.itemFk, SELECT pf.itemFk,
@ -63,7 +75,7 @@ BEGIN
LIMIT 10000000000000000000 LIMIT 10000000000000000000
) tpf ) tpf
GROUP BY tpf.itemFk, tpf.warehouseFk GROUP BY tpf.itemFk, tpf.warehouseFk
) pf ON pf.itemFk = tl.itemFk ) pf ON pf.itemFk = tl.itemFk
AND pf.warehouseFk = tl.warehouseFk AND pf.warehouseFk = tl.warehouseFk
WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01
AND ic.merchandise AND ic.merchandise
@ -95,10 +107,10 @@ BEGIN
FROM tmp.ticketComponent tc FROM tmp.ticketComponent tc
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
GROUP BY tc.itemFk, warehouseFk; GROUP BY tc.itemFk, warehouseFk;
-- RECOBRO -- RECOBRO
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk, tcb.itemFk, c2.id, SELECT tcb.warehouseFk, tcb.itemFk, c2.id,
ROUND(tcb.base * ROUND(tcb.base *
LEAST( LEAST(
MAX(GREATEST(IFNULL(cr.priceIncreasing,0), MAX(GREATEST(IFNULL(cr.priceIncreasing,0),
@ -129,29 +141,29 @@ BEGIN
ROUND(base * wm.pricesModifierRate, 3) manaAuto ROUND(base * wm.pricesModifierRate, 3) manaAuto
FROM tmp.ticketComponentBase tcb FROM tmp.ticketComponentBase tcb
JOIN `client` c on c.id = vClientFk JOIN `client` c on c.id = vClientFk
JOIN workerMana wm ON c.salesPersonFk = wm.workerFk JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
JOIN vn.component c2 ON c2.code = 'autoMana' JOIN vn.component c2 ON c2.code = 'autoMana'
WHERE wm.isPricesModifierActivated WHERE wm.isPricesModifierActivated
HAVING manaAuto <> 0; HAVING manaAuto <> 0;
-- Precios especiales -- Precios especiales
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk, SELECT tcb.warehouseFk,
tcb.itemFk, tcb.itemFk,
c2.id, c2.id,
GREATEST( GREATEST(
IFNULL(ROUND(tcb.base * c2.tax, 4), 0), IFNULL(ROUND(tcb.base * c2.tax, 4), 0),
IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3 IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3
) cost ) cost
FROM tmp.ticketComponentBase tcb FROM tmp.ticketComponentBase tcb
JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount' JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount'
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk 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 LEFT JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk
JOIN vn.item i ON i.id = tcb.itemFk JOIN vn.item i ON i.id = tcb.itemFk
WHERE sp.value IS NULL WHERE sp.value IS NULL
AND i.supplyResponseFk IS NULL; AND i.supplyResponseFk IS NULL;
-- Individual -- Individual
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcb.warehouseFk, SELECT tcb.warehouseFk,
tcb.itemFk, tcb.itemFk,
@ -162,14 +174,14 @@ BEGIN
JOIN vn.client c ON c.id = vClientFk JOIN vn.client c ON c.id = vClientFk
JOIN vn.businessType bt ON bt.code = c.businessTypeFk JOIN vn.businessType bt ON bt.code = c.businessTypeFk
WHERE bt.code = 'individual'; WHERE bt.code = 'individual';
-- Venta por paquetes -- Venta por paquetes
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3
FROM tmp.ticketComponentCalculate tcc FROM tmp.ticketComponentCalculate tcc
JOIN vn.component c2 ON c2.code = 'salePerPackage' JOIN vn.component c2 ON c2.code = 'salePerPackage'
JOIN buy b ON b.id = tcc.buyFk JOIN buy b ON b.id = tcc.buyFk
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk LEFT JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk
WHERE sp.value IS NULL; WHERE sp.value IS NULL;
CREATE OR REPLACE TEMPORARY TABLE tmp.`zone` (INDEX (id)) CREATE OR REPLACE TEMPORARY TABLE tmp.`zone` (INDEX (id))
@ -177,7 +189,7 @@ BEGIN
SELECT vZoneFk id; SELECT vZoneFk id;
CALL zone_getOptionsForShipment(vShipped, TRUE); CALL zone_getOptionsForShipment(vShipped, TRUE);
-- Reparto -- Reparto
INSERT INTO tmp.ticketComponent INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFK, SELECT tcc.warehouseFK,
@ -191,7 +203,7 @@ BEGIN
JOIN agencyMode am ON am.id = z.agencyModeFk JOIN agencyMode am ON am.id = z.agencyModeFk
JOIN vn.volumeConfig vc JOIN vn.volumeConfig vc
JOIN vn.component c2 ON c2.code = 'delivery' JOIN vn.component c2 ON c2.code = 'delivery'
LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
AND ic.itemFk = tcc.itemFk AND ic.itemFk = tcc.itemFk
HAVING cost <> 0; HAVING cost <> 0;
@ -208,7 +220,7 @@ BEGIN
sp.value - SUM(tcc.cost) sumCost sp.value - SUM(tcc.cost) sumCost
FROM tmp.ticketComponentCopy tcc FROM tmp.ticketComponentCopy tcc
JOIN component c ON c.id = tcc.componentFk JOIN component c ON c.id = tcc.componentFk
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk
JOIN vn.component c2 ON c2.code = 'specialPrices' JOIN vn.component c2 ON c2.code = 'specialPrices'
WHERE c.classRate IS NULL WHERE c.classRate IS NULL
AND tcc.warehouseFk = vWarehouseFk AND tcc.warehouseFk = vWarehouseFk
@ -244,9 +256,9 @@ BEGIN
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price,
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg
FROM tmp.ticketComponentCalculate tcc FROM tmp.ticketComponentCalculate tcc
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
AND tcs.warehouseFk = tcc.warehouseFk AND tcs.warehouseFk = tcc.warehouseFk
WHERE IFNULL(tcs.classRate, 1) = 1 WHERE IFNULL(tcs.classRate, 1) = 1
AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0)
GROUP BY tcs.warehouseFk, tcs.itemFk; GROUP BY tcs.warehouseFk, tcs.itemFk;
@ -283,12 +295,13 @@ BEGIN
SELECT * FROM tmp.ticketComponentRate ORDER BY price LIMIT 10000000000000000000 SELECT * FROM tmp.ticketComponentRate ORDER BY price LIMIT 10000000000000000000
) t ) t
GROUP BY itemFk, warehouseFk, `grouping`; GROUP BY itemFk, warehouseFk, `grouping`;
DROP TEMPORARY TABLE DROP TEMPORARY TABLE
tmp.ticketComponentCalculate, tmp.ticketComponentCalculate,
tmp.ticketComponentSum, tmp.ticketComponentSum,
tmp.ticketComponentBase, tmp.ticketComponentBase,
tmp.ticketComponentRate, tmp.ticketComponentRate,
tmp.ticketComponentCopy; tmp.ticketComponentCopy,
tSpecialPrice;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -12,7 +12,7 @@ BEGIN
DECLARE v1Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR; DECLARE v1Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR;
DECLARE v2Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR; DECLARE v2Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR;
DECLARE v4Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR; DECLARE v4Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR;
DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR; DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR;
DECLARE vTrashId VARCHAR(15); DECLARE vTrashId VARCHAR(15);
DECLARE vCompanyBlk INT; DECLARE vCompanyBlk INT;
@ -30,8 +30,9 @@ BEGIN
DELETE IGNORE FROM expedition WHERE created < v26Months; DELETE IGNORE FROM expedition WHERE created < v26Months;
DELETE FROM sms WHERE created < v18Months; DELETE FROM sms WHERE created < v18Months;
DELETE FROM saleTracking WHERE created < v1Years; DELETE FROM saleTracking WHERE created < v1Years;
DELETE FROM productionError WHERE dated < v1Years;
DELETE FROM ticketTracking WHERE created < v18Months; DELETE FROM ticketTracking WHERE created < v18Months;
DELETE tobs FROM ticketObservation tobs DELETE tobs FROM ticketObservation tobs
JOIN ticket t ON tobs.ticketFk = t.id JOIN ticket t ON tobs.ticketFk = t.id
WHERE t.shipped < v5Years; WHERE t.shipped < v5Years;
DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < v1Years; DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < v1Years;
@ -113,12 +114,12 @@ BEGIN
FROM travel t FROM travel t
LEFT JOIN entry e ON e.travelFk = t.id LEFT JOIN entry e ON e.travelFk = t.id
WHERE t.shipped < v3Months AND e.travelFk IS NULL; WHERE t.shipped < v3Months AND e.travelFk IS NULL;
UPDATE dms d UPDATE dms d
JOIN dmsType dt ON dt.id = d.dmsTypeFk JOIN dmsType dt ON dt.id = d.dmsTypeFk
SET d.dmsTypeFk = vTrashId SET d.dmsTypeFk = vTrashId
WHERE created < util.VN_CURDATE() - INTERVAL dt.monthToDelete MONTH; WHERE created < util.VN_CURDATE() - INTERVAL dt.monthToDelete MONTH;
-- borrar entradas sin compras -- borrar entradas sin compras
CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
SELECT e.* SELECT e.*
@ -136,7 +137,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete
SELECT * SELECT *
FROM route r FROM route r
WHERE created < v4Years; WHERE created < v4Years;
UPDATE tRouteToDelete tmp UPDATE tRouteToDelete tmp
JOIN dms d ON d.id = tmp.gestdocFk JOIN dms d ON d.id = tmp.gestdocFk
@ -180,7 +181,7 @@ BEGIN
DELETE FROM mail WHERE creationDate < v2Months; DELETE FROM mail WHERE creationDate < v2Months;
DELETE FROM split WHERE dated < v18Months; DELETE FROM split WHERE dated < v18Months;
DELETE FROM remittance WHERE dated < v18Months; DELETE FROM remittance WHERE dated < v18Months;
CREATE OR REPLACE TEMPORARY TABLE tTicketDelete CREATE OR REPLACE TEMPORARY TABLE tTicketDelete
SELECT DISTINCT tl.originFk ticketFk SELECT DISTINCT tl.originFk ticketFk
FROM ticketLog tl FROM ticketLog tl
@ -189,11 +190,11 @@ BEGIN
FROM ticket t FROM ticket t
JOIN ticketLog tl ON tl.originFk = t.id JOIN ticketLog tl ON tl.originFk = t.id
LEFT JOIN ticketWeekly tw ON tw.ticketFk = t.id LEFT JOIN ticketWeekly tw ON tw.ticketFk = t.id
WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31' WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31'
AND t.isDeleted AND t.isDeleted
AND tw.ticketFk IS NULL AND tw.ticketFk IS NULL
GROUP BY t.id GROUP BY t.id
) sub ON sub.ids = tl.id ) sub ON sub.ids = tl.id
WHERE tl.creationDate <= v2Months; WHERE tl.creationDate <= v2Months;
DELETE t DELETE t
FROM ticket t FROM ticket t

View File

@ -1,8 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`(
vUserFk INT, vUserFk INT,
OUT vCollectionFk INT OUT vCollectionFk INT
) )
proc:BEGIN proc:BEGIN
/** /**
* Comprueba si existen colecciones libres que se ajustan * Comprueba si existen colecciones libres que se ajustan
@ -15,6 +15,13 @@ proc:BEGIN
DECLARE vHasTooMuchCollections BOOL; DECLARE vHasTooMuchCollections BOOL;
DECLARE vLockTime INT DEFAULT 15; DECLARE vLockTime INT DEFAULT 15;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
DO RELEASE_LOCK('collection_assign');
RESIGNAL;
END;
-- Si hay colecciones sin terminar, sale del proceso -- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
@ -84,5 +91,5 @@ proc:BEGIN
WHERE id = vCollectionFk; WHERE id = vCollectionFk;
DO RELEASE_LOCK('collection_assign'); DO RELEASE_LOCK('collection_assign');
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -219,9 +219,11 @@ proc:BEGIN
UPDATE tmp.productionBuffer pb UPDATE tmp.productionBuffer pb
JOIN ( JOIN (
SELECT SUM(litros) liters, SELECT SUM(litros) liters,
@lines:= COUNT(*) + @lines `lines`, @lines:= COUNT(*) + @lines,
COUNT(*) `lines`,
MAX(i.`size`) height, MAX(i.`size`) height,
@volume := SUM(sv.volume) + @volume volume @volume := SUM(sv.volume) + @volume,
SUM(sv.volume) volume
FROM saleVolume sv FROM saleVolume sv
JOIN sale s ON s.id = sv.saleFk JOIN sale s ON s.id = sv.saleFk
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk

View File

@ -7,81 +7,81 @@ BEGIN
* @param vSelf company id * @param vSelf company id
* @param vMonthAgo time interval to be consulted * @param vMonthAgo time interval to be consulted
*/ */
DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE()); DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE());
DECLARE vCurrencyEuroFk INT; DECLARE vCurrencyEuroFk INT;
DECLARE vStartDate DATE; DECLARE vStartDate DATE;
DECLARE vInvalidBalances DOUBLE; DECLARE vInvalidBalances DOUBLE;
SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig; SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig;
SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR'; SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR';
DROP TEMPORARY TABLE IF EXISTS tOpeningBalances; DROP TEMPORARY TABLE IF EXISTS tOpeningBalances;
CREATE TEMPORARY TABLE tOpeningBalances ( CREATE TEMPORARY TABLE tOpeningBalances (
supplierFk INT NOT NULL, supplierFk INT NOT NULL,
companyFk INT NOT NULL, companyFk INT NOT NULL,
openingBalances DOUBLE NOT NULL, openingBalances DOUBLE NOT NULL,
closingBalances DOUBLE NOT NULL, closingBalances DOUBLE NOT NULL,
currencyFk INT NOT NULL, currencyFk INT NOT NULL,
PRIMARY KEY (supplierFk, companyFk, currencyFk) PRIMARY KEY (supplierFk, companyFk, currencyFk)
) ENGINE = MEMORY; ) ENGINE = MEMORY;
-- Calculates the opening and closing balance for each supplier -- Calculates the opening and closing balance for each supplier
INSERT INTO tOpeningBalances INSERT INTO tOpeningBalances
SELECT supplierFk, SELECT supplierFk,
companyFk, companyFk,
SUM(amount * isBeforeStarting) AS openingBalances, SUM(amount * isBeforeStarting) AS openingBalances,
SUM(amount) closingBalances, SUM(amount) closingBalances,
currencyFk currencyFk
FROM ( FROM (
SELECT p.supplierFk, SELECT p.supplierFk,
p.companyFk, p.companyFk,
IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount, IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount,
p.dueDated < vStartingDate isBeforeStarting, p.dueDated < vStartingDate isBeforeStarting,
p.currencyFk p.currencyFk
FROM payment p FROM payment p
WHERE p.received > vStartDate WHERE p.received > vStartDate
AND p.companyFk = vSelf AND p.companyFk = vSelf
UNION ALL UNION ALL
SELECT r.supplierFk, SELECT r.supplierFk,
r.companyFk, r.companyFk,
- IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total, - IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total,
rv.dueDated < vStartingDate isBeforeStarting, rv.dueDated < vStartingDate isBeforeStarting,
r.currencyFk r.currencyFk
FROM invoiceIn r FROM invoiceIn r
INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
WHERE r.issued > vStartDate WHERE r.issued > vStartDate
AND r.isBooked AND r.isBooked
AND r.companyFk = vSelf AND r.companyFk = vSelf
) sub GROUP BY companyFk, supplierFk, currencyFk; ) sub GROUP BY companyFk, supplierFk, currencyFk;
DROP TEMPORARY TABLE IF EXISTS tPendingDuedates; DROP TEMPORARY TABLE IF EXISTS tPendingDuedates;
CREATE TEMPORARY TABLE tPendingDuedates ( CREATE TEMPORARY TABLE tPendingDuedates (
id INT auto_increment, id INT auto_increment,
expirationId INT, expirationId INT,
dated DATE, dated DATE,
supplierFk INT NOT NULL, supplierFk INT NOT NULL,
companyFk INT NOT NULL, companyFk INT NOT NULL,
amount DECIMAL(10, 2) NOT NULL, amount DECIMAL(10, 2) NOT NULL,
currencyFk INT NOT NULL, currencyFk INT NOT NULL,
pending DECIMAL(10, 2) DEFAULT 0, pending DECIMAL(10, 2) DEFAULT 0,
balance DECIMAL(10, 2) DEFAULT 0, balance DECIMAL(10, 2) DEFAULT 0,
endingBalance DECIMAL(10, 2) DEFAULT 0, endingBalance DECIMAL(10, 2) DEFAULT 0,
isPayment BOOLEAN, isPayment BOOLEAN,
isReconciled BOOLEAN, isReconciled BOOLEAN,
PRIMARY KEY (id), PRIMARY KEY (id),
INDEX (supplierFk, companyFk, currencyFk) INDEX (supplierFk, companyFk, currencyFk)
) ENGINE = MEMORY; ) ENGINE = MEMORY;
INSERT INTO tPendingDuedates ( INSERT INTO tPendingDuedates (
expirationId, expirationId,
dated, dated,
supplierFk, supplierFk,
companyFk, companyFk,
amount, amount,
currencyFk, currencyFk,
isPayment, isPayment,
isReconciled isReconciled
)SELECT p.id, )SELECT p.id,
p.dueDated, p.dueDated,
p.supplierFk, p.supplierFk,
p.companyFk, p.companyFk,
@ -100,80 +100,80 @@ BEGIN
-IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue), -IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue),
r.currencyFk, r.currencyFk,
FALSE isPayment, FALSE isPayment,
TRUE TRUE
FROM invoiceIn r FROM invoiceIn r
LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk
AND r.supplierFk = si.supplierFk AND r.supplierFk = si.supplierFk
AND r.currencyFk = si.currencyFk AND r.currencyFk = si.currencyFk
JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
WHERE rv.dueDated >= vStartingDate WHERE rv.dueDated >= vStartingDate
AND (si.closingBalances IS NULL OR si.closingBalances <> 0) AND (si.closingBalances IS NULL OR si.closingBalances <> 0)
AND r.isBooked AND r.isBooked
AND r.companyFk = vSelf AND r.companyFk = vSelf
ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id; ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id;
-- Now, we calculate the outstanding amount for each receipt in descending order -- Now, we calculate the outstanding amount for each receipt in descending order
SET @risk := 0.0; SET @risk := 0.0;
SET @supplier := 0.0; SET @supplier := 0.0;
SET @company := 0.0; SET @company := 0.0;
SET @moneda := 0.0; SET @moneda := 0.0;
SET @pending := 0.0; SET @pending := 0.0;
SET @day := util.VN_CURDATE(); SET @day := util.VN_CURDATE();
UPDATE tPendingDuedates vp UPDATE tPendingDuedates vp
LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk
AND vp.supplierFk = si.supplierFk AND vp.supplierFk = si.supplierFk
AND vp.currencyFk = si.currencyFk AND vp.currencyFk = si.currencyFk
SET vp.balance = @risk := ( SET vp.balance = @risk := (
IF ( IF (
@company <> vp.companyFk @company <> vp.companyFk
OR @supplier <> vp.supplierFk OR @supplier <> vp.supplierFk
OR @moneda <> vp.currencyFk, OR @moneda <> vp.currencyFk,
IFNULL(si.openingBalances, 0), IFNULL(si.openingBalances, 0),
@risk @risk
) + ) +
vp.amount vp.amount
), ),
-- if there is a change of company or supplier or currency, the balance is reset -- if there is a change of company or supplier or currency, the balance is reset
vp.pending = @pending := IF ( vp.pending = @pending := IF (
@company <> vp.companyFk @company <> vp.companyFk
OR @supplier <> vp.supplierFk OR @supplier <> vp.supplierFk
OR @moneda <> vp.currencyFk OR @moneda <> vp.currencyFk
OR @day <> vp.dated, OR @day <> vp.dated,
vp.amount * (NOT vp.isPayment), vp.amount * (NOT vp.isPayment),
@pending + vp.amount @pending + vp.amount
), ),
vp.companyFk = @company := vp.companyFk, vp.companyFk = @company := vp.companyFk,
vp.supplierFk = @supplier := vp.supplierFk, vp.supplierFk = @supplier := vp.supplierFk,
vp.currencyFk = @moneda := vp.currencyFk, vp.currencyFk = @moneda := vp.currencyFk,
vp.dated = @day := vp.dated, vp.dated = @day := vp.dated,
vp.balance = @risk, vp.balance = @risk,
vp.pending = @pending; vp.pending = @pending;
CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY
SELECT expirationId, SELECT expirationId,
dated, dated,
supplierFk, supplierFk,
companyFk, companyFk,
currencyFk, currencyFk,
balance balance
FROM tPendingDuedates FROM tPendingDuedates
WHERE balance < vInvalidBalances WHERE balance < vInvalidBalances
AND balance > - vInvalidBalances; AND balance > - vInvalidBalances;
DELETE vp.*
FROM tPendingDuedates vp
JOIN tRowsToDelete rd ON (
vp.dated < rd.dated
OR (vp.dated = rd.dated AND vp.expirationId <= rd.expirationId)
)
AND vp.supplierFk = rd.supplierFk
AND vp.companyFk = rd.companyFk
AND vp.currencyFk = rd.currencyFk
WHERE vp.isPayment = FALSE;
SELECT vp.expirationId, DELETE vp.*
vp.dated, FROM tPendingDuedates vp
vp.supplierFk, JOIN tRowsToDelete rd ON (
vp.dated < rd.dated
OR (vp.dated = rd.dated AND vp.expirationId <= rd.expirationId)
)
AND vp.supplierFk = rd.supplierFk
AND vp.companyFk = rd.companyFk
AND vp.currencyFk = rd.currencyFk
WHERE NOT vp.isPayment;
SELECT vp.expirationId,
vp.dated,
vp.supplierFk,
vp.companyFk, vp.companyFk,
vp.currencyFk, vp.currencyFk,
vp.amount, vp.amount,
@ -183,15 +183,19 @@ BEGIN
vp.isPayment, vp.isPayment,
vp.isReconciled, vp.isReconciled,
vp.endingBalance, vp.endingBalance,
cr.amount clientRiskAmount cr.amount clientRiskAmount,
FROM tPendingDuedates vp co.CEE
LEFT JOIN supplier s ON s.id = vp.supplierFk FROM tPendingDuedates vp
LEFT JOIN client c ON c.fi = s.nif LEFT JOIN supplier s ON s.id = vp.supplierFk
LEFT JOIN clientRisk cr ON cr.clientFk = c.id LEFT JOIN client c ON c.fi = s.nif
AND cr.companyFk = vp.companyFk; LEFT JOIN clientRisk cr ON cr.clientFk = c.id
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
DROP TEMPORARY TABLE tOpeningBalances; LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk
DROP TEMPORARY TABLE tPendingDuedates; LEFT JOIN country co ON co.id = be.countryFk
DROP TEMPORARY TABLE tRowsToDelete; AND cr.companyFk = vp.companyFk;
DROP TEMPORARY TABLE tOpeningBalances;
DROP TEMPORARY TABLE tPendingDuedates;
DROP TEMPORARY TABLE tRowsToDelete;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,42 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`creditInsurance_getRisk`()
BEGIN
/**
* Devuelve el riesgo de los clientes que estan asegurados
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.client_list
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT * FROM (
SELECT cc.client Id_Cliente, ci.grade
FROM creditClassification cc
JOIN creditInsurance ci ON cc.id = ci.creditClassification
WHERE dateEnd IS NULL
ORDER BY ci.creationDate DESC
LIMIT 10000000000000000000) t1
GROUP BY Id_Cliente;
CALL vn2008.risk_vs_client_list(util.VN_CURDATE());
SELECT
c.id,
c.name,
c.credit clientCredit,
c.creditInsurance solunion,
CAST(r.risk AS DECIMAL(10,0)) risk,
CAST(c.creditInsurance - r.risk AS DECIMAL(10,0)) riskAlive,
cac.invoiced billedAnnually,
c.dueDay,
ci.grade,
c2.country
FROM tmp.client_list ci
LEFT JOIN tmp.risk r ON r.Id_Cliente = ci.Id_Cliente
JOIN client c ON c.id = ci.Id_Cliente
JOIN bs.clientAnnualConsumption cac ON c.id = cac.clientFk
JOIN country c2 ON c2.id = c.countryFk
GROUP BY c.id;
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
END$$
DELIMITER ;

View File

@ -33,6 +33,7 @@ BEGIN
ii.operated = IFNULL(ii.operated,d.operated), ii.operated = IFNULL(ii.operated,d.operated),
ii.issued = IFNULL(ii.issued,d.issued), ii.issued = IFNULL(ii.issued,d.issued),
ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
e.isBooked = TRUE,
e.isConfirmed = TRUE e.isConfirmed = TRUE
WHERE d.id = vDuaFk; WHERE d.id = vDuaFk;

View File

@ -114,7 +114,7 @@ BEGIN
quantity int(11) DEFAULT '0', quantity int(11) DEFAULT '0',
buyingValue decimal(10,4) DEFAULT '0.0000', buyingValue decimal(10,4) DEFAULT '0.0000',
freightValue decimal(10,3) DEFAULT '0.000', freightValue decimal(10,3) DEFAULT '0.000',
packing int(11) DEFAULT '0', packing int(11) DEFAULT '1',
`grouping` smallint(5) unsigned NOT NULL DEFAULT '1', `grouping` smallint(5) unsigned NOT NULL DEFAULT '1',
groupingMode tinyint(4) NOT NULL DEFAULT 0 , groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
comissionValue decimal(10,3) DEFAULT '0.000', comissionValue decimal(10,3) DEFAULT '0.000',

View File

@ -60,7 +60,11 @@ BEGIN
(i.value8 <=> its.value8) match8, (i.value8 <=> its.value8) match8,
a.available, a.available,
IFNULL(ip.counter, 0) `counter`, IFNULL(ip.counter, 0) `counter`,
IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity, CASE
WHEN b.groupingMode = 1 THEN b.grouping
WHEN b.groupingMode = 2 THEN b.packing
ELSE 1
END AS minQuantity,
iss.visible located iss.visible located
FROM vn.item i FROM vn.item i
JOIN cache.available a ON a.item_id = i.id JOIN cache.available a ON a.item_id = i.id

View File

@ -0,0 +1,286 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.sale_boxPickingPrint(
IN vPrinterFk INT,
IN vSaleFk INT,
IN vPacking INT,
IN vSectorFk INT,
IN vUserFk INT,
IN vPackagingFk VARCHAR(10),
IN vPackingSiteFk INT)
BEGIN
/** Splits a line of sale to a different ticket and prints the transport sticker
*/
DECLARE vAgencyModeFk INT;
DECLARE vConcept VARCHAR(30);
DECLARE vExpeditionFk INT;
DECLARE vItemFk INT;
DECLARE vItemShelvingFk INT;
DECLARE vItemShelvingSaleFk INT;
DECLARE vItemShelvingSaleFk_old INT;
DECLARE vLastExpeditionTimeStamp DATETIME;
DECLARE vMaxPhoneLength INT DEFAULT 11;
DECLARE vMaxStreetLength INT DEFAULT 36;
DECLARE vNewSaleFk INT;
DECLARE vNewTicketFk INT;
DECLARE vParkingCode VARCHAR(10);
DECLARE vQuantity INT;
DECLARE vRemainder INT DEFAULT 0;
DECLARE vRemainderSaleFk INT;
DECLARE vShelving VARCHAR(10);
DECLARE vTicketFk INT;
SELECT s.quantity,
s.quantity MOD vPacking,
s.ticketFk,
s.itemFk,
s.concept
INTO vQuantity,
vRemainder,
vTicketFk,
vItemFk,
vConcept
FROM sale s
WHERE s.id = vSaleFk;
IF vRemainder THEN
UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk;
INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept)
SELECT ticketFk, itemFk, vRemainder, price, discount, concept
FROM sale
WHERE id = vSaleFk;
SET vRemainderSaleFk = LAST_INSERT_ID();
INSERT INTO saleComponent(saleFk, componentFk, value)
SELECT vRemainderSaleFk, componentFk, value
FROM saleComponent
WHERE saleFk = vSaleFk;
END IF;
w1: WHILE vQuantity >= vPacking DO
SET vQuantity = vQuantity - vPacking;
SET vItemShelvingFk = NULL;
SELECT sub.id
INTO vItemShelvingFk
FROM productionConfig pc
JOIN (
SELECT ish.id,
ish.visible - IFNULL(SUM(iss.quantity),0) available,
p.pickingOrder,
ish.created
FROM itemShelving ish
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
LEFT JOIN itemShelvingSale iss
ON iss.itemShelvingFk = ish.id
AND iss.created >= CURDATE()
AND iss.isPicked = FALSE
WHERE ish.itemFk = vItemFk
AND p.sectorFk = vSectorFk
GROUP BY ish.id
HAVING available >= vPacking) sub
ORDER BY IF(pc.orderMode = 'Location',sub.pickingOrder, sub.created)
LIMIT 1;
IF vItemShelvingFk THEN
INSERT INTO itemShelvingSale
SET itemShelvingFk = vItemShelvingFk,
saleFk = vSaleFk,
quantity = vPacking,
userFk = vUserFk,
isPicked = TRUE;
SET vItemShelvingSaleFk = LAST_INSERT_ID();
UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk;
ELSE
LEAVE w1;
END IF;
SET vNewTicketFk = NULL;
SELECT MAX(t.id) INTO vNewTicketFk
FROM ticket t
JOIN ticketLastState tls ON tls.ticketFk = t.id
JOIN (SELECT addressFk, clientFk, date(shipped) shipped, warehouseFk
FROM ticket
WHERE id = vTicketFk) tt
ON tt.addressFk = t.addressFk
AND tt.clientFk = t.clientFk
AND t.shipped BETWEEN tt.shipped AND util.dayend(tt.shipped)
AND t.warehouseFk = tt.warehouseFk
WHERE tls.name = 'Encajado' ;
IF ISNULL(vNewTicketFk) THEN
INSERT INTO ticket( clientFk,
shipped,
addressFk,
agencyModeFk,
nickname,
warehouseFk,
companyFk,
landed,
zoneFk,
zonePrice,
zoneBonus,
routeFk,
priority,
hasPriority,
clonedFrom)
SELECT clientFk,
shipped,
addressFk,
agencyModeFk,
nickname,
warehouseFk,
companyFk,
landed,
zoneFk,
zonePrice,
zoneBonus,
routeFk,
priority,
hasPriority,
id
FROM ticket
WHERE id = vTicketFk;
SET vNewTicketFk = LAST_INSERT_ID();
INSERT INTO ticketTracking(ticketFk, stateFk, userFk)
SELECT vNewTicketFk, id, vUserFk
FROM state
WHERE code = 'PACKED';
END IF;
UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk;
UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk;
SET vNewSaleFk = NULL;
SELECT MAX(id) INTO vNewSaleFk
FROM sale
WHERE ticketFk = vNewTicketFk
AND itemFk = vItemFk;
IF vNewSaleFk THEN
UPDATE sale
SET quantity = quantity + vPacking
WHERE id = vNewSaleFk;
SET vItemShelvingSaleFk_old = NULL;
SELECT MAX(id) INTO vItemShelvingSaleFk_old
FROM itemShelvingSale
WHERE itemShelvingFk = vItemShelvingFk
AND saleFk = vNewSaleFk;
IF vItemShelvingSaleFk_old THEN
UPDATE itemShelvingSale
SET quantity = quantity + vPacking
WHERE id = vItemShelvingSaleFk_old;
DELETE FROM itemShelvingSale
WHERE id = vItemShelvingSaleFk;
SET vItemShelvingSaleFk = vItemShelvingSaleFk_old;
ELSE
UPDATE itemShelvingSale
SET saleFk = vNewSaleFk
WHERE id = vItemShelvingSaleFk;
END IF;
ELSE
INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price)
SELECT vNewTicketFk, itemFk, concept, vPacking, discount, price
FROM sale
WHERE id = vSaleFk;
SET vNewSaleFk = LAST_INSERT_ID();
INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge)
SELECT vNewSaleFk, componentFk, value, isGreuge
FROM saleComponent
WHERE saleFk = vSaleFk;
UPDATE itemShelvingSale
SET saleFk = vNewSaleFk
WHERE id = vItemShelvingSaleFk;
END IF;
INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk)
SELECT vNewSaleFk, TRUE, vUserFk, id
FROM state
WHERE code = 'PREPARED';
SELECT agencyModeFk INTO vAgencyModeFk
FROM ticket
WHERE id = vNewTicketFk;
INSERT INTO expedition(
agencyModeFk,
ticketFk,
freightItemFk,
workerFk,
packagingFk,
itemPackingTypeFk,
hostFk,
packingSiteFk,
monitorId,
started,
ended
)
SELECT vAgencyModeFk,
vNewTicketFk,
pc.defaultFreightItemFk,
vUserFk,
vPackagingFk,
ps.code,
h.code,
vPackingSiteFk,
ps.monitorId,
IFNULL(vLastExpeditionTimeStamp, NOW()),
NOW()
FROM packingSite ps
JOIN host h ON h.id = ps.hostFk
JOIN productionConfig pc
WHERE ps.id = vPackingSiteFk;
SET vExpeditionFk = LAST_INSERT_ID();
SET vLastExpeditionTimeStamp = NOW();
CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE);
SELECT shelvingFk, p.code
INTO vShelving, vParkingCode
FROM itemShelving ish
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
WHERE ish.id = vItemShelvingFk;
UPDATE dipole.expedition_PrintOut
SET isPrinted = FALSE,
itemFk = vItemFk,
quantity = vPacking,
longName = vConcept,
shelvingFk = vShelving,
parkingCode = vParkingCode,
phone = RIGHT(phone,vMaxPhoneLength),
street = RIGHT(street, vMAxStreetLength)
WHERE expeditionFk = vExpeditionFk;
DELETE FROM sale
WHERE quantity = 0
AND id = vSaleFk;
END WHILE;
END$$
DELIMITER ;

View File

@ -46,6 +46,7 @@ BEGIN
JOIN parking p ON p.id = sh.parkingFk JOIN parking p ON p.id = sh.parkingFk
JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
JOIN agencyMode am ON am.id = pb.agencyModeFk JOIN agencyMode am ON am.id = pb.agencyModeFk
JOIN agency a ON a .id = am.agencyFk
LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
@ -60,6 +61,7 @@ BEGIN
AND ((rm.bufferFk AND rm.isPickingAllowed) AND ((rm.bufferFk AND rm.isPickingAllowed)
OR am.code = 'REC_ALG') OR am.code = 'REC_ALG')
AND pb.shipped = vDated AND pb.shipped = vDated
AND a.isOwn
GROUP BY s.id GROUP BY s.id
ORDER BY etd; ORDER BY etd;

View File

@ -77,7 +77,9 @@ BEGIN
vNewItemFk); vNewItemFk);
SELECT price INTO vNewPrice SELECT price INTO vNewPrice
FROM tmp.ticketCalculateItem; FROM tmp.ticketComponentPrice
ORDER BY (vQuantity % `grouping`) ASC
LIMIT 1;
IF vNewPrice IS NULL THEN IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed'); CALL util.throw('price retrieval failed');

View File

@ -1,31 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`solunionRiskRequest`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
CREATE TEMPORARY TABLE tmp.client_list
(PRIMARY KEY (Id_Cliente))
ENGINE = MEMORY
SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc
JOIN vn.creditInsurance ci ON cc.id = ci.creditClassification
WHERE dateEnd IS NULL
ORDER BY ci.creationDate DESC
LIMIT 10000000000000000000) t1 GROUP BY Id_Cliente;
CALL vn2008.risk_vs_client_list(util.VN_CURDATE());
SELECT
c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo,
cast(c.creditInsurance - r.risk as decimal(10,0)) margen_vivo,
f.Consumo consumo_anual, c.Vencimiento, ci.grade
FROM
vn2008.Clientes c
JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente
JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente
JOIN bi.facturacion_media_anual f ON c.Id_Cliente = f.Id_Cliente
GROUP BY Id_cliente;
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
DROP TEMPORARY TABLE IF EXISTS tmp.client_list;
END$$
DELIMITER ;

View File

@ -11,7 +11,7 @@ BEGIN
SELECT id itemFk FROM vn.item SELECT id itemFk FROM vn.item
WHERE typeFk = vTypeFk; WHERE typeFk = vTypeFk;
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item;
DROP TEMPORARY TABLE tmp.ticketLot; DROP TEMPORARY TABLE tmp.ticketLot;
END$$ END$$

View File

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

View File

@ -32,5 +32,9 @@ BEGIN
CALL util.throw('The travel has entries with booked invoices'); CALL util.throw('The travel has entries with booked invoices');
END IF; END IF;
END IF; END IF;
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
END IF;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,5 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Proveedores_cargueras`
AS SELECT `fs`.`supplierFk` AS `Id_Proveedor`
FROM `vn`.`supplierFreight` `fs`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Tramos`
AS SELECT `s`.`id` AS `id`,
`s`.`section` AS `Tramo`
FROM `vn`.`timeSlots` `s`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_employee`
AS SELECT `pw`.`workerFkA3` AS `CodTrabajador`,
`pw`.`companyFkA3` AS `codempresa`
FROM `vn`.`payrollWorker` `pw`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_centros`
AS SELECT `pwc`.`workCenterFkA3` AS `cod_centro`,
`pwc`.`companyFkA3` AS `codempresa`
FROM `vn`.`payrollWorkCenter` `pwc`

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_conceptos`
AS SELECT `pc`.`id` AS `conceptoid`,
`pc`.`name` AS `concepto`,
`pc`.`isSalaryAgreed` AS `isSalaryAgreed`,
`pc`.`isVariable` AS `isVariable`,
`pc`.`isException` AS `isException`
FROM `vn`.`payrollComponent` `pc`

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn.flight ADD CONSTRAINT flight_airline_FK FOREIGN KEY (airlineFk)
REFERENCES vn.airline(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.`timeSlots`;
ALTER TABLE IF EXISTS `vn`.`timeSlots`
CHANGE COLUMN IF EXISTS `Tramo` `section` time NOT NULL;

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn2008`.`dock__`;
ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-03-05';

View File

@ -0,0 +1,5 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.`supplierFreight`;
ALTER TABLE IF EXISTS `vn`.`supplierFreight`
CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL;

View File

@ -0,0 +1,13 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`payroll_employee` RENAME `vn`.`payrollWorker`;
ALTER TABLE IF EXISTS `vn`.`payrollWorker`
CHANGE COLUMN IF EXISTS `CodTrabajador` `workerFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',
CHANGE COLUMN IF EXISTS `nss` `nss__` varchar(23) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codpuesto` `codpuesto__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(10) NOT NULL COMMENT 'Columna que hace referencia a A3.',
CHANGE COLUMN IF EXISTS `codcontrato` `codcontrato__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `FAntiguedad` `FAntiguedad__` date NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `grupotarifa` `grupotarifa__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codcategoria` `codcategoria__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `ContratoTemporal` `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@Deprecated refs #6738 15/03/2024';

View File

@ -0,0 +1,13 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`payroll_centros` RENAME `vn`.`payrollWorkCenter`;
ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter`
CHANGE COLUMN IF EXISTS `cod_centro` `workCenterFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',
CHANGE COLUMN IF EXISTS `Centro` `Centro__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `nss_cotizacion` `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `domicilio` `domicilio__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `poblacion` `poblacion__` varchar(45) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `cp` `cp__` varchar(5) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `empresa_id` `empresa_id__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024',
CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(11) DEFAULT NULL COMMENT 'Columna que hace referencia a A3.';
;

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS `vn2008`.`payroll_conceptos` RENAME `vn`.`payrollComponent`;
ALTER TABLE IF EXISTS `vn`.`payrollComponent`
CHANGE COLUMN IF EXISTS `conceptoid` `id` int(11) NOT NULL,
CHANGE COLUMN IF EXISTS `concepto` `name` varchar(255) DEFAULT NULL;

View File

@ -0,0 +1,40 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Tramos` AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.Tramos TO `employee`;
GRANT SELECT ON TABLE vn.timeSlots TO `employee`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`Proveedores_cargueras` AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.Proveedores_cargueras TO `buyer`;
GRANT SELECT ON TABLE vn.supplierFreight TO `buyer`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_employee` AS
SELECT 1;
GRANT SELECT,INSERT ON TABLE vn2008.payroll_employee TO `hr`;
GRANT SELECT,INSERT ON TABLE vn.payrollWorker TO `hr`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_centros` AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.payroll_centros TO `hr`;
GRANT SELECT ON TABLE vn.payrollWorkCenter TO `hr`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`payroll_conceptos` AS
SELECT 1;
GRANT SELECT,UPDATE ON TABLE vn2008.payroll_conceptos TO `hr`;
GRANT SELECT,UPDATE ON TABLE vn.payrollComponent TO `hr`;

View File

@ -0,0 +1,2 @@
-- Place your SQL code here
ALTER TABLE vn.entry CHANGE isBlocked isBlocked__ tinyint(4) DEFAULT 0 NOT NULL COMMENT '@deprecated 27/03/2024';

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('ItemShelving', 'hasItemOlder', 'READ', 'ALLOW', 'ROLE', 'production');

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES('SupplierDms', '*', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,10 @@
ALTER TABLE vn.specialPrice MODIFY COLUMN clientFk int(11) NULL;
ALTER TABLE vn.specialPrice ADD started date NOT NULL DEFAULT '2024-01-01';
ALTER TABLE vn.specialPrice ADD ended date NULL;
ALTER TABLE vn.specialPrice MODIFY COLUMN itemFk int(11) NOT NULL;
ALTER TABLE vn.specialPrice MODIFY COLUMN value DECIMAL(10,2) NOT NULL;
ALTER TABLE vn.`specialPrice`
ADD CONSTRAINT `check_date_range`
CHECK (`ended` IS NULL OR `ended` >= `started`);

View File

@ -0,0 +1,2 @@
-- Place your SQL code here
ALTER TABLE vn.productionConfig ADD defaultFreightItemFk INT UNSIGNED DEFAULT 71 NOT NULL COMMENT 'Default value for expedition table';

View File

@ -0,0 +1 @@
CREATE INDEX expeditionLog_action_IDX USING BTREE ON srt.expeditionLog (`action`);

View File

@ -0,0 +1 @@
CREATE INDEX expeditionLog_expeditionFk_IDX USING BTREE ON srt.expeditionLog (expeditionFk);

View File

@ -0,0 +1,2 @@
-- Place your SQL code here
ALTER TABLE vn.buy DROP COLUMN packageFk;

View File

@ -8,7 +8,7 @@ describe('Account Alias create and basic data path', () => {
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('developer', 'account'); await page.loginAndModule('itManagement', 'account');
await page.accessToSection('account.alias'); await page.accessToSection('account.alias');
}); });

View File

@ -5,7 +5,6 @@
flat flat
round round
icon="phone" icon="phone"
title="MicroSIP"
ng-click="$event.stopPropagation();" ng-click="$event.stopPropagation();"
> >
</vn-icon> </vn-icon>

View File

@ -61,10 +61,10 @@ vn-searchbar {
} }
vn-icon[icon="info"] { vn-icon[icon="info"] {
position: absolute; position: absolute;
top: 2px; top: 2px;
right: 2px right: 2px
} }
} }
} }
} }

View File

@ -59,7 +59,8 @@ export default class Token {
getStorage(storage) { getStorage(storage) {
this.token = storage.getItem('vnToken'); this.token = storage.getItem('vnToken');
this.tokenMultimedia = storage.getItem('vnTokenMultimedia'); // Cambio realizado temporalmente
this.tokenMultimedia = this.token; // storage.getItem('vnTokenMultimedia');
if (!this.token) return; if (!this.token) return;
const created = storage.getItem('vnTokenCreated'); const created = storage.getItem('vnTokenCreated');
this.created = created && new Date(created); this.created = created && new Date(created);

View File

@ -350,4 +350,4 @@
"The line could not be marked": "La linea no puede ser marcada", "The line could not be marked": "La linea no puede ser marcada",
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
"They're not your subordinate": "No es tu subordinado/a." "They're not your subordinate": "No es tu subordinado/a."
} }

View File

@ -117,6 +117,21 @@
"video/mp4" "video/mp4"
] ]
}, },
"supplierStorage": {
"name": "supplierStorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./storage/dms",
"maxFileSize": "31457280",
"allowedContentTypes": [
"image/png",
"image/jpeg",
"image/jpg",
"image/webp",
"video/mp4",
"application/pdf"
]
},
"accessStorage": { "accessStorage": {
"name": "accessStorage", "name": "accessStorage",
"connector": "loopback-component-storage", "connector": "loopback-component-storage",

View File

@ -35,7 +35,7 @@ module.exports = Self => {
path: '/:id/claim-pickup-pdf', path: '/:id/claim-pickup-pdf',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order'); Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order');

View File

@ -33,7 +33,7 @@ module.exports = Self => {
path: `/:id/downloadFile`, path: `/:id/downloadFile`,
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.downloadFile = async function(ctx, id) { Self.downloadFile = async function(ctx, id) {

View File

@ -96,9 +96,9 @@ module.exports = Self => {
// When claimState has been changed // When claimState has been changed
if (args.claimStateFk) { if (args.claimStateFk) {
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions); const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
await notifyStateChange(ctx, salesPerson.id, claim, newState.code); await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
if (newState.code == 'canceled') if (newState.code == 'canceled')
await notifyStateChange(ctx, claim.workerFk, claim, newState.code); await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
} }
if (tx) await tx.commit(); if (tx) await tx.commit();

View File

@ -46,7 +46,7 @@ module.exports = Self => {
path: '/:id/campaign-metrics-pdf', path: '/:id/campaign-metrics-pdf',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics'); Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics');

View File

@ -34,7 +34,7 @@ module.exports = Self => {
path: '/:id/entry-order-pdf', path: '/:id/entry-order-pdf',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order'); Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order');

View File

@ -57,9 +57,6 @@
"columnName": "evaNotes" "columnName": "evaNotes"
} }
}, },
"isBlocked": {
"type": "boolean"
},
"loadPriority": { "loadPriority": {
"type": "number" "type": "number"
}, },

View File

@ -32,7 +32,7 @@ module.exports = Self => {
path: '/:id/download', path: '/:id/download',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.download = async function(ctx, id, options) { Self.download = async function(ctx, id, options) {

View File

@ -32,7 +32,7 @@ module.exports = Self => {
path: '/downloadZip', path: '/downloadZip',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.downloadZip = async function(ctx, ids, options) { Self.downloadZip = async function(ctx, ids, options) {

View File

@ -35,7 +35,7 @@ module.exports = Self => {
path: '/:reference/exportation-pdf', path: '/:reference/exportation-pdf',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation'); Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation');

View File

@ -38,7 +38,7 @@ module.exports = Self => {
path: '/:reference/invoice-csv', path: '/:reference/invoice-csv',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.invoiceCsv = async reference => { Self.invoiceCsv = async reference => {

View File

@ -40,7 +40,7 @@ module.exports = Self => {
path: '/negativeBasesCsv', path: '/negativeBasesCsv',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.negativeBasesCsv = async(ctx, options) => { Self.negativeBasesCsv = async(ctx, options) => {

View File

@ -23,15 +23,16 @@ export default class Controller extends Section {
} }
openPdf() { openPdf() {
const access_token = this.vnToken.tokenMultimedia;
if (this.checked.length <= 1) { if (this.checked.length <= 1) {
const [invoiceOutId] = this.checked; const [invoiceOutId] = this.checked;
const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${this.vnToken.tokenMultimedia}`; const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${access_token}`;
window.open(url, '_blank'); window.open(url, '_blank');
} else { } else {
const invoiceOutIds = this.checked; const invoiceOutIds = this.checked;
const invoicesIds = invoiceOutIds.join(','); const invoicesIds = invoiceOutIds.join(',');
const serializedParams = this.$httpParamSerializer({ const serializedParams = this.$httpParamSerializer({
access_token: this.vnToken.token, access_token,
ids: invoicesIds ids: invoicesIds
}); });
const url = `api/InvoiceOuts/downloadZip?${serializedParams}`; const url = `api/InvoiceOuts/downloadZip?${serializedParams}`;

View File

@ -11,7 +11,7 @@ module.exports = Self => {
path: `/download`, path: `/download`,
verb: 'POST', verb: 'POST',
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.download = async() => { Self.download = async() => {

View File

@ -0,0 +1,63 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('hasItemOlder', {
description:
'Get boolean if any or specific item of the shelving has older created in another shelving or parking',
accessType: 'READ',
accepts: [{
arg: 'shelvingFkIn',
type: 'string',
required: true,
description: 'Shelving code'
},
{
arg: 'parking',
type: 'string',
description: 'Parking code'
},
{
arg: 'shelvingFkOut',
type: 'string',
description: 'Shelving code'
},
{
arg: 'itemFk',
type: 'integer',
description: 'Item id'
}],
returns: {
type: 'boolean',
root: true
},
http: {
path: `/hasItemOlder`,
verb: 'GET'
}
});
Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => {
if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving');
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const result = await Self.rawSql(`
SELECT COUNT(ish.id) countItemOlder
FROM vn.itemShelving ish
JOIN (
SELECT ish.itemFk, created,shelvingFk
FROM vn.itemShelving ish
JOIN vn.shelving s ON ish.shelvingFk = s.code
WHERE ish.shelvingFk = ?
)sub ON sub.itemFK = ish.itemFk
JOIN vn.shelving s ON s.code = ish.shelvingFk
JOIN vn.parking p ON p.id = s.parkingFk
WHERE sub.created > ish.created
AND (p.code <> ? OR ? IS NULL)
AND (ish.shelvingFk <> ? OR ? IS NULL)
AND (ish.itemFk <> ? OR ? IS NULL)`,
[shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions);
return result[0]['countItemOlder'] > 0;
};
};

View File

@ -0,0 +1,45 @@
const {models} = require('vn-loopback/server/server');
describe('itemShelving hasOlder()', () => {
it('should return false because there are not older items', async() => {
const shelvingFkIn = 'GVC';
const shelvingFkOut = 'HEJ';
const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, null, shelvingFkOut);
expect(result).toBe(false);
});
it('should return false because there are not older items in parking', async() => {
const shelvingFkIn = 'HEJ';
const parking = '700-01';
const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking);
expect(result).toBe(false);
});
it('should return true because there is an older item', async() => {
const shelvingFkIn = 'UXN';
const shelvingFkOut = 'PCC';
const parking = 'A-01-1';
const itemFk = 1;
const tx = await models.ItemShelving.beginTransaction({});
const myOptions = {transaction: tx};
const filter = {where: {shelvingFk: shelvingFkOut}
};
try {
const itemShelvingBefore = await models.ItemShelving.findOne(filter, myOptions);
await itemShelvingBefore.updateAttributes({
itemFk: itemFk
}, myOptions);
const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking, null, null, myOptions);
expect(result).toBe(true);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -4,4 +4,5 @@ module.exports = Self => {
require('../methods/item-shelving/getInventory')(Self); require('../methods/item-shelving/getInventory')(Self);
require('../methods/item-shelving/getAlternative')(Self); require('../methods/item-shelving/getAlternative')(Self);
require('../methods/item-shelving/updateFromSale')(Self); require('../methods/item-shelving/updateFromSale')(Self);
require('../methods/item-shelving/hasItemOlder')(Self);
}; };

View File

@ -20,7 +20,6 @@ import './botanical';
import './barcode'; import './barcode';
import './summary'; import './summary';
import './waste/index/'; import './waste/index/';
import './waste/detail';
import './fixed-price'; import './fixed-price';
import './fixed-price-search-panel'; import './fixed-price-search-panel';
import './item-type'; import './item-type';

View File

@ -1,43 +0,0 @@
<vn-crud-model auto-load="true"
vn-id="model"
url="Items/getWasteByItem"
params="$ctrl.$params"
data="details">
</vn-crud-model>
<vn-data-viewer model="model">
<vn-card class="vn-w-md">
<section ng-repeat="detail in details" class="vn-pa-md">
<vn-horizontal class="header">
<h5>{{detail.family}} ({{detail.buyer}})</h5>
</vn-horizontal>
<vn-table>
<vn-thead>
<vn-tr>
<vn-th shrink>Item</vn-th>
<vn-th number>Percentage</vn-th>
<vn-th number>Dwindle</vn-th>
<vn-th number>Total</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="waste in detail.lines">
<vn-td shrink>
<span
ng-click="itemDescriptor.show($event, waste.itemFk)"
class="link">
{{::waste.itemFk}}
</span>
</vn-td>
<vn-td number>{{::(waste.percentage / 100) | percentage: 2}}</vn-td>
<vn-td number>{{::waste.dwindle | currency: 'EUR'}}</vn-td>
<vn-td number>{{::waste.total | currency: 'EUR'}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</section>
</vn-card>
</vn-data-viewer>
<vn-item-descriptor-popover
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>

View File

@ -1,7 +0,0 @@
import ngModule from '../../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnItemWasteDetail', {
template: require('./index.html'),
controller: Section
});

View File

@ -1,25 +0,0 @@
@import "variables";
vn-item-waste {
.header {
margin-bottom: 16px;
text-transform: uppercase;
font-size: 1.25rem;
line-height: 1;
padding: 7px;
padding-bottom: 7px;
padding-bottom: 4px;
font-weight: lighter;
background-color: #fde6ca;
border-bottom: 1px solid #f7931e;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
vn-table vn-th.waste-family,
vn-table vn-td.waste-family {
max-width: 64px;
width: 64px
}
}

View File

@ -1,49 +1,2 @@
<vn-crud-model auto-load="true" <vn-card>
vn-id="model" </vn-card>
url="Items/getWasteByWorker"
data="details">
</vn-crud-model>
<vn-data-viewer model="model">
<vn-card>
<vn-table>
<vn-thead>
<vn-tr class="header">
<vn-th class="waste-family">Buyer</vn-th>
<vn-th class="waste-family">Family</vn-th>
<vn-th number>Percentage</vn-th>
<vn-th number>Dwindle</vn-th>
<vn-th number>Total</vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody ng-repeat="detail in details" class="vn-mb-md">
<vn-tr class="header">
<vn-td>{{::detail.buyer}}</vn-td>
<vn-td>{{::detail.family}}</vn-td>
<vn-td number>{{::(detail.percentage / 100) | percentage: 2}}</vn-td>
<vn-td number>{{::detail.dwindle | currency: 'EUR'}}</vn-td>
<vn-td number>{{::detail.total | currency: 'EUR'}}</vn-td>
<vn-td shrink>
<vn-icon-button
ng-class="{'hidden': !$ctrl.wasteConfig[detail.buyer].hidden}"
class="arrow pointer"
icon="keyboard_arrow_up"
vn-tooltip="Minimize/Maximize"
ng-click="$ctrl.toggleHidePanel(detail)">
</vn-icon-button>
</vn-td>
</vn-tr>
<a ng-repeat="waste in detail.lines" class="clickable vn-tr"
ui-sref="item.waste.detail({buyer: waste.buyer, family: waste.family})"
ng-show="$ctrl.wasteConfig[detail.buyer].hidden">
<vn-td></vn-td>
<vn-td>{{::waste.family}}</vn-td>
<vn-td number>{{::(waste.percentage / 100) | percentage: 2}}</vn-td>
<vn-td number>{{::waste.dwindle | currency: 'EUR'}}</vn-td>
<vn-td number>{{::waste.total | currency: 'EUR'}}</vn-td>
<vn-td shrink></vn-td>
</a>
</vn-tbody>
</vn-table>
</vn-card>
</vn-data-viewer>

View File

@ -5,27 +5,11 @@ import './style.scss';
export default class Controller extends Section { export default class Controller extends Section {
constructor($element, $) { constructor($element, $) {
super($element, $); super($element, $);
this.getWasteConfig();
} }
getWasteConfig() { async $onInit() {
return this.wasteConfig = JSON.parse(localStorage.getItem('wasteConfig')) || {}; this.$state.go('item.index');
} window.location.href = 'https://grafana.verdnatura.es/d/TTNXQAxVk';
setWasteConfig() {
localStorage.setItem('wasteConfig', JSON.stringify(this.wasteConfig));
}
toggleHidePanel(detail) {
if (!this.wasteConfig[detail.buyer]) {
this.wasteConfig[detail.buyer] = {
hidden: true
};
} else
this.wasteConfig[detail.buyer].hidden = !this.wasteConfig[detail.buyer].hidden;
this.setWasteConfig();
} }
} }

View File

@ -1,53 +0,0 @@
import './index.js';
import crudModel from 'core/mocks/crud-model';
describe('Item', () => {
describe('Component vnItemWasteIndex', () => {
let $scope;
let controller;
beforeEach(ngModule('item'));
beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$scope.model = crudModel;
const $element = angular.element('<vn-item-waste-index></vn-item-waste-index>');
controller = $componentController('vnItemWasteIndex', {$element, $scope});
}));
describe('getWasteConfig / setWasteConfig', () => {
it('should return the local storage wasteConfig', () => {
const result = controller.getWasteConfig();
expect(result).toEqual({});
});
it('should set and return the local storage wasteConfig', () => {
controller.wasteConfig = {salesPerson: {hidden: true}};
controller.setWasteConfig();
const result = controller.getWasteConfig();
expect(result).toEqual(controller.wasteConfig);
});
});
describe('toggleHidePanel()', () => {
it('should make details hidden by default', () => {
controller.wasteConfig = {};
controller.toggleHidePanel({buyer: 'salesPerson'});
expect(controller.wasteConfig.salesPerson.hidden).toEqual(true);
});
it('should toggle hidden false', () => {
controller.wasteConfig = {salesPerson: {hidden: true}};
controller.toggleHidePanel({buyer: 'salesPerson'});
expect(controller.wasteConfig.salesPerson.hidden).toEqual(false);
});
});
});
});

View File

@ -92,10 +92,11 @@ module.exports = Self => {
// Calculate items // Calculate items
const order = await Self.findById(orderFk, null, myOptions); const order = await Self.findById(orderFk, null, myOptions);
stmts.push(new ParameterizedSQL( stmts.push(new ParameterizedSQL(
'CALL vn.catalog_calculate(?, ?, ?)', [ 'CALL vn.catalog_calculate(?, ?, ?, ?)', [
order.landed, order.landed,
order.address_id, order.address_id,
order.agency_id, order.agency_id,
false
] ]
)); ));

View File

@ -64,10 +64,11 @@ module.exports = Self => {
stmts.push(stmt); stmts.push(stmt);
stmt = new ParameterizedSQL( stmt = new ParameterizedSQL(
'CALL vn.catalog_calculate(?, ?, ?)', [ 'CALL vn.catalog_calculate(?, ?, ?,?)', [
order.landed, order.landed,
order.addressFk, order.addressFk,
order.agencyModeFk, order.agencyModeFk,
false
] ]
); );
stmts.push(stmt); stmts.push(stmt);

View File

@ -30,7 +30,7 @@ module.exports = Self => {
path: '/downloadCmrsZip', path: '/downloadCmrsZip',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.downloadCmrsZip = async function(ctx, ids, options) { Self.downloadCmrsZip = async function(ctx, ids, options) {

View File

@ -30,7 +30,7 @@ module.exports = Self => {
path: '/downloadZip', path: '/downloadZip',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });
Self.downloadZip = async function(ctx, id, options) { Self.downloadZip = async function(ctx, id, options) {

View File

@ -35,7 +35,7 @@ module.exports = Self => {
path: '/:id/driver-route-pdf', path: '/:id/driver-route-pdf',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] //accessScopes: ['read:multimedia']
}); });

View File

@ -35,16 +35,18 @@ export default class Controller extends Section {
showRouteReport() { showRouteReport() {
const routesIds = []; const routesIds = [];
const access_token = this.vnToken.tokenMultimedia;
for (let route of this.checked) for (let route of this.checked)
routesIds.push(route.id); routesIds.push(route.id);
const stringRoutesIds = routesIds.join(','); const stringRoutesIds = routesIds.join(',');
if (this.checked.length <= 1) { if (this.checked.length <= 1) {
const url = `api/Routes/${stringRoutesIds}/driver-route-pdf?access_token=${this.vnToken.tokenMultimedia}`; const url = `api/Routes/${stringRoutesIds}/driver-route-pdf?access_token=${access_token}`;
window.open(url, '_blank'); window.open(url, '_blank');
} else { } else {
const serializedParams = this.$httpParamSerializer({ const serializedParams = this.$httpParamSerializer({
access_token: this.vnToken.token, access_token,
id: stringRoutesIds id: stringRoutesIds
}); });
const url = `api/Routes/downloadZip?${serializedParams}`; const url = `api/Routes/downloadZip?${serializedParams}`;

View File

@ -45,7 +45,7 @@ module.exports = Self => {
path: '/:id/campaign-metrics-pdf', path: '/:id/campaign-metrics-pdf',
verb: 'GET' verb: 'GET'
}, },
accessScopes: ['read:multimedia'] // accessScopes: ['read:multimedia']
}); });
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics'); Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics');

View File

@ -0,0 +1,59 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('downloadFile', {
description: 'Get the supplier file',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'Number',
description: 'The file id',
http: {source: 'path'}
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
},
{
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
},
{
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: `/:id/downloadFile`,
verb: 'GET'
}
});
Self.downloadFile = async function(ctx, id) {
const models = Self.app.models;
const SupplierContainer = models.SupplierContainer;
const dms = await models.Dms.findById(id);
const pathHash = SupplierContainer.getHash(dms.id);
try {
await SupplierContainer.getFile(pathHash, dms.file);
} catch (e) {
if (e.code != 'ENOENT')
throw e;
const error = new UserError(`File doesn't exists`);
error.statusCode = 404;
throw error;
}
const stream = SupplierContainer.downloadStream(pathHash, dms.file);
return [stream, dms.contentType, `filename="${dms.file}"`];
};
};

View File

@ -0,0 +1,53 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('removeFile', {
description: 'Removes a entry document',
accessType: 'WRITE',
accepts: {
arg: 'id',
type: 'number',
description: 'The file id',
http: {source: 'path'}
},
returns: {
type: 'object',
root: true
},
http: {
path: `/:id/removeFile`,
verb: 'POST'
}
});
Self.removeFile = async(ctx, id, options) => {
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const targetSupplierDms = await Self.findById(id, null, myOptions);
const targetDms = await Self.app.models.Dms.removeFile(ctx, targetSupplierDms.dmsFk, myOptions);
if (!targetDms)
throw new UserError('Try again');
const supplierDmsDestroyed = await targetSupplierDms.destroy(myOptions);
if (tx) await tx.commit();
return supplierDmsDestroyed;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -0,0 +1,86 @@
module.exports = Self => {
Self.remoteMethodCtx('uploadFile', {
description: 'Upload and attach a file',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',
description: 'The supplier id',
http: {source: 'path'}
},
{
arg: 'warehouseId',
type: 'number',
description: 'The warehouse id',
required: true
},
{
arg: 'companyId',
type: 'number',
description: 'The company id',
required: true
},
{
arg: 'dmsTypeId',
type: 'number',
description: 'The dms type id',
required: true
},
{
arg: 'reference',
type: 'string',
required: true
},
{
arg: 'description',
type: 'string',
required: true
},
{
arg: 'hasFile',
type: 'boolean',
description: 'True if has an attached file',
required: true
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/:id/uploadFile`,
verb: 'POST'
}
});
Self.uploadFile = async(ctx, id, options) => {
const {Dms, SupplierDms} = Self.app.models;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
const promises = uploadedFiles.map(dms => SupplierDms.create({
supplierFk: id,
dmsFk: dms.id
}, myOptions));
await Promise.all(promises);
if (tx) await tx.commit();
return uploadedFiles;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -5,6 +5,12 @@
"Supplier": { "Supplier": {
"dataSource": "vn" "dataSource": "vn"
}, },
"SupplierDms": {
"dataSource": "vn"
},
"SupplierContainer": {
"dataSource": "supplierStorage"
},
"SupplierAddress": { "SupplierAddress": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,10 @@
{
"name": "SupplierContainer",
"base": "Container",
"acls": [{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}]
}

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