refs #6312 no inserta el originalquantity
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2023-10-18 13:46:41 +02:00
parent 85baac5c8e
commit 44ce0a8730
1 changed files with 5 additions and 4 deletions

View File

@ -138,14 +138,15 @@ module.exports = Self => {
// Update original sale
const rest = originalSale.quantity - sale.quantity;
query = `UPDATE sale
SET quantity = ?
SET quantity = ?,
originalQuantity = ?
WHERE id = ?`;
await Self.rawSql(query, [rest, sale.id], options);
await Self.rawSql(query, [rest, rest, sale.id], options);
// Clone sale with new quantity
query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed,
query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, discount, priceFixed,
reserved, isPicked, isPriceFixed, isAdded)
SELECT itemFk, ?, concept, ?, originalQuantity, price, discount, priceFixed,
SELECT itemFk, ?, concept, ?, price, discount, priceFixed,
reserved, isPicked, isPriceFixed, isAdded
FROM sale
WHERE id = ?`;