diff --git a/action/action_auditoria.php b/action/action_auditoria.php index 8c7c7fe..f8de81f 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -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 ); diff --git a/action/action_usuarios_insert.php b/action/action_usuarios_insert.php index 7565f32..1cd03b3 100644 --- a/action/action_usuarios_insert.php +++ b/action/action_usuarios_insert.php @@ -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"); diff --git a/export/supervisor_excel.php b/export/supervisor_excel.php index 5dad877..a999f1d 100644 --- a/export/supervisor_excel.php +++ b/export/supervisor_excel.php @@ -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) diff --git a/rest/horarios.php b/rest/horarios.php index 643e482..e3b043c 100644 --- a/rest/horarios.php +++ b/rest/horarios.php @@ -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"]}*
"; + */ 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"] );