Bug #398 El SPLUR crea los nuevos tickets sin Alias(nickname)

This commit is contained in:
gerard 2018-07-11 13:52:04 +02:00
parent c2c4aa23cf
commit 67030370a1
4 changed files with 11 additions and 11 deletions

View File

@ -172,7 +172,7 @@ class Controller {
let sales = this.getCheckedLines();
this.$http.post(`/api/Sales/MoveToNewTicket`, {ticket: ticket, sales: sales}).then(res => {
let url = this.$state.href("ticket.card.sale", {id: res.data.id}, {absolute: true});
let url = this.$state.href("ticket.card.sale", {id: res.data}, {absolute: true});
window.open(url, '_blank');
this.$.transfer.hide();
this.getSales();

View File

@ -47,10 +47,10 @@ module.exports = Self => {
landed: landed
};
let newTicket = await model.Ticket.create(newTicketParams);
let newTicket = await model.Ticket.new(newTicketParams);
for (let i = 0; i < params.sales.length; i++) {
await model.Sale.update({id: params.sales[i].id}, {ticketFk: newTicket.id});
await model.Sale.update({id: params.sales[i].id}, {ticketFk: newTicket});
}
return newTicket;
};

View File

@ -1,5 +1,5 @@
module.exports = Self => {
Self.remoteMethod('create', {
Self.remoteMethod('new', {
description: 'Create a newticket and returns the new ID',
accessType: 'WRITE',
accepts: [{
@ -14,12 +14,12 @@ module.exports = Self => {
root: true
},
http: {
path: `/create`,
path: `/new`,
verb: 'post'
}
});
Self.create = async params => {
Self.new = async params => {
let existsAddress = await Self.app.models.Address.findOne({where: {id: params.addressFk, clientFk: params.clientFk}});
if (!existsAddress)
throw new Error(`This address doesn't exist`);
@ -28,13 +28,13 @@ module.exports = Self => {
let result = await Self.rawSql(query, [
params.clientFk,
params.shipped,
params.wharehouseFk,
params.companyFk,
params.warehouseFk,
params.companyFk | 442,
params.addressFk,
params.agencyModeFk,
params.routeFk,
params.routeFk | null,
params.landed
]);
return result;
return result[0][0].vNewTicket;
};
};

View File

@ -7,7 +7,7 @@ module.exports = Self => {
require('../methods/ticket/getTotal')(Self);
require('../methods/ticket/getTaxes')(Self);
require('../methods/ticket/componentUpdate')(Self);
require('../methods/ticket/create')(Self);
require('../methods/ticket/new')(Self);
require('../methods/ticket/isEditable')(Self);
require('../methods/ticket/threeLastActive')(Self);
require('../methods/ticket/deleted')(Self);