Skip to content

Commit 24bd1cb

Browse files
committed
fn1FA fix alumno se retiró y volvió a entrar
1 parent aefe815 commit 24bd1cb

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

  • ede/ede/validation_functions/fn1_registro_entrega_informacion

ede/ede/validation_functions/fn1_registro_entrega_informacion/fn1FA.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,23 @@ def fn1FA(conn, return_dict):
3131

3232
# VALIDO LA EXISTENCIA DE ALUMNOS RETIRADOS Y QUE TENGAN REGISTRADA FECHA DE RETIRO
3333
_s1 = """SELECT A.personId,B.Identifier,C.OrganizationPersonRoleId ,C.ExitDate
34-
FROM PersonStatus A
35-
JOIN PersonIdentifier B
36-
ON A.personId = B.personId
37-
JOIN OrganizationPersonRole C
38-
ON A.personId = C.personId
39-
where A.RefPersonStatusTypeId = 30;"""
34+
FROM PersonStatus A
35+
JOIN PersonIdentifier B
36+
ON A.personId = B.personId
37+
AND A.RecordEndDateTime IS NULL
38+
AND B.RecordEndDateTime IS NULL
39+
JOIN OrganizationPersonRole C
40+
ON A.personId = C.personId
41+
AND C.RecordEndDateTime IS NULL
42+
WHERE A.RefPersonStatusTypeId = 30;"""
4043

4144
# OBTENGO INFORMACION DE APODERADO
4245
_s2 = """SELECT A.RelatedPersonId ,A.personId
4346
FROM PersonRelationship A
4447
JOIN OrganizationPersonRole B
4548
ON A.RelatedPersonId = B.personId
49+
AND A.RecordEndDateTime IS NULL
50+
AND B.RecordEndDateTime IS NULL
4651
WHERE A.personId = ?
4752
AND B.RoleId = 15;"""
4853

@@ -51,13 +56,16 @@ def fn1FA(conn, return_dict):
5156
FROM IncidentPerson A
5257
JOIN Incident B
5358
ON A.IncidentId = B.IncidentId
59+
AND A.RecordEndDateTime IS NULL
60+
AND B.RecordEndDateTime IS NULL
5461
WHERE A.personId = ?
5562
AND B.RefIncidentBehaviorId = 33;"""
5663

5764
# OBTENGO INFORMACION DE PERSONAS ASOCIADAS A INCIDENTE
5865
_s4 = """SELECT A.personId,A.RefIncidentPersonTypeId ,A.digitalRandomKey, A.fileScanBase64
5966
FROM IncidentPerson A
60-
WHERE A.IncidentId = ?;"""
67+
WHERE A.IncidentId = ?
68+
AND A.RecordEndDateTime IS NULL;"""
6169

6270
# VERIFICA SI EXISTE REGISTRO DE RETIROS ANTICIPADOS DEL ESTABLECIMIENTO (OrganizationPersonRole)
6371
_r = ejecutar_sql(conn, _s1)

0 commit comments

Comments
 (0)