diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js index 5b08cf34a..7b3772c9e 100644 --- a/modules/route/back/methods/route/getExternalCmrs.js +++ b/modules/route/back/methods/route/getExternalCmrs.js @@ -95,7 +95,7 @@ module.exports = Self => { t.id ticketFk, co.country, t.clientFk, - sub.id hasCmrDms, + IF(sub.id, TRUE, FALSE) hasCmrDms, DATE(t.shipped) shipped FROM ticket t JOIN ticketState ts ON ts.ticketFk = t.id diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index f359d0580..96042c9a0 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -142,12 +142,12 @@ module.exports = Self => { const changes = ctx.data || ctx.instance; const orgData = ctx.currentInstance; - const socialName = changes.name || orgData.name; + const name = changes.name || orgData.name; const hasChanges = orgData && changes; - const socialNameChanged = hasChanges - && orgData.socialName != socialName; + const nameChanged = hasChanges + && orgData.name != name; - if ((socialNameChanged) && !isAlpha(socialName)) + if ((nameChanged) && !isAlpha(name)) throw new UserError('The social name has an invalid format'); }); }; diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index a8191610a..12f240ae2 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -67,8 +67,12 @@ module.exports = Self => { const sales = await models.Sale.find(salesFilter, myOptions); const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; + let [firstTicketId] = ticketsIds; + if (!firstTicketId) { + [ticketServices] = await models.TicketService.find({where: {id: {inq: servicesIds}}}, myOptions); + firstTicketId = ticketServices.ticketFk; + } const now = Date.vnNew(); - const [firstTicketId] = ticketsIds; const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions);