From e31e1228b12fe57fc0ab4baef86726c71f0099dd Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 17 Feb 2025 08:16:33 -0600 Subject: [PATCH] Justificado definitivo. --- action/justificar.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/action/justificar.php b/action/justificar.php index 4b9308b..76f6894 100644 --- a/action/justificar.php +++ b/action/justificar.php @@ -17,18 +17,18 @@ try { $post_data = json_decode($raw, true); $data = $db->querySingle( - 'WITH HORARIOS AS ( + "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( + RETURNING *", + [ 'periodo_id' => $user->periodo_id, 'profesor_id' => $post_data['profesor_id'], 'horario_id' => $post_data['horario_id'], @@ -36,7 +36,7 @@ try { 'registro_justificada' => $post_data['registro_justificada'], 'justificador_id' => $user->user['id'], 'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'], - ) + ] ); @@ -49,9 +49,9 @@ try { 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');