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 d0c0cfeda..713ccf7cd 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 @@ -376,7 +376,8 @@ describe('Ticket Edit sale path', () => { expect(result).toBeFalsy(); }); - it('should update all sales discount', async() => { + // 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); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index b325b9176..79ebc1e54 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -167,8 +167,8 @@ "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", "Sorts whole route": "Reordena ruta entera", - "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día {{shipped}}, con una cantidad de {{quantity}} y un precio de {{price}} €", - "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día {{shipped}}, con una cantidad de {{quantity}}", + "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", + "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", "This BIC already exist.": "Este BIC ya existe.", "That item doesn't exists": "Ese artículo no existe", diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 585feb063..778e46001 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -43,9 +43,9 @@ -

Subtotal {{$ctrl.subtotal | currency: 'EUR': 2}}

-

VAT {{$ctrl.VAT | currency: 'EUR': 2}}

-

Total {{$ctrl.total | currency: 'EUR': 2}}

+

Subtotal {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

+

VAT {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

+

Total {{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}

diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 806c5f99e..2f3a65812 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -24,7 +24,6 @@ class Controller extends Section { set sales(value) { this._sales = value; - this.refreshTotal(); } get ticketState() { @@ -33,17 +32,6 @@ class Controller extends Section { return this.ticket.ticketState.state.code; } - get total() { - return this.subtotal + this.VAT; - } - - getSubTotal() { - if (!this.$params.id || !this.sales) return; - this.$http.get(`Tickets/${this.$params.id}`).then(res => { - this.subtotal = res.data.totalWithoutVat || 0.0; - }); - } - getSaleTotal(sale) { if (sale.quantity == null || sale.price == null) return null; @@ -59,19 +47,6 @@ class Controller extends Section { .then(res => this.edit.mana = res.data); } - getVat() { - this.VAT = 0.0; - if (!this.$params.id || !this.sales) return; - this.$http.get(`Tickets/${this.$params.id}`).then(res => { - this.VAT = res.data.totalWithVat - res.data.totalWithoutVat || 0.0; - }); - } - - refreshTotal() { - this.getSubTotal(); - this.getVat(); - } - /** * Returns checked instances * @@ -158,8 +133,6 @@ class Controller extends Section { const index = this.sales.indexOf(sale); this.sales.splice(index, 1); }); - - this.refreshTotal(); } createClaim() { @@ -221,7 +194,6 @@ class Controller extends Section { this.$http.post(query, {newPrice}).then(res => { sale.price = res.data.price; this.edit = null; - this.refreshTotal(); this.vnApp.showSuccess(this.$t('Data saved!')); }).finally(() => this.resetChanges()); } @@ -287,7 +259,6 @@ class Controller extends Section { sale.discount = this.edit.discount; this.edit = null; - this.refreshTotal(); }).finally(() => this.resetChanges()); } @@ -401,7 +372,6 @@ class Controller extends Section { updateQuantity(sale) { const data = {quantity: sale.quantity}; this.$http.post(`Sales/${sale.id}/updateQuantity`, data).then(() => { - this.refreshTotal(); this.vnApp.showSuccess(this.$t('Data saved!')); }).catch(e => { this.$.model.refresh(); @@ -444,7 +414,6 @@ class Controller extends Section { sale.price = newSale.price; sale.item = newSale.item; - this.refreshTotal(); this.vnApp.showSuccess(this.$t('Data saved!')); }).finally(() => this.resetChanges()); } @@ -466,7 +435,6 @@ class Controller extends Section { this.$http.post(query).then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); this.$.model.refresh(); - this.refreshTotal(); }); } diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index c8692f4e9..f49dc7452 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -72,28 +72,6 @@ describe('Ticket', () => { }); }); - describe('sales() setter', () => { - it('should set the sales data an then call the refreshTotal() method', () => { - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); - - controller.sales = [{id: 1}]; - - expect(controller.refreshTotal).toHaveBeenCalledWith(); - }); - }); - - describe('getSubTotal()', () => { - it('should make an HTTP GET query and then set the subtotal property', () => { - const expectedResponse = {totalWithoutVat: 128}; - - $httpBackend.expect('GET', 'Tickets/1').respond(200, expectedResponse); - controller.getSubTotal(); - $httpBackend.flush(); - - expect(controller.subtotal).toEqual(expectedResponse.totalWithoutVat); - }); - }); - describe('getSaleTotal()', () => { it('should return the sale total amount', () => { const sale = { @@ -122,21 +100,6 @@ describe('Ticket', () => { }); }); - describe('getVat()', () => { - it('should make an HTTP GET query and return the ticket VAT', () => { - controller.edit = {}; - const expectedResponse = {totalWithVat: 1000, totalWithoutVat: 999}; - - const expectedVAT = expectedResponse.totalWithVat - expectedResponse.totalWithoutVat; - - $httpBackend.expect('GET', 'Tickets/1').respond(200, expectedResponse); - controller.getVat(); - $httpBackend.flush(); - - expect(controller.VAT).toEqual(expectedVAT); - }); - }); - describe('selectedSales()', () => { it('should return a list of selected sales', () => { controller.sales[1].checked = true; @@ -276,7 +239,6 @@ describe('Ticket', () => { describe('removeSelectedSales()', () => { it('should remove the selected sales from the controller sale property', () => { - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); jest.spyOn(controller, 'resetChanges').mockReturnThis(); const firstSale = controller.sales[0]; @@ -288,7 +250,6 @@ describe('Ticket', () => { expect(controller.sales.length).toEqual(1); expect(lastSale.id).toEqual(4); - expect(controller.refreshTotal).toHaveBeenCalledWith(); }); }); @@ -355,7 +316,6 @@ describe('Ticket', () => { describe('updatePrice()', () => { it('should make an HTTP POST query, update the sale price and then call to the resetChanges() method', () => { - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis(); jest.spyOn(controller, 'resetChanges').mockReturnThis(); @@ -372,7 +332,6 @@ describe('Ticket', () => { $httpBackend.flush(); expect(selectedSale.price).toEqual(2); - expect(controller.refreshTotal).toHaveBeenCalledWith(); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.editPricePopover.hide).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); @@ -451,7 +410,6 @@ describe('Ticket', () => { it('should make an HTTP POST query, update the sales discount and then call to the resetChanges() method', () => { jest.spyOn(controller, 'resetChanges').mockReturnThis(); jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis(); - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); const expectedDiscount = 10; const firstSelectedSale = controller.sales[0]; @@ -473,7 +431,6 @@ describe('Ticket', () => { expect(firstSelectedSale.discount).toEqual(expectedDiscount); expect(secondSelectedSale.discount).toEqual(expectedDiscount); - expect(controller.refreshTotal).toHaveBeenCalledWith(); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); @@ -622,7 +579,6 @@ describe('Ticket', () => { describe('updateQuantity()', () => { it('should make a POST query saving sale quantity', () => { - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); jest.spyOn(controller, 'resetChanges').mockReturnThis(); const selectedSale = controller.sales[0]; @@ -634,7 +590,6 @@ describe('Ticket', () => { controller.updateQuantity(selectedSale); $httpBackend.flush(); - expect(controller.refreshTotal).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -659,7 +614,6 @@ describe('Ticket', () => { describe('addSale()', () => { it('should make a POST query adding a new sale', () => { jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis(); - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); jest.spyOn(controller, 'resetChanges').mockReturnThis(); const newSale = {itemFk: 4, quantity: 10}; @@ -681,7 +635,6 @@ describe('Ticket', () => { $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - expect(controller.refreshTotal).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -712,7 +665,6 @@ describe('Ticket', () => { it('should make an HTTP post query ', () => { jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis(); jest.spyOn(controller.$.model, 'refresh').mockReturnThis(); - jest.spyOn(controller, 'refreshTotal').mockReturnThis(); const selectedSale = controller.sales[0]; selectedSale.checked = true; @@ -723,7 +675,6 @@ describe('Ticket', () => { expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); - expect(controller.refreshTotal).toHaveBeenCalledWith(); }); }); }); diff --git a/print/core/components/attachment/attachment.html b/print/core/components/attachment/attachment.html index d66746e99..88fa64434 100644 --- a/print/core/components/attachment/attachment.html +++ b/print/core/components/attachment/attachment.html @@ -1,5 +1,5 @@
- +
{{attachment.filename}}
diff --git a/print/core/components/attachment/attachment.js b/print/core/components/attachment/attachment.js index 0f2a6d103..5c78a895c 100755 --- a/print/core/components/attachment/attachment.js +++ b/print/core/components/attachment/attachment.js @@ -1,7 +1,7 @@ module.exports = { name: 'attachment', computed: { - path() { + attachmentPath() { const filename = this.attachment.filename; const component = this.attachment.component; if (this.attachment.cid) diff --git a/print/templates/email/letter-debtor-st/locale/fr.yml b/print/templates/email/letter-debtor-st/locale/fr.yml new file mode 100644 index 000000000..a8da98a80 --- /dev/null +++ b/print/templates/email/letter-debtor-st/locale/fr.yml @@ -0,0 +1,20 @@ +subject: Avis initial de solde débiteur +title: Avis initial de solde débiteur +sections: + introduction: + title: Madame, Monsieur, + description: Sauf erreur ou omission de notre part, nous constatons que votre + compte client présente à ce jour un solde débiteur. +checkExtract: Ce montant correspond à nos factures restées impayées, ci-joint en annexe. + Notre service administratif se fera un plaisir de clarifier toutes les questions que vous + pourriez avoir, et vous fournira également tout document que vous nous demandez. +checkValidData: Si lors de la vérification des données fournies, elles sont correctes et + l’échéance étant dépassée, nous vous demandons de bien vouloir régulariser cette situation. +payMethod: Si vous ne souhaitez pas vous rendre personnellement à nos bureaux, vous + pouvez effectuer le paiement par virement bancaire sur le compte qui apparaît en + bas du relevé, en indiquant votre numéro de client, ou vous pouvez effectuer le + paiement en ligne avec une carte bleue sur notre site Internet. +conclusion: Dans le cas où votre règlement aurait été adressé entre temps, + nous vous prions de ne pas tenir compte de la présente. + Nous vous remercions par avance de votre aimable coopération. +transferAccount: Coordonées pour virement bancaire diff --git a/print/templates/reports/letter-debtor/locale/fr.yml b/print/templates/reports/letter-debtor/locale/fr.yml new file mode 100644 index 000000000..eff39d783 --- /dev/null +++ b/print/templates/reports/letter-debtor/locale/fr.yml @@ -0,0 +1,10 @@ +title: Relevé de compte +claimId: Réclamation +clientId: Client +clientData: Données client +date: Date +concept: Objet +invoiced: Facturé +payed: Payé +balance: Solde +client: Client {0} \ No newline at end of file