#6321 - Negative tickets #1945
|
@ -3969,16 +3969,6 @@ INSERT INTO vn.accountDetailType (id, description, code)
|
||||||
(5, 'Referencia Nominas', 'payRef'),
|
(5, 'Referencia Nominas', 'payRef'),
|
||||||
(6, 'ABA', 'aba');
|
(6, 'ABA', 'aba');
|
||||||
|
|
||||||
INSERT INTO vn.accountDetailType
|
|
||||||
(id, description, code)
|
|
||||||
VALUES
|
|
||||||
(1, 'IBAN', 'iban'),
|
|
||||||
(2, 'SWIFT', 'swift'),
|
|
||||||
(3, 'Referencia Remesas', 'remRef'),
|
|
||||||
(4, 'Referencia Transferencias', 'trnRef'),
|
|
||||||
(5, 'Referencia Nominas', 'payRef'),
|
|
||||||
(6, 'ABA', 'aba');
|
|
||||||
|
|
||||||
INSERT IGNORE INTO ormConfig
|
INSERT IGNORE INTO ormConfig
|
||||||
SET id =1,
|
SET id =1,
|
||||||
selectLimit = 1000;
|
selectLimit = 1000;
|
||||||
|
@ -3990,4 +3980,4 @@ INSERT INTO `vn`.`ticket` (id, clientFk,warehouseFk,shipped,nickname,refFk,addre
|
||||||
(1000000, 1,1,'2001-01-01 00:00:00.000','employee',NULL,131,NULL,NULL,0,0,0,0,NULL,0,'2024-07-19 23:32:48.000',1,NULL,NULL,NULL,1,442,1,'2001-01-01',0,0,1,1.00,0.00,0.00,NULL,NULL,NULL,NULL,9,'',NULL);
|
(1000000, 1,1,'2001-01-01 00:00:00.000','employee',NULL,131,NULL,NULL,0,0,0,0,NULL,0,'2024-07-19 23:32:48.000',1,NULL,NULL,NULL,1,442,1,'2001-01-01',0,0,1,1.00,0.00,0.00,NULL,NULL,NULL,NULL,9,'',NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`sale` (id, itemFk,ticketFk,concept,quantity,originalQuantity,price,discount,priceFixed,reserved,isPicked,isPriceFixed,created,isAdded,total,editorFk,problem) VALUES
|
INSERT INTO `vn`.`sale` (id, itemFk,ticketFk,concept,quantity,originalQuantity,price,discount,priceFixed,reserved,isPicked,isPriceFixed,created,isAdded,total,editorFk,problem) VALUES
|
||||||
(43, 88,1000000,'Chest medical box 2',155.00,155.0,0.00,0,0.00,0,0,0,'2024-07-19 23:33:08.000',0,0.00,100,'');
|
(43, 88,1000000,'Chest medical box 2',155.00,155.0,10.00,0,0.00,0,0,0,'2024-07-19 23:33:08.000',0,1550.00,100,'');
|
||||||
|
|
|
@ -4,4 +4,5 @@ INSERT IGNORE INTO salix.ACL (model,property,accessType,permission,principalType
|
||||||
('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'),
|
('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'),
|
||||||
('Ticket','itemLackOrigin','WRITE','ALLOW','ROLE','employee'),
|
('Ticket','itemLackOrigin','WRITE','ALLOW','ROLE','employee'),
|
||||||
('Ticket','split','WRITE','ALLOW','ROLE','employee'),
|
('Ticket','split','WRITE','ALLOW','ROLE','employee'),
|
||||||
('Ticket','negativeOrigin','READ','ALLOW','ROLE','employee');
|
('Ticket','negativeOrigin','READ','ALLOW','ROLE','employee'),
|
||||||
|
('Sale','replaceItem','READ','ALLOW','ROLE','employee');
|
||||||
|
|
|
@ -378,5 +378,6 @@
|
||||||
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
|
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
|
||||||
"The entry does not have stickers": "La entrada no tiene etiquetas",
|
"The entry does not have stickers": "La entrada no tiene etiquetas",
|
||||||
"Too many records": "Demasiados registros",
|
"Too many records": "Demasiados registros",
|
||||||
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha"
|
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
|
||||||
|
"price retrieval failed": "price retrieval failed"
|
||||||
}
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('replaceItem', {
|
Self.remoteMethodCtx('replaceItem', {
|
||||||
|
@ -10,7 +9,7 @@ module.exports = Self => {
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'newItemFk',
|
arg: 'substitutionFk',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
@ -30,9 +29,10 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.replaceItem = async(ctx, saleFk, itemFk, quantity, options) => {
|
Self.replaceItem = async(ctx, saleFk, substitutionFk, quantity, options) => {
|
||||||
const myOptions = {userId: ctx.req.accessToken.userId};
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
let tx;
|
let tx;
|
||||||
|
const {_saleFk, _substitutionFk, _quantity} = ctx.args;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await Self.rawSql('CALL sale_replaceItem(?,?,?)', [saleFk, itemFk, quantity], myOptions);
|
const result = await Self.rawSql('CALL sale_replaceItem(?,?,?)', [saleFk, substitutionFk, quantity], myOptions);
|
||||||
return result;
|
return result;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
|
|
@ -13,7 +13,7 @@ module.exports = Self => {
|
||||||
require('../methods/sale/usesMana')(Self);
|
require('../methods/sale/usesMana')(Self);
|
||||||
require('../methods/sale/clone')(Self);
|
require('../methods/sale/clone')(Self);
|
||||||
require('../methods/sale/getFromSectorCollection')(Self);
|
require('../methods/sale/getFromSectorCollection')(Self);
|
||||||
require('../methods/sale/replaceItem')(Self);
|
// require('../methods/sale/replaceItem')(Self);
|
||||||
|
|
||||||
Self.validatesPresenceOf('concept', {
|
Self.validatesPresenceOf('concept', {
|
||||||
message: `Concept cannot be blank`
|
message: `Concept cannot be blank`
|
||||||
|
|
Loading…
Reference in New Issue