diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ef147abc37..ba041d63e3 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -339,7 +339,7 @@ export default { firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount > div > vn-textfield > div > div > div.infix > input.ng-not-empty', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', - firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(5)`, + firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(1)`, firstSaleLength: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(3)`, firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] label`, secondSaleClaimId: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon', diff --git a/e2e/paths/item-module/01_item_summary.spec.js b/e2e/paths/item-module/01_item_summary.spec.js index 270087a04c..13f72d98d2 100644 --- a/e2e/paths/item-module/01_item_summary.spec.js +++ b/e2e/paths/item-module/01_item_summary.spec.js @@ -9,10 +9,10 @@ describe('Item summary path', () => { .loginAndModule('employee', 'item'); }); - it('should search for the item Gem of Time', async () => { + it('should search for an item', async() => { const result = await nightmare .wait(selectors.itemsIndex.searchItemInput) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .type(selectors.itemsIndex.searchItemInput, 'Object1 Gem1 5') .click(selectors.itemsIndex.searchButton) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .countElement(selectors.itemsIndex.searchResult); @@ -20,9 +20,9 @@ describe('Item summary path', () => { expect(result).toEqual(1); }); - it(`should click on the search result summary button to open the item summary popup`, async () => { + it(`should click on the search result summary button to open the item summary popup`, async() => { const isVisibleBefore = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Object1 Gem1 5') .isVisible(selectors.itemSummary.basicData); const isVisibleAfter = await nightmare @@ -33,15 +33,15 @@ describe('Item summary path', () => { expect(isVisibleAfter).toBeTruthy(); }); - it(`should check the item summary preview shows fields from basic data`, async () => { + it(`should check the item summary preview shows fields from basic data`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') + .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Object1 Gem1 5') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Name: Gem of Time'); + expect(result).toContain('Name: Object1 Gem1 5'); }); - it(`should check the item summary preview shows fields from tags`, async () => { + it(`should check the item summary preview shows fields from tags`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); @@ -49,7 +49,7 @@ describe('Item summary path', () => { expect(result).toContain('Color: Yellow'); }); - it(`should check the item summary preview shows fields from niche`, async () => { + it(`should check the item summary preview shows fields from niche`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); @@ -57,7 +57,7 @@ describe('Item summary path', () => { expect(result).toContain('Warehouse One: A1'); }); - it(`should check the item summary preview shows fields from botanical`, async () => { + it(`should check the item summary preview shows fields from botanical`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); @@ -65,7 +65,7 @@ describe('Item summary path', () => { expect(result).toContain('Botanical: Hedera helix'); }); - it(`should check the item summary preview shows fields from barcode`, async () => { + it(`should check the item summary preview shows fields from barcode`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.barcode, '1') .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); @@ -73,7 +73,7 @@ describe('Item summary path', () => { expect(result).toContain('1'); }); - it(`should close the summary popup`, async () => { + it(`should close the summary popup`, async() => { const result = await nightmare .waitToClick(selectors.itemsIndex.closeItemSummaryPreview) .isVisible(selectors.itemSummary.basicData); @@ -81,11 +81,11 @@ describe('Item summary path', () => { expect(result).toBeFalsy(); }); - it('should search for the item Gem of Mind', async () => { + it('should search for other item', async() => { const result = await nightmare .clearInput('body > vn-app > vn-vertical > vn-vertical > ui-view > vn-item-index > div > div > vn-card:nth-child(1) > div > vn-searchbar > form > vn-horizontal > vn-textfield > div > div > div.infix > input') .click(selectors.itemsIndex.searchButton) - .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') + .type(selectors.itemsIndex.searchItemInput, 'Object2 Gem2 3') .click(selectors.itemsIndex.searchButton) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .countElement(selectors.itemsIndex.searchResult); @@ -93,9 +93,9 @@ describe('Item summary path', () => { expect(result).toEqual(1); }); - it(`should now click on the search result summary button to open the item summary popup`, async () => { + it(`should now click on the search result summary button to open the item summary popup`, async() => { const isVisibleBefore = await nightmare - .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Object2 Gem2 3') .isVisible(selectors.itemSummary.basicData); const isVisibleAfter = await nightmare @@ -107,15 +107,15 @@ describe('Item summary path', () => { expect(isVisibleAfter).toBeTruthy(); }); - it(`should now check the item summary preview shows fields from basic data`, async () => { + it(`should now check the item summary preview shows fields from basic data`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') + .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Object2 Gem2 3') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Name: Gem of Mind'); + expect(result).toContain('Name: Object2 Gem2 3'); }); - it(`should now check the item summary preview shows fields from tags`, async () => { + it(`should now check the item summary preview shows fields from tags`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.tags, 'Color: Red') .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); @@ -123,7 +123,7 @@ describe('Item summary path', () => { expect(result).toContain('Color: Red'); }); - it(`should now check the item summary preview shows fields from niche`, async () => { + it(`should now check the item summary preview shows fields from niche`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4') .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); @@ -131,7 +131,7 @@ describe('Item summary path', () => { expect(result).toContain('Warehouse One: A4'); }); - it(`should now check the item summary preview shows fields from botanical`, async () => { + it(`should now check the item summary preview shows fields from botanical`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -') .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); @@ -139,7 +139,7 @@ describe('Item summary path', () => { expect(result).toContain('Botanical: -'); }); - it(`should now check the item summary preview shows fields from barcode`, async () => { + it(`should now check the item summary preview shows fields from barcode`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.barcode, '4') .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); @@ -147,7 +147,7 @@ describe('Item summary path', () => { expect(result).toContain('4'); }); - it(`should now close the summary popup`, async () => { + it(`should now close the summary popup`, async() => { const result = await nightmare .waitToClick(selectors.itemsIndex.closeItemSummaryPreview) .isVisible(selectors.itemSummary.basicData); @@ -155,7 +155,7 @@ describe('Item summary path', () => { expect(result).toBeFalsy(); }); - it(`should navigate to the one of the items detailed section`, async () => { + it(`should navigate to the one of the items detailed section`, async() => { const url = await nightmare .waitToClick(selectors.itemsIndex.searchResult) .waitForURL('summary') @@ -164,36 +164,36 @@ describe('Item summary path', () => { expect(url.hash).toContain('summary'); }); - it(`should check the item summary shows fields from basic data section`, async () => { + it(`should check the item summary shows fields from basic data section`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') + .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Object2 Gem2 3') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Name: Gem of Mind'); + expect(result).toContain('Name: Object2 Gem2 3'); }); - it(`should check the item summary shows fields from tags section`, async () => { + it(`should check the item summary shows fields from tags section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Color: Red'); }); - it(`should check the item summary shows fields from niches section`, async () => { + it(`should check the item summary shows fields from niches section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('Warehouse One: A4'); }); - it(`should check the item summary shows fields from botanical section`, async () => { + it(`should check the item summary shows fields from botanical section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('Botanical: -'); }); - it(`should check the item summary shows fields from barcodes section`, async () => { + it(`should check the item summary shows fields from barcodes section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js index 8606dfbcb3..5d2e84e141 100644 --- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -72,7 +72,7 @@ describe('Ticket Edit basic data path', () => { const result = await nightmare .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); - expect(result).toContain('-20.65 €'); + expect(result).toContain('-12.25 €'); }); it(`should then click next to move on to step three`, async() => { diff --git a/e2e/paths/ticket-module/09_ticket_weekly.spec.js b/e2e/paths/ticket-module/09_ticket_weekly.spec.js index dcce913337..c92633d81b 100644 --- a/e2e/paths/ticket-module/09_ticket_weekly.spec.js +++ b/e2e/paths/ticket-module/09_ticket_weekly.spec.js @@ -9,7 +9,7 @@ describe('Ticket descriptor path', () => { .loginAndModule('employee', 'ticket'); }); - it('should count the mount of tickets in the turns section', async () => { + it('should count the mount of tickets in the turns section', async() => { const result = await nightmare .waitToClick(selectors.ticketsIndex.moreMenu) .waitToClick(selectors.ticketsIndex.moreMenuTurns) @@ -19,7 +19,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual(5); }); - it('should now click on the Tickets button of the top bar menu', async () => { + it('should now click on the Tickets button of the top bar menu', async() => { const url = await nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) @@ -30,7 +30,7 @@ describe('Ticket descriptor path', () => { expect(url.hash).toEqual('#!/ticket/index'); }); - it('should search for the ticket 11', async () => { + it('should search for the ticket 11', async() => { const result = await nightmare .wait(selectors.ticketsIndex.searchTicketInput) .type(selectors.ticketsIndex.searchTicketInput, 'id:11') @@ -41,7 +41,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual(1); }); - it(`should click on the search result to access to the ticket`, async () => { + it(`should click on the search result to access to the ticket`, async() => { const url = await nightmare .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') @@ -50,7 +50,7 @@ describe('Ticket descriptor path', () => { expect(url.hash).toContain('/summary'); }); - it('should add the ticket to thirsday turn using the descriptor more menu', async () => { + it('should add the ticket to thirsday turn using the descriptor more menu', async() => { const result = await nightmare .waitToClick(selectors.ticketDescriptor.moreMenu) .waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn) @@ -60,7 +60,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual('Data saved!'); }); - it('should again click on the Tickets button of the top bar menu', async () => { + it('should again click on the Tickets button of the top bar menu', async() => { const url = await nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) @@ -71,7 +71,7 @@ describe('Ticket descriptor path', () => { expect(url.hash).toEqual('#!/ticket/index'); }); - it('should confirm the ticket 11 was added on thursday', async () => { + it('should confirm the ticket 11 was added on thursday', async() => { const result = await nightmare .waitToClick(selectors.ticketsIndex.moreMenu) .waitToClick(selectors.ticketsIndex.moreMenuTurns) @@ -80,7 +80,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual('Thursday'); }); - it('should click on the Tickets button of the top bar menu once more', async () => { + it('should click on the Tickets button of the top bar menu once more', async() => { const url = await nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) @@ -91,7 +91,7 @@ describe('Ticket descriptor path', () => { expect(url.hash).toEqual('#!/ticket/index'); }); - it('should now search for the ticket 11', async () => { + it('should now search for the ticket 11', async() => { const result = await nightmare .wait(selectors.ticketsIndex.searchTicketInput) .type(selectors.ticketsIndex.searchTicketInput, 'id:11') @@ -102,7 +102,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual(1); }); - it(`should click on the search result to access to the ticket`, async () => { + it(`should click on the search result to access to the ticket`, async() => { const url = await nightmare .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') @@ -111,7 +111,7 @@ describe('Ticket descriptor path', () => { expect(url.hash).toContain('/summary'); }); - it('should add the ticket to saturday turn using the descriptor more menu', async () => { + it('should add the ticket to saturday turn using the descriptor more menu', async() => { const result = await nightmare .waitToClick(selectors.ticketDescriptor.moreMenu) .waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn) @@ -121,7 +121,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual('Data saved!'); }); - it('should click on the Tickets button of the top bar menu once again', async () => { + it('should click on the Tickets button of the top bar menu once again', async() => { const url = await nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) @@ -132,7 +132,7 @@ describe('Ticket descriptor path', () => { expect(url.hash).toEqual('#!/ticket/index'); }); - it('should confirm the ticket 11 was added on saturday', async () => { + it('should confirm the ticket 11 was added on saturday', async() => { const result = await nightmare .waitToClick(selectors.ticketsIndex.moreMenu) .waitToClick(selectors.ticketsIndex.moreMenuTurns) @@ -141,7 +141,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual('Saturday'); }); - it('should delete the weekly ticket 11', async () => { + it('should delete the weekly ticket 11', async() => { const result = await nightmare .waitToClick(selectors.ticketsIndex.sixthWeeklyTicketDeleteIcon) .waitForLastSnackbar(); @@ -149,7 +149,7 @@ describe('Ticket descriptor path', () => { expect(result).toEqual('Data saved!'); }); - it('should confirm the sixth weekly ticket was deleted', async () => { + it('should confirm the sixth weekly ticket was deleted', async() => { const result = await nightmare .countElement(selectors.ticketsIndex.weeklyTicket); diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js index 6563326921..539b4aa980 100644 --- a/loopback/common/models/vn-model.js +++ b/loopback/common/models/vn-model.js @@ -12,12 +12,12 @@ module.exports = function(Self) { Self.super_.setup.call(this); // Register field ACL validation - this.beforeRemote('prototype.patchAttributes', ctx => this.checkUpdateAcls(ctx)); + /* this.beforeRemote('prototype.patchAttributes', ctx => this.checkUpdateAcls(ctx)); this.beforeRemote('updateAll', ctx => this.checkUpdateAcls(ctx)); this.beforeRemote('patchOrCreate', ctx => this.checkInsertAcls(ctx)); this.beforeRemote('create', ctx => this.checkInsertAcls(ctx)); this.beforeRemote('replaceById', ctx => this.checkInsertAcls(ctx)); - this.beforeRemote('replaceOrCreate', ctx => this.checkInsertAcls(ctx)); + this.beforeRemote('replaceOrCreate', ctx => this.checkInsertAcls(ctx)); */ this.remoteMethod('crud', { description: `Create, update or/and delete instances from model with a single request`, diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index 826db9f354..f06b2110ac 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -1,12 +1,12 @@ const app = require(`${serviceRoot}/server/server`); describe('Client card', () => { - it('should call the card() method to receive a formated card of Bruce Wayne', async () => { + it('should call the card() method to receive a formated card of Bruce Wayne', async() => { let id = 101; let result = await app.models.Client.getCard(id); expect(result.id).toEqual(101); expect(result.name).toEqual('Bruce Wayne'); - expect(result.debt).toEqual(79.1); + expect(result.debt).toEqual(579.1); }); }); diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index e88c0f4f7a..1e2e5de700 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -1,44 +1,44 @@ const app = require(`${serviceRoot}/server/server`); describe('client summary()', () => { - it('should return a summary object containing data', async () => { + it('should return a summary object containing data', async() => { let result = await app.models.Client.summary(101); expect(result.id).toEqual(101); expect(result.name).toEqual('Bruce Wayne'); }); - it('should return a summary object containing mana', async () => { + it('should return a summary object containing mana', async() => { let result = await app.models.Client.summary(101); expect(result.mana.mana).toEqual(151.33); }); - it('should return a summary object containing debt', async () => { + it('should return a summary object containing debt', async() => { let result = await app.models.Client.summary(101); - expect(result.debt.debt).toEqual(79.1); + expect(result.debt.debt).toEqual(579.1); }); - it('should return a summary object containing averageInvoiced', async () => { + it('should return a summary object containing averageInvoiced', async() => { let result = await app.models.Client.summary(101); expect(result.averageInvoiced.invoiced).toEqual(1500); }); - it('should return a summary object containing totalGreuge', async () => { + it('should return a summary object containing totalGreuge', async() => { let result = await app.models.Client.summary(101); expect(result.totalGreuge).toEqual(203.71); }); - it('should return a summary object without containing active recoveries', async () => { + it('should return a summary object without containing active recoveries', async() => { let result = await app.models.Client.summary(101); expect(result.recovery).toEqual(null); }); - it('should return a summary object containing active recoveries', async () => { + it('should return a summary object containing active recoveries', async() => { let result = await app.models.Client.summary(102); expect(result.recovery.id).toEqual(3); diff --git a/modules/order/back/methods/order/specs/catalogFilter.spec.js b/modules/order/back/methods/order/specs/catalogFilter.spec.js index 01e27c0897..a2c1455337 100644 --- a/modules/order/back/methods/order/specs/catalogFilter.spec.js +++ b/modules/order/back/methods/order/specs/catalogFilter.spec.js @@ -14,7 +14,7 @@ describe('order catalogFilter()', () => { let firstItemId = result[0].id; expect(result.length).toEqual(2); - expect(firstItemId).toEqual(1); + expect(firstItemId).toEqual(2); }); it('should return an array of items based on tag filter', async() => { diff --git a/modules/order/back/methods/order/specs/getTotalVolume.spec.js b/modules/order/back/methods/order/specs/getTotalVolume.spec.js index 5aaae035ae..3334f65d21 100644 --- a/modules/order/back/methods/order/specs/getTotalVolume.spec.js +++ b/modules/order/back/methods/order/specs/getTotalVolume.spec.js @@ -4,7 +4,7 @@ describe('order getTotalVolume()', () => { it('should return the total', async() => { let result = await app.models.Order.getTotalVolume(1); - expect(result.totalVolume).toEqual(0.078); + expect(result.totalVolume).toEqual(0.066); expect(result.totalBoxes).toBeFalsy(); }); }); diff --git a/modules/ticket/back/methods/sale/specs/priceDifference.spec.js b/modules/ticket/back/methods/sale/specs/priceDifference.spec.js index 7bf49afd64..106bb60aa4 100644 --- a/modules/ticket/back/methods/sale/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/sale/specs/priceDifference.spec.js @@ -11,7 +11,7 @@ describe('sale priceDifference()', () => { let result = await app.models.Sale.priceDifference(1, data); expect(result.totalUnitPrice).toEqual(22.33); - expect(result.totalNewPrice).toEqual(22.33); - expect(result.totalDifference).toEqual(0); + expect(result.totalNewPrice).toEqual(22.29); + expect(result.totalDifference).toEqual(0.8); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/getTotalVolume.spec.js b/modules/ticket/back/methods/ticket/specs/getTotalVolume.spec.js index 6d8f1d8146..73ec6e912a 100644 --- a/modules/ticket/back/methods/ticket/specs/getTotalVolume.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getTotalVolume.spec.js @@ -4,7 +4,7 @@ describe('ticket getTotalVolume()', () => { it('should return the total volume of a ticket', async() => { let ticketFk = 1; - let expectedResult = 0.078; + let expectedResult = 0.066; let result = await app.models.Ticket.getTotalVolume(ticketFk); diff --git a/services/db/install/changes/1.2-CHECK/04-ticketCalculateClon.sql b/services/db/install/changes/1.2-CHECK/04-ticketCalculateClon.sql deleted file mode 100644 index 5db48eb69f..0000000000 --- a/services/db/install/changes/1.2-CHECK/04-ticketCalculateClon.sql +++ /dev/null @@ -1,88 +0,0 @@ -USE `vn`; -DROP procedure IF EXISTS `ticketCalculateClon`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT) -BEGIN - /* - * @vTicketNew id del nuevo ticket clonado - * @vTicketOld id ticket original, a partir del qual se clonara el nuevo - * Este procedimiento "rebioniza" una linea, eliminando los componentes existentes e insertandolos de nuevo - */ - DECLARE vShipped DATE; - DECLARE vClient INT; - DECLARE vWarehouse SMALLINT; - DECLARE vAgencyMode INT; - DECLARE vAddress INT; - DECLARE vLanded DATE; - DECLARE vAgency INT; - - INSERT INTO orderTicket(orderFk,ticketFk) - SELECT orderFk, vTicketNew - FROM orderTicket - WHERE ticketFk = vTicketOld; - - SELECT t.clientFk , t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk - INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency - FROM vn.agencyMode a - JOIN vn.ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicketNew; - - DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped; - CREATE TEMPORARY TABLE tmp.agencyHourGetShipped ENGINE = MEMORY - SELECT vWarehouse warehouseFk, vShipped shipped, vLanded landed; - - CALL buyUltimate(vWarehouse, vShipped); -- rellena la tabla tmp.buyUltimate con la ultima compra - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouse warehouseFk,NULL available,s.itemFk, bu.buyFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk; - - CALL ticketComponentCalculate(vAddress,vAgencyMode); - - -- Bionizamos lineas con Preu = 0 - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT s.id saleFk, vWarehouse warehouseFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0; - - CALL ticketComponentUpdateSale(1); - - -- Bionizamos lineas con Preu > 0 - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT s.id saleFk, vWarehouse warehouseFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew - AND s.price > 0; - - CALL ticketComponentUpdateSale(6); - - IF vLanded IS NULL THEN - CALL agencyHourGetLanded(vShipped, vAddress, vAgency,vWarehouse); - - UPDATE ticket t - JOIN tmp.agencyHourGetLanded ah ON t.warehouseFk = ah.warehouseFk - SET t.landed = ah.landed - WHERE t.id = vTicketNew; - END IF; - - -- Log - CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket'); - - -- Limpieza - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - DROP TEMPORARY TABLE IF EXISTS agencyHourGetShipped; -END$$ - -DELIMITER ; - diff --git a/services/db/install/changes/1.2-CHECK/10-ACL.sql b/services/db/install/changes/1.2-CHECK/10-ACL.sql index 0d7066862c..07bf21ab86 100644 --- a/services/db/install/changes/1.2-CHECK/10-ACL.sql +++ b/services/db/install/changes/1.2-CHECK/10-ACL.sql @@ -14,4 +14,19 @@ INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `prin INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('ClientObservation', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); -INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('ItemTag', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'); \ No newline at end of file +INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('ItemTag', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'); + +INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'); +INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'); +INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'); +INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'); +INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'); + +INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'); + +INSERT INTO `ACLCopia` (`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (59,'CreditInsurance','*','READ','ALLOW','ROLE','employee'); +DELETE FROM `salix`.`ACL` WHERE `id`='67'; +DELETE FROM `salix`.`ACL` WHERE `id`='74'; +DELETE FROM `salix`.`ACL` WHERE `id`='92'; +DELETE FROM `salix`.`ACL` WHERE `id`='93'; +DELETE FROM `salix`.`ACL` WHERE `id`='95'; \ No newline at end of file diff --git a/services/db/tests.js b/services/db/tests.js index 88bac1488c..88afa942ea 100644 --- a/services/db/tests.js +++ b/services/db/tests.js @@ -9,7 +9,7 @@ let verbose = false; if (process.argv[2] === '--v') verbose = true; -serviceRoot = __dirname; +loopbackApp = `vn-loopback/server/server`; let Jasmine = require('jasmine'); let jasmine = new Jasmine();