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

View File

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

View File

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