diff --git a/modules/entry/back/methods/entry/specs/importBuys.spec.js b/modules/entry/back/methods/entry/specs/importBuys.spec.js index 4d0585b3e..9cf6f4300 100644 --- a/modules/entry/back/methods/entry/specs/importBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/importBuys.spec.js @@ -59,7 +59,7 @@ describe('entry import()', () => { expect(updatedEntry.observation).toEqual(expectedObservation); expect(updatedEntry.ref).toEqual(expectedRef); - expect(entryBuys.length).toEqual(2); + expect(entryBuys.length).toEqual(4); await tx.rollback(); } catch (e) { diff --git a/modules/entry/back/methods/entry/specs/lastItemBuys.spec.js b/modules/entry/back/methods/entry/specs/lastItemBuys.spec.js new file mode 100644 index 000000000..3789113e7 --- /dev/null +++ b/modules/entry/back/methods/entry/specs/lastItemBuys.spec.js @@ -0,0 +1,26 @@ +const models = require('vn-loopback/server/server').models; + +describe('Entry lastItemBuys()', () => { + const entryId = 3; + it('should return the items that have been bought', async() => { + const filter = {where: {}}; + const result = await models.Entry.lastItemBuys(entryId, filter); + + expect(result.length).toBeGreaterThan(1); + }); + + it('should return the items matching color "brown"', async() => { + const brownInkCode = 'BRW'; + const filter = {where: {inkFk: brownInkCode}}; + const result = await models.Entry.lastItemBuys(entryId, filter); + + expect(result.length).toEqual(2); + }); + + it('should return the items with a name containing "Ranged"', async() => { + const filter = {where: {name: {like: '%Ranged%'}}}; + const result = await models.Entry.lastItemBuys(entryId, filter); + + expect(result.length).toEqual(3); + }); +}); diff --git a/modules/entry/front/buy/import/index.js b/modules/entry/front/buy/import/index.js index 2249702c5..a2a28ef69 100644 --- a/modules/entry/front/buy/import/index.js +++ b/modules/entry/front/buy/import/index.js @@ -128,7 +128,7 @@ class Controller extends Section { switch (key) { case 'name': - where['i.name'] = {like: `%${value}%`}; + where[key] = {like: `%${value}%`}; break; case 'producerFk': case 'typeFk': diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 42a77a394..99fb949b6 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -20,7 +20,7 @@ on-change="$ctrl.changeState(value)"> diff --git a/modules/ticket/front/summary/index.js b/modules/ticket/front/summary/index.js index 913c89774..60394b5b3 100644 --- a/modules/ticket/front/summary/index.js +++ b/modules/ticket/front/summary/index.js @@ -41,9 +41,9 @@ class Controller extends Summary { }); } - get isTicketModule() { - const path = this.$state.getCurrentPath()[1]; - return path.state.name === 'ticket'; + get isOnTicketCard() { + const currentState = this.$state.current.name; + return currentState.startsWith('ticket.card'); } get isEditable() { diff --git a/print/templates/email/client-welcome/locale/es.yml b/print/templates/email/client-welcome/locale/es.yml index ac43a7cc6..42426dc74 100644 --- a/print/templates/email/client-welcome/locale/es.yml +++ b/print/templates/email/client-welcome/locale/es.yml @@ -5,9 +5,7 @@ clientData: 'Tus datos para poder comprar en la web de Verdnatura (https://www.verdnatura.es) o en nuestras aplicaciones para iOS y Android (Ver tutorial de uso), son' + title="Google Play" target="_blank" style="color: #8dba25">Android, son' clientId: Identificador de cliente user: Usuario password: ContraseƱa