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");

View File

@@ -51,7 +51,7 @@ $data = $db->query(
JOIN fechas
ON EXTRACT(DOW FROM fechas.registro_fecha_ideal) = horario_dia
AND fechas.registro_fecha_ideal >= horario_fecha_inicio::date
AND (horario_fecha_fin IS NULL OR fechas.registro_fecha_ideal < horario_fecha_fin::date)
AND (horario_fecha_fin IS NULL OR fechas.registro_fecha_ideal+ horario.horario_hora < horario_fecha_fin)
NATURAL JOIN salon_view_mat
JOIN facultad ON facultad.facultad_id = COALESCE(horario.facultad_id, 0)

View File

@@ -191,9 +191,9 @@ try{
//Recorre SGU y genera hash
foreach( $selectedData as $row ){
//if ($debug)
// echo trim($row["HoraInicio"]."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$per["periodo_id"]."|".$row["Carrera"])."[{$row["ClaveCarrera"]}]|{$row["EsMateriaPorReposicion"]}*";
/*if ($debug)
echo trim($row["HoraInicio"]."|".(trim($row["ClaveMateria"])==''?'-':$row["ClaveMateria"])."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$per["periodo_id"]."|".$row["Carrera"])." [{$row["ClaveCarrera"]}] *{$row["EsMateriaPorReposicion"]}*<br>";
*/
if(!$row["EsMateriaPorReposicion"]){
$carrera = $row["ClaveCarrera"];
if(is_null($carrera) || empty($carrera))
@@ -204,7 +204,7 @@ try{
}*/
$sguHash[] = array(
"hash"=>( trim($row["HoraInicio"]."|".($row["ClaveMateria"])."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$per["periodo_id"]."|".$row["Carrera"]) ),
"hash"=>( trim($row["HoraInicio"]."|".(trim($row["ClaveMateria"])==''?'-':$row["ClaveMateria"])."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$per["periodo_id"]."|".$row["Carrera"]) ),
"data"=>$row,
"per"=>$per["periodo_id"]
);