7199-devToTest_2316 #2287
|
@ -10,3 +10,4 @@ print.*.json
|
|||
db.json
|
||||
junit.xml
|
||||
.DS_Store
|
||||
storage
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -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/),
|
||||
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
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2408.01] - 2024-02-22
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
## [2406.01] - 2024-02-08
|
||||
|
||||
### Added
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: `/:id/downloadFile`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadFile = async function(ctx, id) {
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
|||
path: `/:id/download`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async function(id, fileCabinet, filter) {
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = Self => {
|
|||
path: `/:collection/:size/:id/download`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async function(ctx, collection, size, id) {
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = Self => {
|
|||
html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`;
|
||||
|
||||
const subjectReason = httpRequest?.data?.error;
|
||||
smtp.send({
|
||||
await smtp.send({
|
||||
to: `${config.app.reportEmail}, ${emailUser.email}`,
|
||||
subject:
|
||||
'[Support-Salix] ' +
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
DELETE FROM salix.ACL
|
||||
WHERE model = 'MailAliasAccount'
|
||||
AND property = 'canEditAlias'
|
||||
AND principalType = 'ROLE'
|
||||
AND principalId = 'marketingBoss';
|
|
@ -3,7 +3,7 @@ USE `util`;
|
|||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
INSERT INTO `version` VALUES ('vn-database','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','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','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','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','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','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','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','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','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);
|
||||
|
@ -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','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','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','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);
|
||||
|
@ -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','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','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','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','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','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','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 */;
|
||||
/*!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 (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 (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 (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);
|
||||
|
@ -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 (276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing');
|
||||
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 (284,'LdapConfig','*','*','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 (806,'ExpeditionPallet','getPallet','READ','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 (810,'SaleTracking','updateTracking','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 (818,'ExpeditionPallet','*','READ','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 (2,'Client','contact','update','employee');
|
||||
|
@ -2492,7 +2523,7 @@ USE `cache`;
|
|||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
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 (4,'last_buy','23:59:00');
|
||||
INSERT INTO `cache` VALUES (5,'weekly_sales','12:00:00');
|
||||
|
|
|
@ -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 ('','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 ('','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 ('','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');
|
||||
|
@ -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 ('','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 ('','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 `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','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 ('','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','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','');
|
||||
|
@ -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','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','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 `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','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','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 ('','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','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');
|
||||
|
@ -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','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','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 ('','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');
|
||||
|
@ -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_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','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 ('','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');
|
||||
|
@ -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','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 ('','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 ('','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');
|
||||
|
@ -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','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 ('','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','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');
|
||||
|
@ -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 ('','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 ('','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 ('','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}');
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2289,17 +2289,26 @@ trig: BEGIN
|
|||
DECLARE vGroupingMode TINYINT;
|
||||
DECLARE vGenericFk INT;
|
||||
DECLARE vGenericInDate BOOL;
|
||||
DECLARE vBuyerFk INT;
|
||||
|
||||
IF @isModeInventory THEN
|
||||
LEAVE trig;
|
||||
END IF;
|
||||
|
||||
CALL entry_checkBooked(NEW.entryFk);
|
||||
IF NEW.printedStickers <> 0 THEN
|
||||
CALL util.throw('it is not possible to create buy lines with printedstickers other than 0');
|
||||
END IF;
|
||||
|
||||
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`);
|
||||
|
||||
SELECT t.warehouseInFk, t.landed
|
||||
|
@ -2409,11 +2418,13 @@ trig:BEGIN
|
|||
DECLARE vGenericInDate BOOL;
|
||||
DECLARE vIsInventory BOOL;
|
||||
DECLARE vDefaultEntry INT;
|
||||
DECLARE vBuyerFk INT;
|
||||
|
||||
IF @isTriggerDisabled THEN
|
||||
LEAVE trig;
|
||||
END IF;
|
||||
|
||||
CALL entry_checkBooked(OLD.entryFk);
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
SELECT defaultEntry INTO vDefaultEntry
|
||||
|
@ -2467,6 +2478,15 @@ trig:BEGIN
|
|||
SET NEW.isIgnored = TRUE;
|
||||
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
|
||||
NOT (OLD.entryFk <=> NEW.entryFk) THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||
|
@ -2557,10 +2577,11 @@ DELIMITER ;
|
|||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete`
|
||||
BEFORE DELETE ON buy
|
||||
FOR EACH ROW
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete`
|
||||
BEFORE DELETE ON `buy`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL entry_checkBooked(OLD.entryFk);
|
||||
IF OLD.printedStickers <> 0 THEN
|
||||
CALL util.throw("it is not possible to delete buys with printed labels ");
|
||||
END IF;
|
||||
|
@ -4675,6 +4696,10 @@ BEGIN
|
|||
DECLARE vPrintedCount INT;
|
||||
DECLARE vHasDistinctWarehouses BOOL;
|
||||
|
||||
IF NEW.isBooked = OLD.isBooked THEN
|
||||
CALL entry_checkBooked(OLD.id);
|
||||
END IF;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
||||
|
@ -4777,6 +4802,7 @@ DELIMITER ;;
|
|||
BEFORE DELETE ON `entry`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL entry_checkBooked(OLD.id);
|
||||
DELETE FROM buy WHERE entryFk = OLD.id;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
|
@ -10087,6 +10113,10 @@ BEGIN
|
|||
CALL util.throw('The travel has entries with booked invoices');
|
||||
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 */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10126,10 +10156,6 @@ BEGIN
|
|||
CALL buy_checkItem();
|
||||
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 */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10836,6 +10862,7 @@ DELIMITER ;;
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10856,6 +10883,7 @@ DELIMITER ;;
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10865,11 +10893,11 @@ DELIMITER ;
|
|||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||
/*!50003 SET character_set_client = utf8mb3 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb3 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb3_general_ci */ ;
|
||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete`
|
||||
AFTER DELETE ON `zoneIncluded`
|
||||
|
@ -10880,6 +10908,7 @@ BEGIN
|
|||
`changedModel` = 'zoneIncluded',
|
||||
`changedModelId` = OLD.zoneFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -10962,4 +10991,4 @@ USE `vn2008`;
|
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!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
|
||||
|
|
|
@ -156,16 +156,16 @@ INSERT INTO `vn`.`occupationCode` (`code`, `name`)
|
|||
('b', 'Representantes de comercio'),
|
||||
('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
|
||||
(36,'46/10515497-58',6,20,189,'2009-01-02',5,10,0),
|
||||
(43,'46/10235353-50',7,20,189,'2009-04-21',5,10,0),
|
||||
(76,'46/10250562-30',1,20,189,'2009-09-07',9,5,0),
|
||||
(1106,'46/10297768-94',4,20,100,'2021-03-09',7,18,0),
|
||||
(1107,'46/1627085-11',15,20,402,'2021-03-15',9,6,1),
|
||||
(1108,'46/10446901-41',25,20,502,'2021-03-22',10,29,1),
|
||||
(1109,'46/10552113-8',3,20,402,'2021-03-23',9,9,1),
|
||||
(1110,'46/10723579-75',3,20,402,'2021-03-23',9,9,1);
|
||||
(36,20),
|
||||
(43,20),
|
||||
(76,20),
|
||||
(1106,20),
|
||||
(1107,20),
|
||||
(1108,20),
|
||||
(1109,20),
|
||||
(1110,20);
|
||||
|
||||
INSERT INTO `vn`.`trainingCourseType` (`id`, `name`)
|
||||
VALUES
|
||||
|
|
|
@ -2400,7 +2400,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
|||
(18, 'dua', NULL, NULL, 'dua'),
|
||||
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
||||
(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`)
|
||||
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()),
|
||||
(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()),
|
||||
(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`)
|
||||
VALUES
|
||||
|
@ -3221,7 +3223,6 @@ INSERT INTO vn.buy
|
|||
packing = 20,
|
||||
`grouping` = 1,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3260,7 +3261,6 @@ INSERT INTO vn.buy
|
|||
packing = 40,
|
||||
`grouping` = 5,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3299,7 +3299,6 @@ INSERT INTO vn.buy
|
|||
packing = 10,
|
||||
`grouping` = 5,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3346,7 +3345,6 @@ INSERT INTO vn.buy
|
|||
packing = 20,
|
||||
`grouping` = 4,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3385,7 +3383,6 @@ INSERT INTO vn.buy
|
|||
packing = 20,
|
||||
`grouping` = 1,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3425,7 +3422,6 @@ INSERT INTO vn.buy
|
|||
packing = 200,
|
||||
`grouping` = 30,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3465,7 +3461,6 @@ INSERT INTO vn.buy
|
|||
packing = 500,
|
||||
`grouping` = 10,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3505,7 +3500,6 @@ INSERT INTO vn.buy
|
|||
packing = 300,
|
||||
`grouping` = 50,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3545,7 +3539,6 @@ INSERT INTO vn.buy
|
|||
packing = 50,
|
||||
`grouping` = 5,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 1,
|
||||
price2 = 1,
|
||||
price3 = 1,
|
||||
|
@ -3586,7 +3579,6 @@ INSERT vn.buy
|
|||
packing = 5,
|
||||
`grouping` = 2,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 7,
|
||||
price2 = 7,
|
||||
price3 = 7,
|
||||
|
@ -3626,7 +3618,6 @@ INSERT vn.buy
|
|||
packing = 100,
|
||||
`grouping` = 5,
|
||||
groupingMode = 1,
|
||||
packageFk = 94,
|
||||
price1 = 7,
|
||||
price2 = 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)
|
||||
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);
|
||||
|
|
|
@ -32,7 +32,7 @@ BEGIN
|
|||
WHERE c.available > 0
|
||||
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;
|
||||
END$$
|
||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT vSelf itemFk;
|
||||
|
||||
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
|
||||
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
||||
|
||||
SELECT l.warehouseFk, w.name warehouse,
|
||||
p.`grouping`, p.price, p.rate, l.available
|
||||
|
|
|
@ -27,7 +27,7 @@ BEGIN
|
|||
WHERE orderFk = vSelf
|
||||
GROUP BY itemFk;
|
||||
|
||||
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
|
||||
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.item;
|
||||
END$$
|
||||
|
|
|
@ -22,7 +22,7 @@ BEGIN
|
|||
FROM `order`
|
||||
WHERE id = vSelf;
|
||||
|
||||
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
|
||||
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
|
||||
|
||||
IF account.myUser_getName() = 'visitor' THEN
|
||||
UPDATE tmp.ticketCalculateItem
|
||||
|
|
|
@ -7,9 +7,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
|
|||
DO BEGIN
|
||||
UPDATE account.user u
|
||||
JOIN client c ON c.id = u.id
|
||||
JOIN clientType ct ON ct.id = c.typeFk
|
||||
SET u.active = FALSE
|
||||
WHERE ct.code = 'normal'
|
||||
WHERE c.typeFk = 'normal'
|
||||
AND u.id NOT IN (
|
||||
SELECT DISTINCT c.id
|
||||
FROM client c
|
||||
|
|
|
@ -20,6 +20,7 @@ BEGIN
|
|||
|
||||
CALL vn.addressTaxArea();
|
||||
SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.addressCompany,
|
||||
tmp.addressTaxArea;
|
||||
|
|
|
@ -13,8 +13,11 @@ BEGIN
|
|||
|
||||
SELECT `value` INTO price
|
||||
FROM vn.specialPrice
|
||||
WHERE itemFk = vItemFk
|
||||
AND clientFk = vClientFk ;
|
||||
WHERE itemFk = vItemFk
|
||||
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;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -20,7 +20,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT vItemFk itemFk;
|
||||
|
||||
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
|
||||
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, TRUE);
|
||||
DROP TEMPORARY TABLE tmp.item;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
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
|
||||
/**
|
||||
* Calcula los articulos disponibles y sus precios
|
||||
|
@ -25,7 +29,7 @@ BEGIN
|
|||
|
||||
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;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot(
|
||||
|
|
|
@ -25,6 +25,19 @@ BEGIN
|
|||
FROM address
|
||||
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
|
||||
(PRIMARY KEY (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
|
@ -44,8 +57,7 @@ BEGIN
|
|||
JOIN item i ON i.id = tl.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
LEFT JOIN specialPrice sp ON sp.itemFk = i.id
|
||||
AND sp.clientFk = vClientFk
|
||||
LEFT JOIN tSpecialPrice sp ON sp.itemFk = i.id
|
||||
LEFT JOIN (
|
||||
SELECT * FROM (
|
||||
SELECT pf.itemFk,
|
||||
|
@ -146,7 +158,7 @@ BEGIN
|
|||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount'
|
||||
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
|
||||
WHERE sp.value IS NULL
|
||||
AND i.supplyResponseFk IS NULL;
|
||||
|
@ -169,7 +181,7 @@ BEGIN
|
|||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN vn.component c2 ON c2.code = 'salePerPackage'
|
||||
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;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.`zone` (INDEX (id))
|
||||
|
@ -208,7 +220,7 @@ BEGIN
|
|||
sp.value - SUM(tcc.cost) sumCost
|
||||
FROM tmp.ticketComponentCopy tcc
|
||||
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'
|
||||
WHERE c.classRate IS NULL
|
||||
AND tcc.warehouseFk = vWarehouseFk
|
||||
|
@ -289,6 +301,7 @@ BEGIN
|
|||
tmp.ticketComponentSum,
|
||||
tmp.ticketComponentBase,
|
||||
tmp.ticketComponentRate,
|
||||
tmp.ticketComponentCopy;
|
||||
tmp.ticketComponentCopy,
|
||||
tSpecialPrice;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -30,6 +30,7 @@ BEGIN
|
|||
DELETE IGNORE FROM expedition WHERE created < v26Months;
|
||||
DELETE FROM sms WHERE created < v18Months;
|
||||
DELETE FROM saleTracking WHERE created < v1Years;
|
||||
DELETE FROM productionError WHERE dated < v1Years;
|
||||
DELETE FROM ticketTracking WHERE created < v18Months;
|
||||
DELETE tobs FROM ticketObservation tobs
|
||||
JOIN ticket t ON tobs.ticketFk = t.id
|
||||
|
|
|
@ -15,6 +15,13 @@ proc:BEGIN
|
|||
DECLARE vHasTooMuchCollections BOOL;
|
||||
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
|
||||
CALL collection_get(vUserFk);
|
||||
|
||||
|
|
|
@ -219,9 +219,11 @@ proc:BEGIN
|
|||
UPDATE tmp.productionBuffer pb
|
||||
JOIN (
|
||||
SELECT SUM(litros) liters,
|
||||
@lines:= COUNT(*) + @lines `lines`,
|
||||
@lines:= COUNT(*) + @lines,
|
||||
COUNT(*) `lines`,
|
||||
MAX(i.`size`) height,
|
||||
@volume := SUM(sv.volume) + @volume volume
|
||||
@volume := SUM(sv.volume) + @volume,
|
||||
SUM(sv.volume) volume
|
||||
FROM saleVolume sv
|
||||
JOIN sale s ON s.id = sv.saleFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
|
|
|
@ -7,81 +7,81 @@ BEGIN
|
|||
* @param vSelf company id
|
||||
* @param vMonthAgo time interval to be consulted
|
||||
*/
|
||||
DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE());
|
||||
DECLARE vCurrencyEuroFk INT;
|
||||
DECLARE vStartDate DATE;
|
||||
DECLARE vInvalidBalances DOUBLE;
|
||||
DECLARE vStartingDate DATETIME DEFAULT TIMESTAMPADD (MONTH,- vMonthsAgo,util.VN_CURDATE());
|
||||
DECLARE vCurrencyEuroFk INT;
|
||||
DECLARE vStartDate DATE;
|
||||
DECLARE vInvalidBalances DOUBLE;
|
||||
|
||||
SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig;
|
||||
SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR';
|
||||
SELECT dated, invalidBalances INTO vStartDate, vInvalidBalances FROM supplierDebtConfig;
|
||||
SELECT id INTO vCurrencyEuroFk FROM currency WHERE code = 'EUR';
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tOpeningBalances;
|
||||
CREATE TEMPORARY TABLE tOpeningBalances (
|
||||
supplierFk INT NOT NULL,
|
||||
companyFk INT NOT NULL,
|
||||
openingBalances DOUBLE NOT NULL,
|
||||
closingBalances DOUBLE NOT NULL,
|
||||
currencyFk INT NOT NULL,
|
||||
PRIMARY KEY (supplierFk, companyFk, currencyFk)
|
||||
) ENGINE = MEMORY;
|
||||
DROP TEMPORARY TABLE IF EXISTS tOpeningBalances;
|
||||
CREATE TEMPORARY TABLE tOpeningBalances (
|
||||
supplierFk INT NOT NULL,
|
||||
companyFk INT NOT NULL,
|
||||
openingBalances DOUBLE NOT NULL,
|
||||
closingBalances DOUBLE NOT NULL,
|
||||
currencyFk INT NOT NULL,
|
||||
PRIMARY KEY (supplierFk, companyFk, currencyFk)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
-- Calculates the opening and closing balance for each supplier
|
||||
INSERT INTO tOpeningBalances
|
||||
SELECT supplierFk,
|
||||
companyFk,
|
||||
SUM(amount * isBeforeStarting) AS openingBalances,
|
||||
SUM(amount) closingBalances,
|
||||
currencyFk
|
||||
FROM (
|
||||
SELECT p.supplierFk,
|
||||
-- Calculates the opening and closing balance for each supplier
|
||||
INSERT INTO tOpeningBalances
|
||||
SELECT supplierFk,
|
||||
companyFk,
|
||||
SUM(amount * isBeforeStarting) AS openingBalances,
|
||||
SUM(amount) closingBalances,
|
||||
currencyFk
|
||||
FROM (
|
||||
SELECT p.supplierFk,
|
||||
p.companyFk,
|
||||
IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount,
|
||||
p.dueDated < vStartingDate isBeforeStarting,
|
||||
p.currencyFk
|
||||
FROM payment p
|
||||
WHERE p.received > vStartDate
|
||||
AND p.companyFk = vSelf
|
||||
UNION ALL
|
||||
SELECT r.supplierFk,
|
||||
FROM payment p
|
||||
WHERE p.received > vStartDate
|
||||
AND p.companyFk = vSelf
|
||||
UNION ALL
|
||||
SELECT r.supplierFk,
|
||||
r.companyFk,
|
||||
- IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total,
|
||||
rv.dueDated < vStartingDate isBeforeStarting,
|
||||
r.currencyFk
|
||||
FROM invoiceIn r
|
||||
INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
|
||||
WHERE r.issued > vStartDate
|
||||
AND r.isBooked
|
||||
AND r.companyFk = vSelf
|
||||
) sub GROUP BY companyFk, supplierFk, currencyFk;
|
||||
FROM invoiceIn r
|
||||
INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk
|
||||
WHERE r.issued > vStartDate
|
||||
AND r.isBooked
|
||||
AND r.companyFk = vSelf
|
||||
) sub GROUP BY companyFk, supplierFk, currencyFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tPendingDuedates;
|
||||
CREATE TEMPORARY TABLE tPendingDuedates (
|
||||
id INT auto_increment,
|
||||
DROP TEMPORARY TABLE IF EXISTS tPendingDuedates;
|
||||
CREATE TEMPORARY TABLE tPendingDuedates (
|
||||
id INT auto_increment,
|
||||
expirationId INT,
|
||||
dated DATE,
|
||||
supplierFk INT NOT NULL,
|
||||
companyFk INT NOT NULL,
|
||||
amount DECIMAL(10, 2) NOT NULL,
|
||||
currencyFk INT NOT NULL,
|
||||
pending DECIMAL(10, 2) DEFAULT 0,
|
||||
balance DECIMAL(10, 2) DEFAULT 0,
|
||||
endingBalance DECIMAL(10, 2) DEFAULT 0,
|
||||
isPayment BOOLEAN,
|
||||
isReconciled BOOLEAN,
|
||||
PRIMARY KEY (id),
|
||||
INDEX (supplierFk, companyFk, currencyFk)
|
||||
) ENGINE = MEMORY;
|
||||
dated DATE,
|
||||
supplierFk INT NOT NULL,
|
||||
companyFk INT NOT NULL,
|
||||
amount DECIMAL(10, 2) NOT NULL,
|
||||
currencyFk INT NOT NULL,
|
||||
pending DECIMAL(10, 2) DEFAULT 0,
|
||||
balance DECIMAL(10, 2) DEFAULT 0,
|
||||
endingBalance DECIMAL(10, 2) DEFAULT 0,
|
||||
isPayment BOOLEAN,
|
||||
isReconciled BOOLEAN,
|
||||
PRIMARY KEY (id),
|
||||
INDEX (supplierFk, companyFk, currencyFk)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
INSERT INTO tPendingDuedates (
|
||||
expirationId,
|
||||
dated,
|
||||
supplierFk,
|
||||
companyFk,
|
||||
amount,
|
||||
currencyFk,
|
||||
isPayment,
|
||||
isReconciled
|
||||
)SELECT p.id,
|
||||
INSERT INTO tPendingDuedates (
|
||||
expirationId,
|
||||
dated,
|
||||
supplierFk,
|
||||
companyFk,
|
||||
amount,
|
||||
currencyFk,
|
||||
isPayment,
|
||||
isReconciled
|
||||
)SELECT p.id,
|
||||
p.dueDated,
|
||||
p.supplierFk,
|
||||
p.companyFk,
|
||||
|
@ -111,69 +111,69 @@ BEGIN
|
|||
AND r.isBooked
|
||||
AND r.companyFk = vSelf
|
||||
ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id;
|
||||
-- Now, we calculate the outstanding amount for each receipt in descending order
|
||||
SET @risk := 0.0;
|
||||
SET @supplier := 0.0;
|
||||
SET @company := 0.0;
|
||||
SET @moneda := 0.0;
|
||||
SET @pending := 0.0;
|
||||
SET @day := util.VN_CURDATE();
|
||||
-- Now, we calculate the outstanding amount for each receipt in descending order
|
||||
SET @risk := 0.0;
|
||||
SET @supplier := 0.0;
|
||||
SET @company := 0.0;
|
||||
SET @moneda := 0.0;
|
||||
SET @pending := 0.0;
|
||||
SET @day := util.VN_CURDATE();
|
||||
|
||||
UPDATE tPendingDuedates vp
|
||||
LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk
|
||||
AND vp.supplierFk = si.supplierFk
|
||||
AND vp.currencyFk = si.currencyFk
|
||||
SET vp.balance = @risk := (
|
||||
IF (
|
||||
@company <> vp.companyFk
|
||||
OR @supplier <> vp.supplierFk
|
||||
OR @moneda <> vp.currencyFk,
|
||||
IFNULL(si.openingBalances, 0),
|
||||
@risk
|
||||
) +
|
||||
vp.amount
|
||||
),
|
||||
-- if there is a change of company or supplier or currency, the balance is reset
|
||||
vp.pending = @pending := IF (
|
||||
@company <> vp.companyFk
|
||||
OR @supplier <> vp.supplierFk
|
||||
OR @moneda <> vp.currencyFk
|
||||
OR @day <> vp.dated,
|
||||
vp.amount * (NOT vp.isPayment),
|
||||
@pending + vp.amount
|
||||
),
|
||||
vp.companyFk = @company := vp.companyFk,
|
||||
vp.supplierFk = @supplier := vp.supplierFk,
|
||||
vp.currencyFk = @moneda := vp.currencyFk,
|
||||
vp.dated = @day := vp.dated,
|
||||
vp.balance = @risk,
|
||||
vp.pending = @pending;
|
||||
UPDATE tPendingDuedates vp
|
||||
LEFT JOIN tOpeningBalances si ON vp.companyFk = si.companyFk
|
||||
AND vp.supplierFk = si.supplierFk
|
||||
AND vp.currencyFk = si.currencyFk
|
||||
SET vp.balance = @risk := (
|
||||
IF (
|
||||
@company <> vp.companyFk
|
||||
OR @supplier <> vp.supplierFk
|
||||
OR @moneda <> vp.currencyFk,
|
||||
IFNULL(si.openingBalances, 0),
|
||||
@risk
|
||||
) +
|
||||
vp.amount
|
||||
),
|
||||
-- if there is a change of company or supplier or currency, the balance is reset
|
||||
vp.pending = @pending := IF (
|
||||
@company <> vp.companyFk
|
||||
OR @supplier <> vp.supplierFk
|
||||
OR @moneda <> vp.currencyFk
|
||||
OR @day <> vp.dated,
|
||||
vp.amount * (NOT vp.isPayment),
|
||||
@pending + vp.amount
|
||||
),
|
||||
vp.companyFk = @company := vp.companyFk,
|
||||
vp.supplierFk = @supplier := vp.supplierFk,
|
||||
vp.currencyFk = @moneda := vp.currencyFk,
|
||||
vp.dated = @day := vp.dated,
|
||||
vp.balance = @risk,
|
||||
vp.pending = @pending;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY
|
||||
SELECT expirationId,
|
||||
dated,
|
||||
supplierFk,
|
||||
companyFk,
|
||||
currencyFk,
|
||||
balance
|
||||
FROM tPendingDuedates
|
||||
WHERE balance < vInvalidBalances
|
||||
AND balance > - vInvalidBalances;
|
||||
CREATE OR REPLACE TEMPORARY TABLE tRowsToDelete ENGINE = MEMORY
|
||||
SELECT expirationId,
|
||||
dated,
|
||||
supplierFk,
|
||||
companyFk,
|
||||
currencyFk,
|
||||
balance
|
||||
FROM tPendingDuedates
|
||||
WHERE 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;
|
||||
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 NOT vp.isPayment;
|
||||
|
||||
SELECT vp.expirationId,
|
||||
vp.dated,
|
||||
vp.supplierFk,
|
||||
SELECT vp.expirationId,
|
||||
vp.dated,
|
||||
vp.supplierFk,
|
||||
vp.companyFk,
|
||||
vp.currencyFk,
|
||||
vp.amount,
|
||||
|
@ -183,15 +183,19 @@ BEGIN
|
|||
vp.isPayment,
|
||||
vp.isReconciled,
|
||||
vp.endingBalance,
|
||||
cr.amount clientRiskAmount
|
||||
FROM tPendingDuedates vp
|
||||
LEFT JOIN supplier s ON s.id = vp.supplierFk
|
||||
LEFT JOIN client c ON c.fi = s.nif
|
||||
LEFT JOIN clientRisk cr ON cr.clientFk = c.id
|
||||
AND cr.companyFk = vp.companyFk;
|
||||
cr.amount clientRiskAmount,
|
||||
co.CEE
|
||||
FROM tPendingDuedates vp
|
||||
LEFT JOIN supplier s ON s.id = vp.supplierFk
|
||||
LEFT JOIN client c ON c.fi = s.nif
|
||||
LEFT JOIN clientRisk cr ON cr.clientFk = c.id
|
||||
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
|
||||
LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||
LEFT JOIN country co ON co.id = be.countryFk
|
||||
AND cr.companyFk = vp.companyFk;
|
||||
|
||||
DROP TEMPORARY TABLE tOpeningBalances;
|
||||
DROP TEMPORARY TABLE tPendingDuedates;
|
||||
DROP TEMPORARY TABLE tRowsToDelete;
|
||||
DROP TEMPORARY TABLE tOpeningBalances;
|
||||
DROP TEMPORARY TABLE tPendingDuedates;
|
||||
DROP TEMPORARY TABLE tRowsToDelete;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -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 ;
|
|
@ -33,6 +33,7 @@ BEGIN
|
|||
ii.operated = IFNULL(ii.operated,d.operated),
|
||||
ii.issued = IFNULL(ii.issued,d.issued),
|
||||
ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
|
||||
e.isBooked = TRUE,
|
||||
e.isConfirmed = TRUE
|
||||
WHERE d.id = vDuaFk;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ BEGIN
|
|||
quantity int(11) DEFAULT '0',
|
||||
buyingValue decimal(10,4) DEFAULT '0.0000',
|
||||
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',
|
||||
groupingMode tinyint(4) NOT NULL DEFAULT 0 ,
|
||||
comissionValue decimal(10,3) DEFAULT '0.000',
|
||||
|
|
|
@ -60,7 +60,11 @@ BEGIN
|
|||
(i.value8 <=> its.value8) match8,
|
||||
a.available,
|
||||
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
|
||||
FROM vn.item i
|
||||
JOIN cache.available a ON a.item_id = i.id
|
||||
|
|
|
@ -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 ;
|
|
@ -46,6 +46,7 @@ BEGIN
|
|||
JOIN parking p ON p.id = sh.parkingFk
|
||||
JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
|
||||
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 saleGroupDetail sgd ON sgd.saleFk = s.id
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
|
||||
|
@ -60,6 +61,7 @@ BEGIN
|
|||
AND ((rm.bufferFk AND rm.isPickingAllowed)
|
||||
OR am.code = 'REC_ALG')
|
||||
AND pb.shipped = vDated
|
||||
AND a.isOwn
|
||||
GROUP BY s.id
|
||||
ORDER BY etd;
|
||||
|
||||
|
|
|
@ -77,7 +77,9 @@ BEGIN
|
|||
vNewItemFk);
|
||||
|
||||
SELECT price INTO vNewPrice
|
||||
FROM tmp.ticketCalculateItem;
|
||||
FROM tmp.ticketComponentPrice
|
||||
ORDER BY (vQuantity % `grouping`) ASC
|
||||
LIMIT 1;
|
||||
|
||||
IF vNewPrice IS NULL THEN
|
||||
CALL util.throw('price retrieval failed');
|
||||
|
|
|
@ -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 ;
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
SELECT id itemFk FROM vn.item
|
||||
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.ticketLot;
|
||||
END$$
|
||||
|
|
|
@ -23,9 +23,5 @@ BEGIN
|
|||
CALL buy_checkItem();
|
||||
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$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -32,5 +32,9 @@ BEGIN
|
|||
CALL util.throw('The travel has entries with booked invoices');
|
||||
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$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -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`
|
|
@ -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`
|
|
@ -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`
|
|
@ -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`
|
|
@ -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`
|
|
@ -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;
|
|
@ -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;
|
|
@ -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';
|
|
@ -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;
|
|
@ -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';
|
|
@ -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.';
|
||||
;
|
|
@ -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;
|
|
@ -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`;
|
|
@ -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';
|
|
@ -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');
|
|
@ -0,0 +1,3 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('SupplierDms', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -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`);
|
|
@ -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';
|
|
@ -0,0 +1 @@
|
|||
CREATE INDEX expeditionLog_action_IDX USING BTREE ON srt.expeditionLog (`action`);
|
|
@ -0,0 +1 @@
|
|||
CREATE INDEX expeditionLog_expeditionFk_IDX USING BTREE ON srt.expeditionLog (expeditionFk);
|
|
@ -0,0 +1,2 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE vn.buy DROP COLUMN packageFk;
|
|
@ -8,7 +8,7 @@ describe('Account Alias create and basic data path', () => {
|
|||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('developer', 'account');
|
||||
await page.loginAndModule('itManagement', 'account');
|
||||
await page.accessToSection('account.alias');
|
||||
});
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
flat
|
||||
round
|
||||
icon="phone"
|
||||
title="MicroSIP"
|
||||
ng-click="$event.stopPropagation();"
|
||||
>
|
||||
</vn-icon>
|
||||
|
|
|
@ -59,7 +59,8 @@ export default class Token {
|
|||
|
||||
getStorage(storage) {
|
||||
this.token = storage.getItem('vnToken');
|
||||
this.tokenMultimedia = storage.getItem('vnTokenMultimedia');
|
||||
// Cambio realizado temporalmente
|
||||
this.tokenMultimedia = this.token; // storage.getItem('vnTokenMultimedia');
|
||||
if (!this.token) return;
|
||||
const created = storage.getItem('vnTokenCreated');
|
||||
this.created = created && new Date(created);
|
||||
|
|
|
@ -117,6 +117,21 @@
|
|||
"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": {
|
||||
"name": "accessStorage",
|
||||
"connector": "loopback-component-storage",
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
path: '/:id/claim-pickup-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order');
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
|||
path: `/:id/downloadFile`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadFile = async function(ctx, id) {
|
||||
|
|
|
@ -96,9 +96,9 @@ module.exports = Self => {
|
|||
// When claimState has been changed
|
||||
if (args.claimStateFk) {
|
||||
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')
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.code);
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = Self => {
|
|||
path: '/:id/campaign-metrics-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics');
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
|||
path: '/:id/entry-order-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order');
|
||||
|
|
|
@ -57,9 +57,6 @@
|
|||
"columnName": "evaNotes"
|
||||
}
|
||||
},
|
||||
"isBlocked": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"loadPriority": {
|
||||
"type": "number"
|
||||
},
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
path: '/:id/download',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async function(ctx, id, options) {
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
path: '/downloadZip',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadZip = async function(ctx, ids, options) {
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
path: '/:reference/exportation-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation');
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
|||
path: '/:reference/invoice-csv',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.invoiceCsv = async reference => {
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = Self => {
|
|||
path: '/negativeBasesCsv',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.negativeBasesCsv = async(ctx, options) => {
|
||||
|
|
|
@ -23,15 +23,16 @@ export default class Controller extends Section {
|
|||
}
|
||||
|
||||
openPdf() {
|
||||
const access_token = this.vnToken.tokenMultimedia;
|
||||
if (this.checked.length <= 1) {
|
||||
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');
|
||||
} else {
|
||||
const invoiceOutIds = this.checked;
|
||||
const invoicesIds = invoiceOutIds.join(',');
|
||||
const serializedParams = this.$httpParamSerializer({
|
||||
access_token: this.vnToken.token,
|
||||
access_token,
|
||||
ids: invoicesIds
|
||||
});
|
||||
const url = `api/InvoiceOuts/downloadZip?${serializedParams}`;
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = Self => {
|
|||
path: `/download`,
|
||||
verb: 'POST',
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async() => {
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -4,4 +4,5 @@ module.exports = Self => {
|
|||
require('../methods/item-shelving/getInventory')(Self);
|
||||
require('../methods/item-shelving/getAlternative')(Self);
|
||||
require('../methods/item-shelving/updateFromSale')(Self);
|
||||
require('../methods/item-shelving/hasItemOlder')(Self);
|
||||
};
|
||||
|
|
|
@ -20,7 +20,6 @@ import './botanical';
|
|||
import './barcode';
|
||||
import './summary';
|
||||
import './waste/index/';
|
||||
import './waste/detail';
|
||||
import './fixed-price';
|
||||
import './fixed-price-search-panel';
|
||||
import './item-type';
|
||||
|
|
|
@ -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>
|
|
@ -1,7 +0,0 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
ngModule.vnComponent('vnItemWasteDetail', {
|
||||
template: require('./index.html'),
|
||||
controller: Section
|
||||
});
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -1,49 +1,2 @@
|
|||
<vn-crud-model auto-load="true"
|
||||
vn-id="model"
|
||||
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>
|
||||
<vn-card>
|
||||
</vn-card>
|
||||
|
|
|
@ -5,27 +5,11 @@ import './style.scss';
|
|||
export default class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
|
||||
this.getWasteConfig();
|
||||
}
|
||||
|
||||
getWasteConfig() {
|
||||
return this.wasteConfig = JSON.parse(localStorage.getItem('wasteConfig')) || {};
|
||||
}
|
||||
|
||||
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();
|
||||
async $onInit() {
|
||||
this.$state.go('item.index');
|
||||
window.location.href = 'https://grafana.verdnatura.es/d/TTNXQAxVk';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -92,10 +92,11 @@ module.exports = Self => {
|
|||
// Calculate items
|
||||
const order = await Self.findById(orderFk, null, myOptions);
|
||||
stmts.push(new ParameterizedSQL(
|
||||
'CALL vn.catalog_calculate(?, ?, ?)', [
|
||||
'CALL vn.catalog_calculate(?, ?, ?, ?)', [
|
||||
order.landed,
|
||||
order.address_id,
|
||||
order.agency_id,
|
||||
false
|
||||
]
|
||||
));
|
||||
|
||||
|
|
|
@ -64,10 +64,11 @@ module.exports = Self => {
|
|||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(
|
||||
'CALL vn.catalog_calculate(?, ?, ?)', [
|
||||
'CALL vn.catalog_calculate(?, ?, ?,?)', [
|
||||
order.landed,
|
||||
order.addressFk,
|
||||
order.agencyModeFk,
|
||||
false
|
||||
]
|
||||
);
|
||||
stmts.push(stmt);
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: '/downloadCmrsZip',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadCmrsZip = async function(ctx, ids, options) {
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: '/downloadZip',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadZip = async function(ctx, id, options) {
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
path: '/:id/driver-route-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -35,16 +35,18 @@ export default class Controller extends Section {
|
|||
|
||||
showRouteReport() {
|
||||
const routesIds = [];
|
||||
const access_token = this.vnToken.tokenMultimedia;
|
||||
|
||||
for (let route of this.checked)
|
||||
routesIds.push(route.id);
|
||||
const stringRoutesIds = routesIds.join(',');
|
||||
|
||||
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');
|
||||
} else {
|
||||
const serializedParams = this.$httpParamSerializer({
|
||||
access_token: this.vnToken.token,
|
||||
access_token,
|
||||
id: stringRoutesIds
|
||||
});
|
||||
const url = `api/Routes/downloadZip?${serializedParams}`;
|
||||
|
|
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
|||
path: '/:id/campaign-metrics-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics');
|
||||
|
|
|
@ -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}"`];
|
||||
};
|
||||
};
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -5,6 +5,12 @@
|
|||
"Supplier": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SupplierDms": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SupplierContainer": {
|
||||
"dataSource": "supplierStorage"
|
||||
},
|
||||
"SupplierAddress": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "SupplierContainer",
|
||||
"base": "Container",
|
||||
"acls": [{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/supplier/supplier-dms/removeFile')(Self);
|
||||
require('../methods/supplier/supplier-dms/downloadFile')(Self);
|
||||
require('../methods/supplier/supplier-dms/uploadFile')(Self);
|
||||
|
||||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(`The file is already attached to another entry`);
|
||||
return err;
|
||||
});
|
||||
};
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "SupplierDms",
|
||||
"base": "VnModel",
|
||||
"mixins": {
|
||||
"Loggable": true
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "supplierDms"
|
||||
}
|
||||
},
|
||||
"allowedContentTypes": [
|
||||
"image/png",
|
||||
"image/jpeg",
|
||||
"image/jpg",
|
||||
"application/pdf"
|
||||
],
|
||||
"properties": {
|
||||
"dmsFk": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"supplier": {
|
||||
"type": "belongsTo",
|
||||
"model": "Supplier",
|
||||
"foreignKey": "supplierFk"
|
||||
},
|
||||
"dms": {
|
||||
"type": "belongsTo",
|
||||
"model": "Dms",
|
||||
"foreignKey": "dmsFk"
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue