8144-devToTest_2444 #3137

Merged
alexm merged 90 commits from 8144-devToTest_2444 into test 2024-10-22 06:07:15 +00:00
1 changed files with 3 additions and 3 deletions
Showing only changes of commit 8ca097d4a9 - Show all commits

View File

@ -49,12 +49,12 @@ module.exports = Self => {
where: {originalTicketFk: id}
}, myOptions);
const isRefund = !!ticketRefunds?.length;
const hasRefund = !!ticketRefunds?.length;
const allDeleted = ticketRefunds.every(refund => refund.refundTicket().isDeleted);
if (!isRefund) await models.TicketRefund.destroyAll({refundTicketFk: id}, myOptions);
if (isRefund && !allDeleted) {
if (!hasRefund) await models.TicketRefund.destroyAll({refundTicketFk: id}, myOptions);
if (hasRefund && !allDeleted) {
const notDeleted = [];
for (const refund of ticketRefunds)
if (!refund.refundTicket().isDeleted) notDeleted.push(refund.refundTicket().id);