fix: refs #235425 sale priceFixed update
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-10-24 12:26:03 +02:00
parent 70b1628649
commit 4da11c65bb
1 changed files with 13 additions and 0 deletions

View File

@ -92,6 +92,19 @@ module.exports = Self => {
}, myOptions);
}
await sale.updateAttributes({price: newPrice}, myOptions);
await Self.rawSql(`
UPDATE sale
SET priceFixed = (
SELECT SUM(value)
FROM sale s
JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk
WHERE ct.isBase
AND s.id = ?
)
WHERE id = ?
`, [id, id], myOptions);
await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions);
await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions);