From 2173869717ccdcab97a49b9f61b9f802cbecd8ec Mon Sep 17 00:00:00 2001
From: Alejandro Rosales
Date: Fri, 10 Nov 2023 18:15:14 +0000
Subject: [PATCH] Update code with changes from git diff
---
.gitignore | 1 -
action/action_auditoria.php | 20 +-
action/action_justificar.php | 64 +-
action/action_materias_select.php | 14 +-
action/action_materias_update.php | 16 +-
action/correo.php | 20 +
action/justificar.php | 76 +
action/periodos.php | 204 ++
action/reposicion_autoriza.php | 169 +-
action/reposicion_insert.php | 174 +-
action/reposicion_select.php | 12 +-
action/reposicion_update.php | 8 +-
auditoria.php | 116 +-
class/mailer.php | 82 +
días_festivos.php | 192 +-
export/control.php | 65 +
export/horario_excel.php | 139 +
export/supervisor_excel.php | 179 ++
import/periodo.php | 2 +-
include/phpmailer/PHPMailerAutoload.php | 50 +
include/phpmailer/class.phpmailer.php | 3884 +++++++++++++++++++++++
include/phpmailer/class.smtp.php | 1181 +++++++
js/auditoría.js | 68 +-
js/periodos.js | 133 +-
js/scrollables.js | 9 +
materias.php | 42 +-
periodos.php | 307 +-
puestos.php | 101 +-
reposiciones_autorizar.php | 53 +-
reposiciones_crear.php | 3 +-
test.php | 6 +-
ts/auditoría.ts | 68 +-
ts/periodos.ts | 170 +-
33 files changed, 7013 insertions(+), 615 deletions(-)
create mode 100644 action/correo.php
create mode 100644 action/justificar.php
create mode 100644 action/periodos.php
create mode 100644 class/mailer.php
create mode 100644 export/control.php
create mode 100644 export/horario_excel.php
create mode 100644 export/supervisor_excel.php
create mode 100644 include/phpmailer/PHPMailerAutoload.php
create mode 100644 include/phpmailer/class.phpmailer.php
create mode 100644 include/phpmailer/class.smtp.php
diff --git a/.gitignore b/.gitignore
index 6706b56..2dd6ce4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,6 @@ composer.phar
/concept/
/backup/
/.vscode/
-/export/
/log/
/include/.env
diff --git a/action/action_auditoria.php b/action/action_auditoria.php
index 0d5f095..4d99192 100644
--- a/action/action_auditoria.php
+++ b/action/action_auditoria.php
@@ -2,8 +2,8 @@
#input $_GET['id_espacio_sgu']
#output rutas: [ ...ruta, salones: [{...salon}] ]
header('Content-Type: application/json charset=utf-8');
-ini_set('memory_limit', '256M');
-ini_set('post_max_size', '256M');
+ini_set('memory_limit', '500M');
+ini_set('post_max_size', '500M');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
@@ -39,16 +39,18 @@ try {
PERIODO.periodo_fecha_inicio,
PERIODO.periodo_fecha_fin,
salon,
- materia_nombre as materia,
+ COALESCE(materia_nombre, materia_asignacion_materia) as materia,
carrera_nombre as carrera,
facultad_nombre as facultad,
nivel_nombre as nivel,
horario_fin
FROM horario
left JOIN materia USING (materia_id)
- JOIN carrera USING (carrera_id)
+ LEFT JOIN carrera USING (carrera_id)
+ left join materia_asignacion using (horario_id)
+ -- JOIN carrera USING (carrera_id) but if carrera_id is null then 0
JOIN nivel USING (nivel_id)
- JOIN facultad ON facultad.facultad_id = carrera.facultad_id
+ JOIN facultad ON facultad.facultad_id = COALESCE(carrera.facultad_id, 0)
JOIN PERIODO USING (periodo_id)
JOIN SALON USING (salon_id)
WHERE (PERIODO.periodo_id, facultad.facultad_id) = (:periodo_id, COALESCE(:facultad_id, facultad.facultad_id))
@@ -97,12 +99,14 @@ try {
LEFT JOIN ROL on ROL.rol_id = justificador.rol_id
left join facultad on facultad.facultad_id = justificador.facultad_id
WHERE (fechas.registro_fecha_ideal + HORARIO_HORA) BETWEEN
- GREATEST(HORARIO_FECHA_INICIO, PERIODO_FECHA_INICIO, :fecha_inicio) AND LEAST(:fecha_fin, PERIODO_FECHA_FIN, HORARIO_FECHA_FIN)
+ GREATEST(HORARIO_FECHA_INICIO, PERIODO_FECHA_INICIO, :fecha_inicio) AND LEAST(PERIODO_FECHA_FIN, HORARIO_FECHA_FIN, :fecha_fin)
ORDER BY fechas.registro_fecha_ideal DESC, horarios.horario_id, profesor_nombre",
$params
);
-
- // $user->print_to_log(json_encode($params));
+ $db->delete('general_log');
+ $db->insert('general_log', [
+ 'general_log_json' => json_encode($params, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT),
+ ]);
echo json_encode(array_merge($data), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} else {
http_response_code(405);
diff --git a/action/action_justificar.php b/action/action_justificar.php
index cb6fff6..6d0b4fd 100644
--- a/action/action_justificar.php
+++ b/action/action_justificar.php
@@ -25,37 +25,50 @@ try {
echo json_encode(['error' => 'No hay clases pendientes']);
exit;
}
+ if (!(isset($post_data['fecha'], $post_data['bloques'], $post_data['justificacion']))) {
+ http_response_code(400);
+ echo json_encode(['error' => 'Faltan parametros']);
+ exit;
+ }
- $data = $db->querySingle(
- 'INSERT INTO registro (profesor_id, horario_id, registro_fecha_ideal, registro_justificada, justificador_id, registro_fecha_justificacion, justificacion)
- VALUES (:profesor_id, :horario_id, :registro_fecha_ideal, :registro_justificada, :justificador_id, NOW(), :justificacion)
- ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal)
- DO UPDATE SET registro_justificada = :registro_justificada, justificador_id = :justificador_id, registro_fecha_justificacion = NOW(), justificacion = :justificacion
- RETURNING *',
+ $bloques = $db
+ ->where('id', $post_data['bloques'])
+ ->orderBy('hora_inicio')
+ ->get('bloque_horario', null, 'hora_inicio, hora_fin');
+
+ $min_hora_inicio = $bloques[0]['hora_inicio'];
+ $max_hora_fin = $bloques[count($bloques) - 1]['hora_fin'];
+
+ $pdo->beginTransaction();
+ $data = $db->query(
+ "INSERT INTO registro (horario_id, registro_fecha_ideal, profesor_id, justificador_id, justificacion, registro_fecha_justificacion, registro_justificada)
+ SELECT DISTINCT
+ horario_id, :fecha::DATE, profesor_id, :justificador_id::INT, :justificacion, NOW(), true
+ from horario_view
+ join horario_profesor using (horario_id)
+ where
+ (:hora_inicio::TIME, :hora_fin::TIME) OVERLAPS (horario_hora, horario_fin) AND
+ horario_dia = EXTRACT(DOW FROM :fecha::DATE) AND
+ periodo_id = :periodo_id AND
+ (horario_view.facultad_id = :facultad_id OR :facultad_id IS NULL)
+ ON CONFLICT (horario_id, registro_fecha_ideal, profesor_id) DO UPDATE SET
+ justificador_id = :justificador_id,
+ justificacion = :justificacion,
+ registro_fecha_justificacion = NOW(),
+ registro_justificada = true
+ RETURNING *;",
array(
- 'profesor_id' => $post_data['profesor_id'],
- 'horario_id' => $post_data['horario_id'],
- 'registro_fecha_ideal' => $post_data['registro_fecha_ideal'],
- 'registro_justificada' => $post_data['registro_justificada'],
'justificador_id' => $user->user['id'],
'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'],
+ 'fecha' => $post_data['fecha'],
+ 'periodo_id' => $user->periodo_id,
+ 'facultad_id' => $user->facultad['facultad_id'],
+ 'hora_inicio' => $min_hora_inicio,
+ 'hora_fin' => $max_hora_fin,
)
);
-
- $data_justificador = $db->querySingle(
- "SELECT justificador.usuario_nombre as justificador_nombre,
- justificador.usuario_clave as justificador_clave,
- facultad.facultad_nombre as justificador_facultad, rol.rol_titulo as justificador_rol
-
- FROM USUARIO JUSTIFICADOR
- JOIN ROL on ROL.rol_id = justificador.rol_id
- LEFT JOIN facultad on facultad.facultad_id = justificador.facultad_id
- where justificador.usuario_id = :justificador_id",
- array(
- 'justificador_id' => $user->user['id'],
- )
- );
- echo json_encode(array_merge($data, $data_justificador), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ $pdo->commit();
+ echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} else {
http_response_code(405);
echo json_encode(['error' => 'method not allowed']);
@@ -70,6 +83,7 @@ try {
'query' => $db->getLastQuery(),
'post_data' => $post_data,
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ $pdo->rollBack();
exit;
} catch (Exception $th) {
http_response_code(500);
diff --git a/action/action_materias_select.php b/action/action_materias_select.php
index f0d56a9..8966036 100644
--- a/action/action_materias_select.php
+++ b/action/action_materias_select.php
@@ -1,8 +1,10 @@
$_POST['idmateria']];
- echo json_encode(query($sql, $params, false));
+$ruta = "../";
+require_once "../include/bd_pdo.php";
+global $pdo;
+$sql = "SELECT * FROM materia
+JOIN carrera using (carrera_id)
+WHERE materia_id = :idMateria";
+$params = ['idMateria' => $_POST['idmateria']];
+echo json_encode(query($sql, $params, false));
?>
\ No newline at end of file
diff --git a/action/action_materias_update.php b/action/action_materias_update.php
index 19c4e8e..975a2f3 100644
--- a/action/action_materias_update.php
+++ b/action/action_materias_update.php
@@ -1,11 +1,11 @@
mb_strtoupper($_POST["nombre"]), ':id' => $_POST["id"]);
- $hecho = query($sql, $params, false);
- header("Location: ../materias.php");
- exit();
+$sql = "UPDATE materia SET materia_nombre = :nombre, carrera_id = :carrera WHERE materia_id = :id";
+$params = array(':nombre' => mb_strtoupper($_POST["nombre"]), ':id' => $_POST["id"], ':carrera' => $_POST["carrera"]);
+$hecho = query($sql, $params, false);
+header("Location: ../materias.php");
+exit();
?>
\ No newline at end of file
diff --git a/action/correo.php b/action/correo.php
new file mode 100644
index 0000000..7b5d092
--- /dev/null
+++ b/action/correo.php
@@ -0,0 +1,20 @@
+?correo=";
+ exit();
+}
+
+
+$to = $_GET["correo"];
+$texto = "Esto es una prueba automatizada
El correo se envió atutomáticamente, no debes hacer nada más.
";
+$asunto="Prueba";
+Mailer::enviarCorreo($to, $asunto, $texto, true);
+echo "Enviado!".date("H:i:s");
+
+?>
diff --git a/action/justificar.php b/action/justificar.php
new file mode 100644
index 0000000..4b9308b
--- /dev/null
+++ b/action/justificar.php
@@ -0,0 +1,76 @@
+ 'No se ha iniciado sesión']);
+ exit();
+}
+$user = Login::get_user();
+
+try {
+ switch ($_SERVER['REQUEST_METHOD']) {
+ case 'POST':
+ // check parameters
+
+ $raw = file_get_contents('php://input');
+ $post_data = json_decode($raw, true);
+
+ $data = $db->querySingle(
+ 'WITH HORARIOS AS (
+ SELECT *
+ FROM horario
+ JOIN horario_profesor USING (horario_id)
+ WHERE horario.periodo_id = :periodo_id
+ )
+ INSERT INTO registro (profesor_id, horario_id, registro_fecha_ideal, registro_justificada, justificador_id, registro_fecha_justificacion, justificacion)
+ VALUES (:profesor_id, :horario_id, :registro_fecha_ideal, :registro_justificada, :justificador_id, NOW(), :justificacion)
+ ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal)
+ DO UPDATE SET registro_justificada = :registro_justificada, justificador_id = :justificador_id, registro_fecha_justificacion = NOW(), justificacion = :justificacion
+ RETURNING *',
+ array(
+ 'periodo_id' => $user->periodo_id,
+ 'profesor_id' => $post_data['profesor_id'],
+ 'horario_id' => $post_data['horario_id'],
+ 'registro_fecha_ideal' => $post_data['registro_fecha_ideal'],
+ 'registro_justificada' => $post_data['registro_justificada'],
+ 'justificador_id' => $user->user['id'],
+ 'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'],
+ )
+ );
+
+
+ $data_justificador = $db->querySingle(
+ "SELECT justificador.usuario_nombre as justificador_nombre,
+ justificador.usuario_clave as justificador_clave,
+ facultad.facultad_nombre as justificador_facultad, rol.rol_titulo as justificador_rol
+
+ FROM USUARIO JUSTIFICADOR
+ JOIN ROL on ROL.rol_id = justificador.rol_id
+ LEFT JOIN facultad on facultad.facultad_id = justificador.facultad_id
+ where justificador.usuario_id = :justificador_id",
+ array(
+ 'justificador_id' => $user->user['id'],
+ )
+ );
+ // exit('exit');
+
+ echo json_encode(array_merge($data, $data_justificador), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ break;
+
+ default:
+ header('HTTP/1.1 405 Method Not Allowed');
+ echo json_encode(['error' => 'Método no permitido']);
+ }
+} catch (PDOException $e) {
+ echo json_encode([
+ 'error' => $e->getMessage(),
+ 'query' => $db->getLastQuery(),
+ 'exception' => $e->getTraceAsString()
+ ]);
+} catch (Exception $e) {
+ echo json_encode([
+ 'error' => $e->getMessage(),
+ 'exception' => $e->getTraceAsString()
+ ]);
+}
\ No newline at end of file
diff --git a/action/periodos.php b/action/periodos.php
new file mode 100644
index 0000000..618e1d1
--- /dev/null
+++ b/action/periodos.php
@@ -0,0 +1,204 @@
+ 'No se ha iniciado sesión']);
+ exit();
+}
+$user = Login::get_user();
+
+try {
+ switch ($_SERVER['REQUEST_METHOD']) {
+ case 'GET':
+ // Fetch all puestos
+ $periodo_id = $user->periodo_id;
+ if (is_null($user->facultad['facultad_id'])) {
+ $periodos = $db
+ ->where('CURRENT_DATE BETWEEN periodo_fecha_inicio AND periodo_fecha_fin')
+ ->join('nivel', 'nivel.nivel_id = periodo.nivel_id')
+ ->orderBy('periodo_id')
+ ->get('periodo', null, 'periodo.*, nivel_nombre as nivel');
+ } else {
+ $periodos = $db->query(
+ "SELECT DISTINCT periodo.*, nivel_nombre as nivel FROM periodo
+ JOIN horario_view USING (periodo_id)
+ JOIN nivel ON nivel.nivel_id = periodo.nivel_id
+ WHERE CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin
+ AND facultad_id = :facultad_id
+ ORDER BY periodo_id
+ ",
+ ['facultad_id' => $user->facultad['facultad_id']]
+ );
+ }
+ echo json_encode($periodos);
+ break;
+
+ case 'PUT':
+ // Update nivel_id of a periodo
+ $raw = file_get_contents('php://input');
+ $data = json_decode($raw, true);
+
+ if (!isset($data['action'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Falta la acción a realizar']);
+ exit();
+ }
+
+ switch ($data['action']) {
+ case 'changeNivel':
+ if (!isset($data['periodo_id'], $data['nivel_id'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Falta el id del periodo o el nivel']);
+ exit();
+ }
+
+ $periodo_id = $data['periodo_id'];
+ $nivel_id = $data['nivel_id'];
+ $db->where('periodo_id', $periodo_id)->update('periodo', ['nivel_id' => $nivel_id]);
+
+ $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
+ $nivel_nombre = $db->where('nivel_id', $nivel_id)->getOne('nivel', 'nivel_nombre')['nivel_nombre'];
+
+ echo json_encode([
+ 'success' =>
+ "El nivel del periodo $periodo_nombre ha sido cambiado a $nivel_nombre"
+ ]);
+ break;
+
+ case 'changeFechaInicio':
+ if (!isset($data['periodo_id'], $data['periodo_fecha_inicio'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Falta el id del periodo o la fecha de inicio']);
+ exit();
+ }
+
+ $periodo_id = $data['periodo_id'];
+ $periodo_fecha_inicio = $data['periodo_fecha_inicio'];
+ $db->where('periodo_id', $periodo_id)->update('periodo', ['periodo_fecha_inicio' => $periodo_fecha_inicio]);
+
+ $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
+
+ echo json_encode([
+ 'success' =>
+ "La fecha de inicio del periodo $periodo_nombre ha sido cambiada a $periodo_fecha_inicio"
+ ]);
+ break;
+
+ case 'changeFechaFin':
+ if (!isset($data['periodo_id'], $data['periodo_fecha_fin'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Falta el id del periodo o la fecha de fin']);
+ exit();
+ }
+
+ $periodo_id = $data['periodo_id'];
+ $periodo_fecha_fin = $data['periodo_fecha_fin'];
+ $db->where('periodo_id', $periodo_id)->update('periodo', ['periodo_fecha_fin' => $periodo_fecha_fin]);
+
+ $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
+
+ echo json_encode([
+ 'success' =>
+ "La fecha de fin del periodo $periodo_nombre ha sido cambiada a $periodo_fecha_fin"
+ ]);
+ break;
+
+ case 'updatePeriodo':
+ if (!isset($data['periodo_id'], $data['periodo_nombre'], $data['id_periodo_sgu'], $data['periodo_clave'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Faltan datos para actualizar el periodo']);
+ exit();
+ }
+
+ $periodo_id = $data['periodo_id'];
+
+ $db->where('periodo_id', $periodo_id)->update('periodo', array_filter($data, fn($key) => in_array($key, [
+ 'periodo_nombre',
+ 'id_periodo_sgu',
+ 'periodo_clave',
+ ]), ARRAY_FILTER_USE_KEY));
+
+ $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
+
+ echo json_encode([
+ 'success' =>
+ "El periodo $periodo_nombre ha sido actualizado"
+ ]);
+ break;
+
+ default:
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Acción no válida']);
+ exit();
+ }
+
+ break;
+ case 'POST':
+ $raw = file_get_contents('php://input');
+ $data = json_decode($raw, true);
+
+ if (!isset($data['periodo_nombre'], $data['nivel_id'], $data['periodo_fecha_inicio'], $data['periodo_fecha_fin'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Faltan datos para crear el periodo']);
+ exit();
+ }
+
+ $newPeriodo = $db->insert(
+ 'periodo',
+ array_filter($data, fn($key) => in_array($key, [
+ 'periodo_nombre',
+ 'nivel_id',
+ 'periodo_fecha_inicio',
+ 'periodo_fecha_fin',
+ 'periodo_clave',
+ 'id_periodo_sgu',
+ ]), ARRAY_FILTER_USE_KEY)
+ );
+
+ echo json_encode([
+ 'success' => true,
+ 'message' => 'El periodo ha sido creado',
+ 'periodo' => $newPeriodo
+ ]);
+ break;
+
+ case 'DELETE':
+ // Delete a periodo
+ $raw = file_get_contents('php://input');
+ $data = json_decode($raw, true);
+
+ if (!isset($data['periodo_id'])) {
+ header('HTTP/1.1 400 Bad Request');
+ echo json_encode(['error' => 'Falta el id del periodo']);
+ exit();
+ }
+
+ $periodo_id = $data['periodo_id'];
+ $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
+
+ $db->where('periodo_id', $periodo_id)->delete('periodo');
+
+ echo json_encode([
+ 'success' => true,
+ 'message' => "El periodo $periodo_nombre ha sido eliminado"
+ ]);
+ break;
+ default:
+ header('HTTP/1.1 405 Method Not Allowed');
+ echo json_encode(['error' => 'Método no permitido']);
+ break;
+ }
+} catch (PDOException $e) {
+ echo json_encode([
+ 'error' => $e->getMessage(),
+ 'query' => $db->getLastQuery(),
+ 'exception' => $e->getTraceAsString()
+ ]);
+} catch (Exception $e) {
+ echo json_encode([
+ 'error' => $e->getMessage(),
+ 'exception' => $e->getTraceAsString()
+ ]);
+}
\ No newline at end of file
diff --git a/action/reposicion_autoriza.php b/action/reposicion_autoriza.php
index 363168e..67ce10d 100644
--- a/action/reposicion_autoriza.php
+++ b/action/reposicion_autoriza.php
@@ -5,6 +5,11 @@ Cambia de estado la reposición
$pag = "../reposiciones_crear.php";
$ruta = "../";
require_once "../class/c_login.php";
+require_once "../class/mailer.php";
+
+define("COORDINADOR", 9);
+define("SUPERVISOR", 7);
+define("ENVIO_CORREOS", true);
// check if the session is started
if (!isset($_SESSION['user']))
@@ -24,6 +29,71 @@ $id_repo = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia t
$edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
+//--------------
+
+//--------------
+//Obtiene datos reposición
+//TODO , SALÓN SALIÓ PENDIENTE Y FALTA REVISAR LISTA DE CORREOS TO
+$reposicion_rs = $db->querySingle('SELECT h.materia, r.fecha_nueva, r.hora_nueva, r.fecha_clase, h.horario_hora, h.facultad_id, h.facultad, f.clave_dependencia, s.salon_id, s.salon_array, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre
+ from reposicion_solicitud r
+ inner join horario_view h on h.horario_id = r.horario_id
+ inner join facultad f on f.facultad_id = h.facultad_id
+ inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id
+ left join salon_view s on r.salon_id = s.salon_id
+ where r.reposicion_solicitud_id = :id_repo',
+ [':id_repo' => $id_repo]
+ );
+
+if($reposicion_rs["salon_id"] == "" || $reposicion_rs["salon_id"] == NULL){
+ $salon_desc = "Pendiente";
+}else{
+ $salon_json = json_decode($reposicion_rs["salon_array"], true);
+ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
+ unset($salon_json[0]);
+ }
+ $salon_desc = join(" / ",$salon_json);
+}
+//Obtiene correos
+$correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, u.usuario_nombre as jefe_nombre, u.usuario_correo as jefe_correo,
+ coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo
+ from reposicion_solicitud rs
+ inner join profesor p on rs.profesor_id =p.profesor_id
+ inner join usuario u on u.usuario_id = rs.usuario_id
+ inner join horario_view hv on hv.horario_id = rs.horario_id
+ inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
+ where rs.reposicion_solicitud_id = :id_repo',
+ [':rol_coord' => COORDINADOR, ':id_repo' => $id_repo]
+ );
+//print_r($correos_rs); exit();
+
+$prof_correos=array();
+$jefe_correos=[];
+$coord_correos=[];
+
+foreach($correos_rs as $correo){
+ if( count($prof_correos)==0 && $correo["profesor_correo"]!=""){
+ if( !isset($prof_correos["correo"]) || !in_array($correo["profesor_correo"], $prof_correos["correo"]) ){
+ array_push($prof_correos, $correo["profesor_correo"]);
+ }
+ }
+ if( count($jefe_correos)==0 && $correo["jefe_correo"]!=""){
+ if(!isset($jefe_correos["correo"]) || !in_array($correo["jefe_correo"], $jefe_correos["correo"])){
+ array_push($jefe_correos, $correo["jefe_correo"]);
+ }
+ }
+ if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){
+ if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){
+ array_push($coord_correos, $correo["coordinador_correo"]);
+ }
+ }
+}
+
+$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo
+ FROM horario_supervisor hs
+ inner join usuario sup on sup.usuario_id =hs.usuario_id
+ where :facultad = ANY(hs.facultad_id_array)
+ and hs.turno_inicio <= :hora and hs.turno_fin >= :hora",
+ [':facultad'=>$reposicion_rs["facultad_id"], ':hora'=>$reposicion_rs["hora_nueva"]] );
if($edo == 4){//cancelación
@@ -42,55 +112,66 @@ if($edo == 4){//cancelación
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)',
[':id' => $id_repo, ':edo' => $edo]
);
- }
-}
-
-//Obtener datos del usuario que creó la reposición y mandar correo
-/*$stmt = $pdo->prepare('Select * from
-:id, :periodo, NULL, NULL, NULL, NULL, NULL, 0, 1)');
-$stmt->bindParam(":id", $id_repo);
-$stmt->bindParam(":periodo", $_SESSION["periodo_id"]);
-if(!$stmt->execute()){
- header("Location:".$pag."?error=1");
- exit();
-}
-$rs = $stmt->fetch();
-$stmt->closeCursor();
-$stmt = null;
-
-$stmt = $pdo->prepare('Select * from fs_contacto(:usr, 3, NULL)');//3 = correo
-$stmt->bindParam(":usr", $rs["Usuario_id"]);
-if(!$stmt->execute()){
- header("Location:".$pag."?error=1");
- exit();
-}
-$correos_rs = $stmt->fetchAll();
-$stmt->closeCursor();
-$stmt = null;
-
-$correoList = "";
-foreach($correos_rs as $c){
- if($c.substr("lasallistas.org,mx",0) || $c.substr("lasalle.mx",0)){
- $correoList .= $c.";";
}
}
-//$correoHTML = "Se aprobó la reposición para el a las en el salón .
";
-*/
-/*
-$log = new LogActividad();
-if($edo == 4){
- $desc_log = "Cancela reposición ID[".$id_repo."] edo[".$edo."]";
- $ok = 2;
-}else{
- $desc_log = "Autoriza reposición ID[".$id_repo."] edo[".$edo."] Salon[".(empty($salon)?"":$salon)."]";
- $ok = 0;
- if($edo == 3){
+
+$fecha_clase = date('d/m/Y', strtotime($reposicion_rs["fecha_clase"]));
+$fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"]));
+$hora_tmp = explode(":",$reposicion_rs["horario_hora"]);
+$hora_clase = $hora_tmp[0].":".$hora_tmp[1];
+$hora_tmp = explode(":",$reposicion_rs["hora_nueva"]);
+$hora_nueva = $hora_tmp[0].":".$hora_tmp[1];
+
+$asunto = "";
+$texto = "";
+$to = "";
+switch($edo){
+ case 2://Correo a supervisor
+ $asunto = "Reposición nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"];
+ //crear plantilla
+ $texto = "Se creó una reposición nueva para: ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"].".
";
+ $texto .= "".mb_strtoupper($reposicion_rs["materia"])." del día ".$fecha_clase." a las ".$hora_clase." hrs. se propone reponer el ".$fecha_nueva." a las ".$hora_nueva." hrs.";
+ if(!$reposicion_rs["tipoaula_supervisor"]){
+ $texto .= " en el salón: ".$salon_desc."
";
+ }else{
+ $texto .= " en un salón de tipo: ".$reposicion_rs["tipoaula_nombre"]."
";
+ }
+ $texto .= "Ingresa al sistema PAAD para autorizarla.
";
+ $to = join(",", $correosSup_rs);
+ $ok = 0;
+ break;
+ case 3://Correo a coordinador, profesor y jefe
+ $asunto = "Reposición autorizada - ".$reposicion_rs["materia"];
+ $texto = "La resposición de la clase de ".$reposicion_rs["materia"]." del día ".$fecha_clase." a las ".$hora_clase." hrs. está autorizada para realizarse el día ".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc
";
+ $to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
+ $ok = 0;
+ break;
+ case 4://Correo a coordinador, profesor y jefe
+ $asunto = "Reposición declinada - ".$reposicion_rs["materia"];
+ $texto = "La resposición de la clase de ".$reposicion_rs["materia"]." planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs. ha sido declinada por el siguiente motivo:
";
+ $texto .= "".$reposicion_rs["motivo_cancelacion"]."
";
+ $to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
$ok = 1;
- //if($correoList!= "")
- //Mailer::enviarCorreo($correoList , "Reposición autorizada", $correoHTML);
- }
+ break;
}
+
+if($to!= "" && ENVIO_CORREOS){
+ $texto = '
+
+ '.$texto.'
+ ';
+
+ require_once('../include/phpmailer/PHPMailerAutoload.php');
+ /*if(DB_NAME == "poad_pruebas"){
+ $asunto = "PRUEBAS-".$asunto;
+ Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
+ }else{*/
+ Mailer::enviarCorreo($to, $asunto, $texto, true);
+ //}
+}
+
+/*
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
header("Location: ".$pag."?ok=".$ok);
diff --git a/action/reposicion_insert.php b/action/reposicion_insert.php
index d601dac..0a74451 100644
--- a/action/reposicion_insert.php
+++ b/action/reposicion_insert.php
@@ -5,6 +5,10 @@
$pag = "../reposiciones_crear.php";
$ruta = "../";
require_once "../class/c_login.php";
+require_once "../class/mailer.php";
+
+define("COORDINADOR", 9);
+define("ENVIO_CORREOS", true);
// check if the session is started
if (!isset($_SESSION['user']))
@@ -13,64 +17,71 @@ if (!isset($_SESSION['user']))
$user = unserialize($_SESSION['user']);
//$user->access();
-$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT); //Id reposicion
-$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT); //
-$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT); //
-$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
-$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT); //limpia texto
-$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT); //limpia texto
-$hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT); //limpia texto
-$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT); //limpia texto
-$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT); //1 Repo , 0 Cambio
-$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT); //1 regular , 2 sala computo, 3 otro facultad
+$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
+$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//
+$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//
+$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
+$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
+$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
+$hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto
+$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
+$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
+$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
-if (empty($_POST["prof"]))
+if(empty($_POST["prof"]))
$prof = $user["id"];
else
- $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT); //limpia texto
+ $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
-$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8")); //limpia texto
+$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
-$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id" => $duracion_id]);
+$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase
-$horario_rs = $db->querySingle(
- 'SELECT * from horario_view where horario_id = :hor',
- [':hor' => $hor]
-);
-
+$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
+ [':hor' => $hor]
+ );
+
$materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"];
-$hora = $hora_ini . ":" . $min_ini . ":00";
-$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d') . " " . $hora;
-$fecha_fin_new = date("Y-m-d", strtotime($fecha_new)) . " " . $duracion_tiempo;
+$hora = $hora_ini.":".$min_ini.":00";
+$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
+$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new));
-if ($tipo == 1) { //Reposición
+if($tipo == 1){//Reposición
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta));
-} else {
+}else{
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio));
}
//Valida que tenga clase en la fecha de falta
-if (intval($dia) != intval($dia_falta)) {
- header("Location:" . $pag . "?error=11");
+if(intval($dia) != intval($dia_falta)){
+ header("Location:".$pag."?error=11");
/*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$hor;
echo intval($dia)." != ".intval($dia_falta);*/
exit();
}
-if ($tipo == 1) { //Reposición
+//Obtiene correo
+$correos_rs = $db->querySingle('SELECT coor.usuario_correo, coor.usuario_nombre from usuario coor where rol_id = :rol_coord and facultad_id = (
+ select coalesce(facultad_id,0) from usuario u where u.usuario_id = :id_usr)',[':rol_coord' => COORDINADOR, ':id_usr' => $user->user["id"]]
+);
+if( count($correos_rs) > 0 ){
+ $to = $correos_rs["usuario_correo"];
+}
+
+if($tipo == 1){//Reposición
// Valida que grupo no tenga clases
/*$result = validaConflictoHoras($pdo, $gpo, $dia_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $duracion);
if($result != ""){//error
@@ -80,81 +91,82 @@ if ($tipo == 1) { //Reposición
}
*/
//Valida que profesor no este en 2 reposiciones al mismo tiempo en la fecha nueva
-
- $traslape = $db->querySingle(
- 'SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
- [':prof' => $prof, ':fecha' => DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora' => $hora, ':dur' => $duracion_tiempo]
+
+ $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
+ [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo]
)["traslape_profesor_reposicion"];
- if ($traslape) {
+ if($traslape){
//print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
- header("Location:" . $pag . "?error=9");
+ header("Location:".$pag."?error=9");
exit();
}
- try {
- $db->query(
- 'SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
- [
- ':f_falta' => $fecha_falta,
- ':f_nueva' => $fecha_new,
- ':hora_nueva' => $hora,
- ':hor' => $hor,
- ':prof' => $prof,
- ':desc' => $comentario,
- ':alumnos' => $alumnos,
- ':aula' => $aula,
- ':duracion' => $duracion_tiempo,
- ':usr' => $user->user["id"],
- ':bloque' => $bloque,
- ':ciclo' => $ciclo
+ try{
+ $db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
+ [':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor,
+ ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
+ ':bloque' => $bloque, ':ciclo' => $ciclo
]
);
- } catch (Exception $e) {
+ }catch(Exception $e){
echo $e->getMessage();
//header("Location: ".$pag."?error=1");
exit();
}
+ $texto = "Se creó una reposición nueva.
";
+ $texto .= "".mb_strtoupper($reposicion_rs["materia"])." del día ".$fecha_falta." a las ".$hor." hrs. se propone reponer el ".$fecha_new." a las ".$hora." hrs.";
+ $texto .= "
Ingresa al sistema PAAD para autorizarla.
";
+
+/*
+ $log = new LogActividad();
+ $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]";
+ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
- /*
- $log = new LogActividad();
- $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]";
- $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
-
-
-} else { //Cambio salón / hora
-
- try {
- $db->query(
- 'SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
- [
- ':f_falta' => $fecha_falta,
- ':f_nueva' => $fecha_cambio,
- ':hora_nueva' => $hora,
- ':hor' => $hor,
- ':prof' => $prof,
- ':desc' => $comentario,
- ':alumnos' => $alumnos,
- ':aula' => $aula,
- ':duracion' => $duracion_tiempo,
- ':usr' => $user->user["id"],
- ':bloque' => $bloque,
- ':ciclo' => $ciclo
+
+}else{//Cambio salón / hora
+
+ try{
+ $db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
+ [':f_falta' => $fecha_falta, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
+ ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
+ ':bloque' => $bloque, ':ciclo' => $ciclo
]
);
- } catch (Exception $e) {
- header("Location: " . $pag . "?error=1");
+ }catch(Exception $e){
+ header("Location: ".$pag."?error=1");
exit();
}
+ $texto = "Se creó un cambio de salón nuevo.
";
+ $texto .= "".mb_strtoupper($reposicion_rs["materia"])." del día ".$fecha_falta." a las ".$hora." hrs. se propone reponer el ".$fecha_nueva." a las ".$hora_nueva." hrs.";
+ $texto .= "
Ingresa al sistema PAAD para autorizarlo.
";
/*
$log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
-
+
}
-header("Location: " . $pag . "?ok=0");
+
+if($to!= "" && ENVIO_CORREOS){
+ $asunto = "Reposición nueva - solicitud";
+ //crear plantilla
+ $texto = '
+
+ '.$texto.'
+ ';
+
+ require_once('../include/phpmailer/PHPMailerAutoload.php');
+ /*if(DB_NAME == "poad_pruebas"){
+ $asunto = "PRUEBAS-".$asunto;
+ Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
+ }else{*/
+ Mailer::enviarCorreo($to, $asunto, $texto, true);
+ //}
+}
+
+header("Location: ".$pag."?ok=0");
exit();
-?>
\ No newline at end of file
+?>
diff --git a/action/reposicion_select.php b/action/reposicion_select.php
index f2b32f9..38f13af 100644
--- a/action/reposicion_select.php
+++ b/action/reposicion_select.php
@@ -23,13 +23,13 @@ $user = unserialize($_SESSION['user']);
try{
- if($user->rol["rol_id"] == 9){//es coordinador
- $rs = $db->querySingle('SELECT * from fs_reposicion(:id, NULL, :fac, NULL, NULL, NULL, NULL, NULL, NULL)',
- [':id' => $id, ":fac"=>$user->facultad["facultad_id"] ]
+ if($user->rol["rol_id"] == 7){//es supervisor
+ $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, :sup)',
+ [':id' => $id, ':sup'=>$user->user["id"]]
);
- }else{//supervisor
- $rs = $db->querySingle('SELECT * from fs_reposicion(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)',
- [':id' => $id]
+ }else{//coordinador
+ $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, NULL, null)',
+ [':id' => $id, ":fac"=>$user->facultad["facultad_id"] ]
);
}
diff --git a/action/reposicion_update.php b/action/reposicion_update.php
index 04c949b..741f678 100644
--- a/action/reposicion_update.php
+++ b/action/reposicion_update.php
@@ -104,18 +104,18 @@ if($tipo == 1){//Reposición
}
try{
- $db->query('SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, 1, :desc, :alumnos, :aula, :duracion_id, NULL)',
+ $db->query('SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, 1, :desc, :alumnos, :aula, :duracion, NULL)',
[':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
- ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion_id' => $duracion_id
+ ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
]
);
}catch(Exception $e){
//header("Location: ".$pag."?error=2");
print_r($e->getMessage());
- echo "SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, 1, :desc, :alumnos, :aula, :duracion_id, NULL)'";
+ echo "SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, 1, :desc, :alumnos, :aula, :duracion, NULL)'";
print_r(
[':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
- ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion_id' => $duracion_id
+ ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
]);
exit();
}
diff --git a/auditoria.php b/auditoria.php
index a59a4e0..ca3aaa2 100644
--- a/auditoria.php
+++ b/auditoria.php
@@ -57,10 +57,11 @@
exit;
} ?>
-
-
+
+
-