refs #6127 hotFix(ticketRefund): get ticketFk front ticketService
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-17 08:42:04 +02:00
parent 868fbbfc2e
commit 518d5111e4
1 changed files with 5 additions and 1 deletions

View File

@ -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);