Révision 179a9cc1
Ajouté par Mikaël Ates (de retour le 29 avril) il y a plus de 9 ans
- ID 179a9cc193ce6d373c3f54caa1820979906f80b1
- Parent d9fa9f6b
calebasse/cv2helper.py | ||
---|---|---|
30 | 30 |
pass |
31 | 31 |
|
32 | 32 |
if settings.CV2PARSER: |
33 |
import codecs |
|
34 |
import json |
|
33 | 35 |
from cv2parser import cvitale |
34 | 36 |
|
35 | 37 |
def parse(filename): |
38 |
f = codecs.open("calebasse/tables.json", 'r', |
|
39 |
encoding='ISO-8859-1') |
|
40 |
tables = json.loads(f.read()) |
|
36 | 41 |
cv = cvitale.parse(filename) |
42 |
if cv.tech.finValidite: |
|
43 |
cv.tech.finValidite = setter_date_ddmmyyyy(cv.tech.finValidite) |
|
37 | 44 |
for beneficiaire in cv.listeBenef.get_element(): |
38 | 45 |
""" |
39 | 46 |
ident |
... | ... | |
44 | 51 |
setter_date_yymmdd(beneficiaire.ident.naissance.dateEnCarte) |
45 | 52 |
beneficiaire.ident.dateCertification = \ |
46 | 53 |
setter_date_ddmmyyyy(beneficiaire.ident.dateCertification) |
54 |
|
|
47 | 55 |
""" |
48 | 56 |
amo |
49 | 57 |
""" |
50 |
if beneficiaire.amo.listePeriodesDroits: |
|
58 |
if beneficiaire.amo.listePeriodesDroits and beneficiaire.amo.listePeriodesDroits.get_element():
|
|
51 | 59 |
for p in beneficiaire.amo.listePeriodesDroits.get_element(): |
52 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
60 |
if p.debut and p.fin: |
|
61 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
62 |
|
|
53 | 63 |
if beneficiaire.amo.service and \ |
54 | 64 |
beneficiaire.amo.service.periodeService: |
55 | 65 |
p = beneficiaire.amo.service.periodeService |
56 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
66 |
if p.debut and p.fin: |
|
67 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
68 |
beneficiaire.amo.qualBenef = \ |
|
69 |
tables['TABLE_QUALITE'][str(beneficiaire.amo.qualBenef)] |
|
70 |
if beneficiaire.amo.infoCompl: |
|
71 |
beneficiaire.amo.infoCompl = \ |
|
72 |
tables['TABLE_DIVERS'][str(beneficiaire.amo.infoCompl)] |
|
73 |
if beneficiaire.amo.service and beneficiaire.amo.service.codeService: |
|
74 |
beneficiaire.amo.service.codeService = \ |
|
75 |
tables['TABLE_SERVAMO'][str(beneficiaire.amo.service.codeService)] |
|
57 | 76 |
""" |
58 | 77 |
mutuelle |
59 | 78 |
""" |
60 | 79 |
if beneficiaire.mutuelle and beneficiaire.mutuelle.listePeriodes: |
61 | 80 |
for p in beneficiaire.mutuelle.listePeriodes.get_element(): |
62 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
81 |
if p.debut and p.fin: |
|
82 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
83 |
if beneficiaire.mutuelle and beneficiaire.mutuelle.services \ |
|
84 |
and beneficiaire.mutuelle.services.typeService: |
|
85 |
beneficiaire.mutuelle.services.typeService = \ |
|
86 |
tables['TABLE_SERVMUTAMC'][str(beneficiaire.mutuelle.services.typeService)] |
|
63 | 87 |
""" |
64 | 88 |
amc |
65 | 89 |
""" |
66 | 90 |
if beneficiaire.amc and beneficiaire.amc.validiteDonnees: |
67 | 91 |
p = beneficiaire.amc.validiteDonnees |
68 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
92 |
if p.debut and p.fin: |
|
93 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
69 | 94 |
""" |
70 | 95 |
cmu |
71 | 96 |
""" |
72 | 97 |
if beneficiaire.cmu and beneficiaire.cmu.periode: |
73 | 98 |
p = beneficiaire.cmu.periode |
74 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
99 |
if p.debut and p.fin: |
|
100 |
p.debut, p.fin = setter_periode(p.debut, p.fin) |
|
75 | 101 |
|
102 |
f.close() |
|
76 | 103 |
return cv |
Formats disponibles : Unified diff
Replace field of ident and amo using dictionnary.