Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6276-createNewWarehouse
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
88dfdb157f
|
@ -101,6 +101,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Database') {
|
stage('Database') {
|
||||||
when { anyOf {
|
when { anyOf {
|
||||||
|
branch 'dev'
|
||||||
branch 'test'
|
branch 'test'
|
||||||
branch 'master'
|
branch 'master'
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
/* eslint-disable no-console */
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Myt = require('@verdnatura/myt/myt');
|
const Myt = require('@verdnatura/myt/myt');
|
||||||
const Run = require('@verdnatura/myt/myt-run');
|
const Run = require('@verdnatura/myt/myt-run');
|
||||||
let dataSources = require('../loopback/server/datasources.json');
|
let dataSources = require('../loopback/server/datasources.json');
|
||||||
|
|
||||||
let myt;
|
let server;
|
||||||
|
|
||||||
process.on('warning', warning => {
|
process.on('warning', warning => {
|
||||||
console.log(warning.name);
|
console.log(warning.name);
|
||||||
|
@ -11,25 +12,33 @@ process.on('warning', warning => {
|
||||||
console.log(warning.stack);
|
console.log(warning.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('SIGUSR2', async() => {
|
process.on('SIGUSR2', rmServer);
|
||||||
if (myt) await myt.deinit();
|
process.on('exit', rmServer);
|
||||||
});
|
|
||||||
|
|
||||||
process.on('exit', async function() {
|
async function rmServer() {
|
||||||
if (myt) await myt.deinit();
|
if (!server) return;
|
||||||
});
|
await server.rm();
|
||||||
|
server = null;
|
||||||
|
}
|
||||||
|
|
||||||
async function test() {
|
async function test() {
|
||||||
|
console.log('Building and running DB container.');
|
||||||
|
|
||||||
const isCI = process.argv[2] === 'ci';
|
const isCI = process.argv[2] === 'ci';
|
||||||
|
|
||||||
myt = new Myt();
|
const myt = new Myt();
|
||||||
await myt.init({
|
await myt.init({
|
||||||
workspace: path.join(__dirname, '..'),
|
workspace: path.join(__dirname, '..'),
|
||||||
random: true,
|
random: true,
|
||||||
ci: isCI,
|
ci: isCI,
|
||||||
|
tmpfs: process.platform == 'linux',
|
||||||
network: isCI ? 'jenkins' : null
|
network: isCI ? 'jenkins' : null
|
||||||
});
|
});
|
||||||
const {dbConfig} = await myt.run(Run);
|
server = await myt.run(Run);
|
||||||
|
await myt.deinit();
|
||||||
|
const {dbConfig} = server;
|
||||||
|
|
||||||
|
console.log('Initializing backend.');
|
||||||
|
|
||||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||||
Object.assign(dataSources.vn, {
|
Object.assign(dataSources.vn, {
|
||||||
|
@ -46,6 +55,8 @@ async function test() {
|
||||||
// FIXME: Workaround to wait for loopback to be ready
|
// FIXME: Workaround to wait for loopback to be ready
|
||||||
await app.models.Application.status();
|
await app.models.Application.status();
|
||||||
|
|
||||||
|
console.log('Running tests.');
|
||||||
|
|
||||||
const Jasmine = require('jasmine');
|
const Jasmine = require('jasmine');
|
||||||
const jasmine = new Jasmine();
|
const jasmine = new Jasmine();
|
||||||
|
|
||||||
|
@ -81,9 +92,13 @@ async function test() {
|
||||||
});
|
});
|
||||||
|
|
||||||
await jasmine.execute();
|
await jasmine.execute();
|
||||||
|
|
||||||
|
console.log('Stopping.');
|
||||||
|
|
||||||
if (app) await app.disconnect();
|
if (app) await app.disconnect();
|
||||||
if (myt) await myt.deinit();
|
await rmServer();
|
||||||
console.log('App disconnected & container removed');
|
|
||||||
|
console.log('Tests ended.\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
test();
|
test();
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
*/
|
*/
|
||||||
SET foreign_key_checks = 0;
|
SET foreign_key_checks = 0;
|
||||||
|
|
||||||
-- CREATE ROLE 'salix';
|
DROP ROLE 'salix';
|
||||||
-- GRANT 'salix' TO 'root'@'%';
|
CREATE ROLE 'salix';
|
||||||
-- SET DEFAULT ROLE 'salix' FOR 'root'@'%';
|
GRANT 'salix' TO 'root'@'%';
|
||||||
|
SET DEFAULT ROLE 'salix' FOR 'root'@'%';
|
||||||
|
|
||||||
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
||||||
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE `vn`.`operator` MODIFY COLUMN linesLimit int(11) DEFAULT 20 NULL COMMENT 'Límite de lineas en una colección para la asignación de pedidos';
|
||||||
|
ALTER TABLE `vn`.`operator` MODIFY COLUMN volumeLimit decimal(10,6) DEFAULT 0.5 NULL COMMENT 'Límite de volumen en una colección para la asignación de pedidos';
|
||||||
|
ALTER TABLE `vn`.`operator` MODIFY COLUMN numberOfWagons int(11) DEFAULT 2 NULL;
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES
|
||||||
|
('Ticket', 'makePdfList', '*', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Ticket', 'invoiceTicketsAndPdf', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE account.roleLog DROP FOREIGN KEY roleLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE account.userLog DROP FOREIGN KEY userLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.entryLog DROP FOREIGN KEY entryLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.clientLog DROP FOREIGN KEY clientLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.itemLog DROP FOREIGN KEY itemLogItemFk;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.shelvingLog DROP FOREIGN KEY shelvingLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.workerLog DROP FOREIGN KEY workerFk;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.deviceProductionLog DROP FOREIGN KEY deviceProductionOriginFk;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.zoneLog DROP FOREIGN KEY zoneLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.rateLog DROP FOREIGN KEY rateOriginFk;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.ticketLog DROP FOREIGN KEY ticketLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.userLog DROP FOREIGN KEY userLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.routeLog DROP FOREIGN KEY routeLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.claimLog DROP FOREIGN KEY claimOriginFk;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.supplierLog DROP FOREIGN KEY supplierLog_supplierFk;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.invoiceInLog DROP FOREIGN KEY invoiceInLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.travelLog DROP FOREIGN KEY travelLog_ibfk_1;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.packingSiteDeviceLog DROP FOREIGN KEY packingSiteDeviceLog_ibfk_1;
|
|
@ -27,6 +27,6 @@ describe('Ticket expeditions and log path', () => {
|
||||||
const result = await page
|
const result = await page
|
||||||
.countElement(selectors.ticketExpedition.expeditionRow);
|
.countElement(selectors.ticketExpedition.expeditionRow);
|
||||||
|
|
||||||
expect(result).toEqual(4);
|
expect(result).toEqual(6);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,10 +41,10 @@ describe('Supplier basic data path', () => {
|
||||||
expect(result).toEqual('Plants Nick SL');
|
expect(result).toEqual('Plants Nick SL');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the isSerious checkbox is now unchecked', async() => {
|
it('should check the isSerious checkbox is now checked', async() => {
|
||||||
const result = await page.checkboxState(selectors.supplierBasicData.isSerious);
|
const result = await page.checkboxState(selectors.supplierBasicData.isSerious);
|
||||||
|
|
||||||
expect(result).toBe('unchecked');
|
expect(result).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the isActive checkbox is now unchecked', async() => {
|
it('should check the isActive checkbox is now unchecked', async() => {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('makePdfList', {
|
||||||
|
description: 'Handle a list of invoices to generate PDF and send it to client',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'ids',
|
||||||
|
type: ['number'],
|
||||||
|
description: 'The invoice id',
|
||||||
|
required: true,
|
||||||
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'printerFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The printer to print'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/:id/makePdfList',
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.makePdfList = async function(ctx, ids, printerFk, options) {
|
||||||
|
const pdfs = ids.map(id =>
|
||||||
|
Self.makePdfAndNotify(ctx, id, printerFk, options)
|
||||||
|
);
|
||||||
|
await Promise.all(pdfs);
|
||||||
|
};
|
||||||
|
};
|
|
@ -17,6 +17,7 @@ describe('InvoiceOut transferInvoice()', () => {
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
spyOn(models.InvoiceOut, 'makePdfAndNotify');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the id of the created issued invoice', async() => {
|
it('should return the id of the created issued invoice', async() => {
|
||||||
|
|
|
@ -86,17 +86,17 @@ module.exports = Self => {
|
||||||
clonedTicketIds.push(clonedTicket.id);
|
clonedTicketIds.push(clonedTicket.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const invoiceCorrection =
|
const invoiceCorrection = {
|
||||||
{correctedFk: id, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk};
|
correctedFk: id,
|
||||||
|
cplusRectificationTypeFk,
|
||||||
|
siiTypeInvoiceOutFk,
|
||||||
|
invoiceCorrectionTypeFk
|
||||||
|
};
|
||||||
const refundTicketIds = refundTickets.map(ticket => ticket.id);
|
const refundTicketIds = refundTickets.map(ticket => ticket.id);
|
||||||
|
|
||||||
await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions);
|
await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions);
|
||||||
const [invoiceId] = await models.Ticket.invoiceTickets(ctx, clonedTicketIds, null, myOptions);
|
|
||||||
|
|
||||||
if (tx) {
|
const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions);
|
||||||
await tx.commit();
|
|
||||||
await models.InvoiceOut.makePdfAndNotify(ctx, invoiceId, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return invoiceId;
|
return invoiceId;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ module.exports = Self => {
|
||||||
require('../methods/invoiceOut/createManualInvoice')(Self);
|
require('../methods/invoiceOut/createManualInvoice')(Self);
|
||||||
require('../methods/invoiceOut/clientsToInvoice')(Self);
|
require('../methods/invoiceOut/clientsToInvoice')(Self);
|
||||||
require('../methods/invoiceOut/invoiceClient')(Self);
|
require('../methods/invoiceOut/invoiceClient')(Self);
|
||||||
|
require('../methods/invoiceOut/makePdfList')(Self);
|
||||||
require('../methods/invoiceOut/makePdfAndNotify')(Self);
|
require('../methods/invoiceOut/makePdfAndNotify')(Self);
|
||||||
require('../methods/invoiceOut/refund')(Self);
|
require('../methods/invoiceOut/refund')(Self);
|
||||||
require('../methods/invoiceOut/invoiceEmail')(Self);
|
require('../methods/invoiceOut/invoiceEmail')(Self);
|
||||||
|
|
|
@ -76,15 +76,11 @@ module.exports = function(Self) {
|
||||||
for (const ticketIds of ticketsByAddress)
|
for (const ticketIds of ticketsByAddress)
|
||||||
invoicesIds.push(await createInvoice(ctx, companyId, ticketIds, invoiceCorrection, myOptions));
|
invoicesIds.push(await createInvoice(ctx, companyId, ticketIds, invoiceCorrection, myOptions));
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
tx && await tx.commit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
if (tx) {
|
|
||||||
for (const invoiceId of invoicesIds)
|
|
||||||
await models.InvoiceOut.makePdfAndNotify(ctx, invoiceId, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return invoicesIds;
|
return invoicesIds;
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
module.exports = function(Self) {
|
||||||
|
Self.remoteMethodCtx('invoiceTicketsAndPdf', {
|
||||||
|
description: 'Make out an invoice from one or more tickets',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'ticketsIds',
|
||||||
|
description: 'The tickets id',
|
||||||
|
type: ['number'],
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'invoiceCorrection',
|
||||||
|
description: 'The invoice correction',
|
||||||
|
type: 'object',
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
type: ['object'],
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/invoiceTicketsAndPdf`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.invoiceTicketsAndPdf = async(ctx, ticketsIds, invoiceCorrection, options) => {
|
||||||
|
const invoiceIds = await Self.invoiceTickets(ctx, ticketsIds, invoiceCorrection, options);
|
||||||
|
await Self.app.models.InvoiceOut.makePdfList(ctx, invoiceIds, null, options);
|
||||||
|
return invoiceIds;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -102,7 +102,7 @@ describe('ticket invoiceTickets()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ticketsIds = [11];
|
const ticketsIds = [11];
|
||||||
const invoicesIds = await models.Ticket.invoiceTickets(ctx, ticketsIds, null, options);
|
const invoicesIds = await models.Ticket.invoiceTicketsAndPdf(ctx, ticketsIds, null, options);
|
||||||
|
|
||||||
expect(invoicesIds.length).toBeGreaterThan(0);
|
expect(invoicesIds.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
|
describe('ticket invoiceTicketsAndPdf()', () => {
|
||||||
|
const userId = 19;
|
||||||
|
const clientId = 1102;
|
||||||
|
const activeCtx = {
|
||||||
|
getLocale: () => {
|
||||||
|
return 'en';
|
||||||
|
},
|
||||||
|
accessToken: {userId: userId},
|
||||||
|
headers: {origin: 'http://localhost:5000'},
|
||||||
|
};
|
||||||
|
const ctx = {req: activeCtx};
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when invoicing tickets from multiple clients', async() => {
|
||||||
|
const invoiceOutModel = models.InvoiceOut;
|
||||||
|
spyOn(invoiceOutModel, 'makePdfAndNotify');
|
||||||
|
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const ticketsIds = [11, 16];
|
||||||
|
await models.Ticket.invoiceTicketsAndPdf(ctx, ticketsIds, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toEqual(`You can't invoice tickets from multiple clients`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should throw an error when invoicing a client without tax data checked`, async() => {
|
||||||
|
const invoiceOutModel = models.InvoiceOut;
|
||||||
|
spyOn(invoiceOutModel, 'makePdfAndNotify');
|
||||||
|
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const client = await models.Client.findById(clientId, null, options);
|
||||||
|
await client.updateAttribute('isTaxDataChecked', false, options);
|
||||||
|
|
||||||
|
const ticketsIds = [11];
|
||||||
|
await models.Ticket.invoiceTicketsAndPdf(ctx, ticketsIds, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toEqual(`This client can't be invoiced`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should invoice a ticket, then try again to fail', async() => {
|
||||||
|
const invoiceOutModel = models.InvoiceOut;
|
||||||
|
spyOn(invoiceOutModel, 'makePdfAndNotify');
|
||||||
|
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const ticketsIds = [11];
|
||||||
|
await models.Ticket.invoiceTicketsAndPdf(ctx, ticketsIds, null, options);
|
||||||
|
await models.Ticket.invoiceTicketsAndPdf(ctx, ticketsIds, null, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toEqual(`This ticket is already invoiced`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should success to invoice a ticket', async() => {
|
||||||
|
const invoiceOutModel = models.InvoiceOut;
|
||||||
|
spyOn(invoiceOutModel, 'makePdfAndNotify');
|
||||||
|
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const ticketsIds = [11];
|
||||||
|
const invoicesIds = await models.Ticket.invoiceTicketsAndPdf(ctx, ticketsIds, null, options);
|
||||||
|
|
||||||
|
expect(invoicesIds.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -42,5 +42,6 @@ module.exports = function(Self) {
|
||||||
require('../methods/ticket/expeditionPalletLabel')(Self);
|
require('../methods/ticket/expeditionPalletLabel')(Self);
|
||||||
require('../methods/ticket/saveSign')(Self);
|
require('../methods/ticket/saveSign')(Self);
|
||||||
require('../methods/ticket/invoiceTickets')(Self);
|
require('../methods/ticket/invoiceTickets')(Self);
|
||||||
|
require('../methods/ticket/invoiceTicketsAndPdf')(Self);
|
||||||
require('../methods/ticket/docuwareDownload')(Self);
|
require('../methods/ticket/docuwareDownload')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -265,7 +265,7 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]})
|
return this.$http.post(`Tickets/invoiceTicketsAndPdf`, {ticketsIds: [this.id]})
|
||||||
.then(() => this.reload())
|
.then(() => this.reload())
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
const expectedParams = {ticketsIds: [ticket.id]};
|
const expectedParams = {ticketsIds: [ticket.id]};
|
||||||
$httpBackend.expectPOST(`Tickets/invoiceTickets`, expectedParams).respond();
|
$httpBackend.expectPOST(`Tickets/invoiceTicketsAndPdf`, expectedParams).respond();
|
||||||
controller.makeInvoice();
|
controller.makeInvoice();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
makeInvoice() {
|
makeInvoice() {
|
||||||
const ticketsIds = this.checked.map(ticket => ticket.id);
|
const ticketsIds = this.checked.map(ticket => ticket.id);
|
||||||
return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds})
|
return this.$http.post(`Tickets/invoiceTicketsAndPdf`, {ticketsIds})
|
||||||
.then(() => this.$.model.refresh())
|
.then(() => this.$.model.refresh())
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
.then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||||
"@babel/preset-env": "^7.11.0",
|
"@babel/preset-env": "^7.11.0",
|
||||||
"@babel/register": "^7.7.7",
|
"@babel/register": "^7.7.7",
|
||||||
"@verdnatura/myt": "^1.6.0",
|
"@verdnatura/myt": "^1.6.3",
|
||||||
"angular-mocks": "^1.7.9",
|
"angular-mocks": "^1.7.9",
|
||||||
"babel-jest": "^26.0.1",
|
"babel-jest": "^26.0.1",
|
||||||
"babel-loader": "^8.2.4",
|
"babel-loader": "^8.2.4",
|
||||||
|
@ -3375,9 +3375,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@verdnatura/myt": {
|
"node_modules/@verdnatura/myt": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.6.3.tgz",
|
||||||
"integrity": "sha512-bQWWMTkvX4wQzojp//XmTRLFGTBuVJ+pwNZxSoIl4LjsidCq5FId48qpkFG9E/CBi3gaf7AkbYDD+A8pv1WMUQ==",
|
"integrity": "sha512-VRoTB5sEPL8a7VaX9l2afpaPNT6pBa+If1tP9tpaJ4enFQbNITlApcC0GK6XYmWMkJQjl2lgdN4/u0UCiNb2MQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sqltools/formatter": "^1.2.5",
|
"@sqltools/formatter": "^1.2.5",
|
||||||
|
@ -30604,9 +30604,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@verdnatura/myt": {
|
"@verdnatura/myt": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.6.3.tgz",
|
||||||
"integrity": "sha512-bQWWMTkvX4wQzojp//XmTRLFGTBuVJ+pwNZxSoIl4LjsidCq5FId48qpkFG9E/CBi3gaf7AkbYDD+A8pv1WMUQ==",
|
"integrity": "sha512-VRoTB5sEPL8a7VaX9l2afpaPNT6pBa+If1tP9tpaJ4enFQbNITlApcC0GK6XYmWMkJQjl2lgdN4/u0UCiNb2MQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@sqltools/formatter": "^1.2.5",
|
"@sqltools/formatter": "^1.2.5",
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||||
"@babel/preset-env": "^7.11.0",
|
"@babel/preset-env": "^7.11.0",
|
||||||
"@babel/register": "^7.7.7",
|
"@babel/register": "^7.7.7",
|
||||||
"@verdnatura/myt": "^1.6.0",
|
"@verdnatura/myt": "^1.6.3",
|
||||||
"angular-mocks": "^1.7.9",
|
"angular-mocks": "^1.7.9",
|
||||||
"babel-jest": "^26.0.1",
|
"babel-jest": "^26.0.1",
|
||||||
"babel-loader": "^8.2.4",
|
"babel-loader": "^8.2.4",
|
||||||
|
|
Loading…
Reference in New Issue