Correcciones

This commit is contained in:
AlexLara
2025-07-22 10:56:20 -06:00
parent 058fd8ba4d
commit db5ee9fc20
4 changed files with 38 additions and 8 deletions

View File

@@ -102,7 +102,11 @@ try {
CASE
WHEN registro.registro_retardo THEN 'warning'
ELSE 'primary'
END AS color
END AS color,
case
when horario_fecha_fin is null then true
else false
end as horario_activo
FROM horario
JOIN horario_profesor USING (horario_id)
JOIN fechas ON EXTRACT(DOW FROM fechas.fecha) = horario.horario_dia
@@ -116,7 +120,7 @@ try {
JOIN estado_supervisor ON estado_supervisor.estado_supervisor_id = COALESCE(REGISTRO.estado_supervisor_id, 0)
WHERE horario.horario_id IN ($HorariosID)
AND (FECHAS.fecha + horario.horario_hora) < COALESCE(horario.horario_fecha_fin, NOW())
ORDER BY fechas.fecha, horario_hora, REGISTRO.estado_supervisor_id",
ORDER BY fechas.fecha, horario_hora, horario_fin, REGISTRO.estado_supervisor_id",
$fechas
);

View File

@@ -15,13 +15,39 @@ if ($db->where('usuario_clave', $_POST['mclave'])->has('usuario')) {
exit;
}
try {
$db->insert('usuario', [
/*$db->insert('usuario', [
'usuario_nombre' => mb_strtoupper($_POST['mnombre']),
'usuario_correo' => $_POST['mcorreo'],
'usuario_clave' => $_POST['mclave'],
'rol_id' => $_POST['mrol'] ?? null,
'facultad_id' => empty($facultad) ? null : $facultad,
]);*/
$sql = "
INSERT INTO usuario (
usuario_nombre,
usuario_correo,
usuario_clave,
rol_id,
facultad_id
) VALUES (
:usuario_nombre,
:usuario_correo,
:usuario_clave,
:rol_id,
:facultad_id
)
ON CONFLICT (usuario_clave)
DO UPDATE SET estado_baja = FALSE
";
$stmt = $db->querySingle($sql, [
':usuario_nombre' => mb_strtoupper($_POST['mnombre']),
':usuario_correo' => $_POST['mcorreo'],
':usuario_clave' => $_POST['mclave'],
':rol_id' => $_POST['mrol'] ?? null,
':facultad_id' => empty($facultad) ? null : $facultad,
]);
header("Location: ../usuarios.php", true, 307);
} catch (PDOException $e) {
header("Location: ../usuarios.php?error=2");