fix: refs #235425 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-10-25 07:22:36 +02:00
parent 4da11c65bb
commit 111480f7b7
2 changed files with 18 additions and 14 deletions

View File

@ -91,20 +91,21 @@ module.exports = Self => {
value: componentValue
}, 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);
const [priceFixed] = await Self.rawSql(`
SELECT SUM(value) 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 = ?
`, [id], myOptions);
await sale.updateAttributes({
price: newPrice,
priceFixed: priceFixed.value
}, myOptions);
await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions);
await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions);

View File

@ -28,6 +28,9 @@
"discount": {
"type": "number"
},
"priceFixed": {
"type": "number"
},
"reserved": {
"type": "boolean"
},