Merge branch 'dev' into 6685-fixRestoreViewCredit
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
68034fc404
|
@ -17,7 +17,8 @@ const opts = getopts(process.argv.slice(2), {
|
||||||
|
|
||||||
let server;
|
let server;
|
||||||
const PARALLEL = false;
|
const PARALLEL = false;
|
||||||
const TIMEOUT = 900000;
|
const SETUP_TIMEOUT = 15 * 60 * 1000;
|
||||||
|
const SPEC_TIMEOUT = 30 * 1000;
|
||||||
|
|
||||||
process.on('exit', teardown);
|
process.on('exit', teardown);
|
||||||
process.on('uncaughtException', onError);
|
process.on('uncaughtException', onError);
|
||||||
|
@ -74,9 +75,9 @@ async function test() {
|
||||||
let runner;
|
let runner;
|
||||||
const config = {
|
const config = {
|
||||||
globalSetup: setup,
|
globalSetup: setup,
|
||||||
globalSetupTimeout: TIMEOUT,
|
globalSetupTimeout: SETUP_TIMEOUT,
|
||||||
globalTeardown: teardown,
|
globalTeardown: teardown,
|
||||||
globalTeardownTimeout: TIMEOUT,
|
globalTeardownTimeout: SETUP_TIMEOUT,
|
||||||
spec_dir: '.',
|
spec_dir: '.',
|
||||||
spec_files: [
|
spec_files: [
|
||||||
'back/**/*[sS]pec.js',
|
'back/**/*[sS]pec.js',
|
||||||
|
@ -111,7 +112,7 @@ async function test() {
|
||||||
runner.addReporter(new JunitReporter.JUnitXmlReporter());
|
runner.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||||
}
|
}
|
||||||
if (opts.ci)
|
if (opts.ci)
|
||||||
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT;
|
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
|
||||||
|
|
||||||
// runner.loadConfigFile('back/jasmine.json');
|
// runner.loadConfigFile('back/jasmine.json');
|
||||||
runner.loadConfig(config);
|
runner.loadConfig(config);
|
||||||
|
|
|
@ -342,5 +342,6 @@
|
||||||
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||||
"An email is necessary": "Es necesario un email",
|
"An email is necessary": "Es necesario un email",
|
||||||
"You cannot update these fields": "No puedes actualizar estos campos",
|
"You cannot update these fields": "No puedes actualizar estos campos",
|
||||||
"CountryFK cannot be empty": "El país no puede estar vacío"
|
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||||
|
"Cmr file does not exist": "El archivo del cmr no existe"
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
const {ParameterizedSQL} = require('loopback-connector');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('getTickets', {
|
Self.remoteMethod('getTickets', {
|
||||||
|
@ -83,13 +83,15 @@ module.exports = Self => {
|
||||||
|
|
||||||
const where = filter.where;
|
const where = filter.where;
|
||||||
where['r.id'] = filter.id;
|
where['r.id'] = filter.id;
|
||||||
|
where.and = [{or: [
|
||||||
|
{'t.packages': {gt: 0}},
|
||||||
|
{and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]}
|
||||||
|
]}];
|
||||||
|
|
||||||
stmt.merge(conn.makeWhere(filter.where));
|
stmt.merge(conn.makeWhere(filter.where));
|
||||||
stmt.merge(conn.makeGroupBy('t.id'));
|
stmt.merge(conn.makeGroupBy('t.id'));
|
||||||
stmt.merge(conn.makeOrderBy(filter.order));
|
stmt.merge(conn.makeOrderBy(filter.order));
|
||||||
|
|
||||||
const tickets = await conn.executeStmt(stmt, myOptions);
|
return conn.executeStmt(stmt, myOptions);
|
||||||
|
|
||||||
return tickets;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,8 +34,7 @@ module.exports = Self => {
|
||||||
const myOptions = {userId: ctx.req.accessToken.userId};
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
let tx;
|
let tx;
|
||||||
let ticket;
|
let ticket;
|
||||||
let dms;
|
let externalTickets = [];
|
||||||
let gestDocCreated;
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -86,12 +85,11 @@ module.exports = Self => {
|
||||||
contentType: 'image/png',
|
contentType: 'image/png',
|
||||||
hasFile: true
|
hasFile: true
|
||||||
};
|
};
|
||||||
dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
|
const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions);
|
||||||
gestDocCreated = true;
|
await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let externalTickets = [];
|
|
||||||
for (const ticketId of tickets) {
|
for (const ticketId of tickets) {
|
||||||
ticket = await models.Ticket.findById(ticketId, {
|
ticket = await models.Ticket.findById(ticketId, {
|
||||||
include: [{
|
include: [{
|
||||||
|
@ -137,9 +135,8 @@ module.exports = Self => {
|
||||||
throw new UserError('Ticket is already signed');
|
throw new UserError('Ticket is already signed');
|
||||||
|
|
||||||
if (location) await setLocation(ticketId);
|
if (location) await setLocation(ticketId);
|
||||||
if (!await hasSignDms(ticketId) && !gestDocCreated)
|
if (!await hasSignDms(ticketId))
|
||||||
await createGestDoc(ticketId);
|
await createGestDoc(ticketId);
|
||||||
await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions);
|
|
||||||
await ticket.updateAttribute('isSigned', true, myOptions);
|
await ticket.updateAttribute('isSigned', true, myOptions);
|
||||||
|
|
||||||
const deliveryState = await models.State.findOne({
|
const deliveryState = await models.State.findOne({
|
||||||
|
@ -157,11 +154,10 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
await models.Route.cmrEmail(ctx, externalTickets);
|
|
||||||
return;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
await models.Route.cmrEmail(ctx, externalTickets);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue