Liantsoaxx08 commited on
Commit
0418d8a
·
1 Parent(s): 974bfad

adding file

Browse files
app/services/cerfa_generator_service.py CHANGED
@@ -421,7 +421,7 @@ CERFA_TEXT_FIELDS = {
421
  "Zone de texte 8_67": ("entreprise", "smic 4"),
422
 
423
  # Salaire brut mensuel à l'embauche
424
- "Zone de texte 8_72": ("entreprise", "Salaire brut mensuel"), # Partie entière
425
  "Zone de texte 21_73": ("entreprise", "Salaire brut centimes"), # Centimes
426
 
427
  # Caisse de retraite complémentaire
@@ -1321,23 +1321,38 @@ class CerfaGeneratorService:
1321
  return str(heures)
1322
  return candidat_data.get("Nombre heure formation", "")
1323
 
1324
- # ============ CFA RESPONSABLE vs LIEU PRINCIPAL - GESTION CONDITIONNELLE ============
1325
- # Si le "Lieu principal si différent" est renseigné, les champs du "CFA responsable" doivent être vides
1326
- if key in ["Dénomination CFA", "N° UAI du CFA", "N° SIRET CFA",
1327
- "N° Adresse CFA", "Voie Adresse CFA", "Code postal CFA", "Commune CFA", "Complement adresse CFA"]:
1328
- # Vérifier si au moins un champ du "Lieu principal si différent" est rempli
1329
- lieu_principal_rempli = any([
1330
- entreprise_data.get("Dénomination du CFA responsable", ""),
1331
- entreprise_data.get("Numéro UAI du CFA", ""),
1332
- entreprise_data.get("Numéro SIRET du CFA", ""),
1333
- entreprise_data.get("Adresse du CFA", ""),
1334
- entreprise_data.get("Code postal CFA", ""),
1335
- entreprise_data.get("Commune CFA", "")
1336
- ])
1337
-
1338
- # Si le lieu principal est renseigné, retourner vide pour les champs du CFA responsable
1339
- if lieu_principal_rempli:
1340
- return ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1341
 
1342
  value = ""
1343
 
 
421
  "Zone de texte 8_67": ("entreprise", "smic 4"),
422
 
423
  # Salaire brut mensuel à l'embauche
424
+ "Zone de texte 8_72": ("entreprise", "Salaire brut mensuel 1"), # Partie entière
425
  "Zone de texte 21_73": ("entreprise", "Salaire brut centimes"), # Centimes
426
 
427
  # Caisse de retraite complémentaire
 
1321
  return str(heures)
1322
  return candidat_data.get("Nombre heure formation", "")
1323
 
1324
+ # ============ CFA RESPONSABLE vs LIEU PRINCIPAL - GESTION CONDITIONNELLE (EXCLUSION MUTUELLE) ============
1325
+ # Groupe 1: Champs "CFA responsable" (Zone de texte 8_99, 8_73, 8_74, 8_79, 8_80, 8_82, 8_78, 8_81)
1326
+ CFA_RESPONSABLE_KEYS = ["Dénomination CFA", "N° UAI du CFA", "N° SIRET CFA",
1327
+ "N° Adresse CFA", "Voie Adresse CFA", "Code postal CFA", "Commune CFA", "Complement adresse CFA"]
1328
+
1329
+ # Groupe 2: Champs "Lieu principal si différent" (Zone de texte 8_101, 8_84, 8_83, 8_86, 8_88, 8_89, 8_85)
1330
+ LIEU_PRINCIPAL_KEYS = ["Dénomination du CFA responsable", "Numéro UAI du CFA", "Numéro SIRET du CFA",
1331
+ "Adresse du CFA", "Complément adresse CFA", "Code postal CFA", "Commune CFA"]
1332
+
1333
+ # Vérifier si les champs du groupe 1 (CFA responsable) sont remplis
1334
+ cfa_responsable_rempli = any([
1335
+ entreprise_data.get("Dénomination CFA", "") or CFA_RUSH_SCHOOL.get("Dénomination CFA", ""),
1336
+ entreprise_data.get("N° UAI du CFA", "") or CFA_RUSH_SCHOOL.get("N° UAI du CFA", ""),
1337
+ entreprise_data.get("N° SIRET CFA", "") or CFA_RUSH_SCHOOL.get("N° SIRET CFA", ""),
1338
+ ])
1339
+
1340
+ # Vérifier si les champs du groupe 2 (Lieu principal) sont remplis dans Airtable
1341
+ lieu_principal_rempli = any([
1342
+ entreprise_data.get("Dénomination du CFA responsable", ""),
1343
+ entreprise_data.get("Numéro UAI du CFA", ""),
1344
+ entreprise_data.get("Numéro SIRET du CFA", ""),
1345
+ entreprise_data.get("Adresse du CFA", ""),
1346
+ ])
1347
+
1348
+ # LOGIQUE D'EXCLUSION MUTUELLE:
1349
+ # Si on demande un champ du groupe 1 (CFA responsable) ET que le groupe 2 (Lieu principal) est rempli → retourner vide
1350
+ if key in CFA_RESPONSABLE_KEYS and lieu_principal_rempli:
1351
+ return ""
1352
+
1353
+ # Si on demande un champ du groupe 2 (Lieu principal) ET que le groupe 1 (CFA responsable) est rempli (et groupe 2 vide) → retourner vide
1354
+ if key in LIEU_PRINCIPAL_KEYS and cfa_responsable_rempli and not lieu_principal_rempli:
1355
+ return ""
1356
 
1357
  value = ""
1358