diff --git a/modules/turnero/api/get_display_global.php b/modules/turnero/api/get_display_global.php index ca6abc8..39602bc 100644 --- a/modules/turnero/api/get_display_global.php +++ b/modules/turnero/api/get_display_global.php @@ -44,7 +44,7 @@ foreach ($escritoriosRec as $desk) { JOIN turnero_prioridades p ON p.id = t.prioridad_id WHERE t.sesion_id = ? AND t.estado = 'en_recepcion' - AND (t.recepcion_desk_id = ? OR t.recepcion_desk_id IS NULL) + AND t.recepcion_desk_id = ? ORDER BY t.llamado_recepcion_at DESC LIMIT 1" ); diff --git a/modules/turnero/api/llamar_turno.php b/modules/turnero/api/llamar_turno.php index 81f86fb..f2cbab5 100644 --- a/modules/turnero/api/llamar_turno.php +++ b/modules/turnero/api/llamar_turno.php @@ -41,13 +41,16 @@ try { } // Actualizar estado + timestamp + // $deskId puede ser null si el recepcionista no seleccionó escritorio; + // se guarda igual (puede quedar NULL) pero la query del display ya no + // usa IS NULL para evitar que aparezca en todos los escritorios. $stmt = $pdo->prepare( 'UPDATE turnero_turnos SET estado = "en_recepcion", llamado_recepcion_at = NOW(), inicio_recepcion_at = NOW(), atendido_recepcion_por = ?, - recepcion_desk_id = COALESCE(?, recepcion_desk_id) + recepcion_desk_id = ? WHERE id = ? AND estado = "espera"' ); $stmt->execute([adminId(), $deskId, $turno['id']]);