From e8ce8e42fd1d07274343789f215834146d6c03c5 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 25 Apr 2023 14:25:22 +0200 Subject: [PATCH 01/27] refs #5153 --- db/changes/231601/00-clientWorkerName.sql | 73 +++++++++++++++++++ db/changes/231601/00-createWorker.sql | 9 +++ db/dump/fixtures.sql | 4 +- modules/client/back/methods/client/summary.js | 7 +- modules/client/front/summary/index.html | 3 + modules/client/front/summary/locale/es.yml | 1 + modules/worker/back/methods/worker/new.js | 6 +- modules/worker/back/models/worker-config.json | 3 + 8 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 db/changes/231601/00-clientWorkerName.sql create mode 100644 db/changes/231601/00-createWorker.sql diff --git a/db/changes/231601/00-clientWorkerName.sql b/db/changes/231601/00-clientWorkerName.sql new file mode 100644 index 000000000..676d26691 --- /dev/null +++ b/db/changes/231601/00-clientWorkerName.sql @@ -0,0 +1,73 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientCreate`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, + vPostcode CHAR(5), + vCity VARCHAR(25), + vProvinceFk SMALLINT(5), + vCompanyFk SMALLINT(5), + vPhone VARCHAR(11), + vEmail VARCHAR(255), + vUserFk INT) +BEGIN +/** + * Create new client + * + */ + DECLARE vPayMethodFk INT DEFAULT 4; + DECLARE vDueDay INT DEFAULT 5; + DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00; + DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; + DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; + DECLARE vMandateTypeFk INT DEFAULT 2; + + INSERT INTO `client` ( + id, + name, + street, + fi, + phone, + email, + provinceFk, + city, + postcode, + socialName, + payMethodFk, + dueDay, + credit, + isTaxDataChecked, + hasCoreVnl, + isEqualizated) + VALUES ( + vUserFk, + CONCAT(vFirstname, ' ', vSurnames), + vAddress, + TRIM(vFi), + vPhone, + vEmail, + vProvinceFk, + vCity, + vPostcode, + CONCAT(vSurnames, ' ', vFirstname), + vPayMethodFk, + vDueDay, + vDefaultCredit, + vIsTaxDataChecked, + vHasCoreVnl, + FALSE + ) ON duplicate key update + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isActive = TRUE; + + IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN + INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) + VALUES (vUserFk, vCompanyFk, vMandateTypeFk); + END IF; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/changes/231601/00-createWorker.sql b/db/changes/231601/00-createWorker.sql new file mode 100644 index 000000000..7a128415c --- /dev/null +++ b/db/changes/231601/00-createWorker.sql @@ -0,0 +1,9 @@ +INSERT INTO vn.businessType (code,description) + VALUES ('worker','Trabajador'); + +ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL + COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo'; + +UPDATE `vn`.`workerConfig` + SET businessTypeFk = 'worker' + WHERE id = 1; \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 4dc7dcafc..aae76afa7 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2800,9 +2800,9 @@ INSERT INTO `vn`.`payDemDetail` (`id`, `detail`) VALUES (1, 1); -INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`) +INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `businessTypeFk`) VALUES - (1, NULL, 1); + (1, NULL, 1, 'worker'); INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`) VALUES diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index caa3d8033..7dab1f68b 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -27,7 +27,6 @@ module.exports = Self => { Object.assign(myOptions, options); const summaryObj = await getSummary(models.Client, clientFk, myOptions); - summaryObj.mana = await models.Client.getMana(clientFk, myOptions); summaryObj.debt = await models.Client.getDebt(clientFk, myOptions); summaryObj.averageInvoiced = await models.Client.getAverageInvoiced(clientFk, myOptions); @@ -115,6 +114,12 @@ module.exports = Self => { fields: ['claimingRate', 'priceIncreasing'], limit: 1 } + }, + { + relation: 'businessType', + scope: { + fields: ['description'] + } } ], where: {id: clientId} diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index 1b58d42cc..a0d4b918a 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -64,6 +64,9 @@ + +

diff --git a/modules/client/front/summary/locale/es.yml b/modules/client/front/summary/locale/es.yml index ca6e96fef..c1fde0c17 100644 --- a/modules/client/front/summary/locale/es.yml +++ b/modules/client/front/summary/locale/es.yml @@ -23,3 +23,4 @@ Latest tickets: Últimos tickets Rating: Clasificación Value from 1 to 20. The higher the better value: Valor del 1 al 20. Cuanto más alto mejor valoración Go to grafana: Ir a grafana +Business type: Tipo de negocio \ No newline at end of file diff --git a/modules/worker/back/methods/worker/new.js b/modules/worker/back/methods/worker/new.js index 144b07f10..16c1a0011 100644 --- a/modules/worker/back/methods/worker/new.js +++ b/modules/worker/back/methods/worker/new.js @@ -1,4 +1,4 @@ -/* eslint max-len: ["error", { "code": 130 }]*/ +/* eslint max-len: ["error", { "code": 150 }]*/ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { @@ -139,7 +139,7 @@ module.exports = Self => { if (!client) { const nickname = args.firstName.concat(' ', args.lastNames); - const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk']}); + const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk', 'businessTypeFk']}); const [randomPassword] = await models.Worker.rawSql( 'SELECT account.passwordGenerate() as password;' ); @@ -196,7 +196,7 @@ module.exports = Self => { client = await models.Client.findById( user.id, - {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']}, + {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'businessTypeFk']}, myOptions ); diff --git a/modules/worker/back/models/worker-config.json b/modules/worker/back/models/worker-config.json index 05cdfef42..bcee74067 100644 --- a/modules/worker/back/models/worker-config.json +++ b/modules/worker/back/models/worker-config.json @@ -14,6 +14,9 @@ }, "roleFk": { "type": "number" + }, + "businessTypeFk": { + "type": "string" } }, "acls": [ From 09dbd290862bfa32101bb0b0a06c0b7387dcc26f Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 26 Apr 2023 14:46:16 +0200 Subject: [PATCH 02/27] =?UTF-8?q?refs=20#5594=20cuando=20se=20factura=20se?= =?UTF-8?q?=20env=C3=ADa=20autom=C3=A1ticamente=20un=20mail=20y=20quitados?= =?UTF-8?q?=20logs=20duplicados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/231601/00-invoiceOut_new.sql | 254 ++++++++++++++++++ .../ticket/back/methods/ticket/makeInvoice.js | 30 +-- 2 files changed, 269 insertions(+), 15 deletions(-) create mode 100644 db/changes/231601/00-invoiceOut_new.sql diff --git a/db/changes/231601/00-invoiceOut_new.sql b/db/changes/231601/00-invoiceOut_new.sql new file mode 100644 index 000000000..7406d4591 --- /dev/null +++ b/db/changes/231601/00-invoiceOut_new.sql @@ -0,0 +1,254 @@ +DROP PROCEDURE IF EXISTS `vn`.`invoiceOut_new`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`( + vSerial VARCHAR(255), + vInvoiceDate DATE, + vTaxArea VARCHAR(25), + OUT vNewInvoiceId INT) +BEGIN +/** + * Creación de facturas emitidas. + * requiere previamente tabla ticketToInvoice(id). + * + * @param vSerial serie a la cual se hace la factura + * @param vInvoiceDate fecha de la factura + * @param vTaxArea tipo de iva en relacion a la empresa y al cliente + * @param vNewInvoiceId id de la factura que se acaba de generar + * @return vNewInvoiceId + */ + DECLARE vIsAnySaleToInvoice BOOL; + DECLARE vIsAnyServiceToInvoice BOOL; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT account.myUser_getId(); + DECLARE vCompanyFk INT; + DECLARE vInterCompanyFk INT; + DECLARE vClientFk INT; + DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1; + DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6; + DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2; + DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R'; + DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S'; + DECLARE vNewInvoiceInFk INT; + DECLARE vIsInterCompany BOOL DEFAULT FALSE; + DECLARE vIsCEESerial BOOL DEFAULT FALSE; + DECLARE vIsCorrectInvoiceDate BOOL; + DECLARE vMaxShipped DATE; + + SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE()); + + SELECT t.clientFk, + t.companyFk, + MAX(DATE(t.shipped)), + DATE(vInvoiceDate) >= invoiceOut_getMaxIssued( + vSerial, + t.companyFk, + YEAR(vInvoiceDate)) + INTO vClientFk, + vCompanyFk, + vMaxShipped, + vIsCorrectInvoiceDate + FROM ticketToInvoice tt + JOIN ticket t ON t.id = tt.id; + + IF(vMaxShipped > vInvoiceDate) THEN + CALL util.throw("Invoice date can't be less than max date"); + END IF; + + IF NOT vIsCorrectInvoiceDate THEN + CALL util.throw('Exists an invoice with a previous date'); + END IF; + + -- Eliminem de ticketToInvoice els tickets que no han de ser facturats + DELETE ti.* + FROM ticketToInvoice ti + JOIN ticket t ON t.id = ti.id + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN client c ON c.id = t.clientFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted) + OR c.isTaxDataChecked = FALSE + OR t.isDeleted + OR c.hasToInvoice = FALSE + OR itc.id IS NULL; + + SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 + INTO vIsAnySaleToInvoice + FROM ticketToInvoice t + JOIN sale s ON s.ticketFk = t.id; + + SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice + FROM ticketToInvoice t + JOIN ticketService ts ON ts.ticketFk = t.id; + + IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) + AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) + THEN + + -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial + INSERT INTO invoiceOut( + ref, + serial, + issued, + clientFk, + dued, + companyFk, + cplusInvoiceType477Fk + ) + SELECT + 1, + vSerial, + vInvoiceDate, + vClientFk, + getDueDate(vInvoiceDate, dueDay), + vCompanyFk, + IF(vSerial = vCorrectingSerial, + vCplusCorrectingInvoiceTypeFk, + IF(vSerial = vSimplifiedSerial, + vCplusSimplifiedInvoiceTypeFk, + vCplusStandardInvoiceTypeFk)) + FROM client + WHERE id = vClientFk; + + SET vNewInvoiceId = LAST_INSERT_ID(); + + SELECT `ref` + INTO vNewRef + FROM invoiceOut + WHERE id = vNewInvoiceId; + + UPDATE ticket t + JOIN ticketToInvoice ti ON ti.id = t.id + SET t.refFk = vNewRef; + + DROP TEMPORARY TABLE IF EXISTS tmp.updateInter; + CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY + SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador + FROM ticketToInvoice ti + LEFT JOIN ticketState ts ON ti.id = ts.ticket + JOIN state s + WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id); + + INSERT INTO ticketTracking(stateFk,ticketFk,workerFk) + SELECT * FROM tmp.updateInter; + + CALL invoiceExpenceMake(vNewInvoiceId); + CALL invoiceTaxMake(vNewInvoiceId,vTaxArea); + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) total + FROM invoiceOutExpence + WHERE invoiceOutFk = vNewInvoiceId + ) base + JOIN ( + SELECT SUM(vat) total + FROM invoiceOutTax + WHERE invoiceOutFk = vNewInvoiceId + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vNewInvoiceId; + + DROP TEMPORARY TABLE tmp.updateInter; + + SELECT COUNT(*), id + INTO vIsInterCompany, vInterCompanyFk + FROM company + WHERE clientFk = vClientFk; + + IF (vIsInterCompany) THEN + + INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) + SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk; + + SET vNewInvoiceInFk = LAST_INSERT_ID(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM ticketToInvoice; + + CALL `ticket_getTax`('NATIONAL'); + + SET @vTaxableBaseServices := 0.00; + SET @vTaxCodeGeneral := NULL; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + @vTaxableBaseServices, + sub.expenceFk, + sub.taxTypeSageFk, + sub.transactionTypeSageFk + FROM ( + SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, + i.expenceFk, + i.taxTypeSageFk, + i.transactionTypeSageFk, + @vTaxCodeGeneral := i.taxClassCodeFk + FROM tmp.ticketServiceTax tst + JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code + WHERE i.isService + HAVING taxableBase + ) sub; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, + @vTaxableBaseServices, 0) taxableBase, + i.expenceFk, + i.taxTypeSageFk , + i.transactionTypeSageFk + FROM tmp.ticketTax tt + JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code + WHERE !i.isService + GROUP BY tt.pgcFk + HAVING taxableBase + ORDER BY tt.priority; + + CALL invoiceInDueDay_calculate(vNewInvoiceInFk); + + SELECT COUNT(*) INTO vIsCEESerial + FROM invoiceOutSerial + WHERE code = vSerial; + + IF vIsCEESerial THEN + + INSERT INTO invoiceInIntrastat ( + invoiceInFk, + intrastatFk, + amount, + stems, + countryFk, + net) + SELECT + vNewInvoiceInFk, + i.intrastatFk, + SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))), + SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))), + su.countryFk, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2)) + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vNewRef + GROUP BY i.intrastatFk; + + END IF; + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketAmount; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketServiceTax; + END IF; + END IF; + DROP TEMPORARY TABLE `ticketToInvoice`; +END$$ +DELIMITER ; diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index 9739f5985..3228d15a8 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -89,21 +89,6 @@ module.exports = function(Self) { invoiceId = resultInvoice.id; - for (let ticket of tickets) { - const ticketInvoice = await models.Ticket.findById(ticket.id, { - fields: ['refFk'] - }, myOptions); - - await models.TicketLog.create({ - originFk: ticket.id, - userFk: userId, - action: 'insert', - changedModel: 'Ticket', - changedModelId: ticket.id, - newInstance: ticketInvoice - }, myOptions); - } - if (serial != 'R' && invoiceId) await Self.rawSql('CALL invoiceOutBooking(?)', [invoiceId], myOptions); @@ -116,6 +101,21 @@ module.exports = function(Self) { if (serial != 'R' && invoiceId) await models.InvoiceOut.createPdf(ctx, invoiceId); + if (invoiceId) { + const invoiceOut = await models.InvoiceOut.findById(invoiceId, { + include: { + relation: 'client' + } + }); + + ctx.args = { + reference: invoiceOut.ref, + recipientId: invoiceOut.clientFk, + recipient: invoiceOut.client().email + }; + await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref); + } + return {invoiceFk: invoiceId, serial: serial}; }; }; From 8bb8b8cfba8ff6137414d8e559e5b16983f4d5b7 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 26 Apr 2023 14:55:37 +0200 Subject: [PATCH 03/27] refs #5594 fix backTest --- modules/ticket/back/methods/ticket/makeInvoice.js | 13 ++++++------- .../back/methods/ticket/specs/makeInvoice.spec.js | 7 ++++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js index 3228d15a8..a3a684905 100644 --- a/modules/ticket/back/methods/ticket/makeInvoice.js +++ b/modules/ticket/back/methods/ticket/makeInvoice.js @@ -24,7 +24,6 @@ module.exports = function(Self) { }); Self.makeInvoice = async(ctx, ticketsIds, options) => { - const userId = ctx.req.accessToken.userId; const models = Self.app.models; const date = Date.vnNew(); date.setHours(0, 0, 0, 0); @@ -42,6 +41,7 @@ module.exports = function(Self) { let serial; let invoiceId; + let invoiceOut; try { const tickets = await models.Ticket.find({ where: { @@ -92,6 +92,11 @@ module.exports = function(Self) { if (serial != 'R' && invoiceId) await Self.rawSql('CALL invoiceOutBooking(?)', [invoiceId], myOptions); + invoiceOut = await models.InvoiceOut.findById(invoiceId, { + include: { + relation: 'client' + } + }, myOptions); if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); @@ -102,12 +107,6 @@ module.exports = function(Self) { await models.InvoiceOut.createPdf(ctx, invoiceId); if (invoiceId) { - const invoiceOut = await models.InvoiceOut.findById(invoiceId, { - include: { - relation: 'client' - } - }); - ctx.args = { reference: invoiceOut.ref, recipientId: invoiceOut.clientFk, diff --git a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js index 24d4a48ba..d83e7e5f2 100644 --- a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js +++ b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js @@ -1,11 +1,14 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -describe('ticket makeInvoice()', () => { +fdescribe('ticket makeInvoice()', () => { const userId = 19; const ticketId = 11; const clientId = 1102; const activeCtx = { + getLocale: () => { + return 'en'; + }, accessToken: {userId: userId}, headers: {origin: 'http://localhost:5000'}, }; @@ -67,6 +70,7 @@ describe('ticket makeInvoice()', () => { it('should invoice a ticket, then try again to fail', async() => { const invoiceOutModel = models.InvoiceOut; spyOn(invoiceOutModel, 'createPdf'); + spyOn(invoiceOutModel, 'invoiceEmail'); const tx = await models.Ticket.beginTransaction({}); @@ -90,6 +94,7 @@ describe('ticket makeInvoice()', () => { it('should success to invoice a ticket', async() => { const invoiceOutModel = models.InvoiceOut; spyOn(invoiceOutModel, 'createPdf'); + spyOn(invoiceOutModel, 'invoiceEmail'); const tx = await models.Ticket.beginTransaction({}); From 22b223038a0167686bd4956f34cc103ca73995b4 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 26 Apr 2023 14:56:07 +0200 Subject: [PATCH 04/27] delete focus --- modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js index d83e7e5f2..270ba5c93 100644 --- a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js +++ b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -fdescribe('ticket makeInvoice()', () => { +describe('ticket makeInvoice()', () => { const userId = 19; const ticketId = 11; const clientId = 1102; From 2e020b5ebba85ff27ff30f656143fa42e1e8d4cd Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 4 May 2023 09:02:23 +0200 Subject: [PATCH 05/27] fix(): correct version --- CHANGELOG.md | 6 +- db/changes/231801/00-aclClientInforma.sql | 3 + db/changes/231801/00-clientInforma.sql | 16 +++++ db/changes/231801/00-client_setRatingAcl.sql | 64 ++++++++++++++++++++ db/changes/231801/00-deleteProcs_refund.sql | 2 + db/changes/231801/00-kkearEntryNotes.sql | 1 + db/changes/231801/00-newCompanyI18n.sql | 9 +++ db/changes/231801/00-newTableWeb.sql | 1 + db/changes/231801/00-observationEmailACL.sql | 3 + db/changes/231801/00-updateIsVies.sql | 5 ++ db/changes/231801/00-updateisViesClient.sql | 5 ++ db/changes/231801/00-userAcl.sql | 21 +++++++ db/changes/231801/00-userRoleLog.sql | 4 ++ package-lock.json | 4 +- package.json | 2 +- 15 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 db/changes/231801/00-aclClientInforma.sql create mode 100644 db/changes/231801/00-clientInforma.sql create mode 100644 db/changes/231801/00-client_setRatingAcl.sql create mode 100644 db/changes/231801/00-deleteProcs_refund.sql create mode 100644 db/changes/231801/00-kkearEntryNotes.sql create mode 100644 db/changes/231801/00-newCompanyI18n.sql create mode 100644 db/changes/231801/00-newTableWeb.sql create mode 100644 db/changes/231801/00-observationEmailACL.sql create mode 100644 db/changes/231801/00-updateIsVies.sql create mode 100644 db/changes/231801/00-updateisViesClient.sql create mode 100644 db/changes/231801/00-userAcl.sql create mode 100644 db/changes/231801/00-userRoleLog.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 1be03b733..fa318a908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,17 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2316.01] - 2023-05-04 +## [2318.01] - 2023-05-04 ### Added - (Usuarios -> Histórico) Nueva sección - (Roles -> Histórico) Nueva sección +- (General -> Traducciones) Correo de bienvenida a clientes al portugués y al francés ### Changed - (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral ### Fixed -- +- (Ticket -> Boxing) Arreglado selección de horas + ## [2314.01] - 2023-04-20 diff --git a/db/changes/231801/00-aclClientInforma.sql b/db/changes/231801/00-aclClientInforma.sql new file mode 100644 index 000000000..6222d2632 --- /dev/null +++ b/db/changes/231801/00-aclClientInforma.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) +VALUES ('ClientInforma', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('ClientInforma', '*', 'WRITE', 'ALLOW', 'ROLE', 'financial'); diff --git a/db/changes/231801/00-clientInforma.sql b/db/changes/231801/00-clientInforma.sql new file mode 100644 index 000000000..9bf757fc3 --- /dev/null +++ b/db/changes/231801/00-clientInforma.sql @@ -0,0 +1,16 @@ +ALTER TABLE `vn`.`client` ADD rating INT UNSIGNED DEFAULT NULL NULL COMMENT 'información proporcionada por Informa'; +ALTER TABLE `vn`.`client` ADD recommendedCredit INT UNSIGNED DEFAULT NULL NULL COMMENT 'información proporcionada por Informa'; + +CREATE TABLE `vn`.`clientInforma` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL, + `rating` int(10) unsigned DEFAULT NULL, + `recommendedCredit` int(10) unsigned DEFAULT NULL, + `workerFk` int(10) unsigned NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `informaWorkers_fk_idx` (`workerFk`), + KEY `informaClientFk` (`clientFk`), + CONSTRAINT `informa_ClienteFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `informa_workers_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='información proporcionada por Informa, se actualiza desde el hook de client (salix)'; diff --git a/db/changes/231801/00-client_setRatingAcl.sql b/db/changes/231801/00-client_setRatingAcl.sql new file mode 100644 index 000000000..b041b131a --- /dev/null +++ b/db/changes/231801/00-client_setRatingAcl.sql @@ -0,0 +1,64 @@ +DELETE FROM `salix`.`ACL` WHERE id=7; + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('Client', 'setRating', 'WRITE', 'ALLOW', 'ROLE', 'financial'); + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('Client', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'addressesPropagateRe', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'canBeInvoiced', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'canCreateTicket', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'consumption', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'createAddress', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'createWithUser', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'extendedListFilter', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'getAverageInvoiced', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'getCard', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'getDebt', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'getMana', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'transactions', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'hasCustomerRole', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'isValidClient', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'lastActiveTickets', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'sendSms', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'setPassword', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'summary', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'updateAddress', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'updateFiscalData', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'updateUser', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'uploadFile', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'campaignMetricsPdf', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'campaignMetricsEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientWelcomeHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientWelcomeEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'printerSetupHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'printerSetupEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'sepaCoreEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorPdf', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorStHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorStEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorNdHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'letterDebtorNdEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientDebtStatementPdf', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientDebtStatementHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'clientDebtStatementEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'creditRequestPdf', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'creditRequestHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'creditRequestEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'incotermsAuthorizationPdf', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'incotermsAuthorizationHtml', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'incotermsAuthorizationEmail', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'consumptionSendQueued', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'filter', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'getClientOrSupplierReference', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'upsert', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'create', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'replaceById', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'updateAttributes', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'updateAttributes', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'deleteById', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'replaceOrCreate', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'updateAll', '*', 'ALLOW', 'ROLE', 'employee'), + ('Client', 'upsertWithWhere', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/231801/00-deleteProcs_refund.sql b/db/changes/231801/00-deleteProcs_refund.sql new file mode 100644 index 000000000..8bf8982f4 --- /dev/null +++ b/db/changes/231801/00-deleteProcs_refund.sql @@ -0,0 +1,2 @@ +DROP PROCEDURE `vn`.`refund`; +DROP PROCEDURE `vn`.`ticket_doRefund`; diff --git a/db/changes/231801/00-kkearEntryNotes.sql b/db/changes/231801/00-kkearEntryNotes.sql new file mode 100644 index 000000000..ff5c7ce29 --- /dev/null +++ b/db/changes/231801/00-kkearEntryNotes.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`entry` DROP COLUMN `notes`; \ No newline at end of file diff --git a/db/changes/231801/00-newCompanyI18n.sql b/db/changes/231801/00-newCompanyI18n.sql new file mode 100644 index 000000000..948b9cb08 --- /dev/null +++ b/db/changes/231801/00-newCompanyI18n.sql @@ -0,0 +1,9 @@ +-- vn.companyI18n definition +CREATE TABLE `vn`.`companyI18n` ( + `companyFk` smallint(5) unsigned NOT NULL, + `lang` char(2) CHARACTER SET utf8mb3 NOT NULL, + `footnotes` longtext COLLATE utf8mb3_unicode_ci DEFAULT NULL, + PRIMARY KEY (`companyFk`,`lang`), + CONSTRAINT `companyI18n_FK` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + diff --git a/db/changes/231801/00-newTableWeb.sql b/db/changes/231801/00-newTableWeb.sql new file mode 100644 index 000000000..1a2402956 --- /dev/null +++ b/db/changes/231801/00-newTableWeb.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`company` ADD `web` varchar(100) NULL; \ No newline at end of file diff --git a/db/changes/231801/00-observationEmailACL.sql b/db/changes/231801/00-observationEmailACL.sql new file mode 100644 index 000000000..1a5d475e8 --- /dev/null +++ b/db/changes/231801/00-observationEmailACL.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Defaulter', 'observationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/231801/00-updateIsVies.sql b/db/changes/231801/00-updateIsVies.sql new file mode 100644 index 000000000..4e5277559 --- /dev/null +++ b/db/changes/231801/00-updateIsVies.sql @@ -0,0 +1,5 @@ + UPDATE `vn`.`supplier` s + JOIN `vn`.`country` c ON c.id = s.countryFk + SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1) + WHERE s.isVies = TRUE + AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2); diff --git a/db/changes/231801/00-updateisViesClient.sql b/db/changes/231801/00-updateisViesClient.sql new file mode 100644 index 000000000..a153c5219 --- /dev/null +++ b/db/changes/231801/00-updateisViesClient.sql @@ -0,0 +1,5 @@ +UPDATE IGNORE `vn`.`client` c + JOIN `vn`.`country` co ON co.id = c.countryFk + SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1) + WHERE c.isVies = TRUE + AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2); diff --git a/db/changes/231801/00-userAcl.sql b/db/changes/231801/00-userAcl.sql new file mode 100644 index 000000000..64803bf18 --- /dev/null +++ b/db/changes/231801/00-userAcl.sql @@ -0,0 +1,21 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('VnUser', '*', '*', 'ALLOW', 'ROLE', 'employee'), + ('VnUser','acl','READ','ALLOW','ROLE','account'), + ('VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'), + ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'), + ('Account','exists','READ','ALLOW','ROLE','account'); + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('Account','exists','READ','ALLOW','ROLE','account'); + +DELETE FROM `salix`.`ACL` WHERE (model, property) = ('Account', 'acl'); +DELETE FROM `salix`.`ACL` WHERE (model, property) = ('Account', 'getCurrentUserData'); +DELETE FROM `salix`.`ACL` WHERE (model, property) = ('Account', 'changePassword'); +DELETE FROM `salix`.`ACL` WHERE model = 'UserAccount'; + +UPDATE `hedera`.`imageCollection` t +SET t.model = 'VnUser' +WHERE t.id = 6; + diff --git a/db/changes/231801/00-userRoleLog.sql b/db/changes/231801/00-userRoleLog.sql new file mode 100644 index 000000000..ae5da13cb --- /dev/null +++ b/db/changes/231801/00-userRoleLog.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('UserLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('RoleLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/package-lock.json b/package-lock.json index fae8837fa..d373248fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "salix-back", - "version": "23.16.01", - "lockfileVersion": 2, + "version": "23.18.01", + "lockfileVersion": 1, "requires": true, "packages": { "": { diff --git a/package.json b/package.json index 8d6c5340b..fee164f44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.16.01", + "version": "23.18.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 49233eefcd97ff0de16e1c811ffdd4515fe2a5a5 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 4 May 2023 10:18:37 +0200 Subject: [PATCH 06/27] refs #5580 add button, yml --- print/templates/email/weekly-hour-record/locale/en.yml | 5 +++-- print/templates/email/weekly-hour-record/locale/es.yml | 5 +++-- .../email/weekly-hour-record/weekly-hour-record.html | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/print/templates/email/weekly-hour-record/locale/en.yml b/print/templates/email/weekly-hour-record/locale/en.yml index 817e5451e..b76372fb9 100644 --- a/print/templates/email/weekly-hour-record/locale/en.yml +++ b/print/templates/email/weekly-hour-record/locale/en.yml @@ -1,6 +1,7 @@ subject: Weekly time log title: Record of hours week {0} year {1} dear: Dear worker -description: Access the following link:

- {0}

+Acceda al siguiente enlace: Access the following link:
+description: Click 'SATISFIED' if you agree with the hours worked. Otherwise, press 'NOT SATISFIED', detailing the cause of the disagreement. +Hours: Hours \ No newline at end of file diff --git a/print/templates/email/weekly-hour-record/locale/es.yml b/print/templates/email/weekly-hour-record/locale/es.yml index b70862f16..95466addb 100644 --- a/print/templates/email/weekly-hour-record/locale/es.yml +++ b/print/templates/email/weekly-hour-record/locale/es.yml @@ -1,6 +1,7 @@ subject: Registro de horas semanal title: Registro de horas semana {0} año {1} dear: Estimado trabajador -description: Acceda al siguiente enlace:

- {0}

+toaccess: Acceda al siguiente enlace:
+description: Pulse 'CONFORME' si esta de acuerdo con las horas trabajadas. En caso contrario pulse 'NO CONFORME', detallando la causa de la disconformidad. +Hours: Horas \ No newline at end of file diff --git a/print/templates/email/weekly-hour-record/weekly-hour-record.html b/print/templates/email/weekly-hour-record/weekly-hour-record.html index 84abb4c61..b1eb4e0b3 100644 --- a/print/templates/email/weekly-hour-record/weekly-hour-record.html +++ b/print/templates/email/weekly-hour-record/weekly-hour-record.html @@ -3,7 +3,9 @@

{{ $t('title', [week, year]) }}

{{$t('dear')}},

-

+

+ +

{{$t('description')}}

From 68b1b6c5bd1ce930d913aed9af19f7f9139edd09 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 12:03:27 +0200 Subject: [PATCH 07/27] refs #5517 E2E fixes --- e2e/helpers/selectors.js | 24 --- e2e/paths/02-client/14_balance.spec.js | 147 ++++++++---------- .../02-client/23_send_compensation.spec.js | 13 +- e2e/paths/04-item/03_tax.spec.js | 8 - .../05-ticket/01-sale/02_edit_sale.spec.js | 16 +- e2e/paths/05-ticket/18_index_payout.spec.js | 40 ++--- e2e/paths/07-order/01_summary.spec.js | 67 +++----- e2e/paths/08-route/04_tickets.spec.js | 7 - e2e/paths/12-entry/03_latestBuys.spec.js | 14 -- front/core/components/popover/index.spec.js | 24 --- loopback/locale/en.json | 3 +- .../client/front/balance/create/index.html | 18 ++- 12 files changed, 137 insertions(+), 244 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 9181e9d9c..b19db24d7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -285,21 +285,6 @@ export default { clientMandate: { firstMandateText: 'vn-client-mandate vn-card vn-table vn-tbody > vn-tr' }, - clientBalance: { - company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', - newPaymentButton: `vn-float-button`, - newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.bankFk"]', - newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.amountPaid"]', - newDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]', - deliveredAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.deliveredAmount"]', - refundAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.amountToReturn"]', - saveButton: '.vn-dialog.shown [response="accept"]', - anyBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr', - firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)', - firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable', - firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield', - compensationButton: 'vn-client-balance-index vn-icon-button[vn-dialog="send_compensation"]' - }, webPayment: { confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]', firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"]' @@ -841,15 +826,6 @@ export default { landedDatePicker: 'vn-date-picker[label="Landed"]', createButton: 'button[type=submit]' }, - orderSummary: { - id: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(1) span', - alias: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) span', - consignee: 'vn-order-summary vn-one:nth-child(2) > vn-label-value:nth-child(6) span', - subtotal: 'vn-order-summary vn-one.taxes > p:nth-child(1)', - vat: 'vn-order-summary vn-one.taxes > p:nth-child(2)', - total: 'vn-order-summary vn-one.taxes > p:nth-child(3)', - sale: 'vn-order-summary vn-tbody > vn-tr', - }, orderCatalog: { plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', type: 'vn-order-catalog vn-autocomplete[data="$ctrl.itemTypes"]', diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index d3de842e3..b1c0f7eea 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -1,6 +1,17 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; +const $ = { + company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', + newPaymentButton: `vn-float-button`, + newPayment: '.vn-dialog.shown', + refundAmount: '.vn-dialog.shown [vn-name="amountToReturn"]', + saveButton: '.vn-dialog.shown [response="accept"]', + firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)', + firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable', + firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable vn-textfield', +}; + describe('Client balance path', () => { let browser; let page; @@ -18,125 +29,100 @@ describe('Client balance path', () => { it('should now edit the local user config data', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); await page.autocompleteSearch(selectors.globalItems.userLocalCompany, 'CCs'); - const message = await page.waitForSnackbar(); + const companyMessage = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should access to the balance section to check the data shown matches the local settings', async() => { await page.accessToSection('client.card.balance.index'); - let result = await page.waitToGetProperty(selectors.clientBalance.company, 'value'); + const company = await page.getValue($.company); - expect(result).toEqual('CCs'); - }); - - it('should now clear the user local settings', async() => { await page.waitToClick(selectors.globalItems.userMenuButton); await page.clearInput(selectors.globalItems.userConfigThirdAutocomplete); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should reload the section', async() => { await page.closePopup(); await page.reloadSection('client.card.balance.index'); + + expect(companyMessage.isSuccess).toBeTrue(); + expect(company).toEqual('CCs'); + expect(message.isSuccess).toBeTrue(); }); it('should create a new payment that clears the debt', async() => { - await page.closePopup(); - await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Cash'); - await page.clearInput(selectors.clientBalance.newDescription); - await page.write(selectors.clientBalance.newDescription, 'Description'); - await page.waitToClick(selectors.clientBalance.saveButton); + await page.waitToClick($.newPaymentButton); + await page.fillForm($.newPayment, { + bank: 'Cash', + description: 'Description', + viewReceipt: false + }); + await page.respondToDialog('accept'); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); + expect(message.isSuccess).toBeTrue(); }); - it('should edit the 1st line reference', async() => { - await page.waitToClick(selectors.clientBalance.firstLineReference); - await page.write(selectors.clientBalance.firstLineReferenceInput, 'Miscellaneous payment'); + it('should edit the 1st line reference and check data', async() => { + await page.waitToClick($.firstLineReference); + await page.write($.firstLineReferenceInput, 'Miscellaneous payment'); await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => { await page.waitForSpinnerLoad(); - let company = await page - .waitToGetProperty(selectors.clientBalance.company, 'value'); - - let reference = await page - .waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText'); - - let firstBalanceLine = await page - .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); + let company = await page.getValue($.company); + let reference = await page.innerText($.firstLineReference); + let firstBalanceLine = await page.innerText($.firstLineBalance); + expect(message.isSuccess).toBeTrue(); expect(company).toEqual('VNL'); expect(reference).toEqual('Miscellaneous payment'); expect(firstBalanceLine).toContain('0.00'); }); - it('should create a new payment and check the cash comparison works correctly', async() => { - const amountPaid = '100'; - const cashHanded = '500'; - const expectedRefund = '400'; - - await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.write(selectors.clientBalance.newPaymentAmount, amountPaid); - await page.clearInput(selectors.clientBalance.newDescription); - await page.write(selectors.clientBalance.newDescription, 'Payment'); - await page.write(selectors.clientBalance.deliveredAmount, cashHanded); - const refund = await page.waitToGetProperty(selectors.clientBalance.refundAmount, 'value'); - await page.waitToClick(selectors.clientBalance.saveButton); + it('should create a new payment, check the cash comparison works correctly and balance value is -100', async() => { + await page.waitToClick($.newPaymentButton); + await page.fillForm($.newPayment, { + amountPaid: 100, + description: 'Payment', + deliveredAmount: 500, + viewReceipt: false + }); + const refund = await page.getValue($.refundAmount); + await page.respondToDialog('accept'); const message = await page.waitForSnackbar(); - expect(refund).toEqual(expectedRefund); - expect(message.text).toContain('Data saved!'); - }); - - it('should check the balance value is now -100', async() => { - let result = await page - .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); + const result = await page.innerText($.firstLineBalance); + expect(refund).toEqual('400'); + expect(message.isSuccess).toBeTrue(); expect(result).toContain('-€100.00'); }); it('should create a new payment and check the cash exceeded the maximum', async() => { - const amountPaid = '1001'; - - await page.closePopup(); - await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Cash'); - await page.write(selectors.clientBalance.newPaymentAmount, amountPaid); - await page.clearInput(selectors.clientBalance.newDescription); - await page.write(selectors.clientBalance.newDescription, 'Payment'); - await page.waitToClick(selectors.clientBalance.saveButton); + await page.waitToClick($.newPaymentButton); + await page.fillForm($.newPayment, { + bank: 'Cash', + amountPaid: 1001, + description: 'Payment' + }); + await page.waitToClick($.saveButton); const message = await page.waitForSnackbar(); expect(message.text).toContain('Amount exceeded'); }); - it('should create a new payment that sets the balance back to the original negative value', async() => { + it('should create a new payment that sets the balance back to negative value and check it', async() => { await page.closePopup(); - await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); - await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150'); - await page.clearInput(selectors.clientBalance.newDescription); - await page.write(selectors.clientBalance.newDescription, 'Description'); - await page.waitToClick(selectors.clientBalance.saveButton); + await page.waitToClick($.newPaymentButton); + + await page.fillForm($.newPayment, { + bank: 'Pay on receipt', + amountPaid: -150, + description: 'Description' + }); + await page.respondToDialog('accept'); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should check balance is now 50', async() => { - let result = await page - .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); + const result = await page.innerText($.firstLineBalance); + expect(message.isSuccess).toBeTrue(); expect(result).toEqual('€50.00'); }); @@ -149,12 +135,9 @@ describe('Client balance path', () => { await page.waitForState('client.index'); }); - it('should now search for the user Petter Parker', async() => { + it('should now search for the user Petter Parker not check the payment button is not present', async() => { await page.accessToSearchResult('Petter Parker'); await page.accessToSection('client.card.balance.index'); - }); - - it('should not be able to click the new payment button as it isnt present', async() => { - await page.waitForSelector(selectors.clientBalance.newPaymentButton, {hidden: true}); + await page.waitForSelector($.newPaymentButton, {hidden: true}); }); }); diff --git a/e2e/paths/02-client/23_send_compensation.spec.js b/e2e/paths/02-client/23_send_compensation.spec.js index 6ec8936a8..7ab2d0bac 100644 --- a/e2e/paths/02-client/23_send_compensation.spec.js +++ b/e2e/paths/02-client/23_send_compensation.spec.js @@ -1,6 +1,11 @@ -import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; +const $ = { + company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', + compensationButton: 'vn-client-balance-index vn-icon-button[vn-dialog="send_compensation"]', + saveButton: '.vn-dialog.shown [response="accept"]' +}; + describe('Client Send balance compensation', () => { let browser; let page; @@ -17,9 +22,9 @@ describe('Client Send balance compensation', () => { }); it(`should click on send compensation button`, async() => { - await page.autocompleteSearch(selectors.clientBalance.company, 'VNL'); - await page.waitToClick(selectors.clientBalance.compensationButton); - await page.waitToClick(selectors.clientBalance.saveButton); + await page.autocompleteSearch($.company, 'VNL'); + await page.waitToClick($.compensationButton); + await page.waitToClick($.saveButton); const message = await page.waitForSnackbar(); expect(message.text).toContain('Notification sent!'); diff --git a/e2e/paths/04-item/03_tax.spec.js b/e2e/paths/04-item/03_tax.spec.js index 8b3b0f8b1..83f4e6bee 100644 --- a/e2e/paths/04-item/03_tax.spec.js +++ b/e2e/paths/04-item/03_tax.spec.js @@ -53,12 +53,4 @@ describe('Item edit tax path', () => { expect(firstVatType).toEqual('Reduced VAT'); }); - - // # #2680 Undo changes button bugs - xit(`should now click the undo changes button and see the form is restored`, async() => { - await page.waitToClick(selectors.itemTax.undoChangesButton); - const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value'); - - expect(firstVatType).toEqual('General VAT'); - }); }); diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index 1b3204046..2c9646708 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -316,7 +316,7 @@ describe('Ticket Edit sale path', () => { it('should confirm the transfered quantity is the correct one', async() => { const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText'); - expect(result).toContain('20'); + expect(result).toContain('10'); }); it('should go back to the original ticket sales section', async() => { @@ -425,20 +425,6 @@ describe('Ticket Edit sale path', () => { expect(result).toBeFalsy(); }); - // tickets no longer update their totals instantly, a task performed ever 5-10 mins does it. disabled this test until it changes. - xit('should update all sales discount', async() => { - await page.closePopup(); - await page.waitToClick(selectors.ticketSales.moreMenu); - await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount); - await page.waitForSelector(selectors.ticketSales.moreMenuUpdateDiscountInput); - await page.type(selectors.ticketSales.moreMenuUpdateDiscountInput, '100'); - await page.keyboard.press('Enter'); - await page.waitForTextInElement(selectors.ticketSales.totalImport, '0.00'); - const result = await page.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText'); - - expect(result).toContain('0.00'); - }); - it('should log in as Production role and go to a target ticket summary', async() => { await page.loginAndModule('production', 'ticket'); await page.accessToSearchResult('13'); diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js index 220dacf61..7e5201d11 100644 --- a/e2e/paths/05-ticket/18_index_payout.spec.js +++ b/e2e/paths/05-ticket/18_index_payout.spec.js @@ -1,5 +1,10 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; +const $ = { + newPayment: '.vn-dialog.shown', + anyBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr', + firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable' +}; describe('Ticket index payout path', () => { let browser; @@ -8,17 +13,14 @@ describe('Ticket index payout path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; + await page.loginAndModule('administrative', 'ticket'); + await page.waitForState('ticket.index'); }); afterAll(async() => { await browser.close(); }); - it('should navigate to the ticket index', async() => { - await page.loginAndModule('administrative', 'ticket'); - await page.waitForState('ticket.index'); - }); - it('should check the second ticket from a client and 1 of another', async() => { await page.waitToClick(selectors.globalItems.searchButton); await page.waitToClick(selectors.ticketsIndex.thirdTicketCheckbox); @@ -42,27 +44,27 @@ describe('Ticket index payout path', () => { await page.waitForSelector(selectors.ticketsIndex.payoutCompany); }); - it('should fill the company and bank to perform a payout', async() => { - await page.autocompleteSearch(selectors.ticketsIndex.payoutCompany, 'VNL'); - await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash'); - await page.write(selectors.clientBalance.newPaymentAmount, '100'); - await page.write(selectors.ticketsIndex.payoutDescription, 'Payment'); - await page.waitToClick(selectors.ticketsIndex.submitPayout); + it('should fill the company and bank to perform a payout and check a new balance line was entered', async() => { + await page.fillForm($.newPayment, { + company: 'VNL', + bank: 'cash', + amountPaid: 100, + description: 'Payment', + viewReceipt: false + }); + await page.respondToDialog('accept'); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should navigate to the client balance section and check a new balance line was entered', async() => { await page.waitToClick(selectors.globalItems.homeButton); await page.selectModule('client'); await page.accessToSearchResult('1101'); await page.accessToSection('client.card.balance.index'); - await page.waitForSelector(selectors.clientBalance.anyBalanceLine); - const count = await page.countElement(selectors.clientBalance.anyBalanceLine); - const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText'); + await page.waitForSelector($.anyBalanceLine); + const count = await page.countElement($.anyBalanceLine); + const reference = await page.innerText($.firstLineReference); + expect(message.isSuccess).toBeTrue(); expect(count).toEqual(4); - expect(reference).toContain('Cash, Albaran: 7, 8Payment'); + expect(reference).toContain('Payment'); }); }); diff --git a/e2e/paths/07-order/01_summary.spec.js b/e2e/paths/07-order/01_summary.spec.js index 922d5eeee..9df481ef6 100644 --- a/e2e/paths/07-order/01_summary.spec.js +++ b/e2e/paths/07-order/01_summary.spec.js @@ -1,6 +1,15 @@ -import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; +const $ = { + id: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(1) span', + alias: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) span', + consignee: 'vn-order-summary vn-one:nth-child(2) > vn-label-value:nth-child(6) span', + subtotal: 'vn-order-summary vn-one.taxes > p:nth-child(1)', + vat: 'vn-order-summary vn-one.taxes > p:nth-child(2)', + total: 'vn-order-summary vn-one.taxes > p:nth-child(3)', + sale: 'vn-order-summary vn-tbody > vn-tr', +}; + describe('Order summary path', () => { let browser; let page; @@ -15,49 +24,23 @@ describe('Order summary path', () => { await browser.close(); }); - it('should reach the order summary section', async() => { + it('should reach the order summary section and check data', async() => { await page.waitForState('order.card.summary'); - }); - it('should check the summary contains the order id', async() => { - const result = await page.waitToGetProperty(selectors.orderSummary.id, 'innerText'); + const id = await page.innerText($.id); + const alias = await page.innerText($.alias); + const consignee = await page.innerText($.consignee); + const subtotal = await page.innerText($.subtotal); + const vat = await page.innerText($.vat); + const total = await page.innerText($.total); + const sale = await page.countElement($.sale); - expect(result).toEqual('16'); - }); - - it('should check the summary contains the order alias', async() => { - const result = await page.waitToGetProperty(selectors.orderSummary.alias, 'innerText'); - - expect(result).toEqual('Many places'); - }); - - it('should check the summary contains the order consignee', async() => { - const result = await page.waitToGetProperty(selectors.orderSummary.consignee, 'innerText'); - - expect(result).toEqual('address 26 - Gotham (Province one)'); - }); - - it('should check the summary contains the order subtotal', async() => { - const result = await page.waitToGetProperty(selectors.orderSummary.subtotal, 'innerText'); - - expect(result.length).toBeGreaterThan(1); - }); - - it('should check the summary contains the order vat', async() => { - const result = await page.waitToGetProperty(selectors.orderSummary.vat, 'innerText'); - - expect(result.length).toBeGreaterThan(1); - }); - - it('should check the summary contains the order total', async() => { - const result = await page.waitToGetProperty(selectors.orderSummary.total, 'innerText'); - - expect(result.length).toBeGreaterThan(1); - }); - - it('should check the summary contains the order sales', async() => { - const result = await page.countElement(selectors.orderSummary.sale); - - expect(result).toBeGreaterThan(0); + expect(id).toEqual('16'); + expect(alias).toEqual('Many places'); + expect(consignee).toEqual('address 26 - Gotham (Province one)'); + expect(subtotal.length).toBeGreaterThan(1); + expect(vat.length).toBeGreaterThan(1); + expect(total.length).toBeGreaterThan(1); + expect(sale).toBeGreaterThan(0); }); }); diff --git a/e2e/paths/08-route/04_tickets.spec.js b/e2e/paths/08-route/04_tickets.spec.js index 950e11d3e..ccd5562c2 100644 --- a/e2e/paths/08-route/04_tickets.spec.js +++ b/e2e/paths/08-route/04_tickets.spec.js @@ -57,11 +57,4 @@ describe('Route tickets path', () => { it('should now count how many tickets are in route to find one less', async() => { await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0); }); - - // #2862 updateVolume() route descriptor no actualiza volumen - xit('should confirm the route volume on the descriptor has been updated by the changes made', async() => { - const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); - - expect(result).toEqual('0 / 50 m³'); - }); }); diff --git a/e2e/paths/12-entry/03_latestBuys.spec.js b/e2e/paths/12-entry/03_latestBuys.spec.js index a73e12659..9ec072912 100644 --- a/e2e/paths/12-entry/03_latestBuys.spec.js +++ b/e2e/paths/12-entry/03_latestBuys.spec.js @@ -42,20 +42,6 @@ describe('Entry lastest buys path', () => { expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined(); }); - it('should filter by from date', async() => { - await page.pickDate(selectors.entryLatestBuys.fromInput, new Date()); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('from')))).toBeDefined(); - }); - - it('should filter by to date', async() => { - await page.pickDate(selectors.entryLatestBuys.toInput, new Date()); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('to')))).toBeDefined(); - }); - it('should filter by sales person', async() => { await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick'); await page.waitToClick(selectors.entryLatestBuys.chip); diff --git a/front/core/components/popover/index.spec.js b/front/core/components/popover/index.spec.js index dc6e3b23f..4590a8e24 100644 --- a/front/core/components/popover/index.spec.js +++ b/front/core/components/popover/index.spec.js @@ -36,30 +36,6 @@ describe('Component vnPopover', () => { expect(controller.emit).not.toHaveBeenCalledWith('open'); }); - - // #1615 migrar karma a jest (this doesn't work anymore, needs fixing) - xit(`should check that popover is visible into the screen`, () => { - $parent.css({ - backgroundColor: 'red', - position: 'absolute', - width: '50px', - height: '50px', - top: '0', - left: '100px' - }); - controller.show($parent[0]); - - let rect = controller.popover.getBoundingClientRect(); - let style = controller.window.getComputedStyle(controller.element); - - expect(style.visibility).toEqual('visible'); - expect(style.display).not.toEqual('none'); - - expect(0).toBeLessThanOrEqual(rect.top); - expect(0).toBeLessThanOrEqual(rect.left); - expect(controller.window.innerHeight).toBeGreaterThan(rect.bottom); - expect(controller.window.innerWidth).toBeGreaterThan(rect.right); - }); }); describe('hide()', () => { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index ae0da8170..cffedd891 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -170,5 +170,6 @@ "comercialName": "Comercial", "Added observation": "Added observation", "Comment added to client": "Comment added to client", - "This ticket is already a refund": "This ticket is already a refund" + "This ticket is already a refund": "This ticket is already a refund", + "A claim with that sale already exists": "A claim with that sale already exists" } \ No newline at end of file diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html index 524b2b2ef..27b182c9a 100644 --- a/modules/client/front/balance/create/index.html +++ b/modules/client/front/balance/create/index.html @@ -13,6 +13,7 @@ @@ -33,6 +35,7 @@ fields="['accountingTypeFk']" include="{relation: 'accountingType'}" ng-model="$ctrl.bankFk" + vn-name="bank" search-function="$ctrl.bankSearchFunc($search)" selection="$ctrl.bankSelection" order="id" @@ -43,6 +46,7 @@ vn-focus label="Amount" ng-model="$ctrl.amountPaid" + vn-name="amountPaid" step="0.01" required="true" max="$ctrl.maxAmount"> @@ -52,6 +56,7 @@
Compensation
@@ -60,6 +65,7 @@ @@ -70,23 +76,27 @@ + step="0.01" + vn-name="deliveredAmount"> + label="Amount to return" + vn-name="amountToReturn"> + ng-model="$ctrl.viewReceipt" + vn-name="viewReceipt"> + ng-model="$ctrl.sendEmail" + vn-name="sendEmail"> From 90465c275a28146d4ded5dfa95b3dbb3476a39e0 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 8 May 2023 12:21:20 +0200 Subject: [PATCH 08/27] correct folder --- db/changes/231601/00-aclClientInforma.sql | 3 - db/changes/231601/00-clientInforma.sql | 16 ----- db/changes/231601/00-client_setRatingAcl.sql | 64 ------------------- db/changes/231601/00-deleteProcs_refund.sql | 2 - db/changes/231601/00-kkearEntryNotes.sql | 1 - db/changes/231601/00-newCompanyI18n.sql | 9 --- db/changes/231601/00-newTableWeb.sql | 1 - db/changes/231601/00-observationEmailACL.sql | 3 - db/changes/231601/00-updateIsVies.sql | 5 -- db/changes/231601/00-updateisViesClient.sql | 5 -- db/changes/231601/00-userAcl.sql | 21 ------ db/changes/231601/00-userRoleLog.sql | 4 -- .../{231601 => 231801}/00-saleTracking.sql | 0 13 files changed, 134 deletions(-) delete mode 100644 db/changes/231601/00-aclClientInforma.sql delete mode 100644 db/changes/231601/00-clientInforma.sql delete mode 100644 db/changes/231601/00-client_setRatingAcl.sql delete mode 100644 db/changes/231601/00-deleteProcs_refund.sql delete mode 100644 db/changes/231601/00-kkearEntryNotes.sql delete mode 100644 db/changes/231601/00-newCompanyI18n.sql delete mode 100644 db/changes/231601/00-newTableWeb.sql delete mode 100644 db/changes/231601/00-observationEmailACL.sql delete mode 100644 db/changes/231601/00-updateIsVies.sql delete mode 100644 db/changes/231601/00-updateisViesClient.sql delete mode 100644 db/changes/231601/00-userAcl.sql delete mode 100644 db/changes/231601/00-userRoleLog.sql rename db/changes/{231601 => 231801}/00-saleTracking.sql (100%) diff --git a/db/changes/231601/00-aclClientInforma.sql b/db/changes/231601/00-aclClientInforma.sql deleted file mode 100644 index 6222d2632..000000000 --- a/db/changes/231601/00-aclClientInforma.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) -VALUES ('ClientInforma', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('ClientInforma', '*', 'WRITE', 'ALLOW', 'ROLE', 'financial'); diff --git a/db/changes/231601/00-clientInforma.sql b/db/changes/231601/00-clientInforma.sql deleted file mode 100644 index 9bf757fc3..000000000 --- a/db/changes/231601/00-clientInforma.sql +++ /dev/null @@ -1,16 +0,0 @@ -ALTER TABLE `vn`.`client` ADD rating INT UNSIGNED DEFAULT NULL NULL COMMENT 'información proporcionada por Informa'; -ALTER TABLE `vn`.`client` ADD recommendedCredit INT UNSIGNED DEFAULT NULL NULL COMMENT 'información proporcionada por Informa'; - -CREATE TABLE `vn`.`clientInforma` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL, - `rating` int(10) unsigned DEFAULT NULL, - `recommendedCredit` int(10) unsigned DEFAULT NULL, - `workerFk` int(10) unsigned NOT NULL, - `created` timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (`id`), - KEY `informaWorkers_fk_idx` (`workerFk`), - KEY `informaClientFk` (`clientFk`), - CONSTRAINT `informa_ClienteFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `informa_workers_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE -) ENGINE=InnoDB CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='información proporcionada por Informa, se actualiza desde el hook de client (salix)'; diff --git a/db/changes/231601/00-client_setRatingAcl.sql b/db/changes/231601/00-client_setRatingAcl.sql deleted file mode 100644 index b041b131a..000000000 --- a/db/changes/231601/00-client_setRatingAcl.sql +++ /dev/null @@ -1,64 +0,0 @@ -DELETE FROM `salix`.`ACL` WHERE id=7; - -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('Client', 'setRating', 'WRITE', 'ALLOW', 'ROLE', 'financial'); - -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('Client', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'addressesPropagateRe', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'canBeInvoiced', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'canCreateTicket', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'consumption', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'createAddress', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'createWithUser', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'extendedListFilter', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'getAverageInvoiced', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'getCard', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'getDebt', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'getMana', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'transactions', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'hasCustomerRole', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'isValidClient', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'lastActiveTickets', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'sendSms', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'setPassword', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'summary', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'updateAddress', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'updateFiscalData', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'updateUser', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'uploadFile', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'campaignMetricsPdf', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'campaignMetricsEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'clientWelcomeHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'clientWelcomeEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'printerSetupHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'printerSetupEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'sepaCoreEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'letterDebtorPdf', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'letterDebtorStHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'letterDebtorStEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'letterDebtorNdHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'letterDebtorNdEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'clientDebtStatementPdf', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'clientDebtStatementHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'clientDebtStatementEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'creditRequestPdf', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'creditRequestHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'creditRequestEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'incotermsAuthorizationPdf', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'incotermsAuthorizationHtml', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'incotermsAuthorizationEmail', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'consumptionSendQueued', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'filter', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'getClientOrSupplierReference', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'upsert', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'create', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'replaceById', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'updateAttributes', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'updateAttributes', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'deleteById', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'replaceOrCreate', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'updateAll', '*', 'ALLOW', 'ROLE', 'employee'), - ('Client', 'upsertWithWhere', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/231601/00-deleteProcs_refund.sql b/db/changes/231601/00-deleteProcs_refund.sql deleted file mode 100644 index 8bf8982f4..000000000 --- a/db/changes/231601/00-deleteProcs_refund.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP PROCEDURE `vn`.`refund`; -DROP PROCEDURE `vn`.`ticket_doRefund`; diff --git a/db/changes/231601/00-kkearEntryNotes.sql b/db/changes/231601/00-kkearEntryNotes.sql deleted file mode 100644 index ff5c7ce29..000000000 --- a/db/changes/231601/00-kkearEntryNotes.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `vn`.`entry` DROP COLUMN `notes`; \ No newline at end of file diff --git a/db/changes/231601/00-newCompanyI18n.sql b/db/changes/231601/00-newCompanyI18n.sql deleted file mode 100644 index 948b9cb08..000000000 --- a/db/changes/231601/00-newCompanyI18n.sql +++ /dev/null @@ -1,9 +0,0 @@ --- vn.companyI18n definition -CREATE TABLE `vn`.`companyI18n` ( - `companyFk` smallint(5) unsigned NOT NULL, - `lang` char(2) CHARACTER SET utf8mb3 NOT NULL, - `footnotes` longtext COLLATE utf8mb3_unicode_ci DEFAULT NULL, - PRIMARY KEY (`companyFk`,`lang`), - CONSTRAINT `companyI18n_FK` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - diff --git a/db/changes/231601/00-newTableWeb.sql b/db/changes/231601/00-newTableWeb.sql deleted file mode 100644 index 1a2402956..000000000 --- a/db/changes/231601/00-newTableWeb.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `vn`.`company` ADD `web` varchar(100) NULL; \ No newline at end of file diff --git a/db/changes/231601/00-observationEmailACL.sql b/db/changes/231601/00-observationEmailACL.sql deleted file mode 100644 index 1a5d475e8..000000000 --- a/db/changes/231601/00-observationEmailACL.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES - ('Defaulter', 'observationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/231601/00-updateIsVies.sql b/db/changes/231601/00-updateIsVies.sql deleted file mode 100644 index 83fde7352..000000000 --- a/db/changes/231601/00-updateIsVies.sql +++ /dev/null @@ -1,5 +0,0 @@ - UPDATE vn.supplier s - JOIN vn.country c ON c.id = s.countryFk - SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1) - WHERE s.isVies = TRUE - AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2); \ No newline at end of file diff --git a/db/changes/231601/00-updateisViesClient.sql b/db/changes/231601/00-updateisViesClient.sql deleted file mode 100644 index bdf62d7a8..000000000 --- a/db/changes/231601/00-updateisViesClient.sql +++ /dev/null @@ -1,5 +0,0 @@ -UPDATE IGNORE vn.client c - JOIN vn.country co ON co.id = c.countryFk - SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1) - WHERE c.isVies = TRUE - AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2); \ No newline at end of file diff --git a/db/changes/231601/00-userAcl.sql b/db/changes/231601/00-userAcl.sql deleted file mode 100644 index 64803bf18..000000000 --- a/db/changes/231601/00-userAcl.sql +++ /dev/null @@ -1,21 +0,0 @@ -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('VnUser', '*', '*', 'ALLOW', 'ROLE', 'employee'), - ('VnUser','acl','READ','ALLOW','ROLE','account'), - ('VnUser','getCurrentUserData','READ','ALLOW','ROLE','account'), - ('VnUser','changePassword', 'WRITE', 'ALLOW', 'ROLE', 'account'), - ('Account','exists','READ','ALLOW','ROLE','account'); - -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('Account','exists','READ','ALLOW','ROLE','account'); - -DELETE FROM `salix`.`ACL` WHERE (model, property) = ('Account', 'acl'); -DELETE FROM `salix`.`ACL` WHERE (model, property) = ('Account', 'getCurrentUserData'); -DELETE FROM `salix`.`ACL` WHERE (model, property) = ('Account', 'changePassword'); -DELETE FROM `salix`.`ACL` WHERE model = 'UserAccount'; - -UPDATE `hedera`.`imageCollection` t -SET t.model = 'VnUser' -WHERE t.id = 6; - diff --git a/db/changes/231601/00-userRoleLog.sql b/db/changes/231601/00-userRoleLog.sql deleted file mode 100644 index ae5da13cb..000000000 --- a/db/changes/231601/00-userRoleLog.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES - ('UserLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('RoleLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/231601/00-saleTracking.sql b/db/changes/231801/00-saleTracking.sql similarity index 100% rename from db/changes/231601/00-saleTracking.sql rename to db/changes/231801/00-saleTracking.sql From e019ab4160d68181661baf259ccbade0cea9f4f1 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 8 May 2023 12:40:52 +0200 Subject: [PATCH 09/27] deploy(232001): add changes folder, package and changelog --- CHANGELOG.md | 15 ++++++++++++++- db/changes/232001/.gitkeep | 0 package.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 db/changes/232001/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index fa318a908..5ff575175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2318.01] - 2023-05-04 +## [2320.01] - 2023-05-25 + +### Added +- + +### Changed +- + +### Fixed +- + + + +## [2318.01] - 2023-05-08 ### Added - (Usuarios -> Histórico) Nueva sección diff --git a/db/changes/232001/.gitkeep b/db/changes/232001/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index fee164f44..4b4f552ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.18.01", + "version": "23.20.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 9f02fc66c8515d7325b95017e306df99d589200a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 13:10:51 +0200 Subject: [PATCH 10/27] refs #5517 Show spinner when loading --- front/salix/components/log/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index b7697a1fd..f41dfcceb 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -14,7 +14,10 @@ order="changedModel" auto-load="true"> - +
Date: Mon, 8 May 2023 16:30:21 +0200 Subject: [PATCH 11/27] refs #5517 Fix: Show spinner when loading --- e2e/paths/02-client/10_add_greuge.spec.js | 7 ++----- front/core/components/crud-model/crud-model.js | 2 +- front/core/components/th/index.js | 13 ------------- front/salix/components/log/index.html | 5 +---- modules/client/front/greuge/index/index.html | 14 +++++++------- modules/client/front/greuge/index/index.js | 5 +---- modules/order/front/volume/index.html | 6 +++--- modules/order/front/volume/index.js | 5 +++-- modules/ticket/front/volume/index.html | 9 +++++---- modules/ticket/front/volume/index.js | 5 +++-- 10 files changed, 26 insertions(+), 45 deletions(-) diff --git a/e2e/paths/02-client/10_add_greuge.spec.js b/e2e/paths/02-client/10_add_greuge.spec.js index 6ea923a28..9141c499a 100644 --- a/e2e/paths/02-client/10_add_greuge.spec.js +++ b/e2e/paths/02-client/10_add_greuge.spec.js @@ -29,19 +29,16 @@ describe('Client Add greuge path', () => { expect(message.text).toContain('Some fields are invalid'); }); - it(`should create a new greuge with all its data`, async() => { + it(`should create a new greuge with all its data and confirm the greuge was added to the list`, async() => { await page.write(selectors.clientGreuge.amount, '999'); await page.waitForTextInField(selectors.clientGreuge.amount, '999'); await page.write(selectors.clientGreuge.description, 'new armor for Batman!'); await page.waitToClick(selectors.clientGreuge.saveButton); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should confirm the greuge was added to the list', async() => { const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText'); + expect(message.text).toContain('Data saved!'); expect(result).toContain(999); expect(result).toContain('new armor for Batman!'); expect(result).toContain('Diff'); diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 421a79f9b..fcfe0be44 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -236,7 +236,7 @@ export default class CrudModel extends ModelProxy { this.canceler = this.$q.defer(); this.isPaging = append; - if (!append && this.status != 'ready') + if (!append) this.status = 'loading'; let params = Object.assign( diff --git a/front/core/components/th/index.js b/front/core/components/th/index.js index 341558fb1..9f1e11903 100644 --- a/front/core/components/th/index.js +++ b/front/core/components/th/index.js @@ -8,18 +8,8 @@ export default class Th { $element.on('click', () => this.onToggleOrder()); } - /** - * Changes the order if the cell has a field and defaultOrder property - */ $onInit() { if (!this.field) return; - - if (this.defaultOrder) { - this.order = this.defaultOrder; - this.table.applyOrder(this.field, this.order); - this.updateArrow(); - } - this.updateArrow(); } @@ -82,9 +72,6 @@ ngModule.vnComponent('vnTh', { template: require('./index.html'), transclude: true, controller: Th, - bindings: { - defaultOrder: '@?' - }, require: { table: '^^vnTable' } diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index f41dfcceb..b7697a1fd 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -14,10 +14,7 @@ order="changedModel" auto-load="true"> - +
- @@ -28,7 +28,7 @@ - Date + Date Created by Comment Type @@ -53,11 +53,11 @@ - \ No newline at end of file + diff --git a/modules/client/front/greuge/index/index.js b/modules/client/front/greuge/index/index.js index 7a5ccc531..4f1b77b4b 100644 --- a/modules/client/front/greuge/index/index.js +++ b/modules/client/front/greuge/index/index.js @@ -11,8 +11,7 @@ class Controller extends Section { scope: { fields: ['id', 'name'] }, - }, - { + }, { relation: 'user', scope: { fields: ['id', 'name'] @@ -24,8 +23,6 @@ class Controller extends Section { } } -Controller.$inject = ['$element', '$scope']; - ngModule.vnComponent('vnClientGreugeIndex', { template: require('./index.html'), controller: Controller diff --git a/modules/order/front/volume/index.html b/modules/order/front/volume/index.html index 7c2ff4e3d..e0053f9ed 100644 --- a/modules/order/front/volume/index.html +++ b/modules/order/front/volume/index.html @@ -12,11 +12,11 @@ @@ -24,7 +24,7 @@ - Item + Item Description Quantity m³ per quantity diff --git a/modules/order/front/volume/index.js b/modules/order/front/volume/index.js index aaadf2af6..c1bc5ec7d 100644 --- a/modules/order/front/volume/index.js +++ b/modules/order/front/volume/index.js @@ -6,9 +6,10 @@ class Controller extends Section { constructor($element, $) { super($element, $); this.filter = { - include: [{ + include: { relation: 'item' - }] + }, + order: 'itemFk' }; this.order = {}; this.ticketVolumes = []; diff --git a/modules/ticket/front/volume/index.html b/modules/ticket/front/volume/index.html index f5dd18033..ff0a86772 100644 --- a/modules/ticket/front/volume/index.html +++ b/modules/ticket/front/volume/index.html @@ -1,4 +1,5 @@ -
- -
@@ -23,7 +24,7 @@ Item - Description + Description Packing type Quantity m³ per quantity diff --git a/modules/ticket/front/volume/index.js b/modules/ticket/front/volume/index.js index a3d531898..7acecf570 100644 --- a/modules/ticket/front/volume/index.js +++ b/modules/ticket/front/volume/index.js @@ -5,9 +5,10 @@ class Controller extends Section { constructor($element, $) { super($element, $); this.filter = { - include: [{ + include: { relation: 'item' - }] + }, + order: 'concept' }; this.ticketVolumes = []; From a2e71b57a238074482aefc7387d3a4eddfa428be Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 16:33:35 +0200 Subject: [PATCH 12/27] refs #5517 Front test fix --- front/core/components/th/index.spec.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/front/core/components/th/index.spec.js b/front/core/components/th/index.spec.js index a00f73cc9..a3bf19898 100644 --- a/front/core/components/th/index.spec.js +++ b/front/core/components/th/index.spec.js @@ -17,17 +17,6 @@ describe('Component vnTh', () => { controller.column.setAttribute('field', 'MyField'); })); - describe('onInit()', () => { - it(`should define controllers order as per defaultOrder then call setOrder()`, () => { - controller.defaultOrder = 'DESC'; - jest.spyOn(controller.table, 'setOrder'); - controller.$onInit(); - - expect(controller.order).toEqual('DESC'); - expect(controller.table.setOrder).toHaveBeenCalledWith('MyField', 'DESC'); - }); - }); - describe('toggleOrder()', () => { it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => { controller.order = 'ASC'; @@ -61,7 +50,7 @@ describe('Component vnTh', () => { expect(controller.updateArrow).not.toHaveBeenCalledWith(); }); - it(`should call toggleOrder() method if field property and + it(`should call toggleOrder() method if field property and table field property equals and then call updateArrow()`, () => { controller.table.field = 'MyField'; jest.spyOn(controller, 'toggleOrder'); @@ -73,7 +62,7 @@ describe('Component vnTh', () => { expect(controller.updateArrow).toHaveBeenCalledWith(); }); - it(`should call setOrder() method if field property and + it(`should call setOrder() method if field property and table field property doesn't equals and then call updateArrow()`, () => { controller.table.field = 'MyField2'; jest.spyOn(controller.table, 'setOrder'); From 35a888a968e5838e0b7ab532b37de9e52f583f42 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 16:48:05 +0200 Subject: [PATCH 13/27] refs #5517 Pagination spinner fixes --- .../core/components/crud-model/crud-model.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index fcfe0be44..041aa3ca2 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -126,20 +126,20 @@ export default class CrudModel extends ModelProxy { } } - loadMore(append) { + loadMore(overwrite) { if (!this.moreRows) return this.$q.resolve(); const filter = Object.assign({}, this.currentFilter); - if (append) + if (overwrite) filter.skip = this.orgData ? this.orgData.length : 0; - if (!append) { + if (!overwrite) { this.page += 1; filter.limit = this.page * this.limit; } - return this.sendRequest(filter, append); + return this.sendRequest(filter, overwrite, true); } clear() { @@ -231,12 +231,12 @@ export default class CrudModel extends ModelProxy { return params; } - sendRequest(filter, append) { + sendRequest(filter, overwrite, loadMore) { this.cancelRequest(); this.canceler = this.$q.defer(); - this.isPaging = append; + this.isPaging = overwrite; - if (!append) + if (!loadMore) this.status = 'loading'; let params = Object.assign( @@ -249,16 +249,16 @@ export default class CrudModel extends ModelProxy { }; return this.$http.get(this._url, options).then( - json => this.onRemoteDone(json, filter, append), - json => this.onRemoteError(json, append) + json => this.onRemoteDone(json, filter, overwrite), + json => this.onRemoteError(json, overwrite) ).finally(() => { this.isPaging = false; }); } - onRemoteDone(json, filter, append) { + onRemoteDone(json, filter, overwrite) { let data = json.data; - if (append) + if (overwrite) this.orgData = this.orgData.concat(data); else { this.orgData = data; @@ -269,8 +269,8 @@ export default class CrudModel extends ModelProxy { this.onRequestEnd(); } - onRemoteError(err, append) { - if (!append) { + onRemoteError(err, overwrite) { + if (!overwrite) { this.clear(); this.status = 'error'; } From 7a668adf181ae81a818e777afba2cf4278cae4b0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 16:50:20 +0200 Subject: [PATCH 14/27] refs #5517 pagination fixes --- .../core/components/crud-model/crud-model.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 041aa3ca2..495a7d2b0 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -126,20 +126,20 @@ export default class CrudModel extends ModelProxy { } } - loadMore(overwrite) { + loadMore(append) { if (!this.moreRows) return this.$q.resolve(); const filter = Object.assign({}, this.currentFilter); - if (overwrite) + if (append) filter.skip = this.orgData ? this.orgData.length : 0; - if (!overwrite) { + if (!append) { this.page += 1; filter.limit = this.page * this.limit; } - return this.sendRequest(filter, overwrite, true); + return this.sendRequest(filter, append, true); } clear() { @@ -231,10 +231,10 @@ export default class CrudModel extends ModelProxy { return params; } - sendRequest(filter, overwrite, loadMore) { + sendRequest(filter, append, loadMore) { this.cancelRequest(); this.canceler = this.$q.defer(); - this.isPaging = overwrite; + this.isPaging = append; if (!loadMore) this.status = 'loading'; @@ -249,16 +249,16 @@ export default class CrudModel extends ModelProxy { }; return this.$http.get(this._url, options).then( - json => this.onRemoteDone(json, filter, overwrite), - json => this.onRemoteError(json, overwrite) + json => this.onRemoteDone(json, filter, append), + json => this.onRemoteError(json, append) ).finally(() => { this.isPaging = false; }); } - onRemoteDone(json, filter, overwrite) { + onRemoteDone(json, filter, append) { let data = json.data; - if (overwrite) + if (append) this.orgData = this.orgData.concat(data); else { this.orgData = data; @@ -269,8 +269,8 @@ export default class CrudModel extends ModelProxy { this.onRequestEnd(); } - onRemoteError(err, overwrite) { - if (!overwrite) { + onRemoteError(err, append) { + if (!append) { this.clear(); this.status = 'error'; } From 313c641cd78ae54c2ac94368e542759d5d2ab033 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 9 May 2023 12:26:29 +0200 Subject: [PATCH 15/27] move chages sql --- db/changes/232001/00-invoiceOut_new.sql | 254 ++++++++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 db/changes/232001/00-invoiceOut_new.sql diff --git a/db/changes/232001/00-invoiceOut_new.sql b/db/changes/232001/00-invoiceOut_new.sql new file mode 100644 index 000000000..b4fc5c824 --- /dev/null +++ b/db/changes/232001/00-invoiceOut_new.sql @@ -0,0 +1,254 @@ +DROP PROCEDURE IF EXISTS `vn`.`invoiceOut_new`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`( + vSerial VARCHAR(255), + vInvoiceDate DATE, + vTaxArea VARCHAR(25), + OUT vNewInvoiceId INT) +BEGIN +/** + * Creación de facturas emitidas. + * requiere previamente tabla tmp.ticketToInvoice(id). + * + * @param vSerial serie a la cual se hace la factura + * @param vInvoiceDate fecha de la factura + * @param vTaxArea tipo de iva en relacion a la empresa y al cliente + * @param vNewInvoiceId id de la factura que se acaba de generar + * @return vNewInvoiceId + */ + DECLARE vIsAnySaleToInvoice BOOL; + DECLARE vIsAnyServiceToInvoice BOOL; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT account.myUser_getId(); + DECLARE vCompanyFk INT; + DECLARE vInterCompanyFk INT; + DECLARE vClientFk INT; + DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1; + DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6; + DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2; + DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R'; + DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S'; + DECLARE vNewInvoiceInFk INT; + DECLARE vIsInterCompany BOOL DEFAULT FALSE; + DECLARE vIsCEESerial BOOL DEFAULT FALSE; + DECLARE vIsCorrectInvoiceDate BOOL; + DECLARE vMaxShipped DATE; + + SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE()); + + SELECT t.clientFk, + t.companyFk, + MAX(DATE(t.shipped)), + DATE(vInvoiceDate) >= invoiceOut_getMaxIssued( + vSerial, + t.companyFk, + YEAR(vInvoiceDate)) + INTO vClientFk, + vCompanyFk, + vMaxShipped, + vIsCorrectInvoiceDate + FROM tmp.ticketToInvoice tt + JOIN ticket t ON t.id = tt.id; + + IF(vMaxShipped > vInvoiceDate) THEN + CALL util.throw("Invoice date can't be less than max date"); + END IF; + + IF NOT vIsCorrectInvoiceDate THEN + CALL util.throw('Exists an invoice with a previous date'); + END IF; + + -- Eliminem de tmp.ticketToInvoice els tickets que no han de ser facturats + DELETE ti.* + FROM tmp.ticketToInvoice ti + JOIN ticket t ON t.id = ti.id + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN client c ON c.id = t.clientFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted) + OR c.isTaxDataChecked = FALSE + OR t.isDeleted + OR c.hasToInvoice = FALSE + OR itc.id IS NULL; + + SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 + INTO vIsAnySaleToInvoice + FROM tmp.ticketToInvoice t + JOIN sale s ON s.ticketFk = t.id; + + SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice + FROM tmp.ticketToInvoice t + JOIN ticketService ts ON ts.ticketFk = t.id; + + IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) + AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) + THEN + + -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial + INSERT INTO invoiceOut( + ref, + serial, + issued, + clientFk, + dued, + companyFk, + cplusInvoiceType477Fk + ) + SELECT + 1, + vSerial, + vInvoiceDate, + vClientFk, + getDueDate(vInvoiceDate, dueDay), + vCompanyFk, + IF(vSerial = vCorrectingSerial, + vCplusCorrectingInvoiceTypeFk, + IF(vSerial = vSimplifiedSerial, + vCplusSimplifiedInvoiceTypeFk, + vCplusStandardInvoiceTypeFk)) + FROM client + WHERE id = vClientFk; + + SET vNewInvoiceId = LAST_INSERT_ID(); + + SELECT `ref` + INTO vNewRef + FROM invoiceOut + WHERE id = vNewInvoiceId; + + UPDATE ticket t + JOIN tmp.ticketToInvoice ti ON ti.id = t.id + SET t.refFk = vNewRef; + + DROP TEMPORARY TABLE IF EXISTS tmp.updateInter; + CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY + SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador + FROM tmp.ticketToInvoice ti + LEFT JOIN ticketState ts ON ti.id = ts.ticket + JOIN state s + WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id); + + INSERT INTO ticketTracking(stateFk,ticketFk,workerFk) + SELECT * FROM tmp.updateInter; + + CALL invoiceExpenceMake(vNewInvoiceId); + CALL invoiceTaxMake(vNewInvoiceId,vTaxArea); + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) total + FROM invoiceOutExpence + WHERE invoiceOutFk = vNewInvoiceId + ) base + JOIN ( + SELECT SUM(vat) total + FROM invoiceOutTax + WHERE invoiceOutFk = vNewInvoiceId + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vNewInvoiceId; + + DROP TEMPORARY TABLE tmp.updateInter; + + SELECT COUNT(*), id + INTO vIsInterCompany, vInterCompanyFk + FROM company + WHERE clientFk = vClientFk; + + IF (vIsInterCompany) THEN + + INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) + SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk; + + SET vNewInvoiceInFk = LAST_INSERT_ID(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM tmp.ticketToInvoice; + + CALL `ticket_getTax`('NATIONAL'); + + SET @vTaxableBaseServices := 0.00; + SET @vTaxCodeGeneral := NULL; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + @vTaxableBaseServices, + sub.expenceFk, + sub.taxTypeSageFk, + sub.transactionTypeSageFk + FROM ( + SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, + i.expenceFk, + i.taxTypeSageFk, + i.transactionTypeSageFk, + @vTaxCodeGeneral := i.taxClassCodeFk + FROM tmp.ticketServiceTax tst + JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code + WHERE i.isService + HAVING taxableBase + ) sub; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInFk, + SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, + @vTaxableBaseServices, 0) taxableBase, + i.expenceFk, + i.taxTypeSageFk , + i.transactionTypeSageFk + FROM tmp.ticketTax tt + JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code + WHERE !i.isService + GROUP BY tt.pgcFk + HAVING taxableBase + ORDER BY tt.priority; + + CALL invoiceInDueDay_calculate(vNewInvoiceInFk); + + SELECT COUNT(*) INTO vIsCEESerial + FROM invoiceOutSerial + WHERE code = vSerial; + + IF vIsCEESerial THEN + + INSERT INTO invoiceInIntrastat ( + invoiceInFk, + intrastatFk, + amount, + stems, + countryFk, + net) + SELECT + vNewInvoiceInFk, + i.intrastatFk, + SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))), + SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))), + su.countryFk, + CAST(SUM(IFNULL(i.stems, 1) + * s.quantity + * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2)) + FROM sale s + JOIN ticket t ON s.ticketFk = t.id + JOIN supplier su ON su.id = t.companyFk + JOIN item i ON i.id = s.itemFk + LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + WHERE t.refFk = vNewRef + GROUP BY i.intrastatFk; + + END IF; + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketAmount; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketServiceTax; + END IF; + END IF; + DROP TEMPORARY TABLE `tmp`.`ticketToInvoice`; +END$$ +DELIMITER ; From 8c0deb6cfa6593670db8c9f801f5eb1c154e8f4d Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 10 May 2023 09:16:19 +0200 Subject: [PATCH 16/27] test(e2e_order): fiter optimized --- CHANGELOG.md | 1 + .../00-optimiceZoneEstimatedDelivery.sql | 77 +++++++++++++++++++ modules/order/back/methods/order/filter.js | 2 +- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 db/changes/231801/00-optimiceZoneEstimatedDelivery.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index fa318a908..91f332178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Ticket -> Boxing) Arreglado selección de horas +- (Cesta -> Índice) Optimizada búsqueda diff --git a/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql b/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql new file mode 100644 index 000000000..209e1efc3 --- /dev/null +++ b/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql @@ -0,0 +1,77 @@ +CREATE OR REPLACE +ALGORITHM = UNDEFINED VIEW `vn`.`zoneEstimatedDelivery` AS +select + `t`.`zoneFk` AS `zoneFk`, + cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`, `z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`, `z`.`hour`)) minute as time) AS `hourTheoretical`, + cast(sum(`sv`.`volume`) as decimal(5, 1)) AS `totalVolume`, + cast(sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) as decimal(5, 1)) AS `remainingVolume`, + greatest( + ifnull(`lhp`.`m3`, 0), + ifnull(`dl`.`minSpeed`, 0) + ) AS `speed`, + cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `hourEffective`, + floor(-sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0))) AS `minutesLess`, + cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `etc` +from + ( + ( + ( + ( + ( + ( + ( + ( + ( + `vn`.`ticket` `t` + join `vn`.`ticketStateToday` `tst` on + ( + `tst`.`ticket` = `t`.`id` + ) + ) + join `vn`.`state` `s` on + ( + `s`.`id` = `tst`.`state` + ) + ) + join `vn`.`saleVolume` `sv` on + ( + `sv`.`ticketFk` = `t`.`id` + ) + ) + left join `vn`.`lastHourProduction` `lhp` on + ( + `lhp`.`warehouseFk` = `t`.`warehouseFk` + ) + ) + join `vn`.`warehouse` `w` on + ( + `w`.`id` = `t`.`warehouseFk` + ) + ) + join `vn`.`warehouseAlias` `wa` on + ( + `wa`.`id` = `w`.`aliasFk` + ) + ) + straight_join `vn`.`zone` `z` on + ( + `z`.`id` = `t`.`zoneFk` + ) + ) + left join `vn`.`zoneClosure` `zc` on + ( + `zc`.`zoneFk` = `t`.`zoneFk` + and `zc`.`dated` = `util`.`VN_CURDATE`() + ) + ) + left join `cache`.`departure_limit` `dl` on + ( + `dl`.`warehouse_id` = `t`.`warehouseFk` + and `dl`.`fecha` = `util`.`VN_CURDATE`() + ) + ) +where + `w`.`hasProduction` <> 0 + and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() +group by + `t`.`zoneFk`; diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 008c0e5c9..10185af7e 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -141,7 +141,7 @@ module.exports = Self => { let stmt; stmt = new ParameterizedSQL( - `CREATE TEMPORARY TABLE tmp.filter + `CREATE OR REPLACE TEMPORARY TABLE tmp.filter (INDEX (id)) ENGINE = MEMORY SELECT From 3b8cafc783151e990201d3ddd3b31ad253798e7b Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 10 May 2023 09:22:33 +0200 Subject: [PATCH 17/27] fix(ticketConfigSql): correct folder --- db/changes/{230801 => 231801}/00-ticketConfig.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230801 => 231801}/00-ticketConfig.sql (100%) diff --git a/db/changes/230801/00-ticketConfig.sql b/db/changes/231801/00-ticketConfig.sql similarity index 100% rename from db/changes/230801/00-ticketConfig.sql rename to db/changes/231801/00-ticketConfig.sql From 706c62f624e33c760b0f65ed8deed7db9f9f8b1d Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 10 May 2023 09:26:33 +0200 Subject: [PATCH 18/27] typo --- db/changes/231801/00-ticketConfig.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/231801/00-ticketConfig.sql b/db/changes/231801/00-ticketConfig.sql index ca63dbf63..7c8aa83a4 100644 --- a/db/changes/231801/00-ticketConfig.sql +++ b/db/changes/231801/00-ticketConfig.sql @@ -1 +1 @@ -ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuerade plazo'; +ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuera de plazo'; From df1803a2e37a6964dd471faf13da2fdba8330a99 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 10 May 2023 10:11:52 +0200 Subject: [PATCH 19/27] refs #5517 Front test fix --- front/core/components/crud-model/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/core/components/crud-model/index.spec.js b/front/core/components/crud-model/index.spec.js index 7eab80405..e42476098 100644 --- a/front/core/components/crud-model/index.spec.js +++ b/front/core/components/crud-model/index.spec.js @@ -150,7 +150,7 @@ describe('Component vnCrudModel', () => { controller.loadMore(true); - expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true); + expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true, true); }); }); From 7704256079ea1ebe23df7409a9ebc3806936de81 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 11 May 2023 08:00:49 +0200 Subject: [PATCH 20/27] master to test --- loopback/locale/en.json | 2 +- .../ticket/back/methods/ticket/componentUpdate.js | 1 + modules/ticket/back/methods/ticket/new.js | 2 +- .../ticket/back/methods/ticket/priceDifference.js | 1 + modules/zone/back/methods/agency/getShipped.js | 12 ++++++++---- .../back/methods/agency/specs/getShipped.spec.js | 10 ++++++---- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index cffedd891..e950b981b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -172,4 +172,4 @@ "Comment added to client": "Comment added to client", "This ticket is already a refund": "This ticket is already a refund", "A claim with that sale already exists": "A claim with that sale already exists" -} \ No newline at end of file +} diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 531d13b51..b03301204 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -124,6 +124,7 @@ module.exports = Self => { const isDeliveryBoss = await models.VnUser.hasRole(userId, 'deliveryBoss', myOptions); if (!isDeliveryBoss) { const zoneShipped = await models.Agency.getShipped( + ctx, args.landed, args.addressFk, args.agencyModeFk, diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index a5d04bc4c..5f7cf3cb6 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -100,7 +100,7 @@ module.exports = Self => { } if (!args.shipped && args.landed) { - const shippedResult = await models.Agency.getShipped(args.landed, + const shippedResult = await models.Agency.getShipped(ctx, args.landed, address.id, args.agencyModeId, args.warehouseId, myOptions); args.shipped = (shippedResult && shippedResult.shipped) || args.landed; } diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index a0a10d997..16812dcb0 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -81,6 +81,7 @@ module.exports = Self => { const isDeliveryBoss = await models.VnUser.hasRole(userId, 'deliveryBoss', myOptions); if (!isDeliveryBoss) { const zoneShipped = await models.Agency.getShipped( + ctx, args.landed, args.addressId, args.agencyModeId, diff --git a/modules/zone/back/methods/agency/getShipped.js b/modules/zone/back/methods/agency/getShipped.js index 165dd6731..7ef912abd 100644 --- a/modules/zone/back/methods/agency/getShipped.js +++ b/modules/zone/back/methods/agency/getShipped.js @@ -1,7 +1,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { - Self.remoteMethod('getShipped', { + Self.remoteMethodCtx('getShipped', { description: 'Returns the first shipped possible for params', accessType: 'READ', accepts: [{ @@ -34,18 +34,22 @@ module.exports = Self => { } }); - Self.getShipped = async(landed, addressFk, agencyModeFk, warehouseFk, options) => { + Self.getShipped = async(ctx, landed, addressFk, agencyModeFk, warehouseFk, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); const stmts = []; + const userId = ctx.req.accessToken.userId; + const models = Self.app.models; + const isProductionAssistant = await models.VnUser.hasRole(userId, 'productionAssi', myOptions); stmts.push(new ParameterizedSQL( - `CALL vn.zone_getShipped(?, ?, ?, TRUE)`, [ + `CALL vn.zone_getShipped(?, ?, ?, ?)`, [ landed, addressFk, - agencyModeFk + agencyModeFk, + isProductionAssistant ] )); diff --git a/modules/zone/back/methods/agency/specs/getShipped.spec.js b/modules/zone/back/methods/agency/specs/getShipped.spec.js index c262357a7..b226557fb 100644 --- a/modules/zone/back/methods/agency/specs/getShipped.spec.js +++ b/modules/zone/back/methods/agency/specs/getShipped.spec.js @@ -1,6 +1,9 @@ -const {models} = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; describe('agency getShipped()', () => { + const employeeId = 1; + const ctx = {req: {accessToken: {userId: employeeId}}}; + it('should return a shipment date', async() => { const landed = Date.vnNew(); landed.setDate(landed.getDate() + 1); @@ -12,8 +15,7 @@ describe('agency getShipped()', () => { try { const options = {transaction: tx}; - - const result = await models.Agency.getShipped(landed, addressFk, agencyModeFk, warehouseFk, options); + const result = await models.Agency.getShipped(ctx, landed, addressFk, agencyModeFk, warehouseFk, options); expect(result).toBeDefined(); @@ -37,7 +39,7 @@ describe('agency getShipped()', () => { try { const options = {transaction: tx}; - const result = await models.Agency.getShipped(landed, addressFk, agencyModeFk, warehouseFk, options); + const result = await models.Agency.getShipped(ctx, landed, addressFk, agencyModeFk, warehouseFk, options); expect(result).toBeUndefined(); From 43ab07d954ca0dab5224c44d81e077fd1a3b045e Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 11 May 2023 11:57:13 +0200 Subject: [PATCH 21/27] refs move reports views --- db/changes/231801/01-viewCompany10L.sql | 12 ++++++++++++ .../components/report-footer/report-footer.js | 15 ++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 db/changes/231801/01-viewCompany10L.sql diff --git a/db/changes/231801/01-viewCompany10L.sql b/db/changes/231801/01-viewCompany10L.sql new file mode 100644 index 000000000..335827b42 --- /dev/null +++ b/db/changes/231801/01-viewCompany10L.sql @@ -0,0 +1,12 @@ +-- vn.companyL10n source + +CREATE OR REPLACE +ALGORITHM = UNDEFINED VIEW `vn`.`companyL10n` AS +select + `c`.`id` AS `id`, + ifnull(`ci`.`footnotes`, `c`.`footnotes`) AS `footnotes` +from + (`vn`.`company` `c` +left join `vn`.`companyI18n` `ci` on + (`ci`.`companyFk` = `c`.`id` + and `ci`.`lang` = `util`.`LANG`())); \ No newline at end of file diff --git a/print/core/components/report-footer/report-footer.js b/print/core/components/report-footer/report-footer.js index 0eaab8ce4..077ef0bde 100755 --- a/print/core/components/report-footer/report-footer.js +++ b/print/core/components/report-footer/report-footer.js @@ -4,13 +4,14 @@ const db = require('../../database'); module.exports = { name: 'report-footer', async serverPrefetch() { - this.company = await db.findOne( - `SELECT - ci.footnotes - FROM companyI18n ci - JOIN company c ON c.id = ci.companyFk - WHERE c.code = ? AND ci.lang = (SELECT lang FROM account.user WHERE id = ?)`, - [this.companyCode, this.recipientId]); + this.company = await db.findOne(` + SELECT IFNULL(ci.footnotes, cl.footnotes) as footnotes + FROM company c + LEFT JOIN companyL10n cl ON c.id = cl.id + LEFT JOIN companyI18n ci ON ci.companyFk = cl.id + AND ci.lang = (SELECT lang FROM account.user where id = ?) + WHERE c.code = ?`, + [this.recipientId, this.companyCode]); }, props: ['leftText', 'companyCode', 'recipientId', 'centerText'] From d0c8be5697afb24982fc56d420de327a9da0f630 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 11 May 2023 12:07:14 +0200 Subject: [PATCH 22/27] refs #5517, #5667 Fix crudModel status, log fixes --- front/core/components/crud-model/crud-model.js | 6 +++--- front/core/components/crud-model/index.spec.js | 2 +- front/core/components/data-viewer/index.js | 5 ++--- front/salix/components/log/index.html | 9 ++++++--- front/salix/components/log/style.scss | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 495a7d2b0..421a79f9b 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -139,7 +139,7 @@ export default class CrudModel extends ModelProxy { filter.limit = this.page * this.limit; } - return this.sendRequest(filter, append, true); + return this.sendRequest(filter, append); } clear() { @@ -231,12 +231,12 @@ export default class CrudModel extends ModelProxy { return params; } - sendRequest(filter, append, loadMore) { + sendRequest(filter, append) { this.cancelRequest(); this.canceler = this.$q.defer(); this.isPaging = append; - if (!loadMore) + if (!append && this.status != 'ready') this.status = 'loading'; let params = Object.assign( diff --git a/front/core/components/crud-model/index.spec.js b/front/core/components/crud-model/index.spec.js index e42476098..7eab80405 100644 --- a/front/core/components/crud-model/index.spec.js +++ b/front/core/components/crud-model/index.spec.js @@ -150,7 +150,7 @@ describe('Component vnCrudModel', () => { controller.loadMore(true); - expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true, true); + expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true); }); }); diff --git a/front/core/components/data-viewer/index.js b/front/core/components/data-viewer/index.js index 8d0d94402..b480997da 100644 --- a/front/core/components/data-viewer/index.js +++ b/front/core/components/data-viewer/index.js @@ -7,11 +7,10 @@ export default class DataViewer { } get status() { - if (this.model) - return this.model.status; - if (this.isLoading) return 'loading'; + if (this.model) + return this.model.status; if (!this.data) return 'clear'; if (this.data.length) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index b7697a1fd..c6b1ade2a 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -14,9 +14,12 @@ order="changedModel" auto-load="true">
- +
-
+
+ title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}"> {{::$ctrl.relativeDate(log.creationDate)}}
diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index b78dc3824..381b99039 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -4,7 +4,7 @@ vn-log { .change { display: flex; - & > .user-wrapper { + & > .left { position: relative; padding-right: 10px; @@ -34,7 +34,7 @@ vn-log { bottom: -8px; } } - &:last-child > .user-wrapper > .line { + &:last-child > .left > .line { display: none; } .detail { From 8a843b37bd9067b6be1dfa090d557b59a0111bcf Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 11 May 2023 13:54:42 +0200 Subject: [PATCH 23/27] refs #5160 Back test timeout workaround --- back/tests.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index a377011d3..ef5a7bca8 100644 --- a/back/tests.js +++ b/back/tests.js @@ -34,6 +34,8 @@ async function test() { app.boot(bootOptions, err => err ? reject(err) : resolve()); }); + // FIXME: Workaround to wait for loopback to be ready + await app.models.Application.status(); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); @@ -53,7 +55,7 @@ async function test() { const JunitReporter = require('jasmine-reporters'); jasmine.addReporter(new JunitReporter.JUnitXmlReporter()); - jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000; + jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; jasmine.exitOnCompletion = true; } From 8419c76b12fb2aedd4675c4c08da3bc8715bbc31 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 12 May 2023 12:51:07 +0200 Subject: [PATCH 24/27] refs #5153 worker sin tr --- db/changes/{231801 => 232001}/00-clientWorkerName.sql | 0 db/changes/{231801 => 232001}/00-createWorker.sql | 7 ++++++- modules/worker/back/methods/worker/new.js | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) rename db/changes/{231801 => 232001}/00-clientWorkerName.sql (100%) rename db/changes/{231801 => 232001}/00-createWorker.sql (66%) diff --git a/db/changes/231801/00-clientWorkerName.sql b/db/changes/232001/00-clientWorkerName.sql similarity index 100% rename from db/changes/231801/00-clientWorkerName.sql rename to db/changes/232001/00-clientWorkerName.sql diff --git a/db/changes/231801/00-createWorker.sql b/db/changes/232001/00-createWorker.sql similarity index 66% rename from db/changes/231801/00-createWorker.sql rename to db/changes/232001/00-createWorker.sql index 7a128415c..df08b9df4 100644 --- a/db/changes/231801/00-createWorker.sql +++ b/db/changes/232001/00-createWorker.sql @@ -6,4 +6,9 @@ ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL UPDATE `vn`.`workerConfig` SET businessTypeFk = 'worker' - WHERE id = 1; \ No newline at end of file + WHERE id = 1; + + UPDATE client c + JOIN worker w ON w.id = c.id + SET c.name = REPLACE(c.name, 'TR ', ''), + c.businessTypeFk = 'worker'; \ No newline at end of file diff --git a/modules/worker/back/methods/worker/new.js b/modules/worker/back/methods/worker/new.js index 91dabda5d..cec7524c6 100644 --- a/modules/worker/back/methods/worker/new.js +++ b/modules/worker/back/methods/worker/new.js @@ -205,6 +205,7 @@ module.exports = Self => { iban: args.iban, bankEntityFk: args.bankEntityFk, defaultAddressFk: address.id, + businessTypeFk: workerConfig.businessTypeFk, }, myOptions ); From 9ce3e79e00016e789d264138644cdc40bca00574 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 15 May 2023 11:50:51 +0200 Subject: [PATCH 25/27] refs #5594 eliminado archivo ducplicado --- db/changes/231801/00-invoiceOut_new.sql | 254 ------------------------ 1 file changed, 254 deletions(-) delete mode 100644 db/changes/231801/00-invoiceOut_new.sql diff --git a/db/changes/231801/00-invoiceOut_new.sql b/db/changes/231801/00-invoiceOut_new.sql deleted file mode 100644 index 7406d4591..000000000 --- a/db/changes/231801/00-invoiceOut_new.sql +++ /dev/null @@ -1,254 +0,0 @@ -DROP PROCEDURE IF EXISTS `vn`.`invoiceOut_new`; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceOut_new`( - vSerial VARCHAR(255), - vInvoiceDate DATE, - vTaxArea VARCHAR(25), - OUT vNewInvoiceId INT) -BEGIN -/** - * Creación de facturas emitidas. - * requiere previamente tabla ticketToInvoice(id). - * - * @param vSerial serie a la cual se hace la factura - * @param vInvoiceDate fecha de la factura - * @param vTaxArea tipo de iva en relacion a la empresa y al cliente - * @param vNewInvoiceId id de la factura que se acaba de generar - * @return vNewInvoiceId - */ - DECLARE vIsAnySaleToInvoice BOOL; - DECLARE vIsAnyServiceToInvoice BOOL; - DECLARE vNewRef VARCHAR(255); - DECLARE vWorker INT DEFAULT account.myUser_getId(); - DECLARE vCompanyFk INT; - DECLARE vInterCompanyFk INT; - DECLARE vClientFk INT; - DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1; - DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6; - DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2; - DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R'; - DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S'; - DECLARE vNewInvoiceInFk INT; - DECLARE vIsInterCompany BOOL DEFAULT FALSE; - DECLARE vIsCEESerial BOOL DEFAULT FALSE; - DECLARE vIsCorrectInvoiceDate BOOL; - DECLARE vMaxShipped DATE; - - SET vInvoiceDate = IFNULL(vInvoiceDate, util.VN_CURDATE()); - - SELECT t.clientFk, - t.companyFk, - MAX(DATE(t.shipped)), - DATE(vInvoiceDate) >= invoiceOut_getMaxIssued( - vSerial, - t.companyFk, - YEAR(vInvoiceDate)) - INTO vClientFk, - vCompanyFk, - vMaxShipped, - vIsCorrectInvoiceDate - FROM ticketToInvoice tt - JOIN ticket t ON t.id = tt.id; - - IF(vMaxShipped > vInvoiceDate) THEN - CALL util.throw("Invoice date can't be less than max date"); - END IF; - - IF NOT vIsCorrectInvoiceDate THEN - CALL util.throw('Exists an invoice with a previous date'); - END IF; - - -- Eliminem de ticketToInvoice els tickets que no han de ser facturats - DELETE ti.* - FROM ticketToInvoice ti - JOIN ticket t ON t.id = ti.id - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - JOIN supplier su ON su.id = t.companyFk - JOIN client c ON c.id = t.clientFk - LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted) - OR c.isTaxDataChecked = FALSE - OR t.isDeleted - OR c.hasToInvoice = FALSE - OR itc.id IS NULL; - - SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 - INTO vIsAnySaleToInvoice - FROM ticketToInvoice t - JOIN sale s ON s.ticketFk = t.id; - - SELECT COUNT(*) > 0 INTO vIsAnyServiceToInvoice - FROM ticketToInvoice t - JOIN ticketService ts ON ts.ticketFk = t.id; - - IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) - AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) - THEN - - -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial - INSERT INTO invoiceOut( - ref, - serial, - issued, - clientFk, - dued, - companyFk, - cplusInvoiceType477Fk - ) - SELECT - 1, - vSerial, - vInvoiceDate, - vClientFk, - getDueDate(vInvoiceDate, dueDay), - vCompanyFk, - IF(vSerial = vCorrectingSerial, - vCplusCorrectingInvoiceTypeFk, - IF(vSerial = vSimplifiedSerial, - vCplusSimplifiedInvoiceTypeFk, - vCplusStandardInvoiceTypeFk)) - FROM client - WHERE id = vClientFk; - - SET vNewInvoiceId = LAST_INSERT_ID(); - - SELECT `ref` - INTO vNewRef - FROM invoiceOut - WHERE id = vNewInvoiceId; - - UPDATE ticket t - JOIN ticketToInvoice ti ON ti.id = t.id - SET t.refFk = vNewRef; - - DROP TEMPORARY TABLE IF EXISTS tmp.updateInter; - CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY - SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador - FROM ticketToInvoice ti - LEFT JOIN ticketState ts ON ti.id = ts.ticket - JOIN state s - WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = getAlert3State(ti.id); - - INSERT INTO ticketTracking(stateFk,ticketFk,workerFk) - SELECT * FROM tmp.updateInter; - - CALL invoiceExpenceMake(vNewInvoiceId); - CALL invoiceTaxMake(vNewInvoiceId,vTaxArea); - - UPDATE invoiceOut io - JOIN ( - SELECT SUM(amount) total - FROM invoiceOutExpence - WHERE invoiceOutFk = vNewInvoiceId - ) base - JOIN ( - SELECT SUM(vat) total - FROM invoiceOutTax - WHERE invoiceOutFk = vNewInvoiceId - ) vat - SET io.amount = base.total + vat.total - WHERE io.id = vNewInvoiceId; - - DROP TEMPORARY TABLE tmp.updateInter; - - SELECT COUNT(*), id - INTO vIsInterCompany, vInterCompanyFk - FROM company - WHERE clientFk = vClientFk; - - IF (vIsInterCompany) THEN - - INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) - SELECT vCompanyFk, vNewRef, vInvoiceDate, vInterCompanyFk; - - SET vNewInvoiceInFk = LAST_INSERT_ID(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (KEY (ticketFk)) - ENGINE = MEMORY - SELECT id ticketFk - FROM ticketToInvoice; - - CALL `ticket_getTax`('NATIONAL'); - - SET @vTaxableBaseServices := 0.00; - SET @vTaxCodeGeneral := NULL; - - INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) - SELECT vNewInvoiceInFk, - @vTaxableBaseServices, - sub.expenceFk, - sub.taxTypeSageFk, - sub.transactionTypeSageFk - FROM ( - SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, - i.expenceFk, - i.taxTypeSageFk, - i.transactionTypeSageFk, - @vTaxCodeGeneral := i.taxClassCodeFk - FROM tmp.ticketServiceTax tst - JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code - WHERE i.isService - HAVING taxableBase - ) sub; - - INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) - SELECT vNewInvoiceInFk, - SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, - @vTaxableBaseServices, 0) taxableBase, - i.expenceFk, - i.taxTypeSageFk , - i.transactionTypeSageFk - FROM tmp.ticketTax tt - JOIN invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code - WHERE !i.isService - GROUP BY tt.pgcFk - HAVING taxableBase - ORDER BY tt.priority; - - CALL invoiceInDueDay_calculate(vNewInvoiceInFk); - - SELECT COUNT(*) INTO vIsCEESerial - FROM invoiceOutSerial - WHERE code = vSerial; - - IF vIsCEESerial THEN - - INSERT INTO invoiceInIntrastat ( - invoiceInFk, - intrastatFk, - amount, - stems, - countryFk, - net) - SELECT - vNewInvoiceInFk, - i.intrastatFk, - SUM(CAST((s.quantity * s.price * (100 - s.discount) / 100 ) AS DECIMAL(10, 2))), - SUM(CAST(IFNULL(i.stems, 1) * s.quantity AS DECIMAL(10, 2))), - su.countryFk, - CAST(SUM(IFNULL(i.stems, 1) - * s.quantity - * IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000) AS DECIMAL(10, 2)) - FROM sale s - JOIN ticket t ON s.ticketFk = t.id - JOIN supplier su ON su.id = t.companyFk - JOIN item i ON i.id = s.itemFk - LEFT JOIN itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk - WHERE t.refFk = vNewRef - GROUP BY i.intrastatFk; - - END IF; - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticketAmount; - DROP TEMPORARY TABLE tmp.ticketTax; - DROP TEMPORARY TABLE tmp.ticketServiceTax; - END IF; - END IF; - DROP TEMPORARY TABLE `ticketToInvoice`; -END$$ -DELIMITER ; From 9f0d5097fea56e6ebb7b58e8e368b14eab118d1d Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 16 May 2023 09:14:38 +0200 Subject: [PATCH 26/27] refs #5160 increase jasmine timeout --- back/tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index ef5a7bca8..97e548d33 100644 --- a/back/tests.js +++ b/back/tests.js @@ -55,7 +55,7 @@ async function test() { const JunitReporter = require('jasmine-reporters'); jasmine.addReporter(new JunitReporter.JUnitXmlReporter()); - jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000; jasmine.exitOnCompletion = true; } From 36205e75beba2bc4a33c39dd57385c32523d7aa8 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 18 May 2023 07:55:43 +0200 Subject: [PATCH 27/27] feat(232201): new version --- CHANGELOG.md | 17 ++++++++++++++++- db/changes/232001/00-createWorker.sql | 10 +++++----- db/changes/{232001 => 232201}/.gitkeep | 0 package-lock.json | 2 +- package.json | 2 +- 5 files changed, 23 insertions(+), 8 deletions(-) rename db/changes/{232001 => 232201}/.gitkeep (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 083e43199..bfff5e53b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2320.01] - 2023-05-25 +## [2322.01] - 2023-06-08 ### Added - + ### Changed - @@ -18,6 +19,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## [2320.01] - 2023-05-25 + +### Added +- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente + + +### Changed +- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador' + +### Fixed +- + + + ## [2318.01] - 2023-05-08 ### Added diff --git a/db/changes/232001/00-createWorker.sql b/db/changes/232001/00-createWorker.sql index df08b9df4..3e5af683f 100644 --- a/db/changes/232001/00-createWorker.sql +++ b/db/changes/232001/00-createWorker.sql @@ -1,14 +1,14 @@ -INSERT INTO vn.businessType (code,description) + INSERT INTO `vn`.`businessType` (`code`, `description`) VALUES ('worker','Trabajador'); -ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL +ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo'; UPDATE `vn`.`workerConfig` SET businessTypeFk = 'worker' WHERE id = 1; - UPDATE client c - JOIN worker w ON w.id = c.id + UPDATE `vn`.`client` c + JOIN `vn`.`worker` w ON w.id = c.id SET c.name = REPLACE(c.name, 'TR ', ''), - c.businessTypeFk = 'worker'; \ No newline at end of file + c.businessTypeFk = 'worker'; diff --git a/db/changes/232001/.gitkeep b/db/changes/232201/.gitkeep similarity index 100% rename from db/changes/232001/.gitkeep rename to db/changes/232201/.gitkeep diff --git a/package-lock.json b/package-lock.json index d373248fd..05ff6466a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.18.01", + "version": "23.22.01", "lockfileVersion": 1, "requires": true, "packages": { diff --git a/package.json b/package.json index 4b4f552ac..d068d6615 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.20.01", + "version": "23.22.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0",