From 8eec1a97bad088ca7e3fd9a314e0e2ef5a85bd63 Mon Sep 17 00:00:00 2001 From: Alejandro Rosales Date: Mon, 4 Sep 2023 16:15:44 +0000 Subject: [PATCH] User restore session --- action/action_asistencias.php | 6 +- action/action_asistencias_excel.php | 4 +- action/action_auditoria.php | 20 +++++-- action/action_grupo.php | 4 +- action/action_horario_create.php | 4 +- action/one_row.xlsx | Bin 12798 -> 0 bytes action/reposicion_autoriza.php | 5 +- action/reposicion_delete.php | 5 +- action/reposicion_insert.php | 7 +-- action/reposicion_select.php | 7 +-- action/reposicion_update.php | 7 +-- alta_de_horario.php | 5 +- avisos_crear.php | 8 +-- avisos_editar.php | 7 +-- base.php | 8 +-- carreras.php | 8 +-- class/c_login.php | 19 ++++++- consultar_horario.php | 4 +- consultar_horario_old.php | 7 +-- días_festivos.php | 8 +-- editar_horario.php | 7 +-- excel_horario.php | 8 +-- facultades.php | 8 +-- horario_profesor.php | 4 +- import/html_header.php | 8 +-- justificar_asistencias.php | 5 +- main.php | 5 +- materias.php | 7 +-- permisos.php | 8 +-- profesores.php | 7 +-- reporte_de_asistencias.php | 4 +- reposiciones.php | 4 +- reposiciones_autorizar.php | 5 +- reposiciones_crear.php | 5 +- roles.php | 8 +-- usuarios.php | 7 +-- vista_profesor.php | 82 +++++++++++++++++----------- 37 files changed, 130 insertions(+), 195 deletions(-) delete mode 100644 action/one_row.xlsx diff --git a/action/action_asistencias.php b/action/action_asistencias.php index 9a7a464..3e5297b 100644 --- a/action/action_asistencias.php +++ b/action/action_asistencias.php @@ -3,11 +3,7 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die(json_encode(['error' => 'No se ha iniciado sesión'])); - -$user = unserialize($_SESSION['user']); - +$user = Login::get_user(); extract($_POST); $initial_date = DateTime::createFromFormat('d/m/Y', $fecha_inicial); diff --git a/action/action_asistencias_excel.php b/action/action_asistencias_excel.php index 222597d..de67c84 100644 --- a/action/action_asistencias_excel.php +++ b/action/action_asistencias_excel.php @@ -3,10 +3,8 @@ $ruta = "../"; require_once "../vendor/autoload.php"; require_once "../class/c_login.php"; -if (!isset($_SESSION['user'])) - die(json_encode(['error' => 'No se ha iniciado sesión'])); +$user = Login::get_user(); -$user = unserialize($_SESSION['user']); $user->print_to_log('Genera excel de asistencias'); use PhpOffice\PhpSpreadsheet\Spreadsheet; diff --git a/action/action_auditoria.php b/action/action_auditoria.php index c4f2571..f051d3f 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -18,7 +18,7 @@ $user = unserialize($_SESSION['user']); try { if ($_SERVER['REQUEST_METHOD'] === 'GET') { $baseDate = $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null; - + $params = [ ':periodo_id' => $user->periodo_id, ':facultad_id' => $user->facultad['facultad_id'], @@ -27,13 +27,21 @@ try { ]; $data = $db->query( "WITH horarios AS ( - SELECT *, + SELECT + horario_id, + horario_fecha_inicio, + horario_fecha_fin, + horario_grupo, + horario_hora, + periodo_fecha_inicio, + periodo_fecha_fin, + salon, materia_nombre as materia, carrera_nombre as carrera, facultad_nombre as facultad, nivel_nombre as nivel, horario_hora + duracion_interval as horario_fin - FROM horario + FROM horario left JOIN materia USING (materia_id) JOIN carrera USING (carrera_id) JOIN nivel USING (nivel_id) @@ -52,7 +60,11 @@ try { SELECT * FROM ESTADO_SUPERVISOR WHERE (estado_color, estado_icon) = ('dark', 'ing-cancelar') ) SELECT - usuario.*, registro.*, profesor.*, horarios.*, fechas.*, + usuario.usuario_nombre, + registro.registro_id, registro.registro_fecha, registro.registro_retardo, registro.registro_justificada, comentario, registro_fecha_supervisor justificacion, registro_fecha_justificacion, + profesor.profesor_id, profesor_nombre, profesor_clave, profesor_correo, + horarios.*, + registro_fecha_ideal, COALESCE(estado_supervisor.estado_supervisor_id, sin_registro.estado_supervisor_id) as estado_supervisor_id, COALESCE(estado_supervisor.nombre, sin_registro.nombre) as nombre, COALESCE(estado_supervisor.estado_color, sin_registro.estado_color) as estado_color, diff --git a/action/action_grupo.php b/action/action_grupo.php index 9bf3f89..257a4aa 100644 --- a/action/action_grupo.php +++ b/action/action_grupo.php @@ -3,10 +3,8 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die(json_encode(['error' => 'No se ha iniciado sesión'])); +$user = Login::get_user(); -$user = unserialize($_SESSION['user']); $ruta = "../"; require_once("../include/bd_pdo.php"); extract($_POST); diff --git a/action/action_horario_create.php b/action/action_horario_create.php index ce7ede2..1dbaaee 100644 --- a/action/action_horario_create.php +++ b/action/action_horario_create.php @@ -3,10 +3,8 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die(json_encode(['error' => 'No se ha iniciado sesión'])); +$user = Login::get_user(); -$user = unserialize($_SESSION['user']); $ruta = "../"; require_once "../include/bd_pdo.php"; diff --git a/action/one_row.xlsx b/action/one_row.xlsx deleted file mode 100644 index 20c90d0e5215c6e21ff332c3467aa12acc85ace9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12798 zcmeHtWmg>Qwsqs~?(PJ4hXBFd6Wkkj*Wm6>0wfUJ-Q9yj;}A5sdw@%__j&g@+53+7 z2i#L1s;awd%`y6^WzU>TNfrVU695f>1pokK0HzvLN)IpqAPfoszyQF4zkO|I>uhT4 ztgq%_Z|bDW_C6bRu{nZ{sO4=g_)WpId)fYJX|X2q_W0y!J47FdY}C z3+cri8LU28h>j_%8K;!bluv*#wHI-Zy8+qPXNh%UqJS|14{tqYvhGXNdwZqtp|)O- zN5;CA}uCte6MZZnmi$1WyDs0^qF`S>Nt}oJ{(3qVF1dV(ASFUl#!XOeC4LrOqtT>D|Dr>ZPk$`et& zj0aXzVQ4{#@CZ3;$+bt+wS4?g<^4aJ?CPRsUx^4zMMQwW)YSJG8@++J1F=|*Z4xon z+ow+7Vi7Gy_b9da_=*eg%!wF!@k9U~pWi-2N9`HbHs>#J_jTq7jP(!b0-;*uH z^+3A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Dp!~`3vR$x10GL@b~urFF;1BUx0tx4E&Dp zpPj>B_5c7o9RTpRKH_)t|IF?GZa%^AZ{~kydL>z?7q|T>>L9)F1pq)S)6Y-;1H2%( AjsO4v diff --git a/action/reposicion_autoriza.php b/action/reposicion_autoriza.php index 7f8a80c..d74f68c 100644 --- a/action/reposicion_autoriza.php +++ b/action/reposicion_autoriza.php @@ -7,10 +7,7 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die('No se ha iniciado sesión'); - -$user = unserialize($_SESSION['user']); +$user = Login::get_user(); $pag = "../reposiciones_autorizar.php"; diff --git a/action/reposicion_delete.php b/action/reposicion_delete.php index 5ba0429..04637e1 100644 --- a/action/reposicion_delete.php +++ b/action/reposicion_delete.php @@ -7,10 +7,7 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die('No se ha iniciado sesión'); - -$user = unserialize($_SESSION['user']); +$user = Login::get_user(); //--- Objeto para validar usuario. El id de usuario lo lee desde sesión if(!isset($_POST["id"], $_POST["prof"])){ diff --git a/action/reposicion_insert.php b/action/reposicion_insert.php index 828f773..851abfe 100644 --- a/action/reposicion_insert.php +++ b/action/reposicion_insert.php @@ -7,12 +7,7 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die('No se ha iniciado sesión'); - -$user = unserialize($_SESSION['user']); - - +$user = Login::get_user(); $fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto diff --git a/action/reposicion_select.php b/action/reposicion_select.php index 846736c..a4d2bfd 100644 --- a/action/reposicion_select.php +++ b/action/reposicion_select.php @@ -7,12 +7,7 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die('No se ha iniciado sesión'); - -$user = unserialize($_SESSION['user']); - - +$user = Login::get_user(); //--- Objeto para validar usuario. El id de usuario lo lee desde sesión /*if(!$objSesion->tieneAcceso()){ $return["error"] = "Error! No tienes permisos para realizar esta acción."; diff --git a/action/reposicion_update.php b/action/reposicion_update.php index 3a13d2a..5f692fe 100644 --- a/action/reposicion_update.php +++ b/action/reposicion_update.php @@ -8,12 +8,7 @@ $ruta = "../"; require_once "../class/c_login.php"; // check if the session is started -if (!isset($_SESSION['user'])) - die('No se ha iniciado sesión'); - -$user = unserialize($_SESSION['user']); - - +$user = Login::get_user(); /*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){ header("Location: ".$pag."?error=0"); exit(); diff --git a/alta_de_horario.php b/alta_de_horario.php index 5e1e4ec..2e43495 100644 --- a/alta_de_horario.php +++ b/alta_de_horario.php @@ -1,9 +1,6 @@ access(); if (in_array($user->acceso, ['r', 'n'])) die(header('Location: main.php?error=1')); diff --git a/avisos_crear.php b/avisos_crear.php index 06cdb39..4dce33c 100644 --- a/avisos_crear.php +++ b/avisos_crear.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if(!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access('Avisos'); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/avisos_editar.php b/avisos_editar.php index 1f03503..f13613f 100644 --- a/avisos_editar.php +++ b/avisos_editar.php @@ -2,11 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])) { - header('Location: index.php'); - exit; -} else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access('Avisos'); if ($user->acceso == null) { header('Location: main.php?error=1'); diff --git a/base.php b/base.php index fb6b90a..67ae1db 100644 --- a/base.php +++ b/base.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if(!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access('usuarios'); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/carreras.php b/carreras.php index 3463104..6eec3a7 100644 --- a/carreras.php +++ b/carreras.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access('facultades'); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/class/c_login.php b/class/c_login.php index 7d68e34..f3e365e 100644 --- a/class/c_login.php +++ b/class/c_login.php @@ -152,4 +152,21 @@ class Login session_start(); session_destroy(); } -} + + private static function is_logged(): bool + { + return isset($_SESSION["user"]); + } + + // get the user from the session (if not ) + + public static function get_user(): Login + { + if (Login::is_logged()) { + $user = unserialize($_SESSION["user"]); + return $user; + } + header("Location: /"); + exit(); + } +} \ No newline at end of file diff --git a/consultar_horario.php b/consultar_horario.php index 91a8e7c..7b8dbb6 100644 --- a/consultar_horario.php +++ b/consultar_horario.php @@ -1,9 +1,7 @@ access(); if (in_array($user->acceso, ['n'])) die(header('Location: main.php?error=1')); diff --git a/consultar_horario_old.php b/consultar_horario_old.php index 9dde6f9..00aaae9 100644 --- a/consultar_horario_old.php +++ b/consultar_horario_old.php @@ -1,12 +1,7 @@ access(); -if (in_array($user->acceso, ['n'])) - die(header('Location: main.php?error=1')); $user->print_to_log('Consultar horario'); diff --git a/días_festivos.php b/días_festivos.php index 9c04f00..393c982 100644 --- a/días_festivos.php +++ b/días_festivos.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if(!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access(); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/editar_horario.php b/editar_horario.php index f5e9180..3a9d5a7 100644 --- a/editar_horario.php +++ b/editar_horario.php @@ -1,11 +1,8 @@ admin) header('Location: main.php?error=1'); diff --git a/excel_horario.php b/excel_horario.php index dc3f616..53f3840 100644 --- a/excel_horario.php +++ b/excel_horario.php @@ -1,12 +1,6 @@ access('excel_horario'); if (in_array($user->acceso, ['r', 'n'])) { diff --git a/facultades.php b/facultades.php index cceab52..09ae7b4 100644 --- a/facultades.php +++ b/facultades.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access(); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/horario_profesor.php b/horario_profesor.php index 8b653b1..3458b23 100644 --- a/horario_profesor.php +++ b/horario_profesor.php @@ -1,9 +1,7 @@ access(); if (in_array($user->acceso, ['n'])) die(header('Location: main.php?error=1')); diff --git a/import/html_header.php b/import/html_header.php index 4f093c0..22fda38 100644 --- a/import/html_header.php +++ b/import/html_header.php @@ -6,14 +6,8 @@ require_once 'class/c_login.php'; $ruta = "../"; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])) { - if (isset($redirect)) - $_SESSION['ruta'] = $redirect; +$user = Login::get_user(); - header('Location: index.php'); -} - -$user = unserialize($_SESSION['user']); $user->access(); $pagina = substr(basename($_SERVER['PHP_SELF']), 0, -4); if ($pagina != "main" && !$user->acceso) { diff --git a/justificar_asistencias.php b/justificar_asistencias.php index 0b07c65..409d216 100644 --- a/justificar_asistencias.php +++ b/justificar_asistencias.php @@ -4,10 +4,7 @@ ini_set("display_errors", 1); require_once 'class/c_login.php'; -if (!isset($_SESSION['user'])) - die(header('Location: index.php')); - -$user = unserialize($_SESSION['user']); +$user = Login::get_user(); $user->access(); if (in_array($user->acceso, ['r', 'n'])) { diff --git a/main.php b/main.php index efc214a..e660ae8 100644 --- a/main.php +++ b/main.php @@ -1,9 +1,6 @@ diff --git a/materias.php b/materias.php index 1283d59..f190536 100644 --- a/materias.php +++ b/materias.php @@ -2,11 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])) { - header('Location: index.php'); - exit; -} else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access(); if ($user->acceso == null) { // die($access); diff --git a/permisos.php b/permisos.php index 628121d..c05f9ed 100644 --- a/permisos.php +++ b/permisos.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access(); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/profesores.php b/profesores.php index e3c1378..f38d8ea 100644 --- a/profesores.php +++ b/profesores.php @@ -2,11 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])) { - header('Location: index.php'); - exit; -} else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access(); if ($user->acceso == null) { header('Location: main.php?error=1'); diff --git a/reporte_de_asistencias.php b/reporte_de_asistencias.php index 05885de..2df319a 100644 --- a/reporte_de_asistencias.php +++ b/reporte_de_asistencias.php @@ -4,10 +4,8 @@ ini_set("display_errors", 1); require_once 'class/c_login.php'; -if (!isset($_SESSION['user'])) - die(header('Location: index.php')); +$user = Login::get_user(); -$user = unserialize($_SESSION['user']); $user->access('reporte_de_asistencias'); if (in_array($user->acceso, ['n'])) die(header('Location: main.php?error=1')); diff --git a/reposiciones.php b/reposiciones.php index 6f274ec..d41dd36 100644 --- a/reposiciones.php +++ b/reposiciones.php @@ -1,10 +1,8 @@ access(); if (in_array($user->acceso, ['n'])) die(header('Location: main.php?error=1')); diff --git a/reposiciones_autorizar.php b/reposiciones_autorizar.php index 5a2a93e..0de0219 100644 --- a/reposiciones_autorizar.php +++ b/reposiciones_autorizar.php @@ -1,11 +1,8 @@ access(); //if (!$user->admin && in_array($user->acceso, ['n'])) diff --git a/reposiciones_crear.php b/reposiciones_crear.php index 740e535..36c214e 100644 --- a/reposiciones_crear.php +++ b/reposiciones_crear.php @@ -1,11 +1,8 @@ profesor); print_r($user->acceso);//null sin permisos, w o r diff --git a/roles.php b/roles.php index b450f0a..e82adb8 100644 --- a/roles.php +++ b/roles.php @@ -2,12 +2,8 @@ require_once 'class/c_login.php'; require_once 'include/bd_pdo.php'; -if (!isset($_SESSION['user'])){ - header('Location: index.php'); - exit; -} -else - $user = unserialize($_SESSION['user']); +$user = Login::get_user(); + $user->access(); if($user->acceso == null){ header('Location: main.php?error=1'); diff --git a/usuarios.php b/usuarios.php index 7e109ec..9530af6 100644 --- a/usuarios.php +++ b/usuarios.php @@ -1,11 +1,8 @@ access(); if ($user->acceso == null) { diff --git a/vista_profesor.php b/vista_profesor.php index 0083dfa..aa83a5e 100644 --- a/vista_profesor.php +++ b/vista_profesor.php @@ -3,18 +3,16 @@ require_once 'class/c_login.php'; -if (!isset($_SESSION['user'])) - die(header('Location: index.php')); +$user = Login::get_user(); -$user = unserialize($_SESSION['user']); $user->access('reporte_de_asistencias'); -if ( $user->acceso == null ) +if ($user->acceso == null) die(header('Location: main.php?error=1')); $user->print_to_log('Consultar: Reporte de asistencias de profesor'); - + #$required_post = ['id', 'fecha_inicial', 'fecha_final', 'periodo']; #if (array_diff($required_post, array_keys($_POST))) #header('Location: s.php'); @@ -46,7 +44,7 @@ $reporte = queryAll("SELECT * FROM fs_asistencia_profesorreporte(:carrera, :peri ":id" => $id, ":initial_date" => $fecha_inicial->format("Y-m-d"), ":final_date" => $fecha_final->format("Y-m-d"), - ":materia" => empty($materia) ? null : $materia + ":materia" => empty($materia) ? null : $materia ) ); @@ -55,7 +53,8 @@ $profesor = query( array(":id" => $id) ); -$asistencias = query("SELECT total, asistencias, retardos, justificaciones FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date)", +$asistencias = query( + "SELECT total, asistencias, retardos, justificaciones FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date)", array( ":carrera" => empty($carrera) ? null : $carrera, ":periodo" => $user->periodo_id, @@ -92,15 +91,20 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
-

+

+ +

-

Clave:

+

Clave: + +

- @@ -128,7 +132,7 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
+ ?>
@@ -136,7 +140,8 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta Retardo | - Sin registro | Justificada + Sin registro | Justificada
@@ -181,34 +186,47 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta $hora = date("H:i", strtotime($row['hora'])); $hora_checado = is_null($row["hora_checado"]) ? '-' : date("H:i:s", strtotime($row["hora_checado"])); $horario = $db->getOne("fget_horario({$row['id']})"); - ?> + ?> "> - - + + + + + + "> - | + + | + + - - - + + - + + + + + - + Justificada
" ?> - -
No hay registros para mostrar
-
@@ -252,8 +270,10 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
@@ -296,24 +316,24 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta clone.appendTo("#message"); // remove after 4 seconds - setTimeout(function() { + setTimeout(function () { clone.alert("close"); }, 4000); } - $(document).ready(function() { + $(document).ready(function () { $("#reporte").hide(); - $("#reporte").click(function(e) { + $("#reporte").click(function (e) { $("#form_reporte").submit(); }); var periodo_inicio = ''; var periodo_fin = ''; var previous_date; - $('#initial_date_src').focus(function() { + $('#initial_date_src').focus(function () { previous_date = $(this).val(); - }).change(function() { + }).change(function () { // console.log("Periodo inicio: ", periodo_inicio); // console.log("this < Periodo inicio: ", $(this).val() < periodo_inicio); if ($(this).val() > $('#final_date_src').val()) { @@ -330,9 +350,9 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta } }); - $('#final_date_src').focus(function() { + $('#final_date_src').focus(function () { previous_date = $(this).val(); - }).change(function() { + }).change(function () { console.log("Periodo fin: ", periodo_fin); console.log("this > Periodo fin: ", $(this).val() > periodo_fin); if ($(this).val() < $('#initial_date_src').val()) {