Merge pull request 'refs #6127 hotFix(ticketRefund): get ticketFk front ticketService' (!1707) from 6127_hotFix_ticketRefund into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1707 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
5d6de93d1b
|
@ -67,8 +67,12 @@ module.exports = Self => {
|
||||||
const sales = await models.Sale.find(salesFilter, myOptions);
|
const sales = await models.Sale.find(salesFilter, myOptions);
|
||||||
const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))];
|
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 now = Date.vnNew();
|
||||||
const [firstTicketId] = ticketsIds;
|
|
||||||
|
|
||||||
const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions);
|
const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue