Actualizar server.js
This commit is contained in:
@@ -2073,8 +2073,9 @@ app.put("/financials/:id", authMiddleware, async (req, res) => {
|
||||
const { amount, payment_method } = req.body;
|
||||
const parsedAmount = parseFloat(amount) || 0;
|
||||
|
||||
// Si el importe es mayor que 0, se marca como pagado automáticamente
|
||||
const isPaid = parsedAmount > 0;
|
||||
// NUEVA REGLA: Si el método de pago es "Pendiente", NO está pagado,
|
||||
// independientemente del importe que tenga apuntado (Ej: Presupuestos).
|
||||
const isPaid = payment_method !== 'Pendiente';
|
||||
|
||||
await pool.query(`
|
||||
UPDATE service_financials
|
||||
|
||||
Reference in New Issue
Block a user