Justificado definitivo.
This commit is contained in:
@@ -17,18 +17,18 @@ try {
|
|||||||
$post_data = json_decode($raw, true);
|
$post_data = json_decode($raw, true);
|
||||||
|
|
||||||
$data = $db->querySingle(
|
$data = $db->querySingle(
|
||||||
'WITH HORARIOS AS (
|
"WITH HORARIOS AS (
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM horario
|
FROM horario
|
||||||
JOIN horario_profesor USING (horario_id)
|
JOIN horario_profesor USING (horario_id)
|
||||||
WHERE horario.periodo_id = :periodo_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)
|
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)
|
VALUES (:profesor_id, :horario_id, :registro_fecha_ideal, :registro_justificada, :justificador_id, NOW(), :justificacion)
|
||||||
ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal)
|
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
|
DO UPDATE SET registro_justificada = :registro_justificada, justificador_id = :justificador_id, registro_fecha_justificacion = NOW(), justificacion = :justificacion
|
||||||
RETURNING *',
|
RETURNING *",
|
||||||
array(
|
[
|
||||||
'periodo_id' => $user->periodo_id,
|
'periodo_id' => $user->periodo_id,
|
||||||
'profesor_id' => $post_data['profesor_id'],
|
'profesor_id' => $post_data['profesor_id'],
|
||||||
'horario_id' => $post_data['horario_id'],
|
'horario_id' => $post_data['horario_id'],
|
||||||
@@ -36,7 +36,7 @@ try {
|
|||||||
'registro_justificada' => $post_data['registro_justificada'],
|
'registro_justificada' => $post_data['registro_justificada'],
|
||||||
'justificador_id' => $user->user['id'],
|
'justificador_id' => $user->user['id'],
|
||||||
'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'],
|
'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'],
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ try {
|
|||||||
JOIN ROL on ROL.rol_id = justificador.rol_id
|
JOIN ROL on ROL.rol_id = justificador.rol_id
|
||||||
LEFT JOIN facultad on facultad.facultad_id = justificador.facultad_id
|
LEFT JOIN facultad on facultad.facultad_id = justificador.facultad_id
|
||||||
where justificador.usuario_id = :justificador_id",
|
where justificador.usuario_id = :justificador_id",
|
||||||
array(
|
[
|
||||||
'justificador_id' => $user->user['id'],
|
'justificador_id' => $user->user['id'],
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
// exit('exit');
|
// exit('exit');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user