#6321 - Negative tickets #1945

Open
jsegarra wants to merge 93 commits from 6321_negative_tickets into dev
5 changed files with 10 additions and 18 deletions
Showing only changes of commit c876022fe5 - Show all commits

View File

@ -3969,16 +3969,6 @@ INSERT INTO vn.accountDetailType (id, description, code)
(5, 'Referencia Nominas', 'payRef'),
(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
SET id =1,
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);
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,'');

View File

@ -4,4 +4,5 @@ INSERT IGNORE INTO salix.ACL (model,property,accessType,permission,principalType
('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'),
('Ticket','itemLackOrigin','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');

View File

@ -378,5 +378,6 @@
"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",
"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"
}

View File

@ -1,4 +1,3 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('replaceItem', {
@ -10,7 +9,7 @@ module.exports = Self => {
required: true,
},
{
arg: 'newItemFk',
arg: 'substitutionFk',
type: 'number',
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};
let tx;
const {_saleFk, _substitutionFk, _quantity} = ctx.args;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -43,7 +43,7 @@ module.exports = Self => {
}
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;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -13,7 +13,7 @@ module.exports = Self => {
require('../methods/sale/usesMana')(Self);
require('../methods/sale/clone')(Self);
require('../methods/sale/getFromSectorCollection')(Self);
require('../methods/sale/replaceItem')(Self);
// require('../methods/sale/replaceItem')(Self);
Self.validatesPresenceOf('concept', {
message: `Concept cannot be blank`