From 022d3d08e689c224595dff149e47c1e8b79102df Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 1 Sep 2023 12:34:33 +0200 Subject: [PATCH 01/11] refs #5652 feat:itemTrash_new --- back/methods/collection/getAddress.js | 20 ++++++ .../collection/spec/getAddress.spec.js | 10 +++ back/models/collection.js | 1 + .../233801/00-address_getLosesLastYear.sql | 15 +++++ .../233801/00-item_setVisibleDiscard.sql | 65 +++++++++++++++++++ db/changes/233801/00-ticketConfig.sql | 13 ++++ db/dump/fixtures.sql | 9 +++ .../back/methods/item/setVisibleDiscard.js | 37 +++++++++++ modules/item/back/models/item.js | 1 + 9 files changed, 171 insertions(+) create mode 100644 back/methods/collection/getAddress.js create mode 100644 back/methods/collection/spec/getAddress.spec.js create mode 100644 db/changes/233801/00-address_getLosesLastYear.sql create mode 100644 db/changes/233801/00-item_setVisibleDiscard.sql create mode 100644 db/changes/233801/00-ticketConfig.sql create mode 100644 modules/item/back/methods/item/setVisibleDiscard.js diff --git a/back/methods/collection/getAddress.js b/back/methods/collection/getAddress.js new file mode 100644 index 000000000..3fd4b9e6e --- /dev/null +++ b/back/methods/collection/getAddress.js @@ -0,0 +1,20 @@ +module.exports = Self => { + Self.remoteMethod('getAddress', { + description: 'Get all activated address last year ', + accessType: 'READ', + returns: { + type: 'Object', + root: true + }, + http: { + path: `/getAddress`, + verb: 'GET' + } + }); + + Self.getAddress = async() => { + const query = `CALL vn.address_getLosesLastYear()`; + const [result] = await Self.rawSql(query); + return result; + }; +}; diff --git a/back/methods/collection/spec/getAddress.spec.js b/back/methods/collection/spec/getAddress.spec.js new file mode 100644 index 000000000..aac769aa3 --- /dev/null +++ b/back/methods/collection/spec/getAddress.spec.js @@ -0,0 +1,10 @@ +const {models} = require('vn-loopback/server/server'); + +describe('getAddress()', () => { + fit('return list of address last year', async() => { + let response = await models.Collection.getAddress(); + + expect(response.length).toBeGreaterThan(0); + expect(response[0].addressFk).toEqual(1); + }); +}); diff --git a/back/models/collection.js b/back/models/collection.js index a41742ee7..75cdb1174 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -4,4 +4,5 @@ module.exports = Self => { require('../methods/collection/getSectors')(Self); require('../methods/collection/setSaleQuantity')(Self); require('../methods/collection/previousLabel')(Self); + require('../methods/collection/getAddress')(Self); }; diff --git a/db/changes/233801/00-address_getLosesLastYear.sql b/db/changes/233801/00-address_getLosesLastYear.sql new file mode 100644 index 000000000..3b8fa209b --- /dev/null +++ b/db/changes/233801/00-address_getLosesLastYear.sql @@ -0,0 +1,15 @@ + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_getLosesLastYear`() +BEGIN + SELECT t.addressFk , a.nickname, c.name + FROM ticket t + JOIN address a ON a.id = t.addressFk + JOIN client c ON a.clientFk = c.id + WHERE c.typeFk = 'loses' + AND a.isactive = 1 + AND t.created >= (CURRENT_DATE() - INTERVAL 1 YEAR) + GROUP BY t.addressFk; +END$$ +DELIMITER ; + diff --git a/db/changes/233801/00-item_setVisibleDiscard.sql b/db/changes/233801/00-item_setVisibleDiscard.sql new file mode 100644 index 000000000..1b9bf0ffb --- /dev/null +++ b/db/changes/233801/00-item_setVisibleDiscard.sql @@ -0,0 +1,65 @@ + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_setVisibleDiscard`( + vItemFk INT, + vWarehouseFk INT, + vQuantity INT, + vAddressFk INT) + +BEGIN + DECLARE vTicketFk INT; + DECLARE vClientFk INT; + DECLARE vCompanyVnlFk INT; + DECLARE vCalc INT; + + SELECT barcodeToItem(vItemFk) INTO vItemFk; + + SELECT companyDefaultFk INTO vCompanyVnlFk + FROM ticketConfig ; + + SELECT c.id INTO vClientFk + FROM client c + JOIN address a ON a.clientFk = c.id + WHERE a.id = vAddressFk; + + SELECT t.id INTO vTicketFk + FROM ticket t + JOIN address a ON a.id = t.addressFk + WHERE t.warehouseFk = vWarehouseFk + AND t.clientFk = vClientFk + AND DATE(t.shipped) = util.VN_CURDATE() + AND a.isDefaultAddress + LIMIT 1; + + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); + + IF vTicketFk IS NULL THEN + CALL ticket_add( + vClientFk, + util.VN_CURDATE(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + util.VN_CURDATE(), + account.myUser_getId(), + FALSE, + vTicketFk); + END IF; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity) + SELECT vTicketFk, + vItemFk, + CONCAT(longName,' ', getWorkerCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)), + vQuantity + FROM item + WHERE id = vItemFk; + + UPDATE cache.visible + SET visible = visible - vQuantity + WHERE calc_id = vCalc + AND item_id = vItemFk; +END$$ +DELIMITER ; + diff --git a/db/changes/233801/00-ticketConfig.sql b/db/changes/233801/00-ticketConfig.sql new file mode 100644 index 000000000..d80dcd7ab --- /dev/null +++ b/db/changes/233801/00-ticketConfig.sql @@ -0,0 +1,13 @@ + +ALTER TABLE `vn`.`ticketConfig` ADD companyDefaultFk int(10) unsigned DEFAULT 442 NOT NULL COMMENT 'Compañía por defecto para crear ticket'; + +ALTER TABLE `vn`.`ticketConfig` ADD CONSTRAINT ticketConfig_FK FOREIGN KEY (companyDefaultFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; + +-- Se desactivan por utilizarse muy poco + +UPDATE vn.address + SET isDefaultAddress = 0, + isActive = 0 + WHERE id IN (6,47); + + INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId) VALUES(698, 'Item', 'setVisibleDiscard', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index b01c07461..7ce39287e 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2958,3 +2958,12 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) VALUES (1, 0, 0, 'marvel.com'); + +--fixtures for getaddressLastYear +UPDATE vn.client + SET typeFk='loses' + WHERE id=1101; + +UPDATE vn.ticket + SET created='2023-08-01 00:00:00' + WHERE id=6; \ No newline at end of file diff --git a/modules/item/back/methods/item/setVisibleDiscard.js b/modules/item/back/methods/item/setVisibleDiscard.js new file mode 100644 index 000000000..bcdda1ced --- /dev/null +++ b/modules/item/back/methods/item/setVisibleDiscard.js @@ -0,0 +1,37 @@ +module.exports = Self => { + Self.remoteMethodCtx('setVisibleDiscard', { + description: 'Change visible for item', + accessType: 'WRITE', + accepts: [{ + arg: 'itemFk', + type: 'Number', + required: false, + description: 'The item id' + }, { + arg: 'warehouseFk', + type: 'Number', + required: true, + description: 'The warehouse of item' + }, { + arg: 'quantity', + type: 'Number', + required: true, + description: 'The quantity to modify' + }, + { + arg: 'addressFk', + type: 'Number', + required: true, + description: 'The address id' + }], + http: { + path: `/setVisibleDiscard`, + verb: 'POST' + } + }); + + Self.setVisibleDiscard = async(ctx, itemFk, warehouseFk, quantity, addressFk) => { + const query = `CALL vn.item_setVisibleDiscard(?, ?, ?, ?)`; + await Self.rawSql(query, [itemFk, warehouseFk, quantity, addressFk]); + }; +}; diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 61c5c2588..eac1ecb7d 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -16,6 +16,7 @@ module.exports = Self => { require('../methods/item/createIntrastat')(Self); require('../methods/item/buyerWasteEmail')(Self); require('../methods/item/labelPdf')(Self); + require('../methods/item/setVisibleDiscard')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); From 2fffa56d703ab2945895b19d72e05add031c6c95 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 6 Sep 2023 09:18:28 +0200 Subject: [PATCH 02/11] refs #5652 feat:itemTrash_new --- .../client/back/methods/address/getAddress.js | 21 +++++++++++++++++++ .../methods/address/specs}/getAddress.spec.js | 4 ++-- modules/client/back/models/address.js | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 modules/client/back/methods/address/getAddress.js rename {back/methods/collection/spec => modules/client/back/methods/address/specs}/getAddress.spec.js (70%) diff --git a/modules/client/back/methods/address/getAddress.js b/modules/client/back/methods/address/getAddress.js new file mode 100644 index 000000000..94e0439da --- /dev/null +++ b/modules/client/back/methods/address/getAddress.js @@ -0,0 +1,21 @@ +module.exports = Self => { + Self.remoteMethod('getAddress', { + description: 'Get all activated address last year ', + accessType: 'READ', + accepts: [], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getAddress`, + verb: 'GET' + } + }); + + Self.getAddress = async() => { + const query = `CALL vn.address_getLosesLastYear()`; + const [result] = await Self.rawSql(query); + return result; + }; +}; diff --git a/back/methods/collection/spec/getAddress.spec.js b/modules/client/back/methods/address/specs/getAddress.spec.js similarity index 70% rename from back/methods/collection/spec/getAddress.spec.js rename to modules/client/back/methods/address/specs/getAddress.spec.js index aac769aa3..707d7360b 100644 --- a/back/methods/collection/spec/getAddress.spec.js +++ b/modules/client/back/methods/address/specs/getAddress.spec.js @@ -1,8 +1,8 @@ const {models} = require('vn-loopback/server/server'); -describe('getAddress()', () => { +describe('getAddressa()', () => { fit('return list of address last year', async() => { - let response = await models.Collection.getAddress(); + let response = await models.Addressa.getAddress(); expect(response.length).toBeGreaterThan(0); expect(response[0].addressFk).toEqual(1); diff --git a/modules/client/back/models/address.js b/modules/client/back/models/address.js index 3a1157add..4a93b5d5c 100644 --- a/modules/client/back/models/address.js +++ b/modules/client/back/models/address.js @@ -3,6 +3,8 @@ let getFinalState = require('vn-loopback/util/hook').getFinalState; let isMultiple = require('vn-loopback/util/hook').isMultiple; module.exports = Self => { + require('../methods/address/getAddress')(Self); + Self.validateAsync('isEqualizated', cannotHaveET, { message: 'Cannot check Equalization Tax in this NIF/CIF' }); From 9d367b82999c5e296c9eabc53007632903288322 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 6 Sep 2023 09:22:29 +0200 Subject: [PATCH 03/11] refs #5652 feat:itemTrash_new --- back/methods/collection/getAddress.js | 20 -------------------- back/models/collection.js | 1 - 2 files changed, 21 deletions(-) delete mode 100644 back/methods/collection/getAddress.js diff --git a/back/methods/collection/getAddress.js b/back/methods/collection/getAddress.js deleted file mode 100644 index 3fd4b9e6e..000000000 --- a/back/methods/collection/getAddress.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('getAddress', { - description: 'Get all activated address last year ', - accessType: 'READ', - returns: { - type: 'Object', - root: true - }, - http: { - path: `/getAddress`, - verb: 'GET' - } - }); - - Self.getAddress = async() => { - const query = `CALL vn.address_getLosesLastYear()`; - const [result] = await Self.rawSql(query); - return result; - }; -}; diff --git a/back/models/collection.js b/back/models/collection.js index 75cdb1174..a41742ee7 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -4,5 +4,4 @@ module.exports = Self => { require('../methods/collection/getSectors')(Self); require('../methods/collection/setSaleQuantity')(Self); require('../methods/collection/previousLabel')(Self); - require('../methods/collection/getAddress')(Self); }; From dd1f759e209750481a4b8a2cd15fd54c205f4930 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 6 Sep 2023 09:35:43 +0200 Subject: [PATCH 04/11] refs #5652 feat:itemTrash_new --- db/changes/233801/00-ticketConfig.sql | 7 ++++++- .../client/back/methods/address/specs/getAddress.spec.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/db/changes/233801/00-ticketConfig.sql b/db/changes/233801/00-ticketConfig.sql index d80dcd7ab..5cef1ba5f 100644 --- a/db/changes/233801/00-ticketConfig.sql +++ b/db/changes/233801/00-ticketConfig.sql @@ -10,4 +10,9 @@ UPDATE vn.address isActive = 0 WHERE id IN (6,47); - INSERT INTO `salix`.`ACL` (id, model, property, accessType, permission, principalType, principalId) VALUES(698, 'Item', 'setVisibleDiscard', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES('Item', 'setVisibleDiscard', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + + INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES('Address', 'getAddress', 'READ', 'ALLOW', 'ROLE', 'employee'); + diff --git a/modules/client/back/methods/address/specs/getAddress.spec.js b/modules/client/back/methods/address/specs/getAddress.spec.js index 707d7360b..2c84769e6 100644 --- a/modules/client/back/methods/address/specs/getAddress.spec.js +++ b/modules/client/back/methods/address/specs/getAddress.spec.js @@ -1,8 +1,8 @@ const {models} = require('vn-loopback/server/server'); -describe('getAddressa()', () => { +describe('getAddress()', () => { fit('return list of address last year', async() => { - let response = await models.Addressa.getAddress(); + let response = await models.Address.getAddress(); expect(response.length).toBeGreaterThan(0); expect(response[0].addressFk).toEqual(1); From 8218eb2a6b12c1a15e2b9725d61dc891423317c7 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 6 Sep 2023 09:37:41 +0200 Subject: [PATCH 05/11] refs #5652 feat:itemTrash_new --- modules/client/back/methods/address/specs/getAddress.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/back/methods/address/specs/getAddress.spec.js b/modules/client/back/methods/address/specs/getAddress.spec.js index 2c84769e6..d2b219495 100644 --- a/modules/client/back/methods/address/specs/getAddress.spec.js +++ b/modules/client/back/methods/address/specs/getAddress.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); describe('getAddress()', () => { - fit('return list of address last year', async() => { + it('return list of address last year', async() => { let response = await models.Address.getAddress(); expect(response.length).toBeGreaterThan(0); From 5f5a0645be9b0c40c0e780566092d62cbe71e4c3 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 11 Sep 2023 16:16:49 +0200 Subject: [PATCH 06/11] refs #5652 feat:itemTrash_new --- db/changes/233801/00-address_getLosesLastYear.sql | 3 +-- modules/client/back/methods/address/getAddress.js | 4 ++-- modules/client/back/methods/address/specs/getAddress.spec.js | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/db/changes/233801/00-address_getLosesLastYear.sql b/db/changes/233801/00-address_getLosesLastYear.sql index 3b8fa209b..dc75c3121 100644 --- a/db/changes/233801/00-address_getLosesLastYear.sql +++ b/db/changes/233801/00-address_getLosesLastYear.sql @@ -1,6 +1,6 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_getLosesLastYear`() +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_getLoses`() BEGIN SELECT t.addressFk , a.nickname, c.name FROM ticket t @@ -8,7 +8,6 @@ BEGIN JOIN client c ON a.clientFk = c.id WHERE c.typeFk = 'loses' AND a.isactive = 1 - AND t.created >= (CURRENT_DATE() - INTERVAL 1 YEAR) GROUP BY t.addressFk; END$$ DELIMITER ; diff --git a/modules/client/back/methods/address/getAddress.js b/modules/client/back/methods/address/getAddress.js index 94e0439da..a15fb8aba 100644 --- a/modules/client/back/methods/address/getAddress.js +++ b/modules/client/back/methods/address/getAddress.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('getAddress', { - description: 'Get all activated address last year ', + description: 'Get all activated address client active', accessType: 'READ', accepts: [], returns: { @@ -14,7 +14,7 @@ module.exports = Self => { }); Self.getAddress = async() => { - const query = `CALL vn.address_getLosesLastYear()`; + const query = `CALL vn.address_getLoses()`; const [result] = await Self.rawSql(query); return result; }; diff --git a/modules/client/back/methods/address/specs/getAddress.spec.js b/modules/client/back/methods/address/specs/getAddress.spec.js index d2b219495..2c84769e6 100644 --- a/modules/client/back/methods/address/specs/getAddress.spec.js +++ b/modules/client/back/methods/address/specs/getAddress.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); describe('getAddress()', () => { - it('return list of address last year', async() => { + fit('return list of address last year', async() => { let response = await models.Address.getAddress(); expect(response.length).toBeGreaterThan(0); From 1d25355423969b71392b38fb96b18569d23d7e1c Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 12 Sep 2023 08:44:42 +0200 Subject: [PATCH 07/11] refs #5652 fix:without fit --- modules/client/back/methods/address/specs/getAddress.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/back/methods/address/specs/getAddress.spec.js b/modules/client/back/methods/address/specs/getAddress.spec.js index 2c84769e6..d2b219495 100644 --- a/modules/client/back/methods/address/specs/getAddress.spec.js +++ b/modules/client/back/methods/address/specs/getAddress.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); describe('getAddress()', () => { - fit('return list of address last year', async() => { + it('return list of address last year', async() => { let response = await models.Address.getAddress(); expect(response.length).toBeGreaterThan(0); From d2cd522842dbb024f9812b68ed8a58fff4e2fc99 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 14 Sep 2023 07:47:10 +0200 Subject: [PATCH 08/11] refs #5652 modify:without fit --- db/changes/233801/00-item_setVisibleDiscard.sql | 13 +++++-------- db/changes/233801/00-ticketConfig.sql | 11 ----------- db/dump/fixtures.sql | 7 ++----- modules/client/back/methods/address/getAddress.js | 13 ++++++++----- .../back/methods/address/specs/getAddress.spec.js | 5 ++--- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/db/changes/233801/00-item_setVisibleDiscard.sql b/db/changes/233801/00-item_setVisibleDiscard.sql index 1b9bf0ffb..e73a77046 100644 --- a/db/changes/233801/00-item_setVisibleDiscard.sql +++ b/db/changes/233801/00-item_setVisibleDiscard.sql @@ -14,9 +14,8 @@ BEGIN SELECT barcodeToItem(vItemFk) INTO vItemFk; - SELECT companyDefaultFk INTO vCompanyVnlFk - FROM ticketConfig ; - + SELECT DEFAULT(companyFk) INTO vCompanyVnlFk + FROM vn.ticket LIMIT 1; SELECT c.id INTO vClientFk FROM client c JOIN address a ON a.clientFk = c.id @@ -26,10 +25,8 @@ BEGIN FROM ticket t JOIN address a ON a.id = t.addressFk WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = util.VN_CURDATE() - AND a.isDefaultAddress - LIMIT 1; + AND a.id = vAddressFk + AND DATE(t.shipped) = util.VN_CURDATE(); CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); @@ -39,7 +36,7 @@ BEGIN util.VN_CURDATE(), vWarehouseFk, vCompanyVnlFk, - NULL, + vAddressFk, NULL, NULL, util.VN_CURDATE(), diff --git a/db/changes/233801/00-ticketConfig.sql b/db/changes/233801/00-ticketConfig.sql index 5cef1ba5f..5429878b4 100644 --- a/db/changes/233801/00-ticketConfig.sql +++ b/db/changes/233801/00-ticketConfig.sql @@ -1,15 +1,4 @@ -ALTER TABLE `vn`.`ticketConfig` ADD companyDefaultFk int(10) unsigned DEFAULT 442 NOT NULL COMMENT 'Compañía por defecto para crear ticket'; - -ALTER TABLE `vn`.`ticketConfig` ADD CONSTRAINT ticketConfig_FK FOREIGN KEY (companyDefaultFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; - --- Se desactivan por utilizarse muy poco - -UPDATE vn.address - SET isDefaultAddress = 0, - isActive = 0 - WHERE id IN (6,47); - INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES('Item', 'setVisibleDiscard', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 7ce39287e..4e56c8385 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2959,11 +2959,8 @@ INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`) VALUES (1, 0, 0, 'marvel.com'); ---fixtures for getaddressLastYear +--fixtures for getaddress UPDATE vn.client SET typeFk='loses' WHERE id=1101; - -UPDATE vn.ticket - SET created='2023-08-01 00:00:00' - WHERE id=6; \ No newline at end of file + \ No newline at end of file diff --git a/modules/client/back/methods/address/getAddress.js b/modules/client/back/methods/address/getAddress.js index a15fb8aba..86a23674f 100644 --- a/modules/client/back/methods/address/getAddress.js +++ b/modules/client/back/methods/address/getAddress.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('getAddress', { - description: 'Get all activated address client active', + description: 'Get all activated address with loses client activated', accessType: 'READ', accepts: [], returns: { @@ -12,10 +12,13 @@ module.exports = Self => { verb: 'GET' } }); - Self.getAddress = async() => { - const query = `CALL vn.address_getLoses()`; - const [result] = await Self.rawSql(query); - return result; + let getAddressQuery = ` + SELECT a.id, a.nickname + FROM vn.address a + JOIN vn.client c ON a.clientFk = c.id AND c.isActive = 1 + WHERE c.typeFk = 'loses' AND a.isActive = 1;`; + + return result = await Self.rawSql(getAddressQuery); }; }; diff --git a/modules/client/back/methods/address/specs/getAddress.spec.js b/modules/client/back/methods/address/specs/getAddress.spec.js index d2b219495..a86e1007c 100644 --- a/modules/client/back/methods/address/specs/getAddress.spec.js +++ b/modules/client/back/methods/address/specs/getAddress.spec.js @@ -1,10 +1,9 @@ const {models} = require('vn-loopback/server/server'); describe('getAddress()', () => { - it('return list of address last year', async() => { + it('return list of activated address with loses client activated', async() => { let response = await models.Address.getAddress(); - expect(response.length).toBeGreaterThan(0); - expect(response[0].addressFk).toEqual(1); + expect(response.length).toEqual(2); }); }); From b756d2f938f715d3f4aa86326a02b7564c14def5 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 14 Sep 2023 18:03:30 +0200 Subject: [PATCH 09/11] refs #5652 modify --- .../233801/00-address_getLosesLastYear.sql | 14 --------- .../233801/00-item_setVisibleDiscard.sql | 6 ++-- db/dump/fixtures.sql | 31 +++++++++---------- .../client/back/methods/address/getAddress.js | 4 +-- 4 files changed, 19 insertions(+), 36 deletions(-) delete mode 100644 db/changes/233801/00-address_getLosesLastYear.sql diff --git a/db/changes/233801/00-address_getLosesLastYear.sql b/db/changes/233801/00-address_getLosesLastYear.sql deleted file mode 100644 index dc75c3121..000000000 --- a/db/changes/233801/00-address_getLosesLastYear.sql +++ /dev/null @@ -1,14 +0,0 @@ - -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_getLoses`() -BEGIN - SELECT t.addressFk , a.nickname, c.name - FROM ticket t - JOIN address a ON a.id = t.addressFk - JOIN client c ON a.clientFk = c.id - WHERE c.typeFk = 'loses' - AND a.isactive = 1 - GROUP BY t.addressFk; -END$$ -DELIMITER ; - diff --git a/db/changes/233801/00-item_setVisibleDiscard.sql b/db/changes/233801/00-item_setVisibleDiscard.sql index e73a77046..6ee66a947 100644 --- a/db/changes/233801/00-item_setVisibleDiscard.sql +++ b/db/changes/233801/00-item_setVisibleDiscard.sql @@ -16,9 +16,9 @@ BEGIN SELECT DEFAULT(companyFk) INTO vCompanyVnlFk FROM vn.ticket LIMIT 1; - SELECT c.id INTO vClientFk - FROM client c - JOIN address a ON a.clientFk = c.id + + SELECT a.clientFk INTO vClientFk + FROM address a WHERE a.id = vAddressFk; SELECT t.id INTO vTicketFk diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 03a805069..9be9d69f6 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -358,20 +358,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) (4, 'GCN Channel'), (5, 'The Newspaper'); -INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) +INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), - (1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), - (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), - (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'), - (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'); + (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','loses'), + (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), + (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), + (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'), + (1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'), + (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'), + (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','normal'), + (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','normal'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 @@ -2974,8 +2974,5 @@ INSERT INTO vn.XDiario (id, ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EU (4, 2.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T4444444', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0), (5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0), (6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0); ---fixtures for getaddress -UPDATE vn.client - SET typeFk='loses' - WHERE id=1101; + \ No newline at end of file diff --git a/modules/client/back/methods/address/getAddress.js b/modules/client/back/methods/address/getAddress.js index 86a23674f..a62a0ec6f 100644 --- a/modules/client/back/methods/address/getAddress.js +++ b/modules/client/back/methods/address/getAddress.js @@ -16,8 +16,8 @@ module.exports = Self => { let getAddressQuery = ` SELECT a.id, a.nickname FROM vn.address a - JOIN vn.client c ON a.clientFk = c.id AND c.isActive = 1 - WHERE c.typeFk = 'loses' AND a.isActive = 1;`; + JOIN vn.client c ON a.clientFk = c.id AND c.isActive <> FALSE + WHERE c.typeFk = 'loses' AND a.isActive <> FALSE;`; return result = await Self.rawSql(getAddressQuery); }; From 881a1ee0b84b5d9893a84b4adffa78f9c9eb750d Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 15 Sep 2023 11:24:17 +0200 Subject: [PATCH 10/11] refs #5652 modify: solved Tests --- .../back/methods/sales-monitor/specs/salesFilter.spec.js | 4 ++-- modules/ticket/back/methods/ticket/specs/filter.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js index 4e0fb85b7..c3da7f08b 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js @@ -39,7 +39,7 @@ describe('SalesMonitor salesFilter()', () => { const filter = {}; const result = await models.SalesMonitor.salesFilter(ctx, filter, options); - expect(result.length).toBeGreaterThan(15); + expect(result.length).toBeGreaterThan(11); await tx.rollback(); } catch (e) { @@ -151,7 +151,7 @@ describe('SalesMonitor salesFilter()', () => { const result = await models.SalesMonitor.salesFilter(ctx, filter, options); const firstRow = result[0]; - expect(result.length).toEqual(12); + expect(result.length).toEqual(15); expect(firstRow.alertLevel).not.toEqual(0); await tx.rollback(); diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index 510446cab..2e5730980 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -68,7 +68,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(6); + expect(result.length).toEqual(9); await tx.rollback(); } catch (e) { @@ -154,7 +154,7 @@ describe('ticket filter()', () => { const secondRow = result[1]; const thirdRow = result[2]; - expect(result.length).toBeGreaterThan(15); + expect(result.length).toBeGreaterThan(11); expect(firstRow.state).toEqual('Entregado'); expect(secondRow.state).toEqual('Entregado'); expect(thirdRow.state).toEqual('Entregado'); From 690df509d392970e1bde9edb1cef2ec941297b68 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 18 Sep 2023 07:10:12 +0200 Subject: [PATCH 11/11] refs #5684 Fixed no error --- back/methods/edi/updateData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js index 10c81a795..6bebad1e4 100644 --- a/back/methods/edi/updateData.js +++ b/back/methods/edi/updateData.js @@ -139,7 +139,7 @@ module.exports = Self => { ftpClient.exec((err, response) => { if (err || response.error) { console.debug(`Error downloading checksum file... ${response.error}`); - return reject(err); + return reject(response.error || err); } resolve(response);