Merge pull request 'refs #5193 ticketCreateWithUser to ticket_add' (!1358) from 5193-ticketCreateWithUser__ into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1358
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2023-03-02 06:25:02 +00:00
commit bc30fffc2d
3 changed files with 21 additions and 14 deletions

View File

@ -22,7 +22,7 @@ describe('ticket ticketCalculateClon()', () => {
originalTicketId: 11
};
stmt = new ParameterizedSQL('CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [
stmt = new ParameterizedSQL('CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [
params.clientFk,
params.shipped,
params.warehouseFk,
@ -31,7 +31,8 @@ describe('ticket ticketCalculateClon()', () => {
params.agencyType,
params.routeFk,
params.landed,
params.userId
params.userId,
true
]);
stmts.push(stmt);
@ -71,7 +72,7 @@ describe('ticket ticketCalculateClon()', () => {
originalTicketId: 11
};
stmt = new ParameterizedSQL('CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [
stmt = new ParameterizedSQL('CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @result)', [
params.clientFk,
params.shipped,
params.warehouseFk,
@ -80,7 +81,8 @@ describe('ticket ticketCalculateClon()', () => {
params.agencyType,
params.routeFk,
params.landed,
params.userId
params.userId,
true
]);
stmts.push(stmt);

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
describe('ticket ticketCreateWithUser()', () => {
describe('ticket ticket_add()', () => {
const today = Date.vnNew();
it('should confirm the procedure creates the expected ticket', async() => {
let stmts = [];
@ -21,7 +21,7 @@ describe('ticket ticketCreateWithUser()', () => {
userId: 18
};
stmt = new ParameterizedSQL(`CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [
stmt = new ParameterizedSQL(`CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [
params.clientFk,
params.shipped,
params.warehouseFk,
@ -30,7 +30,8 @@ describe('ticket ticketCreateWithUser()', () => {
params.agencyModeFk,
params.routeFk,
params.landed,
params.userId
params.userId,
true
]);
stmts.push(stmt);
@ -70,7 +71,7 @@ describe('ticket ticketCreateWithUser()', () => {
userId: 18
};
stmt = new ParameterizedSQL('CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)', [
stmt = new ParameterizedSQL('CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)', [
params.clientFk,
params.shipped,
params.warehouseFk,
@ -79,7 +80,8 @@ describe('ticket ticketCreateWithUser()', () => {
params.agencyModeFk,
params.routeFk,
params.landed,
params.userId
params.userId,
true
]);
stmts.push(stmt);
@ -120,7 +122,7 @@ describe('ticket ticketCreateWithUser()', () => {
userId: 18
};
stmt = new ParameterizedSQL(`CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [
stmt = new ParameterizedSQL(`CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [
params.clientFk,
params.shipped,
params.warehouseFk,
@ -129,7 +131,8 @@ describe('ticket ticketCreateWithUser()', () => {
params.agencyModeFk,
params.routeFk,
params.landed,
params.userId
params.userId,
true
]);
stmts.push(stmt);
@ -172,7 +175,7 @@ describe('ticket ticketCreateWithUser()', () => {
]);
stmts.push(stmt);
stmt = new ParameterizedSQL(`CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [
stmt = new ParameterizedSQL(`CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @newTicketId)`, [
params.clientFk,
params.shipped,
params.warehouseFk,
@ -181,7 +184,8 @@ describe('ticket ticketCreateWithUser()', () => {
params.agencyModeFk,
params.routeFk,
params.landed,
params.userId
params.userId,
true
]);
stmts.push(stmt);
stmts.push(`select @newTicketId`);

View File

@ -111,7 +111,7 @@ module.exports = Self => {
args.landed = landedResult && landedResult.landed;
}
query = `CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result);
query = `CALL vn.ticket_add(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, @result);
SELECT @result newTicketId;`;
const result = await Self.rawSql(query, [
args.clientId,
@ -122,6 +122,7 @@ module.exports = Self => {
args.agencyModeId || null,
args.routeId || null,
args.landed,
true,
myUserId
], myOptions);