up
This commit is contained in:
@@ -16,6 +16,7 @@ requireTurnero();
|
||||
$datos = inputJson();
|
||||
$area = $datos['area'] ?? '';
|
||||
$lugarId = isset($datos['lugar_id']) ? (int) $datos['lugar_id'] : null;
|
||||
$deskId = isset($datos['desk_id']) ? (int) $datos['desk_id'] : null;
|
||||
|
||||
// ── Validación ────────────────────────────────────────────────
|
||||
if (!in_array($area, ['recepcion', 'lugar'], true)) {
|
||||
@@ -42,12 +43,13 @@ try {
|
||||
$stmt = $pdo->prepare(
|
||||
'UPDATE turnero_turnos
|
||||
SET estado = "en_recepcion",
|
||||
llamado_recepcion_at = NOW(),
|
||||
inicio_recepcion_at = NOW(),
|
||||
atendido_recepcion_por = ?
|
||||
llamado_recepcion_at = NOW(),
|
||||
inicio_recepcion_at = NOW(),
|
||||
atendido_recepcion_por = ?,
|
||||
recepcion_desk_id = COALESCE(?, recepcion_desk_id)
|
||||
WHERE id = ? AND estado = "espera"'
|
||||
);
|
||||
$stmt->execute([adminId(), $turno['id']]);
|
||||
$stmt->execute([adminId(), $deskId, $turno['id']]);
|
||||
|
||||
if ($stmt->rowCount() === 0) {
|
||||
// Otro proceso lo tomó primero (race condition)
|
||||
|
||||
Reference in New Issue
Block a user