Compare commits

...

100 Commits

Author SHA1 Message Date
David Domenech 0c7ca79ae0 Merge branch 'dev' into 6372-Delete-views-from-vn2008
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-14 10:03:49 +00:00
Javier Segarra f608eb1859 Merge pull request '#6386 - Download method add file with extension' (!1993) from 6386_imageWithNoFormat into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1993
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2024-02-14 08:13:55 +00:00
Juanjo Breso f765fcca2c Merge pull request 'feat: refs #6693 revisar triggers' (!2033) from 6693-revisarTriggersPendientes into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
Reviewed-on: #2033
Reviewed-by: Robert Ferrús <robert@verdnatura.es>
2024-02-14 07:12:02 +00:00
Juanjo Breso 6fe6e35607 Merge branch 'dev' into 6693-revisarTriggersPendientes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-14 07:10:08 +00:00
Juanjo Breso c2dadc09a2 feat: refs #6693 comprobar triggers
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-14 07:36:38 +01:00
Juan Ferrer 19bbb4a4bf fix: refs#6706 package.json deprecated scripts removed
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 17:20:04 +01:00
Juan Ferrer 27d7a114e6 fix: refs#6706 package.json dbtest script removed
gitea/salix/pipeline/head This commit looks good Details
2024-02-13 17:16:10 +01:00
Juan Ferrer a5d1597884 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2024-02-13 16:21:02 +01:00
Juan Ferrer 999d9a0f9c fix: refs#6706 E2E show parameter fix 2024-02-13 16:21:01 +01:00
Ivan Mas 11bbab6288 Merge pull request 'feat: refs #6830 item_getLack origin' (!2025) from 6830-item_getLackOrigin into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2025
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-02-13 13:14:02 +00:00
Ivan Mas add5fedc4e Merge branch 'dev' into 6830-item_getLackOrigin
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 13:12:02 +00:00
Juanjo Breso c9294680a5 Merge branch 'dev' into 6693-revisarTriggersPendientes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 12:53:13 +00:00
Jorge Penadés 9bd8c21660 Merge pull request '#6813 fix creditClient' (!2026) from 6813-fixCreditClient into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
Reviewed-on: #2026
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: JAVIER SEGARRA MARTINEZ <jsegarra@verdnatura.es>
2024-02-13 10:53:38 +00:00
Jorge Penadés 76b4f8f46f Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6813-fixCreditClient
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 11:46:47 +01:00
Guillermo Bonet bf6d068830 Merge pull request 'refactor: refs #6781 Deleted timeControlDevice' (!2032) from 6781-timeControlDevice into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2032
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2024-02-13 10:16:43 +00:00
Jorge Penadés 579f2abe5b fix: refs #6813 remove quotation marks
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 11:16:00 +01:00
Jorge Penadés db2919b482 fix: refs #6813 procedure 2024-02-13 11:05:21 +01:00
Jorge Penadés d7fb31ee60 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6813-fixCreditClient
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 10:16:12 +01:00
Josep Domingo 51b336d9f7 Merge pull request 'refs#6685 RestoreViewCredit' (!2030) from 6685-fixRestoreViewCredit into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2030
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-02-13 09:00:03 +00:00
Josep Domingo 68034fc404 Merge branch 'dev' into 6685-fixRestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 08:56:05 +00:00
Juanjo Breso 185cc4f17f feat: refs #6693 revisar triggers
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:50:07 +01:00
Juan Ferrer 4f9b46346f fix: refs#6706 back tests spec timeout reduced
gitea/salix/pipeline/head There was a failure building this commit Details
2024-02-13 09:49:33 +01:00
Guillermo Bonet bbb3f3807a Merge pull request 'fix: refs #6184 Minor change' (!2031) from 6184-externalCmr into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #2031
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-02-13 08:45:03 +00:00
Guillermo Bonet b449da28ef Merge branch 'dev' into 6184-externalCmr
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 08:42:31 +00:00
Jorge Penadés 995e249495 Merge pull request '#6106 where filter' (!2024) from 6106-fixSignView into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #2024
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-02-13 08:42:14 +00:00
Guillermo Bonet 744171dd4c fix: refs #6184 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:41:26 +01:00
Jorge Penadés c8e13fa858 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6106-fixSignView
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:36:07 +01:00
Jorge Penadés 6116ada156 fix: refs #6813 remove inserts
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:35:39 +01:00
Guillermo Bonet 41db1c924f refactor: refs #6781 Deleted timeControlDevice
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 09:20:21 +01:00
Guillermo Bonet e08fb3d229 fix: refs #6184 Minor change
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 08:59:58 +01:00
Josep Domingo 4feae72ee3 Merge branch 'dev' into 6685-fixRestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 07:58:41 +00:00
Josep Domingo 3b35e4dae8 refs#6685 RestoreViewCredit
gitea/salix/pipeline/pr-dev Build queued... Details
2024-02-13 08:57:49 +01:00
Josep Domingo 5b137ad825 Merge pull request 'feat: refs #6685 RestoreViewCredit' (!2028) from 6685-fixRestoreViewCredit into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #2028
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-02-13 07:46:18 +00:00
Josep Domingo a897a05e8b feat: refs#6685RestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 07:52:09 +01:00
Guillermo Bonet 8f4b901818 Merge pull request 'refs #6184 saveCmr' (!1788) from 6184-saveCmr into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1788
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-02-13 06:47:05 +00:00
Guillermo Bonet 97f02187e3 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-13 07:35:07 +01:00
Ivan Mas 0ed5a0ff16 Merge pull request 'refs #6446 Delete function nz from db' (!2022) from 6446-Delete-function-nz-from-DB into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
Reviewed-on: #2022
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-02-12 12:56:05 +00:00
Ivan Mas 474c616b86 Merge branch 'dev' into 6446-Delete-function-nz-from-DB
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-12 12:54:21 +00:00
Jorge Penadés 534b5bb05a fix: refs #6106 where filter
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-12 11:26:00 +01:00
Ivan Mas b06f80e091 refs #6446 Delete function nz from db
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-12 08:11:49 +01:00
Robert Ferrús 02bf78d00a feat: refs #6830 item_getLack origin
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-09 09:22:24 +01:00
Guillermo Bonet cd613c770c Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-08 11:25:24 +00:00
Guillermo Bonet 21d047c21f Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-08 06:06:03 +00:00
Guillermo Bonet ffa9212861 fix: refs #6184 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-07 10:29:42 +01:00
Alex Moreno 87864593b2 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-07 06:17:35 +00:00
Guillermo Bonet f4feb6e8b7 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-06 12:13:48 +01:00
Guillermo Bonet 2cab007f57 fix: refs #6184 Requested changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-06 12:12:45 +01:00
Guillermo Bonet 92abc3fb78 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-06 07:05:27 +00:00
Guillermo Bonet f2946e4168 fix: refs #6184 Requested changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-06 08:04:19 +01:00
Guillermo Bonet d6ae1fd1f8 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-06 06:39:51 +01:00
Javier Segarra 6e62a9b826 Merge branch 'dev' into 6386_imageWithNoFormat
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-02-04 15:45:15 +00:00
Javier Segarra 9448b40533 refs #6386 feat: add extension when return file
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-02 14:53:48 +01:00
Guillermo Bonet eec36300ad refactor: refs #6184 Minor changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-02 12:25:48 +01:00
Guillermo Bonet 1d596b63a0 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-02 12:24:28 +01:00
Guillermo Bonet 3fa49a259c Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-02-01 07:42:22 +00:00
Guillermo Bonet b045584658 Merge branch 'dev' into 6184-saveCmr 2024-02-01 07:11:33 +00:00
Guillermo Bonet 548526964e Merge branch 'dev' into 6184-saveCmr 2024-02-01 06:23:25 +00:00
Guillermo Bonet a47276c86a Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-31 08:17:47 +00:00
Guillermo Bonet ae7fb12b53 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-30 09:25:29 +00:00
Guillermo Bonet 8f52efd5dd Merge branch '6184-saveCmr' of https://gitea.verdnatura.es/verdnatura/salix into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2024-01-30 09:50:54 +01:00
Guillermo Bonet d39d54a514 fix: #6184 Requested changes 2024-01-30 09:50:53 +01:00
Guillermo Bonet 1e56e741e2 fix: #6184 Requested changes
gitea/salix/pipeline/head This commit looks good Details
2024-01-30 09:44:10 +01:00
Guillermo Bonet 34f7345315 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2024-01-30 08:44:04 +00:00
Guillermo Bonet 13b8964e3d Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-30 07:27:34 +00:00
Sergio De la torre 0f3ffcfa61 fix: refs #6184 Upload sign
gitea/salix/pipeline/head This commit looks good Details
2024-01-30 08:11:33 +01:00
Guillermo Bonet 1fe6818a0f fix: #6184 Minor changes
gitea/salix/pipeline/head This commit looks good Details
2024-01-30 07:42:58 +01:00
Guillermo Bonet 65268487b9 fix: #6184 Now creates only one dms in saveSign
gitea/salix/pipeline/head This commit looks good Details
2024-01-30 07:32:26 +01:00
Guillermo Bonet ed43b6be2d Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-29 14:38:14 +01:00
Guillermo Bonet 65756f98ad fix: #6184 Minor changes
gitea/salix/pipeline/head This commit looks good Details
2024-01-29 08:25:00 +01:00
Guillermo Bonet 990e8ee249 Merge branch '6184-saveCmr' of https://gitea.verdnatura.es/verdnatura/salix into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2024-01-29 08:14:34 +01:00
Guillermo Bonet 7c80a7bdda fix: #6184 Minor changes 2024-01-29 08:14:33 +01:00
Guillermo Bonet 49a08a96da Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2024-01-26 11:56:43 +00:00
Guillermo Bonet 567e480e3b feat: #6184 Minor changes
gitea/salix/pipeline/head Build queued... Details
2024-01-26 12:40:42 +01:00
Guillermo Bonet 25fa154f60 feat: #6184 Minor changes
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-26 12:25:02 +01:00
Guillermo Bonet d5a145ba1b feat: #6184 Minor changes
gitea/salix/pipeline/head This commit looks good Details
2024-01-26 10:44:04 +01:00
Guillermo Bonet dec795d902 feat: #6184 Minor changes
gitea/salix/pipeline/head This commit looks good Details
2024-01-26 10:14:47 +01:00
Guillermo Bonet 5828fa9657 feat: #6184 Refactor saveSign
gitea/salix/pipeline/head This commit looks good Details
2024-01-26 10:05:24 +01:00
Guillermo Bonet 9005975f1c feat: #6184 Modified email cmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-25 13:56:47 +01:00
Guillermo Bonet c7be1b57b1 Merge branch '6184-saveCmr' of https://gitea.verdnatura.es/verdnatura/salix into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-23 14:13:41 +01:00
Guillermo Bonet a676607e29 feat: #6184 Added email cmr 2024-01-23 14:13:40 +01:00
Guillermo Bonet 12bfb8ca77 feat: #6184 Added tests and process.env.IS_SPEC_RUNNING 2024-01-23 11:05:39 +01:00
Guillermo Bonet 43bfb3cfde Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-23 10:05:21 +00:00
Guillermo Bonet 6701f70a33 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-22 09:07:31 +00:00
Guillermo Bonet 9faf889833 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2024-01-18 09:55:04 +00:00
Guillermo Bonet ce5a2ada62 feat: #6184 Requested changes
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-18 07:46:58 +01:00
Guillermo Bonet a486b7f2d4 feat: #6184 Minor change
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-17 14:42:38 +01:00
Guillermo Bonet 85a0f8b323 feat: #6184 Minor change
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-17 14:30:58 +01:00
Guillermo Bonet 1a52e58eaa feat: #6184 Created generateCmrPdf
gitea/salix/pipeline/head This commit looks good Details
2024-01-17 14:18:31 +01:00
Guillermo Bonet 45fd96cee6 feat: #6184 Modified uploadFile
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-17 13:07:26 +01:00
Guillermo Bonet f1b84ee7a0 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head There was a failure building this commit Details
2024-01-17 10:44:00 +01:00
Guillermo Bonet 4003e161ce Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2023-11-13 09:44:06 +00:00
Guillermo Bonet 64ca72b1f4 refactor refs #6184 Changed downloadCmrsZip
gitea/salix/pipeline/head This commit looks good Details
2023-11-13 09:57:25 +01:00
Guillermo Bonet 2792efa9cd perf: refs #6184 Requested changes
gitea/salix/pipeline/head This commit looks good Details
2023-11-13 08:36:05 +01:00
Guillermo Bonet 05a7498219 Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2023-11-09 13:14:21 +00:00
Guillermo Bonet 0771548ef1 refs #6184 Requested changes
gitea/salix/pipeline/head This commit looks good Details
2023-11-09 14:14:09 +01:00
Guillermo Bonet c79f706cdc Merge branch 'dev' into 6184-saveCmr
gitea/salix/pipeline/head This commit looks good Details
2023-10-11 12:23:39 +00:00
Guillermo Bonet 3e70cb07e0 refs #6184 Changes
gitea/salix/pipeline/head This commit looks good Details
2023-10-11 14:20:35 +02:00
Guillermo Bonet c0089b1fa0 refs #6184 Added cmrFk in ticket model
gitea/salix/pipeline/head This commit looks good Details
2023-10-11 12:20:30 +02:00
Guillermo Bonet d9339af87e refs #6184 Insert in ticketCmr
gitea/salix/pipeline/head This commit looks good Details
2023-10-11 11:46:56 +02:00
Guillermo Bonet 3e522b08b6 refs #6184 Added saveCmr
gitea/salix/pipeline/head This commit looks good Details
2023-10-11 11:43:21 +02:00
50 changed files with 621 additions and 252 deletions

2
Jenkinsfile vendored
View File

@ -103,7 +103,7 @@ pipeline {
NODE_ENV = ''
}
steps {
sh 'npm run test:back:ci'
sh 'node back/tests.js --ci --junit --network jenkins'
}
post {
always {

View File

@ -49,7 +49,6 @@ module.exports = Self => {
Self.uploadFile = async(ctx, options) => {
const models = Self.app.models;
const TempContainer = models.TempContainer;
const DmsContainer = models.DmsContainer;
const fileOptions = {};
const args = ctx.args;
@ -79,19 +78,21 @@ module.exports = Self => {
const addedDms = [];
for (const uploadedFile of files) {
const newDms = await createDms(ctx, uploadedFile, myOptions);
const pathHash = DmsContainer.getHash(newDms.id);
const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name);
srcFile = path.join(file.client.root, file.container, file.name);
const dmsContainer = await DmsContainer.container(pathHash);
const dstFile = path.join(dmsContainer.client.root, pathHash, newDms.file);
await fs.move(srcFile, dstFile, {
overwrite: true
});
const data = {
workerFk: ctx.req.accessToken.userId,
dmsTypeFk: args.dmsTypeId,
companyFk: args.companyId,
warehouseFk: args.warehouseId,
reference: args.reference,
description: args.description,
contentType: args.contentType,
hasFile: args.hasFile
};
const extension = await models.DmsContainer.getFileExtension(uploadedFile.name);
const newDms = await Self.createFromFile(data, extension, srcFile, myOptions);
addedDms.push(newDms);
}
@ -107,27 +108,4 @@ module.exports = Self => {
throw e;
}
};
async function createDms(ctx, file, myOptions) {
const models = Self.app.models;
const myUserId = ctx.req.accessToken.userId;
const args = ctx.args;
const newDms = await Self.create({
workerFk: myUserId,
dmsTypeFk: args.dmsTypeId,
companyFk: args.companyId,
warehouseFk: args.warehouseId,
reference: args.reference,
description: args.description,
contentType: file.type,
hasFile: args.hasFile
}, myOptions);
let fileName = file.name;
const extension = models.DmsContainer.getFileExtension(fileName);
fileName = `${newDms.id}.${extension}`;
return newDms.updateAttribute('file', fileName, myOptions);
}
};

View File

@ -87,6 +87,6 @@ module.exports = Self => {
await fs.access(file.path);
const stream = fs.createReadStream(file.path);
return [stream, file.contentType, `filename="${file.name}"`];
return [stream, file.contentType, `filename="${fileName}"`];
};
};

View File

@ -1,4 +1,6 @@
const UserError = require('vn-loopback/util/user-error');
const fs = require('fs-extra');
const path = require('path');
module.exports = Self => {
require('../methods/dms/downloadFile')(Self);
@ -35,4 +37,32 @@ module.exports = Self => {
return [stream, dms.contentType, `filename="${dms.file}"`];
};
Self.getPath = async function(dms) {
const models = Self.app.models;
const pathHash = await models.DmsContainer.getHash(dms.id);
const dmsContainer = await models.DmsContainer.container(pathHash);
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
return dstFile;
};
Self.createWithExtension = async function(data, extension, options) {
const newDms = await Self.create(data, options);
return newDms.updateAttribute('file', `${newDms.id}.${extension}`, options);
};
Self.createFromFile = async function(data, extension, srcFile, options) {
const dms = await Self.createWithExtension(data, extension, options);
const dstFile = await Self.getPath(dms);
await fs.move(srcFile, dstFile, {overwrite: true});
return dms;
};
Self.createFromStream = async function(data, extension, stream, options) {
const dms = await Self.createWithExtension(data, extension, options);
const dstFile = await Self.getPath(dms);
const writeStream = await fs.createWriteStream(dstFile);
await stream.pipe(writeStream);
return dms;
};
};

View File

@ -17,7 +17,8 @@ const opts = getopts(process.argv.slice(2), {
let server;
const PARALLEL = false;
const TIMEOUT = 900000;
const SETUP_TIMEOUT = 15 * 60 * 1000;
const SPEC_TIMEOUT = 30 * 1000;
process.on('exit', teardown);
process.on('uncaughtException', onError);
@ -74,9 +75,9 @@ async function test() {
let runner;
const config = {
globalSetup: setup,
globalSetupTimeout: TIMEOUT,
globalSetupTimeout: SETUP_TIMEOUT,
globalTeardown: teardown,
globalTeardownTimeout: TIMEOUT,
globalTeardownTimeout: SETUP_TIMEOUT,
spec_dir: '.',
spec_files: [
'back/**/*[sS]pec.js',
@ -111,10 +112,11 @@ async function test() {
runner.addReporter(new JunitReporter.JUnitXmlReporter());
}
if (opts.ci)
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT;
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
// runner.loadConfigFile('back/jasmine.json');
runner.loadConfig(config);
process.env.SPEC_IS_RUNNING = true;
await runner.execute();
}

View File

@ -66,9 +66,6 @@ UPDATE vn.supplier
SET isTrucker = 1
WHERE id = 2;
INSERT INTO vn.cmr (id, truckPlate, observations, senderInstruccions, paymentInstruccions, specialAgreements, created, companyFk, addressToFk, addressFromFk, supplierFk, packagesList, merchandiseDetail, state, landed, ead)
VALUES (2, NULL, NULL, NULL, 'Carriage paid', NULL, '2022-06-27 13:31:11.000', 442, 3, 2, 2, NULL, NULL, NULL, NULL, NULL);
-- XXX: tpv
UPDATE `vn`.`claimRatio` SET `claimAmount` = '10' WHERE (`clientFk` = '1101');

View File

@ -725,40 +725,40 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
(6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3),
(7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5);
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`)
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`)
VALUES
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1),
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL),
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL),
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL),
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL),
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL),
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL),
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL),
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL);
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1),
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 2),
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 3),
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, NULL),
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, NULL),
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, NULL),
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL, NULL),
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL, NULL),
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL, NULL),
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL, NULL),
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL, NULL),
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL, NULL),
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL),
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL, NULL);
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
@ -2405,7 +2405,7 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
(14, 'Ticket', 1, 1, 'ticket'),
(15, 'Presupuestos', NULL, NULL, 'budgets'),
(16, 'Logistica', NULL, NULL, 'logistics'),
(17, 'cmr', NULL, NULL, 'cmr'),
(17, 'cmr', 1, 1, 'cmr'),
(18, 'dua', NULL, NULL, 'dua'),
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
(20, 'Reclamación', 1, 1, 'claim');
@ -3062,3 +3062,8 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`)
(4, 1103, 4, 32),
(13, 1101, 1, NULL),
(14, 1101, 4, 27);
INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state)
VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
(2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
(3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet');

View File

@ -1,16 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `bi`.`nz`(vData DOUBLE)
RETURNS double
DETERMINISTIC
BEGIN
/**
* Devuelve 0, si el parámetro es NULL:
*/
DECLARE vResult DOUBLE;
SET vResult = IFNULL(vData,0);
RETURN vResult;
END$$
DELIMITER ;

View File

@ -130,13 +130,13 @@ BEGIN
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
UPDATE bi.claims_ratio cr
JOIN (
SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge
SELECT Id_Cliente, IFNULL(SUM(Importe), 0) AS Greuge
FROM vn2008.Greuges
WHERE Fecha <= util.VN_CURDATE()
GROUP BY Id_Cliente
) g ON g.Id_Cliente = cr.Id_Cliente
SET recobro = GREATEST(0,round(nz(Greuge) /
(nz(Consumo) * vMonthToRefund / 12 ) ,3));
SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) /
(IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3));
-- Protección neonatos
UPDATE bi.claims_ratio cr

View File

@ -1,14 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`nz`(vQuantity DOUBLE)
RETURNS double
DETERMINISTIC
BEGIN
DECLARE vResult DOUBLE;
SET vResult = IFNULL(vQuantity,0);
RETURN vResult;
END$$
DELIMITER ;

View File

@ -48,7 +48,7 @@ BEGIN
SELECT lc.companyFk,
c.id,
0,
- (NZ(lc.credit) - NZ(lc.debit))
- (IFNULL(lc.credit, 0) - IFNULL(lc.debit, 0))
FROM tmp.ledgerComparative lc
JOIN client c ON c.accountingAccount = lc.account
WHERE lc.`date` BETWEEN vDateFrom AND vDateTo

View File

@ -23,7 +23,8 @@ BEGIN
SUM(IFNULL(sub.amount,0)) lack,
i.inkFk,
IFNULL(im.timed, util.midnight()) timed,
IFNULL(izc.timed, util.midnight()) minTimed
IFNULL(izc.timed, util.midnight()) minTimed,
o.name originFk
FROM (SELECT item_id,
warehouse_id,
amount
@ -42,6 +43,7 @@ BEGIN
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
JOIN origin o ON o.id = i.originFk
WHERE w.isForTicket
AND ic.display
AND it.code != 'GEN'

View File

@ -60,7 +60,7 @@ BEGIN
SELECT lc.companyFk,
s.id,
0,
- (NZ(lc.debit) - NZ(lc.credit))
- (IFNULL(lc.debit, 0) - IFNULL(lc.credit, 0))
FROM tmp.ledgerComparative lc
JOIN supplier s ON s.account = lc.account
WHERE lc.`date` BETWEEN vDateFrom AND vDateTo

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_BeforeInsert`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`budgetNotes_beforeInsert`
BEFORE INSERT ON `budgetNotes`
FOR EACH ROW
BEGIN

View File

@ -4,22 +4,22 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInse
FOR EACH ROW
BEGIN
DECLARE intcounter INT;
DECLARE vShipFk INT;
DECLARE vShipFk INT;
SET NEW.editorFk = account.myUser_getId();
IF NEW.freightItemFk IS NOT NULL THEN
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk;
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
FROM expedition e
FROM expedition e
INNER JOIN ticket t1 ON e.ticketFk = t1.id
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped)
AND t1.warehouseFk = t2.warehouseFk
AND t1.warehouseFk = t2.warehouseFk
WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
AND t1.agencyModeFk = t2.agencyModeFk;
AND t1.agencyModeFk = t2.agencyModeFk;
SET NEW.`counter` = intcounter;
END IF;

View File

@ -1,14 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`nz`(dblCANTIDAD DOUBLE)
RETURNS double
DETERMINISTIC
BEGIN
DECLARE dblRESULT DOUBLE;
SET dblRESULT = IFNULL(dblCANTIDAD,0);
RETURN dblRESULT;
END$$
DELIMITER ;

View File

@ -8,16 +8,10 @@ BEGIN
END;
START TRANSACTION;
INSERT INTO vn.clientCredit(clientFk, amount)
SELECT c.id, 0
FROM vn.`client` c
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
WHERE c.credit <> 0 AND pm.`code` = 'card';
UPDATE vn.`client` c
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
SET credit = 0
WHERE pm.`code` = 'card';
WHERE pm.`code` = 'card';
DROP TEMPORARY TABLE IF EXISTS clientes_credit;
CREATE TEMPORARY TABLE clientes_credit
@ -44,10 +38,6 @@ BEGIN
UPDATE Clientes
JOIN clientes_credit USING(Id_Cliente)
SET Clientes.Credito = newCredit;
INSERT INTO credit(Id_Cliente, amount, Id_Trabajador)
SELECT Id_Cliente, newCredit, NULL
FROM clientes_credit;
DROP TEMPORARY TABLE clientes_credit;
COMMIT;

View File

@ -0,0 +1,9 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`credit`
AS SELECT `c`.`id` AS `id`,
`c`.`clientFk` AS `Id_Cliente`,
`c`.`workerFk` AS `Id_Trabajador`,
`c`.`amount` AS `amount`,
`c`.`created` AS `odbc_date`
FROM `vn`.`clientCredit` `c`

View File

@ -0,0 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`credit`AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.credit TO financialBoss;

View File

@ -0,0 +1 @@
DROP TABLE vn.timeControlDevice;

View File

@ -10,7 +10,7 @@ const Myt = require('@verdnatura/myt/myt');
const Run = require('@verdnatura/myt/myt-run');
const axios = require('axios');
const e2eConfig = require('./config.js');
const e2eConfig = require('./helpers/config.js');
const log = require('fancy-log');
process.on('warning', warning => {
@ -23,11 +23,12 @@ async function test() {
const opts = getopts(process.argv.slice(2), {
boolean: ['show']
});
process.env.E2E_SHOW = opts.show;
if (opts.show)
process.env.E2E_SHOW = true;
console.log('Building and running DB container.');
const myt = new Myt();
await myt.init({workspace: path.join(__dirname, '../..')});
await myt.init({workspace: path.join(__dirname, '..')});
await myt.run(Run);
await myt.deinit();

View File

@ -337,9 +337,11 @@
"You already have the mailAlias": "Ya tienes este alias de correo",
"The alias cant be modified": "Este alias de correo no puede ser modificado",
"No tickets to invoice": "No hay tickets para facturar",
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
"Name should be uppercase": "El nombre debe ir en mayúscula",
"Bank entity must be specified": "La entidad bancaria es obligatoria",
"An email is necessary": "Es necesario un email",
"You cannot update these fields": "No puedes actualizar estos campos",
"CountryFK cannot be empty": "El país no puede estar vacío"
"CountryFK cannot be empty": "El país no puede estar vacío",
"Cmr file does not exist": "El archivo del cmr no existe"
}

View File

@ -0,0 +1,89 @@
const {Email} = require('vn-print');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('cmrEmail', {
description: 'Sends the email with an cmr attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'tickets',
type: ['number'],
required: true,
description: 'The ticket id',
}
],
http: {
path: '/cmrEmail',
verb: 'POST'
}
});
Self.cmrEmail = async function(ctx, tickets, options) {
const models = 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 {
for (const ticketId of tickets) {
const ticket = await models.Ticket.findOne({
where: {
id: ticketId
},
include: [{
relation: 'client',
fields: ['email']
}]
}, myOptions);
const recipient = ticket.client().email;
if (!recipient)
throw new UserError('There is no assigned email for this client');
const dms = await models.TicketDms.findOne({
where: {ticketFk: ticketId},
include: [{
relation: 'dms',
fields: ['id'],
scope: {
relation: 'dmsType',
scope: {
where: {code: 'cmr'}
}
}
}]
}, myOptions);
if (!dms) throw new UserError('Cmr file does not exist');
const response = await models.Dms.downloadFile(ctx, dms.id);
const email = new Email('cmr', {
ticketId,
lang: ctx.req.getLocale(),
recipient
});
await email.send({
overrideAttachments: true,
attachments: [{
filename: `${ticket.cmrFk}.pdf`,
content: response[0]
}]
});
}
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -1,6 +1,4 @@
const JSZip = require('jszip');
const axios = require('axios');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('downloadCmrsZip', {
@ -37,35 +35,20 @@ module.exports = Self => {
Self.downloadCmrsZip = async function(ctx, ids, options) {
const models = Self.app.models;
const myOptions = {};
const token = ctx.req.accessToken;
const zip = new JSZip();
if (typeof options == 'object')
Object.assign(myOptions, options);
const zipConfig = await models.ZipConfig.findOne(null, myOptions);
let totalSize = 0;
ids = ids.split(',');
try {
for (let id of ids) {
if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large');
const response = await axios.get(
`${ctx.req.headers.referer}api/Routes/${id}/cmr?access_token=${token.id}`, {
...myOptions,
responseType: 'arraybuffer',
});
if (response.headers['content-type'] !== 'application/pdf')
throw new UserError(`The response is not a PDF`);
zip.file(`${id}.pdf`, response.data, { binary: true });
}
const zipStream = zip.generateNodeStream({ streamFiles: true });
return [zipStream, 'application/zip', `filename="cmrs.zip"`];
} catch (e) {
throw e;
for (const id of ids) {
ctx.args = ctx.args || {};
ctx.args.id = Number(id);
const [data] = await models.Route.cmr(ctx, myOptions);
zip.file(`${id}.pdf`, data, {binary: true});
}
const zipStream = zip.generateNodeStream({streamFiles: true});
return [zipStream, 'application/zip', `filename="cmrs.zip"`];
};
};

View File

@ -1,5 +1,5 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const {ParameterizedSQL} = require('loopback-connector');
module.exports = Self => {
Self.remoteMethod('getTickets', {
@ -83,13 +83,15 @@ module.exports = Self => {
const where = filter.where;
where['r.id'] = filter.id;
where.and = [{or: [
{'t.packages': {gt: 0}},
{and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]}
]}];
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id'));
stmt.merge(conn.makeOrderBy(filter.order));
const tickets = await conn.executeStmt(stmt, myOptions);
return tickets;
return conn.executeStmt(stmt, myOptions);
};
};

View File

@ -0,0 +1,25 @@
const models = require('vn-loopback/server/server').models;
describe('route downloadCmrsZip()', () => {
it('should create a zip file with the given cmr ids', async() => {
const tx = await models.Route.beginTransaction({});
const ctx = {
req: {
getLocale: () => {
return 'en';
},
accessToken: {userId: 9}
}
};
let cmrs = '1,2';
try {
const stream = await models.Route.downloadCmrsZip(ctx, cmrs);
expect(stream[0]).toBeDefined();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -0,0 +1,58 @@
{
"name": "Cmr",
"base": "VnModel",
"options": {
"mysql": {
"table": "cmr"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"truckPlate": {
"type": "number"
},
"observations": {
"type": "string"
},
"senderInstrucctions": {
"type": "string"
},
"paymentInstruccions": {
"type": "string"
},
"specialAgreements": {
"type": "string"
},
"created": {
"type": "date"
},
"companyFk": {
"type": "number"
},
"addressToFk": {
"type": "number"
},
"addressFromFk": {
"type": "number"
},
"supplierFk": {
"type": "number"
},
"packagesList": {
"type": "string"
},
"merchandiseDetail": {
"type": "string"
},
"landed": {
"type": "date"
},
"ead": {
"type": "date"
}
}
}

View File

@ -17,6 +17,7 @@ module.exports = Self => {
require('../methods/route/cmr')(Self);
require('../methods/route/getExternalCmrs')(Self);
require('../methods/route/downloadCmrsZip')(Self);
require('../methods/route/cmrEmail')(Self);
require('../methods/route/getExpeditionSummary')(Self);
require('../methods/route/getByWorker')(Self);

View File

@ -0,0 +1,86 @@
const {Readable} = require('stream');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('saveCmr', {
description: 'Save cmr',
accessType: 'WRITE',
accepts: [
{
arg: 'tickets',
type: ['number'],
required: true,
description: 'The tickets'
}
],
http: {
path: `/saveCmr`,
verb: 'POST'
}
});
Self.saveCmr = async(ctx, tickets, options) => {
const models = Self.app.models;
const myOptions = {userId: ctx.req.accessToken.userId};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const dmsTypeCmr = await models.DmsType.findOne({
where: {code: 'cmr'},
fields: ['id']
}, myOptions);
for (const ticketId of tickets) {
const ticket = await models.Ticket.findById(ticketId, myOptions);
if (ticket.cmrFk) {
const hasDmsCmr = await models.TicketDms.findOne({
where: {ticketFk: ticketId},
include: {
relation: 'dms',
fields: ['dmsFk'],
scope: {
where: {dmsTypeFk: dmsTypeCmr.id}
}
}
}, myOptions);
if (hasDmsCmr?.dms())
throw new UserError('This ticket already has a cmr saved');
ctx.args.id = ticket.cmrFk;
const response = await models.Route.cmr(ctx, myOptions);
const pdfStream = Readable.from(Buffer.from(response[0]));
const data = {
workerFk: ctx.req.accessToken.userId,
dmsTypeFk: dmsTypeCmr.id,
companyFk: ticket.companyFk,
warehouseFk: ticket.warehouseFk,
reference: ticket.id,
contentType: 'application/pdf',
hasFile: true
};
const dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions);
await models.TicketDms.create({
ticketFk: ticketId,
dmsFk: dms.id
}, myOptions);
}
}
if (tx) await tx.commit();
return;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -33,8 +33,8 @@ module.exports = Self => {
const models = Self.app.models;
const myOptions = {userId: ctx.req.accessToken.userId};
let tx;
let dms;
let gestDocCreated = false;
let ticket;
let externalTickets = [];
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -44,6 +44,11 @@ module.exports = Self => {
myOptions.transaction = tx;
}
const dmsTypeTicket = await models.DmsType.findOne({
where: {code: 'ticket'},
fields: ['id']
}, myOptions);
async function setLocation(ticketId) {
await models.Delivery.create({
ticketFk: ticketId,
@ -53,102 +58,106 @@ module.exports = Self => {
}, myOptions);
}
async function gestDocExists(ticketId) {
async function hasSignDms(ticketId) {
const ticketDms = await models.TicketDms.findOne({
where: {ticketFk: ticketId},
fields: ['dmsFk']
include: [
{
relation: 'dms',
fields: ['id'],
scope: {
where: {dmsTypeFk: dmsTypeTicket.id}
}
}
]
}, myOptions);
if (!ticketDms) return false;
const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions);
if (ticket.isSigned == true)
return true;
else
await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions);
return false;
if (ticketDms?.dms()?.id) return true;
}
async function createGestDoc(id) {
const ticket = await models.Ticket.findById(id,
{
include: [
{
relation: 'warehouse',
scope: {
fields: ['id']
}
}, {
relation: 'client',
scope: {
fields: ['name']
}
}, {
relation: 'route',
scope: {
fields: ['id']
}
}
]
}, myOptions);
const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions);
async function createGestDoc() {
const ctxUploadFile = Object.assign({}, ctx);
if (ticket.route() === null)
throw new UserError('Ticket without route');
ctxUploadFile.args = {
warehouseId: ticket.warehouseFk,
companyId: ticket.companyFk,
dmsTypeId: dmsType.id,
reference: '',
dmsTypeId: dmsTypeTicket.id,
reference: ticket.id,
description: `Firma del cliente - Ruta ${ticket.route().id}`,
hasFile: false
contentType: 'image/png',
hasFile: true
};
dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
gestDocCreated = true;
const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
}
try {
for (const ticketId of tickets) {
const ticketState = await models.TicketState.findOne(
{where: {ticketFk: ticketId},
fields: ['alertLevel']
}, myOptions);
ticket = await models.Ticket.findById(ticketId, {
include: [{
relation: 'address',
scope: {
include: {
relation: 'province',
scope: {
include: {
relation: 'country',
scope: {
fields: ['code']
}
}
}
}
}
}, {
relation: 'route',
scope: {
fields: ['id']
}
}]
}, myOptions);
const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'},
const ticketState = await models.TicketState.findOne({
where: {ticketFk: ticketId},
fields: ['alertLevel']
}, myOptions);
const packedAlertLevel = await models.AlertLevel.findOne({
where: {code: 'PACKED'},
fields: ['id']
}, myOptions);
if (!ticketState)
throw new UserError('Ticket does not exist');
if (!ticket.route())
throw new UserError('Ticket without route');
if (ticketState.alertLevel < packedAlertLevel.id)
throw new UserError('This ticket cannot be signed because it has not been boxed');
if (await gestDocExists(ticketId))
if (await ticket.isSigned)
throw new UserError('Ticket is already signed');
if (location) await setLocation(ticketId);
if (!gestDocCreated) await createGestDoc(ticketId);
await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions);
const ticket = await models.Ticket.findById(ticketId, null, myOptions);
if (!await hasSignDms(ticketId))
await createGestDoc(ticketId);
await ticket.updateAttribute('isSigned', true, myOptions);
const deliveryState = await models.State.findOne({
where: {
code: 'DELIVERED'
}
where: {code: 'DELIVERED'}
}, myOptions);
await models.Ticket.state(ctx, {
ticketFk: ticketId,
stateFk: deliveryState.id
}, myOptions);
}
if (ticket?.address()?.province()?.country()?.code != 'ES') {
await models.Ticket.saveCmr(ctx, [ticketId], myOptions);
externalTickets.push(ticketId);
}
}
if (tx) await tx.commit();
return;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
await models.Route.cmrEmail(ctx, externalTickets);
};
};

View File

@ -0,0 +1,41 @@
const models = require('vn-loopback/server/server').models;
describe('ticket saveCmr()', () => {
it(`should save cmr`, async() => {
const tx = await models.Ticket.beginTransaction({});
const ctx = {
req: {
getLocale: () => {
return 'en';
},
accessToken: {userId: 9}
},
args: {}
};
try {
const options = {transaction: tx};
const ticket = [2];
await models.Ticket.saveCmr(ctx, ticket, options);
const hasDmsCmr = await models.TicketDms.findOne({
where: {ticketFk: ticket[0]},
include: [{
relation: 'dms',
fields: ['id'],
scope: {
relation: 'dmsType',
scope: {
where: {code: 'cmr'}
}
}
}]
}, options);
expect(hasDmsCmr?.dms()?.id).toBeGreaterThanOrEqual(1);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -1,14 +1,11 @@
const models = require('vn-loopback/server/server').models;
describe('Ticket saveSign()', () => {
const FormData = require('form-data');
const data = new FormData();
let ctx = {req: {
accessToken: {userId: 9},
headers: {
...data.getHeaders()
}
getLocale: () => {
return 'en';
},
accessToken: {userId: 9}
}};
it(`should throw error if the ticket's alert level is lower than 2`, async() => {
@ -17,9 +14,9 @@ describe('Ticket saveSign()', () => {
let error;
try {
const options = {transaction: tx};
ctx.args = {tickets: [ticketWithOkState]};
const tickets = [ticketWithOkState];
await models.Ticket.saveSign(ctx, options);
await models.Ticket.saveSign(ctx, tickets, options);
await tx.rollback();
} catch (e) {

View File

@ -41,6 +41,7 @@ module.exports = function(Self) {
require('../methods/ticket/collectionLabel')(Self);
require('../methods/ticket/expeditionPalletLabel')(Self);
require('../methods/ticket/saveSign')(Self);
require('../methods/ticket/saveCmr')(Self);
require('../methods/ticket/invoiceTickets')(Self);
require('../methods/ticket/invoiceTicketsAndPdf')(Self);
require('../methods/ticket/docuwareDownload')(Self);

View File

@ -66,6 +66,9 @@
},
"weight": {
"type": "number"
},
"cmrFk": {
"type": "number"
}
},
"relations": {
@ -139,6 +142,11 @@
"type": "belongsTo",
"model": "Zone",
"foreignKey": "zoneFk"
},
"cmrFk": {
"type": "belongsTo",
"model": "Cmr",
"foreignKey": "cmrFk"
}
}
}

View File

@ -105,14 +105,11 @@
"yaml-loader": "^0.5.0"
},
"scripts": {
"dbtest": "nodemon -q db/tests.js -w db/tests",
"test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json",
"test:back:ci": "node back/tests.js --ci --junit --network jenkins",
"test:e2e": "node e2e/helpers/tests.js",
"test:e2e": "node e2e/tests.js",
"test:front": "jest --watch",
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
"docker": "docker build --progress=plain -t salix-db ./db"
"lint": "eslint ./ --cache --ignore-pattern .gitignore"
},
"jest": {
"projects": [

View File

@ -35,7 +35,8 @@ module.exports = {
logger.error(`[Print] => ${err.message}`);
});
cluster.on('queue', () => logger.info('Printing task initialized by pool'));
cluster.on('queue', () =>
process.env.SPEC_IS_RUNNING === 'false' && logger.info('Printing task initialized by pool'));
});
}
};

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,6 @@
[
{
"filename": "cmr.pdf",
"component": "cmr"
}
]

View File

@ -0,0 +1,12 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>{{ $t('title') }}</h1>
<p>{{$t('dear')}},</p>
<p v-html="$t('description', [cmr.id, cmr.ticketFk])"></p>
<p v-html="$t('poll')"></p>
<p v-html="$t('help')"></p>
<p v-html="$t('conclusion')"></p>
</div>
</div>
</email-body>

View File

@ -0,0 +1,22 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
name: 'cmr',
async serverPrefetch() {
this.cmr = await this.fetchCmr(this.ticketId);
},
methods: {
fetchCmr(ticketId) {
return this.findOneFromDef('cmr', [ticketId]);
},
},
components: {
'email-body': emailBody.build(),
},
props: {
ticketId: {
type: Number,
required: true
}
}
};

View File

@ -0,0 +1,9 @@
subject: Your CMR
title: Your CMR
dear: Dear Customer
description: The CMR <strong>{0}</strong> corresponding to order <strong>{1}</strong> is now available. <br/>
You can download it by clicking on the attachment in this email.
poll: If you wish, you can respond to our satisfaction survey to
help us provide better service. Your opinion is very important to us!
help: If you have any doubts, do not hesitate to ask, <strong>we are here to serve you!</strong>
conclusion: Thank you for your attention!

View File

@ -0,0 +1,9 @@
subject: Tu CMR
title: Tu CMR
dear: Estimado cliente
description: Ya está disponible el CMR <strong>{0}</strong> correspondiente al pedido <strong>{1}</strong>. <br/>
Puedes descargarla haciendo clic en el adjunto de este correo.
poll: Si lo deseas, puedes responder a nuestra encuesta de satisfacción para
ayudarnos a prestar un mejor servicio. ¡Tu opinión es muy importante para nosotros!
help: Cualquier duda que te surja, no dudes en consultarla, <strong>¡estamos para atenderte!</strong>
conclusion: ¡Gracias por tu atención!

View File

@ -0,0 +1,9 @@
subject: Votre CMR
title: Votre CMR
dear: Cher client
description: Le CMR <strong>{0}</strong> correspondant à la commande <strong>{1}</strong> est maintenant disponible. <br/>
Vous pouvez le télécharger en cliquant sur la pièce jointe de cet e-mail.
poll: Si vous le souhaitez, vous pouvez répondre à notre enquête de satisfaction pour
nous aider à améliorer notre service. Votre avis est très important pour nous !
help: Si vous avez des doutes, n'hésitez pas à nous consulter, <strong>nous sommes là pour vous servir !</strong>
conclusion: Merci de votre attention !

View File

@ -0,0 +1,9 @@
subject: Seu CMR
title: Seu CMR
dear: Caro cliente
description: O CMR <strong>{0}</strong> correspondente ao pedido <strong>{1}</strong> já está disponível. <br/>
Você pode baixá-lo clicando no anexo deste e-mail.
poll: Se desejar, pode responder à nossa pesquisa de satisfação para
nos ajudar a oferecer um serviço melhor. Sua opinião é muito importante para nós!
help: Se tiver alguma dúvida, não hesite em nos consultar, <strong>estamos aqui para atendê-lo!</strong>
conclusion: Obrigado pela sua atenção!

View File

@ -0,0 +1,5 @@
SELECT t.id ticketFk,
c.id
FROM ticket t
JOIN cmr c ON c.id = t.cmrFk
WHERE t.id = ?