Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5410-client.defaulter_getChecked
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
6c75853ce6
|
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- (Clientes -> Morosos) Ahora se puede filtrar por las columnas "Desde" y "Fecha Ú. O.". También se envia un email al comercial cuando se añade una nota.
|
- (Clientes -> Morosos) Ahora se puede filtrar por las columnas "Desde" y "Fecha Ú. O.". También se envia un email al comercial cuando se añade una nota.
|
||||||
|
- (Monitor tickets) Muestra un icono al lado de la zona, si el ticket es frágil y se envía por agencia
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
-
|
-
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('setSaleQuantity()', () => {
|
describe('setSaleQuantity()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should change quantity sale', async() => {
|
it('should change quantity sale', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
ALTER TABLE `vn`.`itemType` ADD isFragile tinyint(1) NULL;
|
||||||
|
ALTER TABLE `vn`.`itemType` MODIFY COLUMN isFragile tinyint(1) DEFAULT 0 NOT NULL;
|
||||||
|
|
||||||
|
UPDATE `vn`.`itemType`
|
||||||
|
SET isFragile = 1
|
||||||
|
WHERE code IN ('ZKA', 'ZKE');
|
||||||
|
|
||||||
|
UPDATE `vn`.`itemType`
|
||||||
|
SET isFragile = 1
|
||||||
|
WHERE id IN (SELECT it.id
|
||||||
|
FROM itemCategory ic
|
||||||
|
JOIN itemType it ON it.categoryFk = ic.id
|
||||||
|
WHERE ic.code = 'plant');
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
DROP PROCEDURE IF EXISTS `vn`.`ticket_getWarnings`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE PROCEDURE `vn`.`ticket_getWarnings`()
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula las adventencias para un conjunto de tickets.
|
||||||
|
* Agrupados por ticket
|
||||||
|
*
|
||||||
|
* @table tmp.sale_getWarnings(ticketFk) Identificadores de los tickets a calcular
|
||||||
|
* @return tmp.ticket_warnings
|
||||||
|
*/
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.sale_warnings;
|
||||||
|
CREATE TEMPORARY TABLE tmp.sale_warnings (
|
||||||
|
ticketFk INT(11),
|
||||||
|
saleFk INT(11),
|
||||||
|
isFragile INTEGER(1) DEFAULT 0,
|
||||||
|
PRIMARY KEY (ticketFk, saleFk)
|
||||||
|
) ENGINE = MEMORY;
|
||||||
|
|
||||||
|
-- Frágil
|
||||||
|
INSERT INTO tmp.sale_warnings(ticketFk, saleFk, isFragile)
|
||||||
|
SELECT tt.ticketFk, s.id, TRUE
|
||||||
|
FROM tmp.sale_getWarnings tt
|
||||||
|
LEFT JOIN sale s ON s.ticketFk = tt.ticketFk
|
||||||
|
LEFT JOIN item i ON i.id = s.itemFk
|
||||||
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
|
LEFT JOIN agencyMode am ON am.id = tt.agencyModeFk
|
||||||
|
LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
|
WHERE dm.code IN ('AGENCY')
|
||||||
|
AND it.isFragile;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_warnings;
|
||||||
|
CREATE TEMPORARY TABLE tmp.ticket_warnings
|
||||||
|
(PRIMARY KEY (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT
|
||||||
|
sw.ticketFk,
|
||||||
|
MAX(sw.isFragile) AS isFragile
|
||||||
|
FROM tmp.sale_warnings sw
|
||||||
|
GROUP BY sw.ticketFk;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
tmp.sale_warnings;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -838,14 +838,14 @@ INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
|
||||||
('warm', 'Warm', 'Warm'),
|
('warm', 'Warm', 'Warm'),
|
||||||
('cool', 'Cool', 'Cool');
|
('cool', 'Cool', 'Cool');
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`)
|
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`, `isFragile`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool'),
|
(1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool', 0),
|
||||||
(2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool'),
|
(2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool', 1),
|
||||||
(3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool'),
|
(3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool', 0),
|
||||||
(4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm'),
|
(4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm', 0),
|
||||||
(5, 'CON', 'Container', 3, NULL, 35, 1, 'warm'),
|
(5, 'CON', 'Container', 3, NULL, 35, 1, 'warm', 0),
|
||||||
(6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm');
|
(6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -524,7 +524,6 @@ export default {
|
||||||
},
|
},
|
||||||
itemLog: {
|
itemLog: {
|
||||||
anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr',
|
anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr',
|
||||||
fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) table tr:nth-child(4) td.after',
|
|
||||||
},
|
},
|
||||||
ticketSummary: {
|
ticketSummary: {
|
||||||
header: 'vn-ticket-summary > vn-card > h5',
|
header: 'vn-ticket-summary > vn-card > h5',
|
||||||
|
@ -1040,7 +1039,6 @@ export default {
|
||||||
boss: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bossFk"]',
|
boss: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bossFk"]',
|
||||||
role: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.roleFk"]',
|
role: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.roleFk"]',
|
||||||
iban: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.iban"]',
|
iban: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.iban"]',
|
||||||
switft: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bankEntityFk"]',
|
|
||||||
createButton: 'vn-worker-create vn-submit[label="Create"]',
|
createButton: 'vn-worker-create vn-submit[label="Create"]',
|
||||||
},
|
},
|
||||||
workerPda: {
|
workerPda: {
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe('Worker time control path', () => {
|
||||||
date.setMonth(date.getMonth() + 1);
|
date.setMonth(date.getMonth() + 1);
|
||||||
let month = date.toLocaleString('default', {month: 'long'});
|
let month = date.toLocaleString('default', {month: 'long'});
|
||||||
|
|
||||||
await page.click(selectors.workerTimeControl.nextMonthButton);
|
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
||||||
let result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
let result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain(month);
|
expect(result).toContain(month);
|
||||||
|
@ -36,7 +36,7 @@ describe('Worker time control path', () => {
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
month = date.toLocaleString('default', {month: 'long'});
|
month = date.toLocaleString('default', {month: 'long'});
|
||||||
|
|
||||||
await page.click(selectors.workerTimeControl.previousMonthButton);
|
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
||||||
result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain(month);
|
expect(result).toContain(month);
|
||||||
|
@ -49,7 +49,7 @@ describe('Worker time control path', () => {
|
||||||
|
|
||||||
await page.loginAndModule('salesBoss', 'worker');
|
await page.loginAndModule('salesBoss', 'worker');
|
||||||
await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`);
|
await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`);
|
||||||
await page.click(selectors.workerTimeControl.secondWeekDay);
|
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||||
|
|
||||||
result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ describe('Worker create path', () => {
|
||||||
await page.write(selectors.workerCreate.street, 'S/ Doomstadt');
|
await page.write(selectors.workerCreate.street, 'S/ Doomstadt');
|
||||||
await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com');
|
await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com');
|
||||||
await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332');
|
await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332');
|
||||||
await page.autocompleteSearch(selectors.workerCreate.switft, 'BBKKESMMMMM');
|
|
||||||
|
|
||||||
// should check for autocompleted worker code and worker user name
|
// should check for autocompleted worker code and worker user name
|
||||||
const workerCode = await page
|
const workerCode = await page
|
||||||
|
|
|
@ -48,14 +48,14 @@ describe('Item log path', () => {
|
||||||
await page.accessToSection('item.card.log');
|
await page.accessToSection('item.card.log');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the log is showing 5 entries`, async() => {
|
it(`should confirm the log is showing 4 entries`, async() => {
|
||||||
await page.waitForSelector(selectors.itemLog.anyLineCreated);
|
await page.waitForSelector(selectors.itemLog.anyLineCreated);
|
||||||
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
|
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
|
||||||
|
|
||||||
expect(anyLineCreatedCount).toEqual(5);
|
expect(anyLineCreatedCount).toEqual(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the log is showing the intrastat for the created item`, async() => {
|
xit(`should confirm the log is showing the intrastat for the created item`, async() => {
|
||||||
const fifthLineCreatedProperty = await page
|
const fifthLineCreatedProperty = await page
|
||||||
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check in the history that logs has been added', async() => {
|
it('should check in the history that logs has been added', async() => {
|
||||||
|
pending('https://redmine.verdnatura.es/issues/5455');
|
||||||
await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
|
await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
|
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
|
||||||
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe('Ticket Future path', () => {
|
||||||
it('should search with the origin IPT', async() => {
|
it('should search with the origin IPT', async() => {
|
||||||
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
|
||||||
|
|
||||||
await page.autocompleteSearch(selectors.ticketFuture.ipt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketFuture.ipt, 'H');
|
||||||
await page.waitToClick(selectors.ticketFuture.submit);
|
await page.waitToClick(selectors.ticketFuture.submit);
|
||||||
|
|
||||||
expect(httpRequest).toContain('ipt=H');
|
expect(httpRequest).toContain('ipt=H');
|
||||||
|
@ -65,7 +65,7 @@ describe('Ticket Future path', () => {
|
||||||
|
|
||||||
await page.clearInput(selectors.ticketFuture.ipt);
|
await page.clearInput(selectors.ticketFuture.ipt);
|
||||||
|
|
||||||
await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'H');
|
||||||
await page.waitToClick(selectors.ticketFuture.submit);
|
await page.waitToClick(selectors.ticketFuture.submit);
|
||||||
|
|
||||||
expect(httpRequest).toContain('futureIpt=H');
|
expect(httpRequest).toContain('futureIpt=H');
|
||||||
|
@ -108,7 +108,7 @@ describe('Ticket Future path', () => {
|
||||||
|
|
||||||
it('should search in smart-table with an IPT Destination', async() => {
|
it('should search in smart-table with an IPT Destination', async() => {
|
||||||
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
||||||
await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'H');
|
||||||
|
|
||||||
expect(httpRequest).toContain('futureIpt');
|
expect(httpRequest).toContain('futureIpt');
|
||||||
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
await page.waitToClick(selectors.ticketFuture.tableButtonSearch);
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe('Ticket Advance path', () => {
|
||||||
|
|
||||||
it('should search with the origin IPT', async() => {
|
it('should search with the origin IPT', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H');
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
|
|
||||||
expect(httpRequest).toContain('futureIpt=H');
|
expect(httpRequest).toContain('futureIpt=H');
|
||||||
|
@ -66,7 +66,7 @@ describe('Ticket Advance path', () => {
|
||||||
|
|
||||||
it('should search with the destination IPT', async() => {
|
it('should search with the destination IPT', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H');
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
|
|
||||||
expect(httpRequest).toContain('ipt=H');
|
expect(httpRequest).toContain('ipt=H');
|
||||||
|
@ -78,7 +78,7 @@ describe('Ticket Advance path', () => {
|
||||||
|
|
||||||
it('should search in smart-table with an IPT Origin', async() => {
|
it('should search in smart-table with an IPT Origin', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical');
|
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'V');
|
||||||
|
|
||||||
expect(httpRequest).toContain('futureIpt');
|
expect(httpRequest).toContain('futureIpt');
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ describe('Ticket Advance path', () => {
|
||||||
|
|
||||||
it('should search in smart-table with an IPT Destination', async() => {
|
it('should search in smart-table with an IPT Destination', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical');
|
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'V');
|
||||||
|
|
||||||
expect(httpRequest).toContain('ipt');
|
expect(httpRequest).toContain('ipt');
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,13 @@ describe('Travel basic data path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the travel logs', async() => {
|
it('should navigate to the travel logs', async() => {
|
||||||
|
pending('https://redmine.verdnatura.es/issues/5455');
|
||||||
await page.accessToSection('travel.card.log');
|
await page.accessToSection('travel.card.log');
|
||||||
await page.waitForState('travel.card.log');
|
await page.waitForState('travel.card.log');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the 1st log contains details from the changes made', async() => {
|
it('should check the 1st log contains details from the changes made', async() => {
|
||||||
|
pending('https://redmine.verdnatura.es/issues/5455');
|
||||||
const result = await page.waitToGetProperty(selectors.travelLog.firstLogFirstTD, 'innerText');
|
const result = await page.waitToGetProperty(selectors.travelLog.firstLogFirstTD, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('new reference!');
|
expect(result).toContain('new reference!');
|
||||||
|
|
|
@ -27,12 +27,12 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const state = await models.ClaimState.findById(id, {
|
const state = await models.ClaimState.findById(id, {
|
||||||
include: {
|
include: {
|
||||||
relation: 'writeRole'
|
relation: 'writeRole'
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
const roleWithGrants = state && state.writeRole().name;
|
const roleWithGrants = state && state.writeRole().name;
|
||||||
return await models.Account.hasRole(userId, roleWithGrants, myOptions);
|
return await models.Account.hasRole(userId, roleWithGrants, myOptions);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('claim regularizeClaim()', () => {
|
describe('claim regularizeClaim()', () => {
|
||||||
const userId = 18;
|
const userId = 18;
|
||||||
|
@ -39,6 +40,20 @@ describe('claim regularizeClaim()', () => {
|
||||||
return await models.ClaimEnd.create(claimEnds, options);
|
return await models.ClaimEnd.create(claimEnds, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should send a chat message with value "Trash" and then change claim state to resolved', async() => {
|
it('should send a chat message with value "Trash" and then change claim state to resolved', async() => {
|
||||||
const tx = await models.Claim.beginTransaction({});
|
const tx = await models.Claim.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,11 @@
|
||||||
"type": "hasMany",
|
"type": "hasMany",
|
||||||
"model": "ClaimDms",
|
"model": "ClaimDms",
|
||||||
"foreignKey": "claimFk"
|
"foreignKey": "claimFk"
|
||||||
|
},
|
||||||
|
"lines": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "ClaimBeginning",
|
||||||
|
"foreignKey": "claimFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Controller extends Section {
|
||||||
isClaimEditable() {
|
isClaimEditable() {
|
||||||
if (!this.claim) return;
|
if (!this.claim) return;
|
||||||
|
|
||||||
this.$http.get(`ClaimStates/${this.claim.id}/isEditable`).then(res => {
|
this.$http.get(`ClaimStates/${this.claim.claimStateFk}/isEditable`).then(res => {
|
||||||
this.isRewritable = res.data;
|
this.isRewritable = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ describe('claim', () => {
|
||||||
controller = $componentController('vnClaimDetail', {$element, $scope});
|
controller = $componentController('vnClaimDetail', {$element, $scope});
|
||||||
controller.claim = {
|
controller.claim = {
|
||||||
ticketFk: 1,
|
ticketFk: 1,
|
||||||
id: 2}
|
id: 2,
|
||||||
|
claimStateFk: 2}
|
||||||
;
|
;
|
||||||
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
|
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
|
||||||
controller.salesClaimed = [{id: 1, sale: {}}];
|
controller.salesClaimed = [{id: 1, sale: {}}];
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('Buy editLatestsBuys()', () => {
|
describe('Buy editLatestsBuys()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should change the value of a given column for the selected buys', async() => {
|
it('should change the value of a given column for the selected buys', async() => {
|
||||||
const tx = await models.Buy.beginTransaction({});
|
const tx = await models.Buy.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"log": {
|
"log": {
|
||||||
"model": "EntryLog",
|
"model": "EntryLog",
|
||||||
"relation": "entry"
|
"relation": "entry",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
"name": "Entry",
|
"name": "Entry",
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"log": {
|
"log": {
|
||||||
"model":"EntryLog"
|
"model":"EntryLog",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('upsertFixedPrice()', () => {
|
describe('upsertFixedPrice()', () => {
|
||||||
const now = Date.vnNew();
|
const now = Date.vnNew();
|
||||||
|
@ -7,6 +8,17 @@ describe('upsertFixedPrice()', () => {
|
||||||
|
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
originalFixedPrice = await models.FixedPrice.findById(fixedPriceId);
|
originalFixedPrice = await models.FixedPrice.findById(fixedPriceId);
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should toggle the hasMinPrice boolean if there's a minPrice and update the rest of the data`, async() => {
|
it(`should toggle the hasMinPrice boolean if there's a minPrice and update the rest of the data`, async() => {
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('item clone()', () => {
|
describe('item clone()', () => {
|
||||||
let nextItemId;
|
let nextItemId;
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(async() => {
|
beforeEach(async() => {
|
||||||
let query = `SELECT i1.id + 1 as id FROM vn.item i1
|
let query = `SELECT i1.id + 1 as id FROM vn.item i1
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('item new()', () => {
|
describe('item new()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should create a new item, adding the name as a tag', async() => {
|
it('should create a new item, adding the name as a tag', async() => {
|
||||||
const tx = await models.Item.beginTransaction({});
|
const tx = await models.Item.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('regularize()', () => {
|
describe('regularize()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 18},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should create a new ticket and add a line', async() => {
|
it('should create a new ticket and add a line', async() => {
|
||||||
const tx = await models.Item.beginTransaction({});
|
const tx = await models.Item.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"log": {
|
"log": {
|
||||||
"model": "ItemLog",
|
"model": "ItemLog",
|
||||||
"showField": "id"
|
"showField": "id",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -295,11 +295,26 @@ module.exports = Self => {
|
||||||
risk = t.debt + t.credit, totalProblems = totalProblems + 1
|
risk = t.debt + t.credit, totalProblems = totalProblems + 1
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getWarnings');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
SELECT t.*, tp.*,
|
CREATE TEMPORARY TABLE tmp.sale_getWarnings
|
||||||
((tp.risk) + cc.riskTolerance < 0) AS hasHighRisk
|
(INDEX (ticketFk, agencyModeFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT f.id ticketFk, f.agencyModeFk
|
||||||
|
FROM tmp.filter f`);
|
||||||
|
stmts.push(stmt);
|
||||||
|
|
||||||
|
stmts.push('CALL ticket_getWarnings()');
|
||||||
|
|
||||||
|
stmt = new ParameterizedSQL(`
|
||||||
|
SELECT t.*,
|
||||||
|
tp.*,
|
||||||
|
((tp.risk) + cc.riskTolerance < 0) AS hasHighRisk,
|
||||||
|
tw.*
|
||||||
FROM tmp.tickets t
|
FROM tmp.tickets t
|
||||||
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = t.id
|
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = t.id
|
||||||
|
LEFT JOIN tmp.ticket_warnings tw ON tw.ticketFk = t.id
|
||||||
JOIN clientConfig cc`);
|
JOIN clientConfig cc`);
|
||||||
|
|
||||||
const hasProblems = args.problems;
|
const hasProblems = args.problems;
|
||||||
|
@ -387,6 +402,8 @@ module.exports = Self => {
|
||||||
tmp.filter,
|
tmp.filter,
|
||||||
tmp.ticket_problems,
|
tmp.ticket_problems,
|
||||||
tmp.sale_getProblems,
|
tmp.sale_getProblems,
|
||||||
|
tmp.sale_getWarnings,
|
||||||
|
tmp.ticket_warnings,
|
||||||
tmp.risk`);
|
tmp.risk`);
|
||||||
|
|
||||||
const sql = ParameterizedSQL.join(stmts, ';');
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
|
|
@ -13,3 +13,4 @@ Practical: Práctica
|
||||||
Preparation: Preparación
|
Preparation: Preparación
|
||||||
Auto-refresh: Auto-refresco
|
Auto-refresh: Auto-refresco
|
||||||
Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos
|
Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos
|
||||||
|
Is fragile: Es frágil
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<th field="stateFk">
|
<th field="stateFk">
|
||||||
<span translate>State</span>
|
<span translate>State</span>
|
||||||
</th>
|
</th>
|
||||||
|
<th field="isFragile"></th>
|
||||||
<th field="zoneFk">
|
<th field="zoneFk">
|
||||||
<span translate>Zone</span>
|
<span translate>Zone</span>
|
||||||
</th>
|
</th>
|
||||||
|
@ -175,6 +176,14 @@
|
||||||
{{ticket.state}}
|
{{ticket.state}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td number>
|
||||||
|
<vn-icon
|
||||||
|
ng-show="ticket.isFragile"
|
||||||
|
translate-attr="{title: 'Is fragile'}"
|
||||||
|
class="bright"
|
||||||
|
icon="local_bar">
|
||||||
|
</vn-icon>
|
||||||
|
</td>
|
||||||
<td name="zone">
|
<td name="zone">
|
||||||
<span
|
<span
|
||||||
title="{{ticket.zoneName}}"
|
title="{{ticket.zoneName}}"
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('route clone()', () => {
|
describe('route clone()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const createdDate = Date.vnNew();
|
const createdDate = Date.vnNew();
|
||||||
it('should throw an error if the amount of ids pased to the clone function do no match the database', async() => {
|
it('should throw an error if the amount of ids pased to the clone function do no match the database', async() => {
|
||||||
const ids = [996, 997, 998, 999];
|
const ids = [996, 997, 998, 999];
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('route updateWorkCenter()', () => {
|
describe('route updateWorkCenter()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
const routeId = 1;
|
const routeId = 1;
|
||||||
|
|
||||||
it('should set the commission work center if the worker has workCenter', async() => {
|
it('should set the commission work center if the worker has workCenter', async() => {
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
"name": "Route",
|
"name": "Route",
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"log": {
|
"log": {
|
||||||
"model":"RouteLog"
|
"model":"RouteLog",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale canEdit()', () => {
|
describe('sale canEdit()', () => {
|
||||||
const employeeId = 1;
|
const employeeId = 1;
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('sale editTracked', () => {
|
describe('sale editTracked', () => {
|
||||||
it('should return true if the role is production regardless of the saleTrackings', async() => {
|
it('should return true if the role is production regardless of the saleTrackings', async() => {
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale deleteSales()', () => {
|
describe('sale deleteSales()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should throw an error if the ticket of the given sales is not editable', async() => {
|
it('should throw an error if the ticket of the given sales is not editable', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale reserve()', () => {
|
describe('sale reserve()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
|
@ -9,6 +10,20 @@ describe('sale reserve()', () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should throw an error if the ticket can not be modified', async() => {
|
it('should throw an error if the ticket can not be modified', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale updateConcept()', () => {
|
describe('sale updateConcept()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: 9}}};
|
const ctx = {req: {accessToken: {userId: 9}}};
|
||||||
const saleId = 25;
|
const saleId = 25;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale updatePrice()', () => {
|
describe('sale updatePrice()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 18},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const ctx = {
|
const ctx = {
|
||||||
req: {
|
req: {
|
||||||
accessToken: {userId: 18},
|
accessToken: {userId: 18},
|
||||||
|
|
|
@ -1,6 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale updateQuantity()', () => {
|
describe('sale updateQuantity()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const ctx = {
|
const ctx = {
|
||||||
req: {
|
req: {
|
||||||
accessToken: {userId: 9},
|
accessToken: {userId: 9},
|
||||||
|
|
|
@ -127,19 +127,6 @@ module.exports = Self => {
|
||||||
], myOptions);
|
], myOptions);
|
||||||
|
|
||||||
const ticket = await models.Ticket.findById(result[1][0].newTicketId, null, myOptions);
|
const ticket = await models.Ticket.findById(result[1][0].newTicketId, null, myOptions);
|
||||||
const cleanInstance = JSON.parse(JSON.stringify(ticket));
|
|
||||||
|
|
||||||
const logRecord = {
|
|
||||||
originFk: cleanInstance.id,
|
|
||||||
userFk: myUserId,
|
|
||||||
action: 'insert',
|
|
||||||
changedModel: 'Ticket',
|
|
||||||
changedModelId: cleanInstance.id,
|
|
||||||
oldInstance: {},
|
|
||||||
newInstance: cleanInstance
|
|
||||||
};
|
|
||||||
|
|
||||||
await models.TicketLog.create(logRecord, myOptions);
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('ticket addSale()', () => {
|
describe('ticket addSale()', () => {
|
||||||
const ticketId = 13;
|
const ticketId = 13;
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should create a new sale for the ticket with id 13', async() => {
|
it('should create a new sale for the ticket with id 13', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
|
@ -10,11 +10,15 @@ describe('ticket merge()', () => {
|
||||||
workerFk: 1
|
workerFk: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const activeCtx = {
|
beforeAll(async() => {
|
||||||
accessToken: {userId: 9},
|
const activeCtx = {
|
||||||
};
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
beforeEach(() => {
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
@ -35,16 +39,16 @@ describe('ticket merge()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const chatNotificationBeforeMerge = await models.Chat.find();
|
const chatNotificationBeforeMerge = await models.Chat.find(null, options);
|
||||||
|
|
||||||
await models.Ticket.merge(ctx, [tickets], options);
|
await models.Ticket.merge(ctx, [tickets], options);
|
||||||
|
|
||||||
const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets.originId}}, options);
|
const createdTicketLog = await models.TicketLog.find({where: {originFk: tickets.destinationId}}, options);
|
||||||
const deletedTicket = await models.Ticket.findOne({where: {id: tickets.originId}}, options);
|
const deletedTicket = await models.Ticket.findOne({where: {id: tickets.originId}}, options);
|
||||||
const salesTicketFuture = await models.Sale.find({where: {ticketFk: tickets.destinationId}}, options);
|
const salesTicketFuture = await models.Sale.find({where: {ticketFk: tickets.destinationId}}, options);
|
||||||
const chatNotificationAfterMerge = await models.Chat.find();
|
const chatNotificationAfterMerge = await models.Chat.find(null, options);
|
||||||
|
|
||||||
expect(createdTicketLog.length).toEqual(2);
|
expect(createdTicketLog.length).toEqual(1);
|
||||||
expect(deletedTicket.isDeleted).toEqual(true);
|
expect(deletedTicket.isDeleted).toEqual(true);
|
||||||
expect(salesTicketFuture.length).toEqual(2);
|
expect(salesTicketFuture.length).toEqual(2);
|
||||||
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2);
|
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2);
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('sale updateDiscount()', () => {
|
describe('sale updateDiscount()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
const originalSaleId = 8;
|
const originalSaleId = 8;
|
||||||
|
|
||||||
it('should throw an error if no sales were selected', async() => {
|
it('should throw an error if no sales were selected', async() => {
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"log": {
|
"log": {
|
||||||
"model": "TicketLog",
|
"model": "TicketLog",
|
||||||
"relation": "ticket",
|
"relation": "ticket",
|
||||||
"showField": "concept"
|
"showField": "concept",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"log": {
|
"log": {
|
||||||
"model":"TicketLog",
|
"model":"TicketLog",
|
||||||
"showField": "id"
|
"showField": "id",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"base": "Loggable",
|
"base": "Loggable",
|
||||||
"log": {
|
"log": {
|
||||||
"model":"TravelLog",
|
"model":"TravelLog",
|
||||||
"showField": "ref"
|
"showField": "ref",
|
||||||
|
"grabUser": true
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<div class="size50">
|
<div class="size50">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="header">{{$t('deliveryAddress')}}</div>
|
<div class="header">{{$t('deliveryAddress')}}</div>
|
||||||
<div class="body">
|
<div class="body" v-if="address">
|
||||||
<h3 class="uppercase">{{address.nickname}}</h3>
|
<h3 class="uppercase">{{address.nickname}}</h3>
|
||||||
<div>{{address.street}}</div>
|
<div>{{address.street}}</div>
|
||||||
<div>{{address.postalCode}}, {{address.city}} ({{address.province}})</div>
|
<div>{{address.postalCode}}, {{address.city}} ({{address.province}})</div>
|
||||||
|
@ -245,13 +245,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<report-footer
|
<report-footer id="pageFooter" v-bind:company-code="ticket.companyCode" v-bind:left-text="footerType"
|
||||||
id="pageFooter"
|
v-bind:center-text="client.socialName" v-bind="$props">
|
||||||
v-bind:company-code="ticket.companyCode"
|
|
||||||
v-bind:left-text="footerType"
|
|
||||||
v-bind:center-text="client.socialName"
|
|
||||||
v-bind="$props"
|
|
||||||
>
|
|
||||||
</report-footer>
|
</report-footer>
|
||||||
</template>
|
</template>
|
||||||
</report-body>
|
</report-body>
|
Loading…
Reference in New Issue