From 29c6ca35ff112093d47d1b193f12bd3f1fd2e597 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 27 Jan 2023 13:39:19 +0100 Subject: [PATCH 01/24] fix: test e2e --- modules/item/back/methods/tag/onSubmit.js | 24 ++++++----------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/modules/item/back/methods/tag/onSubmit.js b/modules/item/back/methods/tag/onSubmit.js index aec67e92a..7abbe60d4 100644 --- a/modules/item/back/methods/tag/onSubmit.js +++ b/modules/item/back/methods/tag/onSubmit.js @@ -47,44 +47,32 @@ module.exports = function(Self) { } try { - const promises = []; - if (args.deletes) { - for (const itemTagId of args.deletes) { - const itemTagDeleted = models.ItemTag.destroyById(itemTagId, myOptions); - promises.push(itemTagDeleted); - } + for (const itemTagId of args.deletes) + await models.ItemTag.destroyById(itemTagId, myOptions); } if (args.updates) { for (const row of args.updates) { if (row.data.priority) { const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions); - const itemTagUpdatedPriority = itemTag.updateAttributes({ + await itemTag.updateAttributes({ priority: row.data.priority + args.maxPriority }, myOptions); - promises.push(itemTagUpdatedPriority); } } for (const row of args.updates) { const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions); - const itemTagUpdated = itemTag.updateAttributes(row.data, myOptions); - promises.push(itemTagUpdated); + await itemTag.updateAttributes(row.data, myOptions); } } if (args.creates) { - for (const itemTag of args.creates) { - const newItemTag = models.ItemTag.create(itemTag, myOptions); - promises.push(newItemTag); - } + for (const itemTag of args.creates) + await models.ItemTag.create(itemTag, myOptions); } - const resolvedPromises = await Promise.all(promises); - if (tx) await tx.commit(); - - return resolvedPromises; } catch (e) { if (tx) await tx.rollback(); throw e; From 79bf1739baff7947c697ac5473a1f76294b18726 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 27 Jan 2023 13:52:14 +0100 Subject: [PATCH 02/24] fix: backTest --- modules/item/back/methods/tag/specs/onSubmit.spec.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/item/back/methods/tag/specs/onSubmit.spec.js b/modules/item/back/methods/tag/specs/onSubmit.spec.js index a8077db67..f24aad7e4 100644 --- a/modules/item/back/methods/tag/specs/onSubmit.spec.js +++ b/modules/item/back/methods/tag/specs/onSubmit.spec.js @@ -12,9 +12,8 @@ describe('tag onSubmit()', () => { deletes: deletes } }; - const result = await models.Tag.onSubmit(ctx, options); + await models.Tag.onSubmit(ctx, options); - expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -33,9 +32,8 @@ describe('tag onSubmit()', () => { updates: updates } }; - const result = await models.Tag.onSubmit(ctx, options); + await models.Tag.onSubmit(ctx, options); - expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -62,9 +60,8 @@ describe('tag onSubmit()', () => { creates: creates } }; - const result = await models.Tag.onSubmit(ctx, options); + await models.Tag.onSubmit(ctx, options); - expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -88,9 +85,8 @@ describe('tag onSubmit()', () => { } }; - const result = await models.Tag.onSubmit(ctx, options); + await models.Tag.onSubmit(ctx, options); - expect(result.length).toEqual(4); await tx.rollback(); } catch (e) { await tx.rollback(); From 7e5f50e637a8e8f67e2527a1de46a556d1d4db26 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 08:30:39 +0100 Subject: [PATCH 03/24] refs #5072 email validation added --- db/changes/230401/00-updateIsToBeMailed.sql | 6 ++++++ loopback/locale/es.json | 3 ++- modules/client/back/models/client.js | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 db/changes/230401/00-updateIsToBeMailed.sql diff --git a/db/changes/230401/00-updateIsToBeMailed.sql b/db/changes/230401/00-updateIsToBeMailed.sql new file mode 100644 index 000000000..c04090663 --- /dev/null +++ b/db/changes/230401/00-updateIsToBeMailed.sql @@ -0,0 +1,6 @@ +UPDATE vn.client + SET isToBeMailed = FALSE + WHERE + mailAddress is NULL + AND email is NULL + AND isToBeMailed = TRUE; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d65054f37..1bf6c18f0 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -259,5 +259,6 @@ "Try again": "Vuelve a intentarlo", "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", "Failed to upload file": "Error al subir archivo", - "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists" + "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists", + "There is no assigned email for this client": "No hay correo asignado para este cliente" } diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index e07993f79..2d8e7bd27 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -141,6 +141,16 @@ module.exports = Self => { done(); } + Self.validateAsync('isToBeMailed', isToBeMailed, { + message: 'There is no assigned email for this client' + }); + + function isToBeMailed(err, done) { + if (this.isToBeMailed == true && !this.email) + err(); + done(); + } + Self.validateAsync('defaultAddressFk', isActive, {message: 'Unable to default a disabled consignee'} ); From fbf252b634772ff61c9f6bba70aa8c00bcfd5014 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 08:31:56 +0100 Subject: [PATCH 04/24] refs #5072 template strings --- db/changes/230401/00-updateIsToBeMailed.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/230401/00-updateIsToBeMailed.sql b/db/changes/230401/00-updateIsToBeMailed.sql index c04090663..1bb177f57 100644 --- a/db/changes/230401/00-updateIsToBeMailed.sql +++ b/db/changes/230401/00-updateIsToBeMailed.sql @@ -1,4 +1,4 @@ -UPDATE vn.client +UPDATE `vn`.`client` SET isToBeMailed = FALSE WHERE mailAddress is NULL From cf64de39f9653c0d88bb60e0dff0339a276a9507 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Mon, 30 Jan 2023 09:01:20 +0100 Subject: [PATCH 05/24] refs #5146 @1h add step to vn-inputs --- modules/supplier/front/agency-term/index/index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/supplier/front/agency-term/index/index.html b/modules/supplier/front/agency-term/index/index.html index 9d53226c5..44c6deba9 100644 --- a/modules/supplier/front/agency-term/index/index.html +++ b/modules/supplier/front/agency-term/index/index.html @@ -24,36 +24,42 @@ From 46ee12de6d29c65cf2925a630c18c683399c60fe Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 09:45:10 +0100 Subject: [PATCH 06/24] refs #5088 text deleted --- print/templates/reports/receipt/receipt.html | 6 +++--- print/templates/reports/receipt/sql/receipt.sql | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/print/templates/reports/receipt/receipt.html b/print/templates/reports/receipt/receipt.html index e0bab5ecf..5dd4299be 100644 --- a/print/templates/reports/receipt/receipt.html +++ b/print/templates/reports/receipt/receipt.html @@ -4,9 +4,9 @@

{{$t('title')}}

- Recibo de {{client.socialName}}, la cantidad de - {{receipt.amountPaid}} € en concepto de 'entrega a cuenta', quedando pendiente en - la cuenta del cliente un saldo de {{receipt.amountUnpaid}} €. + Recibo de {{client.socialName}}, + la cantidad de {{receipt.amountPaid}} € + en concepto de 'entrega a cuenta'.

diff --git a/print/templates/reports/receipt/sql/receipt.sql b/print/templates/reports/receipt/sql/receipt.sql index b8f5a4112..4094d25b3 100644 --- a/print/templates/reports/receipt/sql/receipt.sql +++ b/print/templates/reports/receipt/sql/receipt.sql @@ -1,11 +1,10 @@ -SELECT - r.id, - r.amountPaid, - cr.amount AS amountUnpaid, - r.payed, +SELECT + r.id, + r.amountPaid, + r.payed, r.companyFk FROM receipt r JOIN client c ON c.id = r.clientFk JOIN vn.clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = r.companyFk -WHERE r.id = ? \ No newline at end of file +WHERE r.id = ? From 77742d94d77a34576980f13f8f79250318fcd586 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 12:19:11 +0100 Subject: [PATCH 07/24] refs #5138 summary changed like route/tickets --- .../route/back/methods/route/getTickets.js | 11 ++- modules/route/front/summary/index.html | 82 ++++++++++--------- modules/route/front/tickets/index.html | 26 +++--- 3 files changed, 66 insertions(+), 53 deletions(-) diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 708644c1a..1eb9e27f5 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -50,14 +50,17 @@ module.exports = Self => { am.name AS agencyModeName, u.nickname AS userNickname, vn.ticketTotalVolume(t.id) AS volume, - tob.description + tob.description, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt FROM vn.route r JOIN ticket t ON t.routeFk = r.id + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN observationType ot ON ot.code = 'delivery' - LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id + LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = ot.id LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk @@ -70,7 +73,9 @@ module.exports = Self => { const where = filter.where; where['r.id'] = filter.id; - stmt.merge(conn.makeSuffix(filter)); + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makeGroupBy('t.id')); + stmt.merge(conn.makeOrderBy(filter.order)); const tickets = await conn.executeStmt(stmt, myOptions); diff --git a/modules/route/front/summary/index.html b/modules/route/front/summary/index.html index 86f558634..a64ad4ff7 100644 --- a/modules/route/front/summary/index.html +++ b/modules/route/front/summary/index.html @@ -10,26 +10,26 @@ - - - - - {{$ctrl.summary.route.worker.user.name}} - @@ -40,35 +40,35 @@ - - - -

- Ticket

-

Ticket @@ -77,45 +77,49 @@ Order - Ticket id - Alias + Street + City + PC + Client + Warehouse Packages - Warehouse - PC - Street + Packaging + Ticket {{ticket.priority | dashIfEmpty}} + {{ticket.street}} + {{ticket.city}} + {{ticket.postalCode}} + + + {{ticket.nickname}} + + + {{ticket.warehouseName}} + {{ticket.packages}} + {{ticket.volume}} + {{ticket.ipt}} - {{ticket.id}} - - {{ticket.nickname}} - - - {{ticket.packages}} - {{ticket.volume}} - {{ticket.warehouseName}} - {{ticket.postalCode}} - {{ticket.street}} - - - + + @@ -123,12 +127,12 @@ - - diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index dae894ac7..18d6fb160 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -6,9 +6,9 @@ data="$ctrl.tickets" auto-load="true"> - -
@@ -25,18 +25,18 @@ vn-tooltip="Open buscaman" icon="icon-buscaman"> - - - City PC Client + Warehouse Packages + Packaging Ticket @@ -100,8 +102,10 @@ {{::ticket.nickname}} + {{ticket.warehouseName}} {{::ticket.packages}} {{::ticket.volume | number:2}} + {{::ticket.ipt}}
- - @@ -160,7 +164,7 @@ - - - \ No newline at end of file + From a43f2cd35fcf1005435eb56fdf9d78f9eb143ea8 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 12:31:17 +0100 Subject: [PATCH 08/24] refs #5138 changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00cafc2b..7aa44e258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Trabajadores -> Nuevo trabajador) Nueva sección ### Changed -- +- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets ### Fixed - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. From f7a65cfa6ea63d6f5811fc6d09a3df6efcac2282 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 12:35:09 +0100 Subject: [PATCH 09/24] refs #5072 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00cafc2b..bda004470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. +- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail ## [2302.01] - 2023-01-26 From 8580851b5b74883f54046e1fafca104587bbfe43 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Mon, 30 Jan 2023 13:32:09 +0100 Subject: [PATCH 11/24] refs #5148 @0:30h change style to pre-line --- front/salix/components/log/style.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index bc943996d..68cd5a047 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -42,6 +42,7 @@ vn-log { & > td.after, & > th.after { width: 40%; + white-space: pre-line; } } } From 9cb363e4e5236083ca6b1841d8c3edadab64fdab Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 13:34:08 +0100 Subject: [PATCH 12/24] refs #5074 deleted null in reference --- CHANGELOG.md | 2 +- modules/client/front/balance/create/index.js | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00cafc2b..22efa1b28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. - +- (Tickets -> Añadir pago) Eliminado "null" en las referencias ## [2302.01] - 2023-01-26 diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 35b2e0b38..b64129e2e 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -59,13 +59,11 @@ class Controller extends Dialog { if (value) { const accountingType = value.accountingType; - if (this.originalDescription) { - this.receipt.description = - `${accountingType && accountingType.receiptDescription}, ${this.originalDescription}`; - } else { - this.receipt.description = - `${accountingType && accountingType.receiptDescription}`; - } + if (accountingType.receiptDescription != null) { + this.receipt.description = accountingType.receiptDescription; + if (this.originalDescription) this.receipt.description += `, ${this.originalDescription}`; + } else if (this.originalDescription) + this.receipt.description = this.originalDescription; this.maxAmount = accountingType && accountingType.maxAmount; this.receipt.payed = new Date(); From 896988279302a23febc45dd8dc3504e7aa66eda7 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 30 Jan 2023 14:13:38 +0100 Subject: [PATCH 13/24] Removed where property dependency --- modules/ticket/back/methods/state/editableStates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/state/editableStates.js b/modules/ticket/back/methods/state/editableStates.js index 2c90ac43b..115876f26 100644 --- a/modules/ticket/back/methods/state/editableStates.js +++ b/modules/ticket/back/methods/state/editableStates.js @@ -24,7 +24,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - let statesList = await models.State.find({where: filter.where}, myOptions); + let statesList = await models.State.find(filter, myOptions); const isProduction = await models.Account.hasRole(userId, 'production', myOptions); const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions); const isAdministrative = await models.Account.hasRole(userId, 'administrative', myOptions); From 444d2ae4c4b518b2d306d49b74190553de903b69 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 15:28:47 +0100 Subject: [PATCH 15/24] refs #5104 grouping/packing unified --- modules/entry/front/latest-buys/locale/es.yml | 4 +- modules/entry/front/summary/index.html | 14 +++-- modules/item/front/last-entries/index.html | 52 +++++++++---------- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/modules/entry/front/latest-buys/locale/es.yml b/modules/entry/front/latest-buys/locale/es.yml index 8d70844fa..795e3f5f4 100644 --- a/modules/entry/front/latest-buys/locale/es.yml +++ b/modules/entry/front/latest-buys/locale/es.yml @@ -1,5 +1,5 @@ Edit buy(s): Editar compra(s) -Buying value: Precio +Buying value: Coste Freight value: Porte Commission value: Comisión Package value: Embalaje @@ -16,4 +16,4 @@ Field to edit: Campo a editar PackageName: Cubo Edit: Editar buy(s): compra(s) -Package out: Embalaje envíos \ No newline at end of file +Package out: Embalaje envíos diff --git a/modules/entry/front/summary/index.html b/modules/entry/front/summary/index.html index 04844ab99..8f1cd924d 100644 --- a/modules/entry/front/summary/index.html +++ b/modules/entry/front/summary/index.html @@ -38,7 +38,7 @@ - {{$ctrl.entryData.travel.ref}} @@ -114,8 +114,7 @@ Grouping Buying value Import - Grouping price - Packing price + PVP @@ -125,19 +124,18 @@ {{::line.packageFk | dashIfEmpty}} {{::line.weight}} - + {{::line.packing | dashIfEmpty}} - + {{::line.grouping | dashIfEmpty}} {{::line.buyingValue | currency: 'EUR':2}} {{::line.quantity * line.buyingValue | currency: 'EUR':2}} - {{::line.price2 | currency: 'EUR':2}} - {{::line.price3 | currency: 'EUR':2}} + {{::line.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::line.price3 | currency: 'EUR':2 | dashIfEmpty}} @@ -195,7 +193,7 @@ vn-id="item-descriptor" warehouse-fk="$ctrl.vnConfig.warehouseFk"> - diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 0348d4f66..1c2db10a5 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -9,15 +9,15 @@ - + @@ -35,8 +35,7 @@ Warehouse Landed Entry - P.P.U - P.P.P + PVP Label Packing Grouping @@ -51,7 +50,7 @@ - @@ -65,30 +64,31 @@ {{::entry.entryFk | dashIfEmpty}} - {{::entry.price2 | dashIfEmpty}} - {{::entry.price3 | dashIfEmpty}} + + {{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}} + {{entry.stickers | dashIfEmpty}} - + {{::entry.packing | dashIfEmpty}} - + {{::entry.grouping | dashIfEmpty}} {{::entry.stems | dashIfEmpty}} {{::entry.quantity}} - - {{::entry.cost | dashIfEmpty}} + {{::$ctrl.$t('Cost')}}: {{::entry.buyingValue | currency: 'EUR':2 | dashIfEmpty}}
+ {{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':2 | dashIfEmpty}}
+ {{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':2 | dashIfEmpty}}
+ {{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':2 | dashIfEmpty}}"> + {{::entry.cost | currency: 'EUR':2 | dashIfEmpty}}
{{::entry.weight | dashIfEmpty}} @@ -113,24 +113,24 @@ ng-click="contextmenu.filterBySelection()"> Filter by selection - Exclude selection - Remove filter - Remove all filters - Copy value - \ No newline at end of file + From 2bbd7cb2170eb9fd5b9a0bb943e36ea60c015853 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 15:40:08 +0100 Subject: [PATCH 16/24] refs #5104 changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00cafc2b..3f2faeb13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Trabajadores -> Nuevo trabajador) Nueva sección ### Changed -- +- (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste" +- (Artículos -> Últimas compras) Cambiados los campos "P.P.U." y "P.P.P." por "PVP" ### Fixed - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. From 53349fcea74961767c63de4e38c7b6c359f0c891 Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 30 Jan 2023 15:41:04 +0100 Subject: [PATCH 17/24] refs #5104 changelog modified --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f2faeb13..e65983d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste" -- (Artículos -> Últimas compras) Cambiados los campos "P.P.U." y "P.P.P." por "PVP" +- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP" ### Fixed - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. From 7d617c0ac420afa0e7d63362569e5bf24abd2183 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 31 Jan 2023 09:04:45 +0100 Subject: [PATCH 19/24] refs #5129 translations and userErrors added --- loopback/locale/en.json | 19 +++++----- loopback/locale/es.json | 6 ++-- modules/ticket/back/methods/sale/canEdit.js | 9 ++++- .../ticket/back/methods/sale/deleteSales.js | 4 +-- .../back/methods/sale/recalculatePrice.js | 4 +-- modules/ticket/back/methods/sale/reserve.js | 4 +-- .../back/methods/sale/specs/canEdit.spec.js | 36 +++++++++---------- .../ticket/back/methods/sale/updateConcept.js | 5 +-- .../ticket/back/methods/sale/updatePrice.js | 4 +-- .../back/methods/sale/updateQuantity.js | 4 +-- 10 files changed, 47 insertions(+), 48 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index a406b55a5..c810e5a69 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -67,7 +67,7 @@ "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}", - "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked", + "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked", "Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*", "Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*", "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", @@ -137,15 +137,18 @@ "Password does not meet requirements": "Password does not meet requirements", "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", "Not enough privileges to edit a client": "Not enough privileges to edit a client", - "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", + "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", "You don't have grant privilege": "You don't have grant privilege", "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", - "Email verify": "Email verify", + "Email verify": "Email verify", "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", - "Sale(s) blocked, please contact production": "Sale(s) blocked, please contact production", "App locked": "App locked by user {{userId}}", - "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", - "Receipt's bank was not found": "Receipt's bank was not found", - "This receipt was not compensated": "This receipt was not compensated", - "Client's email was not found": "Client's email was not found" + "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", + "Receipt's bank was not found": "Receipt's bank was not found", + "This receipt was not compensated": "This receipt was not compensated", + "Client's email was not found": "Client's email was not found", + "It is not possible to modify tracked sales": "It is not possible to modify tracked sales", + "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", + "It is not possible to modify cloned sales": "It is not possible to modify cloned sales", + "Valid priorities: 1,2,3": "Valid priorities: 1,2,3" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d65054f37..06c3efa2b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -84,7 +84,6 @@ "The current ticket can't be modified": "El ticket actual no puede ser modificado", "The current claim can't be modified": "La reclamación actual no puede ser modificada", "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "Sale(s) blocked, contact production": "Linea(s) bloqueada(s), contacte con produccion", "Please select at least one sale": "Por favor selecciona al menos una linea", "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", @@ -259,5 +258,8 @@ "Try again": "Vuelve a intentarlo", "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", "Failed to upload file": "Error al subir archivo", - "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists" + "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists", + "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que estén en marcha", + "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", + "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas" } diff --git a/modules/ticket/back/methods/sale/canEdit.js b/modules/ticket/back/methods/sale/canEdit.js index f44bd6743..3091ebca7 100644 --- a/modules/ticket/back/methods/sale/canEdit.js +++ b/modules/ticket/back/methods/sale/canEdit.js @@ -56,6 +56,13 @@ module.exports = Self => { const shouldEditCloned = canEditCloned || !hasSaleCloned; const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo; - return shouldEditTracked && shouldEditCloned && shouldEditFloramondo; + if (!shouldEditTracked) + throw new UserError('It is not possible to modify tracked sales'); + if (!shouldEditCloned) + throw new UserError('It is not possible to modify cloned sales'); + if (!shouldEditFloramondo) + throw new UserError('It is not possible to modify sales that their articles are from Floramondo'); + + return true; }; }; diff --git a/modules/ticket/back/methods/sale/deleteSales.js b/modules/ticket/back/methods/sale/deleteSales.js index c045b9197..5d1463a66 100644 --- a/modules/ticket/back/methods/sale/deleteSales.js +++ b/modules/ticket/back/methods/sale/deleteSales.js @@ -43,9 +43,7 @@ module.exports = Self => { try { const saleIds = sales.map(sale => sale.id); - const canEditSales = await models.Sale.canEdit(ctx, saleIds, myOptions); - if (!canEditSales) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, saleIds, myOptions); const ticket = await models.Ticket.findById(ticketId, { include: { diff --git a/modules/ticket/back/methods/sale/recalculatePrice.js b/modules/ticket/back/methods/sale/recalculatePrice.js index 38c68d7f6..2c8e6768b 100644 --- a/modules/ticket/back/methods/sale/recalculatePrice.js +++ b/modules/ticket/back/methods/sale/recalculatePrice.js @@ -37,9 +37,7 @@ module.exports = Self => { try { const salesIds = sales.map(sale => sale.id); - const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions); - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, salesIds, myOptions); const query = ` DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; diff --git a/modules/ticket/back/methods/sale/reserve.js b/modules/ticket/back/methods/sale/reserve.js index 648e6de23..2dc368af6 100644 --- a/modules/ticket/back/methods/sale/reserve.js +++ b/modules/ticket/back/methods/sale/reserve.js @@ -51,9 +51,7 @@ module.exports = Self => { try { const salesIds = sales.map(sale => sale.id); - const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions); - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, salesIds, myOptions); let changesMade = ''; const promises = []; diff --git a/modules/ticket/back/methods/sale/specs/canEdit.spec.js b/modules/ticket/back/methods/sale/specs/canEdit.spec.js index 2aa873df5..58d8f0635 100644 --- a/modules/ticket/back/methods/sale/specs/canEdit.spec.js +++ b/modules/ticket/back/methods/sale/specs/canEdit.spec.js @@ -50,7 +50,7 @@ describe('sale canEdit()', () => { it('should return false if any of the sales has a saleTracking record', async() => { const tx = await models.Sale.beginTransaction({}); - + let error; try { const options = {transaction: tx}; @@ -59,15 +59,15 @@ describe('sale canEdit()', () => { const sales = [31]; - const result = await models.Sale.canEdit(ctx, sales, options); - - expect(result).toEqual(false); - + await models.Sale.canEdit(ctx, sales, options); await tx.rollback(); } catch (e) { await tx.rollback(); - throw e; + error = e; } + + expect(error).toEqual( + new Error('It is not possible to modify tracked sales')); }); }); @@ -75,22 +75,22 @@ describe('sale canEdit()', () => { const saleCloned = [29]; it('should return false if any of the sales is cloned', async() => { const tx = await models.Sale.beginTransaction({}); - + let error; try { const options = {transaction: tx}; const buyerId = 35; const ctx = {req: {accessToken: {userId: buyerId}}}; - const result = await models.Sale.canEdit(ctx, saleCloned, options); - - expect(result).toEqual(false); - + await models.Sale.canEdit(ctx, saleCloned, options); await tx.rollback(); } catch (e) { await tx.rollback(); - throw e; + error = e; } + + expect(error).toEqual( + new Error('It is not possible to modify cloned sales')); }); it('should return true if any of the sales is cloned and has the correct role', async() => { @@ -130,7 +130,7 @@ describe('sale canEdit()', () => { it('should return false if any of the sales isFloramondo', async() => { const tx = await models.Sale.beginTransaction({}); const sales = [26]; - + let error; try { const options = {transaction: tx}; @@ -140,15 +140,15 @@ describe('sale canEdit()', () => { const saleToEdit = await models.Sale.findById(sales[0], null, options); await saleToEdit.updateAttribute('itemFk', 9, options); - const result = await models.Sale.canEdit(ctx, sales, options); - - expect(result).toEqual(false); - + await models.Sale.canEdit(ctx, sales, options); await tx.rollback(); } catch (e) { await tx.rollback(); - throw e; + error = e; } + + expect(error).toEqual( + new Error('It is not possible to modify sales that their articles are from Floramondo')); }); it('should return true if any of the sales is of isFloramondo and has the correct role', async() => { diff --git a/modules/ticket/back/methods/sale/updateConcept.js b/modules/ticket/back/methods/sale/updateConcept.js index 0730f85e2..dcd25dcbb 100644 --- a/modules/ticket/back/methods/sale/updateConcept.js +++ b/modules/ticket/back/methods/sale/updateConcept.js @@ -40,10 +40,7 @@ module.exports = Self => { try { const currentLine = await models.Sale.findById(id, null, myOptions); - const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); - - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, [id], myOptions); const line = await currentLine.updateAttributes({concept: newConcept}, myOptions); diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index 8f27e1af5..505de5180 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -66,9 +66,7 @@ module.exports = Self => { const sale = await models.Sale.findById(id, filter, myOptions); - const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, [id], myOptions); const oldPrice = sale.price; const userId = ctx.req.accessToken.userId; diff --git a/modules/ticket/back/methods/sale/updateQuantity.js b/modules/ticket/back/methods/sale/updateQuantity.js index 8cf0720ce..d2927c65c 100644 --- a/modules/ticket/back/methods/sale/updateQuantity.js +++ b/modules/ticket/back/methods/sale/updateQuantity.js @@ -41,9 +41,7 @@ module.exports = Self => { } try { - const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); - if (!canEditSale) - throw new UserError(`Sale(s) blocked, please contact production`); + await models.Sale.canEdit(ctx, [id], myOptions); const filter = { include: { From 4740cdbbb9696b8d2c8c2565a21a8bdb2c7034d0 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 31 Jan 2023 10:37:18 +0100 Subject: [PATCH 20/24] fix: e2e --- e2e/paths/03-worker/04_time_control.spec.js | 3 + front/core/components/button-menu/index.js | 1 + modules/ticket/front/sale/index.html | 1 + modules/ticket/front/summary/index.html | 61 +++++++++++---------- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index bba7ced89..b5da799fc 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -23,6 +23,7 @@ describe('Worker time control path', () => { it('should go to the next month, go to current month and go 1 month in the past', async() => { let date = new Date(); + date.setDate(1); date.setMonth(date.getMonth() + 1); let month = date.toLocaleString('default', {month: 'long'}); @@ -32,6 +33,7 @@ describe('Worker time control path', () => { expect(result).toContain(month); date = new Date(); + date.setDate(1); month = date.toLocaleString('default', {month: 'long'}); await page.click(selectors.workerTimeControl.previousMonthButton); @@ -40,6 +42,7 @@ describe('Worker time control path', () => { expect(result).toContain(month); date = new Date(); + date.setDate(1); date.setMonth(date.getMonth() - 1); const timestamp = Math.round(date.getTime() / 1000); month = date.toLocaleString('default', {month: 'long'}); diff --git a/front/core/components/button-menu/index.js b/front/core/components/button-menu/index.js index c19962b08..e9e4e5ab7 100644 --- a/front/core/components/button-menu/index.js +++ b/front/core/components/button-menu/index.js @@ -87,6 +87,7 @@ ngModule.vnComponent('vnButtonMenu', { selectFields: ' diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index fe49a301f..af44ed67c 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -1,6 +1,6 @@
- - Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} + Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} - -
- - {{$ctrl.summary.client.salesPersonUser.name}} - @@ -47,11 +48,11 @@ {{$ctrl.summary.zone.name}} - - {{$ctrl.summary.routeFk}} @@ -66,17 +67,17 @@ - - -

- Sale @@ -146,13 +147,13 @@ vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}"> - - @@ -170,22 +171,22 @@ - {{sale.itemFk | zeroFill:6}} - {{::sale.visible}} - {{::sale.available}} @@ -216,7 +217,7 @@

- Packages @@ -241,7 +242,7 @@

- Service @@ -276,7 +277,7 @@

- Purchase request @@ -304,7 +305,7 @@ {{::request.quantity}} {{::request.price}} - @@ -336,9 +337,9 @@ - - - \ No newline at end of file + From ffdc539851a5eefa4b3e25690b395b4ca41628b5 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 31 Jan 2023 11:29:07 +0100 Subject: [PATCH 21/24] refs #5138 fix e2e --- e2e/helpers/selectors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a1412f431..986c6547b 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -944,9 +944,9 @@ export default { routeSummary: { header: 'vn-route-summary > vn-card > h5', cost: 'vn-route-summary vn-label-value[label="Cost"]', - firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span', + firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(10) > span', firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor', - firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span', + firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(5) > span', firstClientDescriptor: '.vn-popover.shown vn-client-descriptor', goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a', From a358e58171ca37eef21e513a662f4040a5b1e483 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 31 Jan 2023 12:12:25 +0100 Subject: [PATCH 22/24] docuware translation --- loopback/locale/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 06c3efa2b..df17b82a3 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -258,7 +258,7 @@ "Try again": "Vuelve a intentarlo", "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", "Failed to upload file": "Error al subir archivo", - "The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists", + "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que estén en marcha", "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas" From fd440a4db38d8f328bca88f7a684db2a5cc1e1e4 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 31 Jan 2023 15:42:36 +0100 Subject: [PATCH 23/24] refs #5129 better translation tracked sales --- loopback/locale/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index df17b82a3..f86d211f7 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -259,7 +259,7 @@ "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", "Failed to upload file": "Error al subir archivo", "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", - "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que estén en marcha", + "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas" } From 17bb4b60727794f948e95a362d4dd40cdda6bf31 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 1 Feb 2023 07:17:16 +0100 Subject: [PATCH 24/24] refs #5088 added receiptId --- print/templates/reports/receipt/receipt.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/receipt/receipt.html b/print/templates/reports/receipt/receipt.html index 5dd4299be..be0bfc375 100644 --- a/print/templates/reports/receipt/receipt.html +++ b/print/templates/reports/receipt/receipt.html @@ -4,7 +4,7 @@

{{$t('title')}}

- Recibo de {{client.socialName}}, + Recibo #{{receipt.id}} de {{client.socialName}}, la cantidad de {{receipt.amountPaid}} € en concepto de 'entrega a cuenta'.